@atomic-solutions/woocommerce-api-client 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.d.mts +2 -3
- package/dist/client/index.d.ts +2 -3
- package/dist/client/index.js +8 -151
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +8 -151
- package/dist/client/index.mjs.map +1 -1
- package/dist/http/index.d.mts +2 -3
- package/dist/http/index.d.ts +2 -3
- package/dist/index.d.mts +5021 -7
- package/dist/index.d.ts +5021 -7
- package/dist/index.js +34 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -38
- package/dist/index.mjs.map +1 -1
- package/dist/types-B09FKPkT.d.mts +3475 -0
- package/dist/types-B09FKPkT.d.ts +3475 -0
- package/dist/utils/index.d.mts +2 -3
- package/dist/utils/index.d.ts +2 -3
- package/package.json +3 -5
- package/dist/types-DuA0wOpm.d.mts +0 -183
- package/dist/types-DuA0wOpm.d.ts +0 -183
package/dist/client/index.mjs
CHANGED
|
@@ -694,28 +694,6 @@ var moneySchema = z.object({
|
|
|
694
694
|
/** Currency symbol suffix (empty if symbol is prefix) */
|
|
695
695
|
currency_suffix: z.string()
|
|
696
696
|
});
|
|
697
|
-
z.object({
|
|
698
|
-
/** Current page number */
|
|
699
|
-
page: z.number().int().positive().optional(),
|
|
700
|
-
/** Items per page */
|
|
701
|
-
per_page: z.number().int().positive().max(100).optional(),
|
|
702
|
-
/** Offset for pagination */
|
|
703
|
-
offset: z.number().int().nonnegative().optional(),
|
|
704
|
-
/** Sort order */
|
|
705
|
-
order: z.enum(["asc", "desc"]).optional(),
|
|
706
|
-
/** Field to sort by */
|
|
707
|
-
orderby: z.string().optional()
|
|
708
|
-
});
|
|
709
|
-
z.object({
|
|
710
|
-
/** Total number of items */
|
|
711
|
-
total: z.number(),
|
|
712
|
-
/** Total number of pages */
|
|
713
|
-
totalPages: z.number(),
|
|
714
|
-
/** Current page */
|
|
715
|
-
currentPage: z.number(),
|
|
716
|
-
/** Items per page */
|
|
717
|
-
perPage: z.number()
|
|
718
|
-
});
|
|
719
697
|
var productImageSchema = z.object({
|
|
720
698
|
/** Alternative text for the image */
|
|
721
699
|
alt: z.string(),
|
|
@@ -772,6 +750,8 @@ var pricesSchema = z.object({
|
|
|
772
750
|
sale_price: z.string()
|
|
773
751
|
}).optional()
|
|
774
752
|
}).merge(moneySchema);
|
|
753
|
+
|
|
754
|
+
// ../schemas/src/woocommerce/store-api/cart-item.schema.ts
|
|
775
755
|
var itemTotalsSchema = z.object({
|
|
776
756
|
/** Subtotal before taxes */
|
|
777
757
|
line_subtotal: z.string(),
|
|
@@ -948,6 +928,8 @@ var shippingPackageSchema = z.object({
|
|
|
948
928
|
/** Available shipping rates for this package */
|
|
949
929
|
shipping_rates: z.array(shippingRateSchema)
|
|
950
930
|
});
|
|
931
|
+
|
|
932
|
+
// ../schemas/src/woocommerce/store-api/cart.ts
|
|
951
933
|
var cartSchema = z.object({
|
|
952
934
|
items: z.array(cartItemSchema),
|
|
953
935
|
items_count: z.number(),
|
|
@@ -1167,6 +1149,8 @@ var orderTotalsSchema = z.object({
|
|
|
1167
1149
|
/** Currency suffix (e.g., 'USD') */
|
|
1168
1150
|
currency_suffix: z.string()
|
|
1169
1151
|
});
|
|
1152
|
+
|
|
1153
|
+
// ../schemas/src/woocommerce/store-api/order.schema.ts
|
|
1170
1154
|
var orderStatusEnum = z.enum([
|
|
1171
1155
|
"pending",
|
|
1172
1156
|
// Order received, awaiting payment
|
|
@@ -1213,21 +1197,6 @@ var storeApiOrderSchema = z.object({
|
|
|
1213
1197
|
/** Payment method title (optional - returned from checkout) */
|
|
1214
1198
|
payment_method_title: z.string().optional()
|
|
1215
1199
|
});
|
|
1216
|
-
z.object({
|
|
1217
|
-
id: z.number(),
|
|
1218
|
-
status: z.string(),
|
|
1219
|
-
order_key: z.string(),
|
|
1220
|
-
number: z.string(),
|
|
1221
|
-
currency: z.string(),
|
|
1222
|
-
total: z.string(),
|
|
1223
|
-
date_created: z.string(),
|
|
1224
|
-
customer_note: z.string(),
|
|
1225
|
-
billing: z.record(z.string(), z.unknown()),
|
|
1226
|
-
shipping: z.record(z.string(), z.unknown()),
|
|
1227
|
-
payment_method: z.string(),
|
|
1228
|
-
payment_method_title: z.string(),
|
|
1229
|
-
line_items: z.array(z.unknown())
|
|
1230
|
-
});
|
|
1231
1200
|
var checkoutSchema = z.object({
|
|
1232
1201
|
order_id: z.number(),
|
|
1233
1202
|
status: z.string(),
|
|
@@ -1311,103 +1280,8 @@ var productCategorySchema = z.object({
|
|
|
1311
1280
|
/** Number of products in this category */
|
|
1312
1281
|
count: z.number()
|
|
1313
1282
|
});
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
/** Current page number */
|
|
1317
|
-
page: z.number(),
|
|
1318
|
-
/** Number of products per page (1-100) */
|
|
1319
|
-
per_page: z.number().min(1).max(100).default(10),
|
|
1320
|
-
// Ordering
|
|
1321
|
-
/** Field to order results by */
|
|
1322
|
-
orderby: z.enum([
|
|
1323
|
-
"date",
|
|
1324
|
-
"id",
|
|
1325
|
-
"include",
|
|
1326
|
-
"title",
|
|
1327
|
-
"slug",
|
|
1328
|
-
"price",
|
|
1329
|
-
"popularity",
|
|
1330
|
-
"rating",
|
|
1331
|
-
"menu_order",
|
|
1332
|
-
"date_modified"
|
|
1333
|
-
]).optional(),
|
|
1334
|
-
/** Sort order (ascending or descending) */
|
|
1335
|
-
order: z.enum(["asc", "desc"]).optional(),
|
|
1336
|
-
// Filtering
|
|
1337
|
-
/** Search query string */
|
|
1338
|
-
search: z.string().optional(),
|
|
1339
|
-
/** Exact slug match */
|
|
1340
|
-
slug: z.string().optional(),
|
|
1341
|
-
// Date filtering
|
|
1342
|
-
/** Filter products published after this date */
|
|
1343
|
-
after: z.string().datetime().optional(),
|
|
1344
|
-
/** Filter products published before this date */
|
|
1345
|
-
before: z.string().datetime().optional(),
|
|
1346
|
-
/** Filter products modified after this date */
|
|
1347
|
-
modified_after: z.string().datetime().optional(),
|
|
1348
|
-
/** Filter products modified before this date */
|
|
1349
|
-
modified_before: z.string().datetime().optional(),
|
|
1350
|
-
// ID filtering
|
|
1351
|
-
/** Include specific product IDs */
|
|
1352
|
-
include: z.array(z.number()).optional(),
|
|
1353
|
-
/** Exclude specific product IDs */
|
|
1354
|
-
exclude: z.array(z.number()).optional(),
|
|
1355
|
-
// Parent/Child
|
|
1356
|
-
/** Filter by parent product IDs */
|
|
1357
|
-
parent: z.array(z.number()).optional(),
|
|
1358
|
-
/** Exclude products with these parent IDs */
|
|
1359
|
-
parent_exclude: z.array(z.number()).optional(),
|
|
1360
|
-
// Type & Status
|
|
1361
|
-
/** Filter by product type */
|
|
1362
|
-
type: z.enum(["simple", "grouped", "external", "variable", "variation"]).optional(),
|
|
1363
|
-
/** Filter by product status */
|
|
1364
|
-
status: z.enum(["any", "draft", "pending", "private", "publish"]).optional(),
|
|
1365
|
-
// Featured
|
|
1366
|
-
/** Filter featured products */
|
|
1367
|
-
featured: z.boolean().optional(),
|
|
1368
|
-
// Visibility
|
|
1369
|
-
/** Filter by catalog visibility */
|
|
1370
|
-
catalog_visibility: z.enum(["any", "visible", "catalog", "search", "hidden"]).optional(),
|
|
1371
|
-
// Stock
|
|
1372
|
-
/** Filter by stock status */
|
|
1373
|
-
stock_status: z.array(z.enum(["instock", "outofstock", "onbackorder"])).optional(),
|
|
1374
|
-
// Category & Tag filtering
|
|
1375
|
-
/** Filter by category slug or ID */
|
|
1376
|
-
category: z.string().optional(),
|
|
1377
|
-
/** Category filter operator */
|
|
1378
|
-
category_operator: z.enum(["in", "not_in", "and"]).optional(),
|
|
1379
|
-
/** Filter by tag slug or ID */
|
|
1380
|
-
tag: z.string().optional(),
|
|
1381
|
-
/** Tag filter operator */
|
|
1382
|
-
tag_operator: z.enum(["in", "not_in", "and"]).optional(),
|
|
1383
|
-
// Attribute filtering
|
|
1384
|
-
/** Filter by product attributes */
|
|
1385
|
-
attributes: z.array(
|
|
1386
|
-
z.object({
|
|
1387
|
-
/** Attribute name */
|
|
1388
|
-
attribute: z.string(),
|
|
1389
|
-
/** Filter by attribute term IDs */
|
|
1390
|
-
term_id: z.array(z.number()).optional(),
|
|
1391
|
-
/** Filter by attribute term slugs */
|
|
1392
|
-
slug: z.array(z.string()).optional(),
|
|
1393
|
-
/** Attribute filter operator */
|
|
1394
|
-
operator: z.enum(["in", "not_in", "and"]).optional()
|
|
1395
|
-
})
|
|
1396
|
-
).optional(),
|
|
1397
|
-
/** Relationship between attribute filters */
|
|
1398
|
-
attribute_relation: z.enum(["in", "and"]).optional(),
|
|
1399
|
-
// Price filtering
|
|
1400
|
-
/** Minimum price filter */
|
|
1401
|
-
min_price: z.string().optional(),
|
|
1402
|
-
/** Maximum price filter */
|
|
1403
|
-
max_price: z.string().optional(),
|
|
1404
|
-
// Sale status
|
|
1405
|
-
/** Filter products on sale */
|
|
1406
|
-
on_sale: z.boolean().optional(),
|
|
1407
|
-
// Rating filter
|
|
1408
|
-
/** Filter by product rating (1-5 stars) */
|
|
1409
|
-
rating: z.array(z.number().min(1).max(5)).optional()
|
|
1410
|
-
});
|
|
1283
|
+
|
|
1284
|
+
// ../schemas/src/woocommerce/store-api/products.ts
|
|
1411
1285
|
var productSchema = z.object({
|
|
1412
1286
|
id: z.number(),
|
|
1413
1287
|
name: z.string(),
|
|
@@ -1438,23 +1312,6 @@ var productSchema = z.object({
|
|
|
1438
1312
|
review_count: z.number(),
|
|
1439
1313
|
extensions: z.record(z.string(), z.unknown())
|
|
1440
1314
|
});
|
|
1441
|
-
var paymentDataItemSchema = z.object({
|
|
1442
|
-
/** Key identifier for the payment data field */
|
|
1443
|
-
key: z.string(),
|
|
1444
|
-
/** Value can be string or boolean depending on the field */
|
|
1445
|
-
value: z.union([z.string(), z.boolean()])
|
|
1446
|
-
});
|
|
1447
|
-
z.object({
|
|
1448
|
-
/** Payment method ID (e.g., "cod", "stripe", "bacs") */
|
|
1449
|
-
payment_method: z.string().min(1, "Payment method is required"),
|
|
1450
|
-
/**
|
|
1451
|
-
* Optional payment gateway-specific data
|
|
1452
|
-
*
|
|
1453
|
-
* Array of key-value pairs that will be passed to the payment gateway
|
|
1454
|
-
* Example: [{ key: "stripe_token", value: "tok_xyz" }]
|
|
1455
|
-
*/
|
|
1456
|
-
payment_data: z.array(paymentDataItemSchema).optional()
|
|
1457
|
-
});
|
|
1458
1315
|
|
|
1459
1316
|
// src/api/cart.ts
|
|
1460
1317
|
var createCartAPI = (client, endpoints, options) => ({
|