@stacksjs/commerce 0.70.37 → 0.70.43
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,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a shipping rate
|
|
3
|
+
*
|
|
4
|
+
* @param id The shipping rate ID to update
|
|
5
|
+
* @param data The shipping rate data to update
|
|
6
|
+
* @returns The updated shipping rate record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: ShippingRateUpdate): Promise<ShippingRateJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update multiple shipping rates at once
|
|
11
|
+
*
|
|
12
|
+
* @param updates Array of objects containing rate ID and update data
|
|
13
|
+
* @returns Number of shipping rates updated
|
|
14
|
+
*/
|
|
15
|
+
export declare function bulkUpdate(updates: Array<{
|
|
16
|
+
id: number
|
|
17
|
+
data: ShippingRateUpdate
|
|
18
|
+
}>): Promise<number>;
|
|
19
|
+
/**
|
|
20
|
+
* Update shipping rates by zone
|
|
21
|
+
*
|
|
22
|
+
* @param zone The zone to update rates for
|
|
23
|
+
* @param data The update data to apply
|
|
24
|
+
* @returns Number of shipping rates updated
|
|
25
|
+
*/
|
|
26
|
+
export declare function updateByZone(zone: number, data: ShippingRateUpdate): Promise<number>;
|
|
27
|
+
/**
|
|
28
|
+
* Update shipping rates by method
|
|
29
|
+
*
|
|
30
|
+
* @param method The shipping method to update rates for
|
|
31
|
+
* @param data The update data to apply
|
|
32
|
+
* @returns Number of shipping rates updated
|
|
33
|
+
*/
|
|
34
|
+
export declare function updateByMethod(method: string, data: ShippingRateUpdate): Promise<number>;
|
|
35
|
+
declare type ShippingRateJsonResponse = ModelRow<typeof ShippingRate>;
|
|
36
|
+
declare type ShippingRateUpdate = UpdateModelData<typeof ShippingRate>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a shipping zone by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the shipping zone to delete
|
|
5
|
+
* @returns True if the shipping zone was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Soft delete a shipping zone by ID (updates status to 'inactive')
|
|
10
|
+
*
|
|
11
|
+
* @param id The ID of the shipping zone to soft delete
|
|
12
|
+
* @returns True if the shipping zone was soft deleted, false otherwise
|
|
13
|
+
*/
|
|
14
|
+
export declare function softDelete(id: number): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Delete multiple shipping zones by ID
|
|
17
|
+
*
|
|
18
|
+
* @param ids Array of shipping zone IDs to delete
|
|
19
|
+
* @returns Number of shipping zones deleted
|
|
20
|
+
*/
|
|
21
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Soft delete multiple shipping zones by ID (updates status to 'inactive')
|
|
24
|
+
*
|
|
25
|
+
* @param ids Array of shipping zone IDs to soft delete
|
|
26
|
+
* @returns Number of shipping zones soft deleted
|
|
27
|
+
*/
|
|
28
|
+
export declare function bulkSoftDelete(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch all shipping zones
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchAll(): Promise<ShippingZoneJsonResponse[]>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch a shipping zone by ID
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchById(id: number): Promise<ShippingZoneJsonResponse | undefined>;
|
|
9
|
+
/**
|
|
10
|
+
* Format shipping zone options for dropdown menus or selectors
|
|
11
|
+
*
|
|
12
|
+
* @returns Array of formatted shipping zone options with id, name, and status
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatZoneOptions(): Promise<{ id: number, name: string, status: string | string[], countries: string | undefined }[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Get active shipping zones
|
|
17
|
+
*
|
|
18
|
+
* @returns List of active shipping zones
|
|
19
|
+
*/
|
|
20
|
+
export declare function getActiveShippingZones(): Promise<ShippingZoneJsonResponse[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Get shipping zones by country code
|
|
23
|
+
*
|
|
24
|
+
* @param countryCode ISO country code
|
|
25
|
+
* @returns List of shipping zones covering the specified country
|
|
26
|
+
*/
|
|
27
|
+
export declare function getZonesByCountry(countryCode: string): Promise<ShippingZoneJsonResponse[]>;
|
|
28
|
+
declare type ShippingZoneJsonResponse = ModelRow<typeof ShippingZone>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export {
|
|
2
|
+
bulkDestroy,
|
|
3
|
+
bulkSoftDelete,
|
|
4
|
+
destroy,
|
|
5
|
+
softDelete,
|
|
6
|
+
} from './destroy';
|
|
7
|
+
export {
|
|
8
|
+
fetchAll,
|
|
9
|
+
fetchById,
|
|
10
|
+
formatZoneOptions,
|
|
11
|
+
getActiveShippingZones,
|
|
12
|
+
getZonesByCountry,
|
|
13
|
+
} from './fetch';
|
|
14
|
+
export {
|
|
15
|
+
bulkStore,
|
|
16
|
+
store,
|
|
17
|
+
} from './store';
|
|
18
|
+
export {
|
|
19
|
+
update,
|
|
20
|
+
updateCountries,
|
|
21
|
+
updateRegionsAndPostalCodes,
|
|
22
|
+
updateStatus,
|
|
23
|
+
} from './update';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new shipping zone
|
|
3
|
+
*
|
|
4
|
+
* @param data The shipping zone data to store
|
|
5
|
+
* @returns The newly created shipping zone record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewShippingZone): Promise<ShippingZoneJsonResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple shipping zones at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of shipping zone data to store
|
|
12
|
+
* @returns Number of shipping zones created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewShippingZone[]): Promise<number>;
|
|
15
|
+
// Import dependencies
|
|
16
|
+
declare type ShippingZoneJsonResponse = ModelRow<typeof ShippingZone>;
|
|
17
|
+
declare type NewShippingZone = NewModelData<typeof ShippingZone>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a shipping zone
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the shipping zone
|
|
5
|
+
* @param data The shipping zone data to update
|
|
6
|
+
* @returns The updated shipping zone record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: ShippingZoneUpdate): Promise<ShippingZoneJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update a shipping zone's status
|
|
11
|
+
*
|
|
12
|
+
* @param id The ID of the shipping zone
|
|
13
|
+
* @param status The new status
|
|
14
|
+
* @returns The updated shipping zone with the new status
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateStatus(id: number, status: string | string[]): Promise<ShippingZoneJsonResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Update countries for a shipping zone
|
|
19
|
+
*
|
|
20
|
+
* @param id The ID of the shipping zone
|
|
21
|
+
* @param countries The updated countries JSON string
|
|
22
|
+
* @returns The updated shipping zone
|
|
23
|
+
*/
|
|
24
|
+
export declare function updateCountries(id: number, countries: string): Promise<ShippingZoneJsonResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Update regions and/or postal codes for a shipping zone
|
|
27
|
+
*
|
|
28
|
+
* @param id The ID of the shipping zone
|
|
29
|
+
* @param regions Optional updated regions JSON string
|
|
30
|
+
* @param postal_codes Optional updated postal codes JSON string
|
|
31
|
+
* @returns The updated shipping zone
|
|
32
|
+
*/
|
|
33
|
+
export declare function updateRegionsAndPostalCodes(id: number, regions?: string, postal_codes?: string): Promise<ShippingZoneJsonResponse>;
|
|
34
|
+
declare type ShippingZoneJsonResponse = ModelRow<typeof ShippingZone>;
|
|
35
|
+
declare type ShippingZoneUpdate = UpdateModelData<typeof ShippingZone>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a tax rate by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the tax rate to delete
|
|
5
|
+
* @returns True if the tax rate was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple tax rates by ID
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of tax rate IDs to delete
|
|
12
|
+
* @returns Number of tax rates deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a tax rate by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<TaxRateJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all tax rates
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<TaxRateJsonResponse[]>;
|
|
9
|
+
declare type TaxRateJsonResponse = ModelRow<typeof TaxRate>;
|
|
@@ -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
|
+
updateRate,
|
|
20
|
+
updateStatus,
|
|
21
|
+
} from './update';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new tax rate
|
|
3
|
+
*
|
|
4
|
+
* @param data Tax rate data to store
|
|
5
|
+
* @returns The newly created tax rate record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewTaxRate): Promise<TaxRateJsonResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple tax rates at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of tax rate data to store
|
|
12
|
+
* @returns Number of tax rates created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewTaxRate[]): Promise<number>;
|
|
15
|
+
declare type TaxRateJsonResponse = ModelRow<typeof TaxRate>;
|
|
16
|
+
declare type NewTaxRate = NewModelData<typeof TaxRate>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a tax rate
|
|
3
|
+
*
|
|
4
|
+
* @param id The id of the tax rate to update
|
|
5
|
+
* @param data The tax rate data to update
|
|
6
|
+
* @returns The updated tax rate record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: TaxRateUpdate): Promise<TaxRateJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update a tax rate's status
|
|
11
|
+
*
|
|
12
|
+
* @param id The ID of the tax rate
|
|
13
|
+
* @param status The new status
|
|
14
|
+
* @returns The updated tax rate with the new status
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateStatus(id: number, status: 'active' | 'inactive'): Promise<TaxRateJsonResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Update rate information for a tax rate
|
|
19
|
+
*
|
|
20
|
+
* @param id The ID of the tax rate
|
|
21
|
+
* @param rate The updated rate value
|
|
22
|
+
* @returns The updated tax rate
|
|
23
|
+
*/
|
|
24
|
+
export declare function updateRate(id: number, rate: number): Promise<TaxRateJsonResponse>;
|
|
25
|
+
declare type TaxRateJsonResponse = ModelRow<typeof TaxRate>;
|
|
26
|
+
declare type TaxRateUpdate = UpdateModelData<typeof TaxRate>;
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
// Define the input for creating a customer
|
|
2
|
+
export declare interface CreateCustomerInput {
|
|
3
|
+
name: string
|
|
4
|
+
email: string
|
|
5
|
+
phone: string
|
|
6
|
+
orders?: number
|
|
7
|
+
total_spent?: number
|
|
8
|
+
last_order?: string
|
|
9
|
+
status?: string
|
|
10
|
+
avatar?: string
|
|
11
|
+
user_id?: number
|
|
12
|
+
}
|
|
13
|
+
// Define the input for updating a customer
|
|
14
|
+
export declare interface UpdateCustomerInput {
|
|
15
|
+
name?: string
|
|
16
|
+
email?: string
|
|
17
|
+
phone?: string
|
|
18
|
+
orders?: number
|
|
19
|
+
total_spent?: number
|
|
20
|
+
last_order?: string
|
|
21
|
+
status?: string
|
|
22
|
+
avatar?: string
|
|
23
|
+
user_id?: number
|
|
24
|
+
}
|
|
25
|
+
// Define the structure of an order item
|
|
26
|
+
export declare interface OrderItem {
|
|
27
|
+
product_id: string
|
|
28
|
+
quantity: number
|
|
29
|
+
price: number
|
|
30
|
+
special_instructions?: string
|
|
31
|
+
}
|
|
32
|
+
// Type for status count
|
|
33
|
+
export declare interface StatusCount {
|
|
34
|
+
status: string
|
|
35
|
+
count: number | string
|
|
36
|
+
}
|
|
37
|
+
// Type for order type count
|
|
38
|
+
export declare interface OrderTypeCount {
|
|
39
|
+
order_type: string
|
|
40
|
+
count: number | string
|
|
41
|
+
}
|
|
42
|
+
// Type for the stats return value
|
|
43
|
+
export declare interface OrderStats {
|
|
44
|
+
total: number
|
|
45
|
+
by_status: StatusCount[]
|
|
46
|
+
by_type: OrderTypeCount[]
|
|
47
|
+
recent: OrderJsonResponse[]
|
|
48
|
+
revenue: number
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Represents a simplified order item structure with required properties for total calculation
|
|
52
|
+
*/
|
|
53
|
+
export declare interface OrderItemForCalculation {
|
|
54
|
+
price: number
|
|
55
|
+
quantity: number
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Represents the totals calculated for an order
|
|
59
|
+
*/
|
|
60
|
+
export declare interface OrderTotals {
|
|
61
|
+
subtotal: number
|
|
62
|
+
tax_amount: number
|
|
63
|
+
total_amount: number
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Represents statistics for a discount type
|
|
67
|
+
*/
|
|
68
|
+
export declare interface DiscountTypeCount {
|
|
69
|
+
discount_type: string | undefined
|
|
70
|
+
count: string | number | bigint
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Represents comprehensive coupon statistics
|
|
74
|
+
*/
|
|
75
|
+
export declare interface CouponStats {
|
|
76
|
+
total: number
|
|
77
|
+
active: number
|
|
78
|
+
by_type: DiscountTypeCount[]
|
|
79
|
+
most_used: {
|
|
80
|
+
id: number | undefined
|
|
81
|
+
code: string | undefined
|
|
82
|
+
discount_type: string | undefined
|
|
83
|
+
discount_value: number | undefined
|
|
84
|
+
usage_count: number | undefined
|
|
85
|
+
}[]
|
|
86
|
+
upcoming: {
|
|
87
|
+
id: number | undefined
|
|
88
|
+
code: string | undefined
|
|
89
|
+
discount_type: string | undefined
|
|
90
|
+
discount_value: number | undefined
|
|
91
|
+
start_date: Date | string
|
|
92
|
+
end_date: Date | string
|
|
93
|
+
}[]
|
|
94
|
+
}
|
|
95
|
+
export declare interface OrderWithTotals {
|
|
96
|
+
order_items: OrderItemJsonResponse[] | []
|
|
97
|
+
id: number
|
|
98
|
+
customer_id: number
|
|
99
|
+
customer: CustomerJsonResponse | undefined
|
|
100
|
+
coupon_id: number
|
|
101
|
+
coupon: CouponJsonResponse | undefined
|
|
102
|
+
status: string
|
|
103
|
+
total_amount: number
|
|
104
|
+
tax_amount: number | undefined
|
|
105
|
+
discount_amount: number | undefined
|
|
106
|
+
delivery_fee: number | undefined
|
|
107
|
+
tip_amount: number | undefined
|
|
108
|
+
order_type: string
|
|
109
|
+
delivery_address: string | undefined
|
|
110
|
+
special_instructions: string | undefined
|
|
111
|
+
estimated_delivery_time: string | undefined
|
|
112
|
+
applied_coupon_id: string | undefined
|
|
113
|
+
uuid: string | undefined
|
|
114
|
+
created_at: Date | undefined
|
|
115
|
+
updated_at: Date | undefined
|
|
116
|
+
customer_name: string | null
|
|
117
|
+
customer_email: string | null
|
|
118
|
+
totalItems: number
|
|
119
|
+
totalPrice: number
|
|
120
|
+
}
|
|
121
|
+
export declare interface FetchGiftCardsOptions {
|
|
122
|
+
page?: number
|
|
123
|
+
limit?: number
|
|
124
|
+
search?: string
|
|
125
|
+
status?: string
|
|
126
|
+
is_active?: boolean
|
|
127
|
+
is_digital?: boolean
|
|
128
|
+
is_reloadable?: boolean
|
|
129
|
+
sortBy?: string
|
|
130
|
+
sortOrder?: 'asc' | 'desc'
|
|
131
|
+
purchaser_id?: string
|
|
132
|
+
from_date?: string
|
|
133
|
+
to_date?: string
|
|
134
|
+
min_balance?: number
|
|
135
|
+
max_balance?: number
|
|
136
|
+
}
|
|
137
|
+
declare interface BaseResponse {
|
|
138
|
+
paging: {
|
|
139
|
+
total_records: number
|
|
140
|
+
page: number
|
|
141
|
+
total_pages: number
|
|
142
|
+
}
|
|
143
|
+
next_cursor: number | null
|
|
144
|
+
}
|
|
145
|
+
export declare interface GiftCardResponse extends BaseResponse {
|
|
146
|
+
data: GiftCardJsonResponse[]
|
|
147
|
+
}
|
|
148
|
+
export declare interface GiftCardStats {
|
|
149
|
+
total: number
|
|
150
|
+
active: number
|
|
151
|
+
by_status: Array<{ status: string, count: number }>
|
|
152
|
+
by_balance: {
|
|
153
|
+
low: number
|
|
154
|
+
medium: number
|
|
155
|
+
high: number
|
|
156
|
+
}
|
|
157
|
+
expiring_soon: GiftCardJsonResponse[]
|
|
158
|
+
recently_used: GiftCardJsonResponse[]
|
|
159
|
+
}
|
|
160
|
+
export declare interface FetchReviewsOptions {
|
|
161
|
+
page?: number
|
|
162
|
+
limit?: number
|
|
163
|
+
}
|
|
164
|
+
export declare interface ReviewResponse extends BaseResponse {
|
|
165
|
+
data: ReviewJsonResponse[]
|
|
166
|
+
}
|
|
167
|
+
export declare interface ManufacturerResponse extends BaseResponse {
|
|
168
|
+
data: ManufacturerJsonResponse[]
|
|
169
|
+
}
|
|
170
|
+
export declare interface ReviewStats {
|
|
171
|
+
total: number
|
|
172
|
+
average_rating: number
|
|
173
|
+
rating_distribution: {
|
|
174
|
+
one_star: number
|
|
175
|
+
two_star: number
|
|
176
|
+
three_star: number
|
|
177
|
+
four_star: number
|
|
178
|
+
five_star: number
|
|
179
|
+
}
|
|
180
|
+
recent_reviews: ReviewJsonResponse[]
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Represents comprehensive category statistics
|
|
184
|
+
*/
|
|
185
|
+
export declare interface CategoryStats {
|
|
186
|
+
total: number
|
|
187
|
+
active: number
|
|
188
|
+
root_categories: number
|
|
189
|
+
child_categories: number
|
|
190
|
+
with_images: number
|
|
191
|
+
recently_added: Array<any>
|
|
192
|
+
top_parent_categories: Array<{
|
|
193
|
+
id: string
|
|
194
|
+
name: string
|
|
195
|
+
child_count: number
|
|
196
|
+
}>
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Options for fetching product manufacturers
|
|
200
|
+
*/
|
|
201
|
+
export declare interface FetchManufacturersOptions {
|
|
202
|
+
country?: string
|
|
203
|
+
featured?: boolean
|
|
204
|
+
search?: string
|
|
205
|
+
}
|
|
206
|
+
export declare interface FetchCouponsOptions {
|
|
207
|
+
page?: number
|
|
208
|
+
limit?: number
|
|
209
|
+
search?: string
|
|
210
|
+
is_active?: boolean
|
|
211
|
+
discount_type?: string
|
|
212
|
+
sortBy?: string
|
|
213
|
+
sortOrder?: 'asc' | 'desc'
|
|
214
|
+
product_id?: string
|
|
215
|
+
category_id?: string
|
|
216
|
+
from_date?: string
|
|
217
|
+
to_date?: string
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Interface for coupon count statistics
|
|
221
|
+
*/
|
|
222
|
+
export declare interface CouponCountStats {
|
|
223
|
+
total: number
|
|
224
|
+
active: number
|
|
225
|
+
inactive: number
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Interface for time-based coupon statistics
|
|
229
|
+
*/
|
|
230
|
+
export declare interface CouponTimeStats {
|
|
231
|
+
week: CouponCountStats
|
|
232
|
+
month: CouponCountStats
|
|
233
|
+
year: CouponCountStats
|
|
234
|
+
all_time: CouponCountStats
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Interface for coupon redemption statistics
|
|
238
|
+
*/
|
|
239
|
+
export declare interface CouponRedemptionStats {
|
|
240
|
+
total: number
|
|
241
|
+
week: number
|
|
242
|
+
month: number
|
|
243
|
+
year: number
|
|
244
|
+
by_type: Record<string, number>
|
|
245
|
+
}
|
|
246
|
+
export declare interface FetchOrdersOptions {
|
|
247
|
+
page?: number
|
|
248
|
+
limit?: number
|
|
249
|
+
search?: string
|
|
250
|
+
status?: string
|
|
251
|
+
order_type?: string
|
|
252
|
+
customer_id?: number
|
|
253
|
+
sortBy?: string
|
|
254
|
+
sortOrder?: 'asc' | 'desc'
|
|
255
|
+
from_date?: string
|
|
256
|
+
to_date?: string
|
|
257
|
+
}
|
|
258
|
+
// Import the CustomerTable type from the ORM
|
|
259
|
+
declare type CouponJsonResponse = ModelRow<typeof Coupon>;
|
|
260
|
+
declare type CustomerJsonResponse = ModelRow<typeof Customer>;
|
|
261
|
+
declare type GiftCardJsonResponse = ModelRow<typeof GiftCard>;
|
|
262
|
+
declare type ManufacturerJsonResponse = ModelRow<typeof Manufacturer>;
|
|
263
|
+
declare type OrderJsonResponse = ModelRow<typeof Order>;
|
|
264
|
+
declare type OrderItemJsonResponse = ModelRow<typeof OrderItem>;
|
|
265
|
+
declare type ReviewJsonResponse = ModelRow<typeof Review>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a typed aggregate query against a table.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const stats = await aggregateStats('receipts', {
|
|
7
|
+
* total: { kind: 'count' },
|
|
8
|
+
* success: { kind: 'count', filter: { column: 'status', op: '=', value: 'success' } },
|
|
9
|
+
* averageSize: { kind: 'avg', column: 'size' },
|
|
10
|
+
* }, qb => qb.where('timestamp', '>=', start).where('timestamp', '<=', end))
|
|
11
|
+
* // typeof stats: { total: number; success: number; averageSize: number }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function aggregateStats<TKeys extends string>(table: string, descriptors: Record<TKeys, StatsDescriptor>, applyWhere?: (qb: any) => any): Promise<Record<TKeys, number>>;
|
|
15
|
+
/**
|
|
16
|
+
* Stats descriptors map: each key is the result-row alias; each value is
|
|
17
|
+
* a `{ kind, column, where? }` triple describing the aggregate to emit.
|
|
18
|
+
*/
|
|
19
|
+
export type StatsDescriptor = | { kind: 'count', column?: string, filter?: { column: string, op: string, value: unknown } }
|
|
20
|
+
| { kind: 'sum', column: string, filter?: { column: string, op: string, value: unknown } }
|
|
21
|
+
| { kind: 'avg', column: string, filter?: { column: string, op: string, value: unknown } }
|
|
22
|
+
| { kind: 'min', column: string, filter?: { column: string, op: string, value: unknown } }
|
|
23
|
+
| { kind: 'max', column: string, filter?: { column: string, op: string, value: unknown } }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as products from './products/index';
|
|
2
|
+
import * as restaurant from './restaurant/index';
|
|
3
|
+
declare const waitlists: WaitlistsNamespace;
|
|
4
|
+
declare interface WaitlistsNamespace {
|
|
5
|
+
products: typeof products
|
|
6
|
+
restaurant: typeof restaurant
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
products,
|
|
10
|
+
restaurant,
|
|
11
|
+
};
|
|
12
|
+
export default waitlists;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a waitlist product entry by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the waitlist product to delete
|
|
5
|
+
* @returns The deleted waitlist product record
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<WaitlistProductJsonResponse | undefined>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple waitlist product entries by their IDs
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of waitlist product IDs to delete
|
|
12
|
+
* @returns Number of waitlist products deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
15
|
+
declare type WaitlistProductJsonResponse = ModelRow<typeof WaitlistProduct>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a waitlist product by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<WaitlistProductJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all waitlist products
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<WaitlistProductJsonResponse[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Fetch the count of waitlist products grouped by source
|
|
11
|
+
* @param startDate Optional start date to filter by
|
|
12
|
+
* @param endDate Optional end date to filter by
|
|
13
|
+
* @returns An object containing the count for each source
|
|
14
|
+
*/
|
|
15
|
+
export declare function fetchCountBySource(startDate?: Date, _endDate?: Date): Promise<Record<string, number>>;
|
|
16
|
+
/**
|
|
17
|
+
* Fetch the count of waitlist products for a specific date
|
|
18
|
+
* @param date The date to count entries for (defaults to today)
|
|
19
|
+
* @returns The count of entries for the specified date
|
|
20
|
+
*/
|
|
21
|
+
export declare function fetchCountByDate(date?: Date): Promise<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Fetch the count of waitlist products with a specific quantity
|
|
24
|
+
* @param quantity The quantity to count orders for
|
|
25
|
+
* @returns The count of orders with the specified quantity
|
|
26
|
+
*/
|
|
27
|
+
export declare function fetchCountByQuantity(quantity: number): Promise<number>;
|
|
28
|
+
/**
|
|
29
|
+
* Fetch the count of waitlist products grouped by quantity
|
|
30
|
+
* @param startDate Optional start date to filter by
|
|
31
|
+
* @param endDate Optional end date to filter by
|
|
32
|
+
* @returns An object containing the count for each quantity
|
|
33
|
+
*/
|
|
34
|
+
export declare function fetchCountByAllQuantities(startDate?: Date, _endDate?: Date): Promise<Record<number, number>>;
|
|
35
|
+
/**
|
|
36
|
+
* Fetch waitlist products between two dates
|
|
37
|
+
* @param startDate The start date of the range
|
|
38
|
+
* @param endDate The end date of the range
|
|
39
|
+
* @returns Array of waitlist products within the date range
|
|
40
|
+
*/
|
|
41
|
+
export declare function fetchBetweenDates(startDate: Date, endDate: Date): Promise<WaitlistProductJsonResponse[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Fetch waitlist products that were notified between two dates
|
|
44
|
+
* @param startDate The start date of the range
|
|
45
|
+
* @param endDate The end date of the range
|
|
46
|
+
* @returns Array of waitlist products that were notified within the date range
|
|
47
|
+
*/
|
|
48
|
+
export declare function fetchNotifiedBetweenDates(startDate: Date, endDate: Date): Promise<WaitlistProductJsonResponse[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Fetch waitlist products that were purchased between two dates
|
|
51
|
+
* @param startDate The start date of the range
|
|
52
|
+
* @param endDate The end date of the range
|
|
53
|
+
* @returns Array of waitlist products that were purchased within the date range
|
|
54
|
+
*/
|
|
55
|
+
export declare function fetchPurchasedBetweenDates(startDate: Date, endDate: Date): Promise<WaitlistProductJsonResponse[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Fetch waitlist products that were cancelled between two dates
|
|
58
|
+
* @param startDate The start date of the range
|
|
59
|
+
* @param endDate The end date of the range
|
|
60
|
+
* @returns Array of waitlist products that were cancelled within the date range
|
|
61
|
+
*/
|
|
62
|
+
export declare function fetchCancelledBetweenDates(startDate: Date, endDate: Date): Promise<WaitlistProductJsonResponse[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Fetch all waitlist products with waiting status
|
|
65
|
+
* @returns Array of waitlist products with waiting status
|
|
66
|
+
*/
|
|
67
|
+
export declare function fetchWaiting(): Promise<WaitlistProductJsonResponse[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Fetch the count of waitlist products by status
|
|
70
|
+
* @param status The status to filter by
|
|
71
|
+
* @param startDate Optional start date to filter by
|
|
72
|
+
* @param endDate Optional end date to filter by
|
|
73
|
+
* @returns The count of waitlist products with the specified status
|
|
74
|
+
*/
|
|
75
|
+
export declare function fetchCountByStatus(status: string, startDate?: Date, _endDate?: Date): Promise<number>;
|
|
76
|
+
/**
|
|
77
|
+
* Fetch conversion rates for waitlist products
|
|
78
|
+
* @param startDate Optional start date to filter by
|
|
79
|
+
* @param endDate Optional end date to filter by
|
|
80
|
+
* @returns Object containing total conversion rate and breakdown by status
|
|
81
|
+
*/
|
|
82
|
+
export declare function fetchConversionRates(_startDate?: Date, _endDate?: Date): Promise<{
|
|
83
|
+
totalConversionRate: number
|
|
84
|
+
statusBreakdown: Record<string, { count: number, percentage: number }>
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Fetch the count of waitlist products between two dates
|
|
88
|
+
* @param startDate The start date of the range
|
|
89
|
+
* @param endDate The end date of the range
|
|
90
|
+
* @returns The count of waitlist products within the date range
|
|
91
|
+
*/
|
|
92
|
+
export declare function fetchCountBetweenDates(startDate: Date, endDate: Date): Promise<number>;
|
|
93
|
+
/**
|
|
94
|
+
* Fetch the count of waitlist products grouped by date
|
|
95
|
+
* @param startDate Optional start date to filter by
|
|
96
|
+
* @param endDate Optional end date to filter by
|
|
97
|
+
* @returns An array of objects containing date and count
|
|
98
|
+
*/
|
|
99
|
+
export declare function fetchCountByDateGrouped(startDate?: Date, _endDate?: Date): Promise<{ date: string, count: number }[]>;
|
|
100
|
+
declare type WaitlistProductJsonResponse = ModelRow<typeof WaitlistProduct>;
|