@atomic-solutions/woocommerce-api-client 0.1.3 → 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/index.js CHANGED
@@ -778,6 +778,8 @@ var pricesSchema = zod.z.object({
778
778
  sale_price: zod.z.string()
779
779
  }).optional()
780
780
  }).merge(moneySchema);
781
+
782
+ // ../schemas/src/woocommerce/store-api/cart-item.schema.ts
781
783
  var itemTotalsSchema = zod.z.object({
782
784
  /** Subtotal before taxes */
783
785
  line_subtotal: zod.z.string(),
@@ -954,6 +956,8 @@ var shippingPackageSchema = zod.z.object({
954
956
  /** Available shipping rates for this package */
955
957
  shipping_rates: zod.z.array(shippingRateSchema)
956
958
  });
959
+
960
+ // ../schemas/src/woocommerce/store-api/cart.ts
957
961
  var cartSchema = zod.z.object({
958
962
  items: zod.z.array(cartItemSchema),
959
963
  items_count: zod.z.number(),
@@ -1173,6 +1177,8 @@ var orderTotalsSchema = zod.z.object({
1173
1177
  /** Currency suffix (e.g., 'USD') */
1174
1178
  currency_suffix: zod.z.string()
1175
1179
  });
1180
+
1181
+ // ../schemas/src/woocommerce/store-api/order.schema.ts
1176
1182
  var orderStatusEnum = zod.z.enum([
1177
1183
  "pending",
1178
1184
  // Order received, awaiting payment
@@ -1219,21 +1225,6 @@ var storeApiOrderSchema = zod.z.object({
1219
1225
  /** Payment method title (optional - returned from checkout) */
1220
1226
  payment_method_title: zod.z.string().optional()
1221
1227
  });
1222
- zod.z.object({
1223
- id: zod.z.number(),
1224
- status: zod.z.string(),
1225
- order_key: zod.z.string(),
1226
- number: zod.z.string(),
1227
- currency: zod.z.string(),
1228
- total: zod.z.string(),
1229
- date_created: zod.z.string(),
1230
- customer_note: zod.z.string(),
1231
- billing: zod.z.record(zod.z.string(), zod.z.unknown()),
1232
- shipping: zod.z.record(zod.z.string(), zod.z.unknown()),
1233
- payment_method: zod.z.string(),
1234
- payment_method_title: zod.z.string(),
1235
- line_items: zod.z.array(zod.z.unknown())
1236
- });
1237
1228
  var checkoutSchema = zod.z.object({
1238
1229
  order_id: zod.z.number(),
1239
1230
  status: zod.z.string(),
@@ -1414,6 +1405,8 @@ var storeProductsSearchParamsSchema = zod.z.object({
1414
1405
  /** Filter by product rating (1-5 stars) */
1415
1406
  rating: zod.z.array(zod.z.number().min(1).max(5)).optional()
1416
1407
  });
1408
+
1409
+ // ../schemas/src/woocommerce/store-api/products.ts
1417
1410
  var productSchema = zod.z.object({
1418
1411
  id: zod.z.number(),
1419
1412
  name: zod.z.string(),
@@ -1444,23 +1437,6 @@ var productSchema = zod.z.object({
1444
1437
  review_count: zod.z.number(),
1445
1438
  extensions: zod.z.record(zod.z.string(), zod.z.unknown())
1446
1439
  });
1447
- var paymentDataItemSchema = zod.z.object({
1448
- /** Key identifier for the payment data field */
1449
- key: zod.z.string(),
1450
- /** Value can be string or boolean depending on the field */
1451
- value: zod.z.union([zod.z.string(), zod.z.boolean()])
1452
- });
1453
- zod.z.object({
1454
- /** Payment method ID (e.g., "cod", "stripe", "bacs") */
1455
- payment_method: zod.z.string().min(1, "Payment method is required"),
1456
- /**
1457
- * Optional payment gateway-specific data
1458
- *
1459
- * Array of key-value pairs that will be passed to the payment gateway
1460
- * Example: [{ key: "stripe_token", value: "tok_xyz" }]
1461
- */
1462
- payment_data: zod.z.array(paymentDataItemSchema).optional()
1463
- });
1464
1440
 
1465
1441
  // src/api/cart.ts
1466
1442
  var createCartAPI = (client, endpoints, options) => ({
@@ -1599,6 +1575,8 @@ var createClient = (config) => {
1599
1575
  setupErrorInterceptor(axiosInstance, fullConfig, client);
1600
1576
  return client;
1601
1577
  };
1578
+
1579
+ // ../schemas/src/woocommerce/admin-api/enums/enums-raw.ts
1602
1580
  var ORDER_STATUS = [
1603
1581
  "cancelled",
1604
1582
  "completed",
@@ -1712,6 +1690,8 @@ var ENUM_RAW = {
1712
1690
  ORDER_BY: COUPONS_ORDER_BY
1713
1691
  }
1714
1692
  };
1693
+
1694
+ // ../schemas/src/woocommerce/admin-api/enums/enums.ts
1715
1695
  var APP_ENUMS = {
1716
1696
  PRODUCT_TYPES: {
1717
1697
  RAW: ENUM_RAW.PRODUCT.TYPES,
@@ -1817,6 +1797,8 @@ var wpLinksSchema = zod.z.object({
1817
1797
  })
1818
1798
  ).optional()
1819
1799
  });
1800
+
1801
+ // ../schemas/src/woocommerce/admin-api/base/base-wc.schema.ts
1820
1802
  var wcSortingSchema = zod.z.object({
1821
1803
  order: getAppEnumZod("COMMON_SORT_ORDER").default("desc"),
1822
1804
  orderby: zod.z.string().optional()
@@ -1855,7 +1837,7 @@ var wcBaseResponseSchema = zod.z.object({
1855
1837
  _links: wpLinksSchema,
1856
1838
  meta_data: zod.z.array(wcMetaDataSchema).optional()
1857
1839
  });
1858
- zod.z.object({
1840
+ var wcPaginationMetaSchema = zod.z.object({
1859
1841
  total: zod.z.number(),
1860
1842
  totalPages: zod.z.number(),
1861
1843
  currentPage: zod.z.number(),
@@ -1868,6 +1850,12 @@ var wcErrorResponseSchema = zod.z.object({
1868
1850
  status: zod.z.number()
1869
1851
  }).optional()
1870
1852
  }).passthrough();
1853
+ var createPaginatedSchema = (schema) => zod.z.object({
1854
+ data: zod.z.array(schema),
1855
+ meta: wcPaginationMetaSchema
1856
+ });
1857
+
1858
+ // ../schemas/src/woocommerce/admin-api/coupons/coupon-filter.schema.ts
1871
1859
  var couponFilterSchema = wcBaseParamsSchema.extend({
1872
1860
  orderby: getAppEnumZod("COUPONS_ORDER_BY").default("date"),
1873
1861
  code: zod.z.string().optional()
@@ -1958,7 +1946,7 @@ var orderLineItemSchema = zod.z.object({
1958
1946
  sku: zod.z.string(),
1959
1947
  price: zod.z.number()
1960
1948
  });
1961
- var orderSchema2 = wcBaseResponseSchema.extend({
1949
+ var orderSchema = wcBaseResponseSchema.extend({
1962
1950
  id: zod.z.number(),
1963
1951
  parent_id: zod.z.number(),
1964
1952
  status: getAppEnumZod("ORDER_STATUS"),
@@ -1990,7 +1978,7 @@ var orderSchema2 = wcBaseResponseSchema.extend({
1990
1978
  var paymentMethodFilterSchema = wcBaseParamsSchema.extend({
1991
1979
  enabled: zod.z.boolean().optional()
1992
1980
  });
1993
- var paymentMethodSchema2 = wcBaseResponseSchema.extend({
1981
+ var paymentMethodSchema = wcBaseResponseSchema.extend({
1994
1982
  id: getAppEnumZod("PAYMENT_METHODS"),
1995
1983
  title: zod.z.string(),
1996
1984
  description: zod.z.string(),
@@ -2053,6 +2041,8 @@ var productSchema2 = wcBaseResponseSchema.extend({
2053
2041
  on_sale: zod.z.boolean(),
2054
2042
  manufacturer: zod.z.string().optional()
2055
2043
  });
2044
+
2045
+ // ../schemas/src/woocommerce/admin-api/products/category.schema.ts
2056
2046
  var productCategorySchema2 = wcBaseResponseSchema.extend({
2057
2047
  id: zod.z.number(),
2058
2048
  name: zod.z.string(),
@@ -2086,6 +2076,8 @@ var createCategorySchema = productCategorySchema2.omit({
2086
2076
  }).extend({
2087
2077
  name: zod.z.string().min(1, "Name is required")
2088
2078
  });
2079
+
2080
+ // ../schemas/src/woocommerce/admin-api/index.ts
2089
2081
  var schemas = {
2090
2082
  resources: {
2091
2083
  product: {
@@ -2098,7 +2090,7 @@ var schemas = {
2098
2090
  },
2099
2091
  order: {
2100
2092
  filter: orderFilterSchema,
2101
- entity: orderSchema2,
2093
+ entity: orderSchema,
2102
2094
  lineItem: orderLineItemSchema
2103
2095
  },
2104
2096
  customer: {
@@ -2114,7 +2106,7 @@ var schemas = {
2114
2106
  },
2115
2107
  paymentMethod: {
2116
2108
  filter: paymentMethodFilterSchema,
2117
- entity: paymentMethodSchema2
2109
+ entity: paymentMethodSchema
2118
2110
  }
2119
2111
  }
2120
2112
  };
@@ -2127,7 +2119,7 @@ exports.adminCategoryFilterSchema = categoryFilterSchema;
2127
2119
  exports.adminCouponFilterSchema = couponFilterSchema;
2128
2120
  exports.adminCouponSchema = couponSchema;
2129
2121
  exports.adminOrderFilterSchema = orderFilterSchema;
2130
- exports.adminOrderSchema = orderSchema2;
2122
+ exports.adminOrderSchema = orderSchema;
2131
2123
  exports.adminProductCategorySchema = productCategorySchema2;
2132
2124
  exports.adminProductFilterSchema = productFilterSchema;
2133
2125
  exports.adminProductSchema = productSchema2;
@@ -2141,6 +2133,7 @@ exports.createCategorySchema = createCategorySchema;
2141
2133
  exports.createClient = createClient;
2142
2134
  exports.createCouponSchema = createCouponSchema;
2143
2135
  exports.createCustomerSchema = createCustomerSchema;
2136
+ exports.createPaginatedSchema = createPaginatedSchema;
2144
2137
  exports.customerFilterSchema = customerFilterSchema;
2145
2138
  exports.customerSchema = customerSchema;
2146
2139
  exports.getAppEnumRaw = getAppEnumRaw;
@@ -2148,7 +2141,7 @@ exports.getAppEnumZod = getAppEnumZod;
2148
2141
  exports.paginationMetaSchema = paginationMetaSchema;
2149
2142
  exports.paginationParamsSchema = paginationParamsSchema;
2150
2143
  exports.paymentMethodFilterSchema = paymentMethodFilterSchema;
2151
- exports.paymentMethodSchema = paymentMethodSchema2;
2144
+ exports.paymentMethodSchema = paymentMethodSchema;
2152
2145
  exports.productCategorySchema = productCategorySchema;
2153
2146
  exports.productImageSchema = productImageSchema;
2154
2147
  exports.productSchema = productSchema;
@@ -2160,6 +2153,8 @@ exports.storeApiOrderSchema = storeApiOrderSchema;
2160
2153
  exports.updateCartItemInputSchema = updateCartItemInputSchema;
2161
2154
  exports.updateCustomerInputSchema = updateCustomerInputSchema;
2162
2155
  exports.updateCustomerSchema = updateCustomerSchema;
2156
+ exports.wcBaseParamsSchema = wcBaseParamsSchema;
2163
2157
  exports.wcErrorResponseSchema = wcErrorResponseSchema;
2158
+ exports.wcPaginationMetaSchema = wcPaginationMetaSchema;
2164
2159
  //# sourceMappingURL=index.js.map
2165
2160
  //# sourceMappingURL=index.js.map