@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,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a coupon by ID
|
|
3
|
+
* @param id The ID of the coupon to delete
|
|
4
|
+
* @returns A boolean indicating success
|
|
5
|
+
*/
|
|
6
|
+
export declare function deleteCoupon(id: number): Promise<boolean>;
|
|
7
|
+
/**
|
|
8
|
+
* Delete multiple coupons by IDs
|
|
9
|
+
* @param ids Array of coupon IDs to delete
|
|
10
|
+
* @returns Number of deleted coupons
|
|
11
|
+
*/
|
|
12
|
+
export declare function deleteCoupons(ids: number[]): Promise<number>;
|
|
13
|
+
/**
|
|
14
|
+
* Delete expired coupons
|
|
15
|
+
* @returns The number of deleted coupons
|
|
16
|
+
*/
|
|
17
|
+
export declare function deleteExpiredCoupons(): Promise<number>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { CouponCountStats, CouponRedemptionStats, CouponStats, CouponTimeStats } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Fetch all coupons from the database
|
|
4
|
+
*/
|
|
5
|
+
export declare function fetchAll(): Promise<CouponJsonResponse[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Fetch a coupon by ID
|
|
8
|
+
*/
|
|
9
|
+
export declare function fetchById(id: number): Promise<CouponJsonResponse | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Fetch a coupon by code
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchByCode(code: string): Promise<CouponJsonResponse | undefined>;
|
|
14
|
+
/**
|
|
15
|
+
* Fetch active coupons (is_active = true and within date range)
|
|
16
|
+
*/
|
|
17
|
+
export declare function fetchActive(): Promise<CouponJsonResponse[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Get coupon statistics
|
|
20
|
+
*/
|
|
21
|
+
export declare function fetchStats(): Promise<CouponStats>;
|
|
22
|
+
/**
|
|
23
|
+
* Get count of active and inactive coupons for different time periods
|
|
24
|
+
*/
|
|
25
|
+
export declare function fetchCouponCounts(): Promise<CouponTimeStats>;
|
|
26
|
+
/**
|
|
27
|
+
* Get detailed breakdown of active/inactive coupons by discount type
|
|
28
|
+
*/
|
|
29
|
+
export declare function fetchCouponCountsByType(): Promise<Record<string, CouponCountStats>>;
|
|
30
|
+
/**
|
|
31
|
+
* Fetch coupon redemption statistics based on usage_count
|
|
32
|
+
*/
|
|
33
|
+
export declare function fetchRedemptionStats(): Promise<CouponRedemptionStats>;
|
|
34
|
+
/**
|
|
35
|
+
* Get top redeemed coupons
|
|
36
|
+
*/
|
|
37
|
+
export declare function fetchTopRedeemedCoupons(limit?: number): Promise<any[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Get redemption trend data in a simplified manner
|
|
40
|
+
*/
|
|
41
|
+
export declare function fetchRedemptionTrend(days?: number): Promise<any[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Get conversion rate (number of redemptions / number of active coupons)
|
|
44
|
+
*/
|
|
45
|
+
export declare function fetchConversionRate(): Promise<{
|
|
46
|
+
rate: number
|
|
47
|
+
total_active: number
|
|
48
|
+
total_redeemed: number
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Calculate the month-over-month change in active coupons
|
|
52
|
+
*/
|
|
53
|
+
export declare function getActiveCouponsMoMChange(): Promise<{
|
|
54
|
+
current_month: number
|
|
55
|
+
previous_month: number
|
|
56
|
+
difference: number
|
|
57
|
+
percentage_change: number
|
|
58
|
+
}>;
|
|
59
|
+
declare type CouponJsonResponse = ModelRow<typeof Coupon>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export {
|
|
2
|
+
deleteCoupon,
|
|
3
|
+
deleteCoupons,
|
|
4
|
+
deleteExpiredCoupons,
|
|
5
|
+
} from './destroy';
|
|
6
|
+
export {
|
|
7
|
+
fetchActive,
|
|
8
|
+
fetchAll,
|
|
9
|
+
fetchByCode,
|
|
10
|
+
fetchById,
|
|
11
|
+
fetchConversionRate,
|
|
12
|
+
fetchCouponCounts,
|
|
13
|
+
fetchCouponCountsByType,
|
|
14
|
+
fetchRedemptionStats,
|
|
15
|
+
fetchRedemptionTrend,
|
|
16
|
+
fetchStats,
|
|
17
|
+
fetchTopRedeemedCoupons,
|
|
18
|
+
getActiveCouponsMoMChange,
|
|
19
|
+
} from './fetch';
|
|
20
|
+
export {
|
|
21
|
+
store,
|
|
22
|
+
} from './store';
|
|
23
|
+
export {
|
|
24
|
+
update,
|
|
25
|
+
} from './update';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new coupon
|
|
3
|
+
*
|
|
4
|
+
* @param data The coupon data to store
|
|
5
|
+
* @returns The newly created coupon record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewCoupon): Promise<CouponJsonResponse | undefined>;
|
|
8
|
+
declare type CouponJsonResponse = ModelRow<typeof Coupon>;
|
|
9
|
+
declare type NewCoupon = NewModelData<typeof Coupon>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a coupon by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the coupon to update
|
|
5
|
+
* @param data The updated coupon data
|
|
6
|
+
* @returns The updated coupon record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: Omit<CouponUpdate, 'id'>): Promise<CouponJsonResponse | undefined>;
|
|
9
|
+
declare type CouponJsonResponse = ModelRow<typeof Coupon>;
|
|
10
|
+
declare type CouponUpdate = UpdateModelData<typeof Coupon>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a customer by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the customer to delete
|
|
5
|
+
* @returns True if the deletion was successful, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Bulk delete multiple customers
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of customer IDs to delete
|
|
12
|
+
* @returns Number of customers successfully deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a customer by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<CustomerJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all customers
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<CustomerJsonResponse[]>;
|
|
9
|
+
declare type CustomerJsonResponse = ModelRow<typeof Customer>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new customer
|
|
3
|
+
*
|
|
4
|
+
* @param data The customer data to store
|
|
5
|
+
* @returns The newly created customer record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewCustomer): Promise<CustomerJsonResponse>;
|
|
8
|
+
declare type CustomerJsonResponse = ModelRow<typeof Customer>;
|
|
9
|
+
declare type NewCustomer = NewModelData<typeof Customer>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a customer
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the customer to update
|
|
5
|
+
* @param data The customer data to update
|
|
6
|
+
* @returns The updated customer record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: Omit<CustomerUpdate, 'id'>): Promise<CustomerJsonResponse>;
|
|
9
|
+
declare type CustomerJsonResponse = ModelRow<typeof Customer>;
|
|
10
|
+
declare type CustomerUpdate = UpdateModelData<typeof Customer>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a print device by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the print device to delete
|
|
5
|
+
* @returns True if the print device was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple print devices by ID
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of print device IDs to delete
|
|
12
|
+
* @returns Number of print devices deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SpreadsheetWrapper } from 'ts-spreadsheets';
|
|
2
|
+
/**
|
|
3
|
+
* Export print devices to a spreadsheet
|
|
4
|
+
* @param format The format of the spreadsheet (default is CSV)
|
|
5
|
+
* @returns Spreadsheet object ready for download or storage
|
|
6
|
+
*/
|
|
7
|
+
export declare function exportPrintDevices(format?: 'csv' | 'excel'): Promise<SpreadsheetWrapper>;
|
|
8
|
+
/**
|
|
9
|
+
* Export print devices and automatically download
|
|
10
|
+
* @param format The format of the spreadsheet (default is CSV)
|
|
11
|
+
* @param filename Optional filename for the download
|
|
12
|
+
* @returns Download response
|
|
13
|
+
*/
|
|
14
|
+
export declare function downloadPrintDevices(format?: 'csv' | 'excel', filename?: string): Promise<Response>;
|
|
15
|
+
/**
|
|
16
|
+
* Store print devices export to disk
|
|
17
|
+
* @param format The format of the spreadsheet (default is CSV)
|
|
18
|
+
* @param path Optional path to store the file
|
|
19
|
+
* @returns Path where the file is stored
|
|
20
|
+
*/
|
|
21
|
+
export declare function storePrintDevicesExport(format?: 'csv' | 'excel', path?: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Represents the structure of an exported print device
|
|
24
|
+
*/
|
|
25
|
+
export declare interface ExportedPrintDevice {
|
|
26
|
+
'Device ID': number
|
|
27
|
+
'Name': string
|
|
28
|
+
'MAC Address': string
|
|
29
|
+
'Location': string
|
|
30
|
+
'Terminal': string
|
|
31
|
+
'Status': string
|
|
32
|
+
'Last Ping': string
|
|
33
|
+
'Print Count': number
|
|
34
|
+
}
|
|
35
|
+
declare type PrintDeviceJsonResponse = ModelRow<typeof PrintDevice>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a print device by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<PrintDeviceJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all print devices
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<PrintDeviceJsonResponse[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Count all print devices
|
|
11
|
+
*/
|
|
12
|
+
export declare function countAll(): Promise<number>;
|
|
13
|
+
/**
|
|
14
|
+
* Count total prints across all print devices from receipts
|
|
15
|
+
*/
|
|
16
|
+
export declare function countTotalPrints(): Promise<number>;
|
|
17
|
+
/**
|
|
18
|
+
* Count total prints for a specific print device from receipts
|
|
19
|
+
*/
|
|
20
|
+
export declare function countPrintsByDeviceId(printDeviceId: number): Promise<number>;
|
|
21
|
+
/**
|
|
22
|
+
* Calculate error rate percentage based on receipts
|
|
23
|
+
*/
|
|
24
|
+
export declare function calculateErrorRate(): Promise<number>;
|
|
25
|
+
/**
|
|
26
|
+
* Fetch all errors from receipts for a specific print device
|
|
27
|
+
*/
|
|
28
|
+
export declare function fetchErrorsByDeviceId(printDeviceId: number): Promise<ReceiptJsonResponse[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Calculate printer health percentage based on online status
|
|
31
|
+
*/
|
|
32
|
+
export declare function calculatePrinterHealth(): Promise<number>;
|
|
33
|
+
/**
|
|
34
|
+
* Get printer counts by status for visualization
|
|
35
|
+
*/
|
|
36
|
+
export declare function getPrinterStatusCounts(): Promise<Record<string, number>>;
|
|
37
|
+
declare type PrintDeviceJsonResponse = ModelRow<typeof PrintDevice>;
|
|
38
|
+
declare type ReceiptJsonResponse = ModelRow<typeof Receipt>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Functions from destroy.ts
|
|
2
|
+
export {
|
|
3
|
+
bulkDestroy,
|
|
4
|
+
destroy,
|
|
5
|
+
} from './destroy';
|
|
6
|
+
// Functions from export.ts
|
|
7
|
+
export {
|
|
8
|
+
downloadPrintDevices,
|
|
9
|
+
exportPrintDevices,
|
|
10
|
+
storePrintDevicesExport,
|
|
11
|
+
} from './export';
|
|
12
|
+
// Functions from fetch.ts
|
|
13
|
+
export {
|
|
14
|
+
fetchAll,
|
|
15
|
+
fetchById,
|
|
16
|
+
} from './fetch';
|
|
17
|
+
// Functions from store.ts
|
|
18
|
+
export {
|
|
19
|
+
bulkStore,
|
|
20
|
+
store,
|
|
21
|
+
} from './store';
|
|
22
|
+
// Functions from update.ts
|
|
23
|
+
export {
|
|
24
|
+
update,
|
|
25
|
+
updatePrintCount,
|
|
26
|
+
updateStatus,
|
|
27
|
+
} from './update';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new print device
|
|
3
|
+
*
|
|
4
|
+
* @param data Print device data to store
|
|
5
|
+
* @returns The newly created print device record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewPrintDevice): Promise<PrintDeviceJsonResponse | undefined>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple print devices at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of print device data to store
|
|
12
|
+
* @returns Number of print devices created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewPrintDevice[]): Promise<number>;
|
|
15
|
+
declare type PrintDeviceJsonResponse = ModelRow<typeof PrintDevice>;
|
|
16
|
+
declare type NewPrintDevice = NewModelData<typeof PrintDevice>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a print device by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the print device to update
|
|
5
|
+
* @param data The updated print device data
|
|
6
|
+
* @returns The updated print device record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: Omit<PrintDeviceUpdate, 'id'>): Promise<PrintDeviceJsonResponse | undefined>;
|
|
9
|
+
/**
|
|
10
|
+
* Update a print device's status
|
|
11
|
+
*
|
|
12
|
+
* @param id The ID of the print device
|
|
13
|
+
* @param status The new status
|
|
14
|
+
* @returns The updated print device with the new status
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateStatus(id: number, status: 'online' | 'offline' | 'warning'): Promise<PrintDeviceJsonResponse | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Update print count for a print device
|
|
19
|
+
*
|
|
20
|
+
* @param id The ID of the print device
|
|
21
|
+
* @param printCount The updated print count value
|
|
22
|
+
* @returns The updated print device
|
|
23
|
+
*/
|
|
24
|
+
export declare function updatePrintCount(id: number, printCount?: number): Promise<PrintDeviceJsonResponse | undefined>;
|
|
25
|
+
declare type PrintDeviceJsonResponse = ModelRow<typeof PrintDevice>;
|
|
26
|
+
declare type PrintDeviceUpdate = UpdateModelData<typeof PrintDevice>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a single error by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
5
|
+
/**
|
|
6
|
+
* Delete multiple errors by IDs
|
|
7
|
+
*/
|
|
8
|
+
export declare function bulkDestroy(ids: number[]): Promise<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* Delete all errors in a group (by type and message)
|
|
11
|
+
*/
|
|
12
|
+
export declare function destroyGroup(type: string, message: string): Promise<boolean>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a single error by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<ErrorRecord | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all errors (raw, ungrouped)
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<ErrorRecord[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Fetch errors grouped by type and message (Sentry-like behavior)
|
|
11
|
+
* Same errors are aggregated instead of creating duplicate entries
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchGrouped(): Promise<GroupedError[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Fetch errors for a specific group (by type and message)
|
|
16
|
+
*/
|
|
17
|
+
export declare function fetchByGroup(type: string, message: string): Promise<ErrorRecord[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Fetch error statistics
|
|
20
|
+
*/
|
|
21
|
+
export declare function fetchStats(): Promise<ErrorStats>;
|
|
22
|
+
/**
|
|
23
|
+
* Fetch error timeline (hourly counts for the last 24 hours)
|
|
24
|
+
*/
|
|
25
|
+
export declare function fetchTimeline(): Promise<{ hour: string, count: number }[]>;
|
|
26
|
+
export declare interface ErrorRecord {
|
|
27
|
+
id: number
|
|
28
|
+
type: string
|
|
29
|
+
message: string
|
|
30
|
+
stack: string | null
|
|
31
|
+
status: number | null
|
|
32
|
+
additional_info: string | null
|
|
33
|
+
created_at: string
|
|
34
|
+
updated_at: string | null
|
|
35
|
+
}
|
|
36
|
+
export declare interface GroupedError {
|
|
37
|
+
id: number
|
|
38
|
+
type: string
|
|
39
|
+
message: string
|
|
40
|
+
stack: string | null
|
|
41
|
+
status: string
|
|
42
|
+
count: number
|
|
43
|
+
first_seen: string
|
|
44
|
+
last_seen: string
|
|
45
|
+
error_ids: number[]
|
|
46
|
+
}
|
|
47
|
+
export declare interface ErrorStats {
|
|
48
|
+
total: number
|
|
49
|
+
unresolved: number
|
|
50
|
+
resolved: number
|
|
51
|
+
ignored: number
|
|
52
|
+
last_24h: number
|
|
53
|
+
trend: number
|
|
54
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
ErrorRecord,
|
|
3
|
+
ErrorStats,
|
|
4
|
+
GroupedError,
|
|
5
|
+
} from './fetch';
|
|
6
|
+
export {
|
|
7
|
+
bulkDestroy,
|
|
8
|
+
destroy,
|
|
9
|
+
destroyGroup,
|
|
10
|
+
} from './destroy';
|
|
11
|
+
export {
|
|
12
|
+
fetchAll,
|
|
13
|
+
fetchByGroup,
|
|
14
|
+
fetchById,
|
|
15
|
+
fetchGrouped,
|
|
16
|
+
fetchStats,
|
|
17
|
+
fetchTimeline,
|
|
18
|
+
} from './fetch';
|
|
19
|
+
export {
|
|
20
|
+
bulkUpdateStatus,
|
|
21
|
+
ignoreGroup,
|
|
22
|
+
resolveGroup,
|
|
23
|
+
unresolveGroup,
|
|
24
|
+
update,
|
|
25
|
+
} from './update';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a single error by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function update(id: number, data: UpdateErrorData): Promise<boolean>;
|
|
5
|
+
/**
|
|
6
|
+
* Update multiple errors by IDs (for bulk status updates on grouped errors)
|
|
7
|
+
*/
|
|
8
|
+
export declare function bulkUpdateStatus(ids: number[], status: number): Promise<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve a grouped error (sets status = 1 for all errors in the group)
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveGroup(type: string, message: string): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Ignore a grouped error (sets status = 2 for all errors in the group)
|
|
15
|
+
*/
|
|
16
|
+
export declare function ignoreGroup(type: string, message: string): Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* Unresolve a grouped error (sets status = 0 for all errors in the group)
|
|
19
|
+
*/
|
|
20
|
+
export declare function unresolveGroup(type: string, message: string): Promise<boolean>;
|
|
21
|
+
export declare interface UpdateErrorData {
|
|
22
|
+
status?: number
|
|
23
|
+
additional_info?: string
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a gift card by ID
|
|
3
|
+
* @param id The ID of the gift card to delete
|
|
4
|
+
* @returns A boolean indicating whether the deletion was successful
|
|
5
|
+
*/
|
|
6
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
7
|
+
/**
|
|
8
|
+
* Bulk delete multiple gift cards
|
|
9
|
+
* @param ids Array of gift card IDs to delete
|
|
10
|
+
* @returns Number of gift cards successfully deleted
|
|
11
|
+
*/
|
|
12
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
13
|
+
/**
|
|
14
|
+
* Delete expired gift cards
|
|
15
|
+
* @returns Number of gift cards deleted
|
|
16
|
+
*/
|
|
17
|
+
export declare function destroyExpired(): Promise<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Deactivate a gift card (set is_active to false)
|
|
20
|
+
* @param id The ID of the gift card to deactivate
|
|
21
|
+
* @returns A boolean indicating whether the deactivation was successful
|
|
22
|
+
*/
|
|
23
|
+
export declare function deactivate(id: number): Promise<boolean>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { GiftCardStats } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Fetch all gift cards from the database
|
|
4
|
+
*/
|
|
5
|
+
export declare function fetchAll(): Promise<GiftCardJsonResponse[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Fetch a gift card by ID
|
|
8
|
+
*/
|
|
9
|
+
export declare function fetchById(id: number): Promise<GiftCardJsonResponse | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Fetch a gift card by code
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchByCode(code: string): Promise<GiftCardJsonResponse | undefined>;
|
|
14
|
+
/**
|
|
15
|
+
* Fetch active gift cards (is_active = true and not expired)
|
|
16
|
+
*/
|
|
17
|
+
export declare function fetchActive(): Promise<GiftCardJsonResponse[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Get gift card statistics
|
|
20
|
+
*/
|
|
21
|
+
export declare function fetchStats(): Promise<GiftCardStats>;
|
|
22
|
+
/**
|
|
23
|
+
* Check gift card balance by code
|
|
24
|
+
*/
|
|
25
|
+
export declare function checkBalance(code: string): Promise<{ valid: boolean, balance?: number, currency?: string, message?: string }>;
|
|
26
|
+
/**
|
|
27
|
+
* Compare active gift cards between different time periods
|
|
28
|
+
* @param daysRange Number of days to look back (7, 30, 60, etc.)
|
|
29
|
+
*/
|
|
30
|
+
export declare function compareActiveGiftCards(_daysRange?: number): Promise<{
|
|
31
|
+
current_period: number
|
|
32
|
+
previous_period: number
|
|
33
|
+
difference: number
|
|
34
|
+
percentage_change: number
|
|
35
|
+
days_range: number
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Calculate gift card balances and initial values for different time periods
|
|
39
|
+
* with clear increase/decrease indicators
|
|
40
|
+
* @param daysRange Number of days to look back (7, 30, 60, etc.)
|
|
41
|
+
*/
|
|
42
|
+
export declare function calculateGiftCardValues(_daysRange?: number): Promise<{
|
|
43
|
+
current_period: {
|
|
44
|
+
total_initial_value: number
|
|
45
|
+
total_remaining_balance: number
|
|
46
|
+
utilization_rate: number
|
|
47
|
+
card_count: number
|
|
48
|
+
average_initial_value: number
|
|
49
|
+
average_remaining_balance: number
|
|
50
|
+
}
|
|
51
|
+
previous_period: {
|
|
52
|
+
total_initial_value: number
|
|
53
|
+
total_remaining_balance: number
|
|
54
|
+
utilization_rate: number
|
|
55
|
+
card_count: number
|
|
56
|
+
}
|
|
57
|
+
comparison: {
|
|
58
|
+
initial_value: {
|
|
59
|
+
difference: number
|
|
60
|
+
percentage: number
|
|
61
|
+
is_increase: boolean
|
|
62
|
+
}
|
|
63
|
+
balance: {
|
|
64
|
+
difference: number
|
|
65
|
+
percentage: number
|
|
66
|
+
is_increase: boolean
|
|
67
|
+
}
|
|
68
|
+
card_count: {
|
|
69
|
+
difference: number
|
|
70
|
+
percentage: number
|
|
71
|
+
is_increase: boolean
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
days_range: number
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Get total value of all gift cards
|
|
78
|
+
*/
|
|
79
|
+
export declare function fetchTotalValue(): Promise<{
|
|
80
|
+
total_value: number
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Get total current balance of all gift cards
|
|
84
|
+
*/
|
|
85
|
+
export declare function fetchTotalCurrentBalance(): Promise<{
|
|
86
|
+
total_balance: number
|
|
87
|
+
}>;
|
|
88
|
+
declare type GiftCardJsonResponse = ModelRow<typeof GiftCard>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export {
|
|
2
|
+
bulkDestroy,
|
|
3
|
+
destroy,
|
|
4
|
+
} from './destroy';
|
|
5
|
+
export {
|
|
6
|
+
calculateGiftCardValues,
|
|
7
|
+
checkBalance,
|
|
8
|
+
compareActiveGiftCards,
|
|
9
|
+
fetchActive,
|
|
10
|
+
fetchAll,
|
|
11
|
+
fetchByCode,
|
|
12
|
+
fetchById,
|
|
13
|
+
fetchStats,
|
|
14
|
+
fetchTotalCurrentBalance,
|
|
15
|
+
fetchTotalValue,
|
|
16
|
+
} from './fetch';
|
|
17
|
+
export {
|
|
18
|
+
store,
|
|
19
|
+
} from './store';
|
|
20
|
+
export {
|
|
21
|
+
update,
|
|
22
|
+
updateBalance,
|
|
23
|
+
} from './update';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new gift card
|
|
3
|
+
*
|
|
4
|
+
* @param data The gift card data to store
|
|
5
|
+
* @returns The newly created gift card record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewGiftCard): Promise<GiftCardJsonResponse | undefined>;
|
|
8
|
+
declare type GiftCardJsonResponse = ModelRow<typeof GiftCard>;
|
|
9
|
+
declare type NewGiftCard = NewModelData<typeof GiftCard>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a gift card by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the gift card to update
|
|
5
|
+
* @param data The updated gift card data
|
|
6
|
+
* @returns The updated gift card record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: Omit<GiftCardUpdate, 'id'>): Promise<GiftCardJsonResponse | undefined>;
|
|
9
|
+
/**
|
|
10
|
+
* Update a gift card's balance
|
|
11
|
+
*
|
|
12
|
+
* @param id The ID of the gift card
|
|
13
|
+
* @param amount The amount to adjust (positive to add, negative to deduct)
|
|
14
|
+
* @returns The updated gift card with new balance
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateBalance(id: number, amount: number): Promise<GiftCardJsonResponse | undefined>;
|
|
17
|
+
declare type GiftCardJsonResponse = ModelRow<typeof GiftCard>;
|
|
18
|
+
declare type GiftCardUpdate = UpdateModelData<typeof GiftCard>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as coupons from './coupons';
|
|
2
|
-
import * as customers from './customers';
|
|
3
|
-
import * as devices from './devices';
|
|
4
|
-
import * as errors from './errors';
|
|
5
|
-
import * as giftCards from './gift-cards';
|
|
6
|
-
import * as orders from './orders';
|
|
7
|
-
import * as payments from './payments';
|
|
8
|
-
import * as products from './products';
|
|
9
|
-
import * as receipts from './receipts';
|
|
10
|
-
import * as restaurant from './waitlists/restaurant';
|
|
11
|
-
import * as shippings from './shippings';
|
|
12
|
-
import * as tax from './tax';
|
|
13
|
-
import * as waitlists from './waitlists';
|
|
1
|
+
import * as coupons from './coupons/index';
|
|
2
|
+
import * as customers from './customers/index';
|
|
3
|
+
import * as devices from './devices/index';
|
|
4
|
+
import * as errors from './errors/index';
|
|
5
|
+
import * as giftCards from './gift-cards/index';
|
|
6
|
+
import * as orders from './orders/index';
|
|
7
|
+
import * as payments from './payments/index';
|
|
8
|
+
import * as products from './products/index';
|
|
9
|
+
import * as receipts from './receipts/index';
|
|
10
|
+
import * as restaurant from './waitlists/restaurant/index';
|
|
11
|
+
import * as shippings from './shippings/index';
|
|
12
|
+
import * as tax from './tax/index';
|
|
13
|
+
import * as waitlists from './waitlists/index';
|
|
14
14
|
export declare const commerce: CommerceNamespace;
|
|
15
15
|
export declare interface CommerceNamespace {
|
|
16
16
|
coupons: CouponsModule
|