@tallyui/connector-vendure 4.1.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -1
- package/package.json +4 -4
- package/src/store-orders.ts +4 -2
package/dist/index.js
CHANGED
|
@@ -1108,6 +1108,9 @@ async function getVendureCustomer(context, id) {
|
|
|
1108
1108
|
return toVendureCustomer(raw);
|
|
1109
1109
|
}
|
|
1110
1110
|
|
|
1111
|
+
// src/store-orders.ts
|
|
1112
|
+
import { assertOrderFiltersSupported } from "@tallyui/core";
|
|
1113
|
+
|
|
1111
1114
|
// src/orders.ts
|
|
1112
1115
|
var ORDER_ROW_FIELDS = `
|
|
1113
1116
|
id code state orderPlacedAt updatedAt currencyCode totalQuantity total totalWithTax
|
|
@@ -1270,12 +1273,13 @@ function createVendureOrders(options = {}) {
|
|
|
1270
1273
|
const pricesIncludeTax = options.pricesIncludeTax === true;
|
|
1271
1274
|
return {
|
|
1272
1275
|
async listOrders(context, query2 = {}) {
|
|
1276
|
+
assertOrderFiltersSupported(query2, void 0);
|
|
1273
1277
|
const page = Math.max(1, wholeNumber(query2.page, 1));
|
|
1274
1278
|
const perPage = Math.max(1, Math.min(100, wholeNumber(query2.perPage, 25)));
|
|
1275
1279
|
const skip = (page - 1) * perPage;
|
|
1276
1280
|
const search = query2.search?.trim();
|
|
1277
1281
|
const { items, totalItems } = await listVendureOrderDetails(context, { skip, take: perPage, ...search ? { search } : {}, ...tally });
|
|
1278
|
-
return { orders: items.map((o) => toVendureStoreOrder(o, pricesIncludeTax)), hasMore: skip + items.length < totalItems };
|
|
1282
|
+
return { orders: items.map((o) => toVendureStoreOrder(o, pricesIncludeTax)), hasMore: skip + items.length < totalItems, total: totalItems };
|
|
1279
1283
|
},
|
|
1280
1284
|
async getOrders(context, ids) {
|
|
1281
1285
|
const wanted = [...new Set(ids.filter((id) => id.length > 0))];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tallyui/connector-vendure",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vendure connector for Tally UI",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"directory": "connectors/vendure"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@tallyui/core": "^
|
|
30
|
+
"@tallyui/core": "^5.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tallyui/database": "
|
|
34
|
-
"@tallyui/pos": "
|
|
33
|
+
"@tallyui/database": "5.0.0",
|
|
34
|
+
"@tallyui/pos": "5.0.0",
|
|
35
35
|
"rxdb": "17.5.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
package/src/store-orders.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { assertOrderFiltersSupported, type StoreOrder, type StoreOrderLine, type SyncContext, type TallyConnector } from '@tallyui/core';
|
|
2
2
|
import { getVendureOrder, listVendureOrderDetails, type VendureOrder } from './orders';
|
|
3
3
|
|
|
4
4
|
const nonEmpty = (value: unknown) => (typeof value === 'string' && value.length > 0 ? value : undefined);
|
|
@@ -71,12 +71,14 @@ export function createVendureOrders(options: { pricesIncludeTax?: boolean; tally
|
|
|
71
71
|
const pricesIncludeTax = options.pricesIncludeTax === true;
|
|
72
72
|
return {
|
|
73
73
|
async listOrders(context: SyncContext, query = {}) {
|
|
74
|
+
// Vendure lists no orderFilters yet, so every filter field is refused, never dropped (ListOrdersQuery contract).
|
|
75
|
+
assertOrderFiltersSupported(query, undefined);
|
|
74
76
|
const page = Math.max(1, wholeNumber(query.page, 1));
|
|
75
77
|
const perPage = Math.max(1, Math.min(100, wholeNumber(query.perPage, 25)));
|
|
76
78
|
const skip = (page - 1) * perPage;
|
|
77
79
|
const search = query.search?.trim();
|
|
78
80
|
const { items, totalItems } = await listVendureOrderDetails(context, { skip, take: perPage, ...(search ? { search } : {}), ...tally });
|
|
79
|
-
return { orders: items.map((o) => toVendureStoreOrder(o, pricesIncludeTax)), hasMore: skip + items.length < totalItems };
|
|
81
|
+
return { orders: items.map((o) => toVendureStoreOrder(o, pricesIncludeTax)), hasMore: skip + items.length < totalItems, total: totalItems };
|
|
80
82
|
},
|
|
81
83
|
|
|
82
84
|
async getOrders(context: SyncContext, ids: readonly string[]) {
|