@01.software/cli 0.14.3 → 0.15.1
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 +76 -26
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -900,6 +900,9 @@ var tenantFeatureProgressResponseSchema = z.object({
|
|
|
900
900
|
planBlocked: z.array(z.string()),
|
|
901
901
|
closureAdded: z.array(z.string())
|
|
902
902
|
}).strict(),
|
|
903
|
+
config: z.object({
|
|
904
|
+
fulfillmentMode: z.enum(["shipping", "none"])
|
|
905
|
+
}).strict(),
|
|
903
906
|
summary: z.object({
|
|
904
907
|
complete: z.number().int().nonnegative(),
|
|
905
908
|
total: z.number().int().nonnegative(),
|
|
@@ -977,6 +980,10 @@ var productFieldShape = {
|
|
|
977
980
|
publishedAt: z2.string().optional().nullable(),
|
|
978
981
|
categories: z2.array(IdSchema).optional(),
|
|
979
982
|
tags: z2.array(IdSchema).optional(),
|
|
983
|
+
seo: z2.object({
|
|
984
|
+
title: z2.string().optional().nullable(),
|
|
985
|
+
description: z2.string().optional().nullable()
|
|
986
|
+
}).optional().nullable(),
|
|
980
987
|
metadata: z2.unknown().optional()
|
|
981
988
|
};
|
|
982
989
|
var PRODUCT_UPSERT_PRODUCT_FIELDS = Object.keys(
|
|
@@ -1043,6 +1050,7 @@ var VariantInputSchema = z2.object({
|
|
|
1043
1050
|
compareAtPrice: z2.number().min(0).optional().nullable(),
|
|
1044
1051
|
stock: z2.number().int().min(0).optional(),
|
|
1045
1052
|
isUnlimited: z2.boolean().optional(),
|
|
1053
|
+
inventoryPolicy: z2.enum(["deny", "continue"]).optional(),
|
|
1046
1054
|
weight: z2.number().int().min(0).optional().nullable(),
|
|
1047
1055
|
requiresShipping: z2.boolean().optional(),
|
|
1048
1056
|
barcode: z2.string().optional().nullable(),
|
|
@@ -1142,6 +1150,7 @@ var orderDisplayFulfillmentStatusSchema = z3.enum([
|
|
|
1142
1150
|
"unfulfilled",
|
|
1143
1151
|
"in_progress",
|
|
1144
1152
|
"on_hold",
|
|
1153
|
+
"partially_fulfilled",
|
|
1145
1154
|
"shipped",
|
|
1146
1155
|
"fulfilled",
|
|
1147
1156
|
"canceled"
|
|
@@ -1193,7 +1202,7 @@ var createOrderSchema = z3.object({
|
|
|
1193
1202
|
deliveryMessage: z3.string().optional(),
|
|
1194
1203
|
recipientName: z3.string().optional(),
|
|
1195
1204
|
phone: z3.string().optional()
|
|
1196
|
-
}).strict(),
|
|
1205
|
+
}).strict().optional(),
|
|
1197
1206
|
orderItems: z3.array(createOrderItemSchema).min(1, "At least one order item is required").max(100, "Maximum 100 items per order"),
|
|
1198
1207
|
totalAmount: z3.number().nonnegative("totalAmount must be non-negative"),
|
|
1199
1208
|
shippingAmount: z3.number().min(0).optional(),
|
|
@@ -1235,13 +1244,29 @@ var confirmPaymentSchema = z3.object({
|
|
|
1235
1244
|
),
|
|
1236
1245
|
metadata: z3.record(z3.string(), z3.unknown()).optional()
|
|
1237
1246
|
}).strict();
|
|
1238
|
-
var
|
|
1247
|
+
var confirmPaymentResponseSchema = z3.object({
|
|
1248
|
+
orderId: z3.string().min(1),
|
|
1249
|
+
transactionId: z3.string().min(1),
|
|
1250
|
+
status: z3.literal("paid"),
|
|
1251
|
+
alreadyConfirmed: z3.boolean().optional()
|
|
1252
|
+
}).strict();
|
|
1253
|
+
var RETURN_REASON_CODES = [
|
|
1239
1254
|
"change_of_mind",
|
|
1240
1255
|
"defective",
|
|
1241
1256
|
"wrong_delivery",
|
|
1242
1257
|
"damaged",
|
|
1243
1258
|
"other"
|
|
1244
|
-
]
|
|
1259
|
+
];
|
|
1260
|
+
var returnReasonSchema = z3.enum(RETURN_REASON_CODES);
|
|
1261
|
+
var RETURN_REJECTION_REASON_CODES = [
|
|
1262
|
+
"window_expired",
|
|
1263
|
+
"used_or_damaged",
|
|
1264
|
+
"non_returnable",
|
|
1265
|
+
"other"
|
|
1266
|
+
];
|
|
1267
|
+
var returnRejectionReasonCodeSchema = z3.enum(
|
|
1268
|
+
RETURN_REJECTION_REASON_CODES
|
|
1269
|
+
);
|
|
1245
1270
|
var restockActionSchema = z3.enum(["return_to_stock", "discard"]);
|
|
1246
1271
|
var returnWithRefundItemSchema = z3.object({
|
|
1247
1272
|
orderItem: z3.union([z3.string().min(1), z3.number()]).transform(String),
|
|
@@ -1280,14 +1305,23 @@ var createReturnSchema = z3.object({
|
|
|
1280
1305
|
"Operator audit note required when overriding policy suggestion"
|
|
1281
1306
|
)
|
|
1282
1307
|
}).strict();
|
|
1283
|
-
var
|
|
1308
|
+
var CANCEL_REASON_CODES = [
|
|
1284
1309
|
"customer",
|
|
1285
1310
|
"inventory",
|
|
1286
1311
|
"fraud",
|
|
1287
1312
|
"declined",
|
|
1288
1313
|
"staff",
|
|
1289
1314
|
"other"
|
|
1290
|
-
]
|
|
1315
|
+
];
|
|
1316
|
+
var cancelReasonCodeSchema = z3.enum(CANCEL_REASON_CODES);
|
|
1317
|
+
var FORCE_RESOLUTION_REASON_CODES = [
|
|
1318
|
+
"staff_error",
|
|
1319
|
+
"wrong_fulfillment",
|
|
1320
|
+
"other"
|
|
1321
|
+
];
|
|
1322
|
+
var forceResolutionReasonCodeSchema = z3.enum(
|
|
1323
|
+
FORCE_RESOLUTION_REASON_CODES
|
|
1324
|
+
);
|
|
1291
1325
|
var idempotencyKeySchema = z3.string().trim().min(1, "idempotencyKey is required").max(255, "idempotencyKey must be 255 characters or fewer").regex(
|
|
1292
1326
|
/^[\x21-\x7E]+$/,
|
|
1293
1327
|
"idempotencyKey must contain only printable header-safe characters"
|
|
@@ -1804,14 +1838,30 @@ function registerReturnCommands(program2, getClient2, getFormat2) {
|
|
|
1804
1838
|
// src/commands/cart.ts
|
|
1805
1839
|
function registerCartCommands(program2, getClient2, getFormat2) {
|
|
1806
1840
|
const cart = program2.command("cart").description("Cart management");
|
|
1807
|
-
cart.command("
|
|
1841
|
+
cart.command("create").description("Create a cart and print its cartToken handle").option("--dry-run", "Validate inputs without executing").action(async (opts) => {
|
|
1842
|
+
try {
|
|
1843
|
+
if (opts.dryRun) {
|
|
1844
|
+
printResult(
|
|
1845
|
+
{ dryRun: true, valid: true, action: "cart create", data: {} },
|
|
1846
|
+
getFormat2()
|
|
1847
|
+
);
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1850
|
+
const client = getClient2();
|
|
1851
|
+
const result = await client.commerce.cart.create();
|
|
1852
|
+
printResult(result, getFormat2());
|
|
1853
|
+
} catch (e) {
|
|
1854
|
+
exitWithError(e);
|
|
1855
|
+
}
|
|
1856
|
+
});
|
|
1857
|
+
cart.command("add <cartToken>").description("Add an item to a cart (addressed by its cartToken)").requiredOption("--product <id>", "Product ID").requiredOption("--variant <id>", "Variant ID").requiredOption("--option <id>", "Option ID").requiredOption(
|
|
1808
1858
|
"--quantity <n>",
|
|
1809
1859
|
"Quantity",
|
|
1810
1860
|
(v) => parseInt(v, 10)
|
|
1811
|
-
).option("--dry-run", "Validate inputs without executing").action(async (
|
|
1861
|
+
).option("--dry-run", "Validate inputs without executing").action(async (cartToken, opts) => {
|
|
1812
1862
|
try {
|
|
1813
1863
|
const data = {
|
|
1814
|
-
|
|
1864
|
+
cartToken,
|
|
1815
1865
|
product: opts.product,
|
|
1816
1866
|
variant: opts.variant,
|
|
1817
1867
|
option: opts.option,
|
|
@@ -1831,13 +1881,17 @@ function registerCartCommands(program2, getClient2, getFormat2) {
|
|
|
1831
1881
|
exitWithError(e);
|
|
1832
1882
|
}
|
|
1833
1883
|
});
|
|
1834
|
-
cart.command("update <cartItemId>").description("Update cart item quantity").requiredOption(
|
|
1884
|
+
cart.command("update <cartItemId>").description("Update cart item quantity").requiredOption("--cart-token <token>", "Cart token (cart handle)").requiredOption(
|
|
1835
1885
|
"--quantity <n>",
|
|
1836
1886
|
"New quantity",
|
|
1837
1887
|
(v) => parseInt(v, 10)
|
|
1838
1888
|
).option("--dry-run", "Validate inputs without executing").action(async (cartItemId, opts) => {
|
|
1839
1889
|
try {
|
|
1840
|
-
const data = {
|
|
1890
|
+
const data = {
|
|
1891
|
+
cartToken: opts.cartToken,
|
|
1892
|
+
cartItemId,
|
|
1893
|
+
quantity: opts.quantity
|
|
1894
|
+
};
|
|
1841
1895
|
if (opts.dryRun) {
|
|
1842
1896
|
printResult(
|
|
1843
1897
|
{ dryRun: true, valid: true, action: "cart update", data },
|
|
@@ -1852,46 +1906,42 @@ function registerCartCommands(program2, getClient2, getFormat2) {
|
|
|
1852
1906
|
exitWithError(e);
|
|
1853
1907
|
}
|
|
1854
1908
|
});
|
|
1855
|
-
cart.command("remove <cartItemId>").description("Remove an item from cart").option("--dry-run", "Validate inputs without executing").action(async (cartItemId, opts) => {
|
|
1909
|
+
cart.command("remove <cartItemId>").description("Remove an item from a cart").requiredOption("--cart-token <token>", "Cart token (cart handle)").option("--dry-run", "Validate inputs without executing").action(async (cartItemId, opts) => {
|
|
1856
1910
|
try {
|
|
1911
|
+
const data = { cartToken: opts.cartToken, cartItemId };
|
|
1857
1912
|
if (opts.dryRun) {
|
|
1858
1913
|
printResult(
|
|
1859
|
-
{
|
|
1860
|
-
dryRun: true,
|
|
1861
|
-
valid: true,
|
|
1862
|
-
action: "cart remove",
|
|
1863
|
-
data: { cartItemId }
|
|
1864
|
-
},
|
|
1914
|
+
{ dryRun: true, valid: true, action: "cart remove", data },
|
|
1865
1915
|
getFormat2()
|
|
1866
1916
|
);
|
|
1867
1917
|
return;
|
|
1868
1918
|
}
|
|
1869
1919
|
const client = getClient2();
|
|
1870
|
-
const result = await client.commerce.cart.removeItem(
|
|
1920
|
+
const result = await client.commerce.cart.removeItem(data);
|
|
1871
1921
|
printResult(result, getFormat2());
|
|
1872
1922
|
} catch (e) {
|
|
1873
1923
|
exitWithError(e);
|
|
1874
1924
|
}
|
|
1875
1925
|
});
|
|
1876
|
-
cart.command("clear <
|
|
1926
|
+
cart.command("clear <cartToken>").description("Remove all items from a cart").option("--dry-run", "Validate inputs without executing").action(async (cartToken, opts) => {
|
|
1877
1927
|
try {
|
|
1878
1928
|
if (opts.dryRun) {
|
|
1879
1929
|
printResult(
|
|
1880
|
-
{ dryRun: true, valid: true, action: "cart clear", data: {
|
|
1930
|
+
{ dryRun: true, valid: true, action: "cart clear", data: { cartToken } },
|
|
1881
1931
|
getFormat2()
|
|
1882
1932
|
);
|
|
1883
1933
|
return;
|
|
1884
1934
|
}
|
|
1885
1935
|
const client = getClient2();
|
|
1886
|
-
const result = await client.commerce.cart.clear({
|
|
1936
|
+
const result = await client.commerce.cart.clear({ cartToken });
|
|
1887
1937
|
printResult(result, getFormat2());
|
|
1888
1938
|
} catch (e) {
|
|
1889
1939
|
exitWithError(e);
|
|
1890
1940
|
}
|
|
1891
1941
|
});
|
|
1892
|
-
cart.command("apply-discount <
|
|
1942
|
+
cart.command("apply-discount <cartToken>").description("Apply a discount code to a cart").requiredOption("--code <code>", "Discount code").option("--dry-run", "Validate inputs without executing").action(async (cartToken, opts) => {
|
|
1893
1943
|
try {
|
|
1894
|
-
const data = {
|
|
1944
|
+
const data = { cartToken, discountCode: opts.code };
|
|
1895
1945
|
if (opts.dryRun) {
|
|
1896
1946
|
printResult(
|
|
1897
1947
|
{ dryRun: true, valid: true, action: "cart apply-discount", data },
|
|
@@ -1906,7 +1956,7 @@ function registerCartCommands(program2, getClient2, getFormat2) {
|
|
|
1906
1956
|
exitWithError(e);
|
|
1907
1957
|
}
|
|
1908
1958
|
});
|
|
1909
|
-
cart.command("remove-discount <
|
|
1959
|
+
cart.command("remove-discount <cartToken>").description("Remove the discount from a cart").option("--dry-run", "Validate inputs without executing").action(async (cartToken, opts) => {
|
|
1910
1960
|
try {
|
|
1911
1961
|
if (opts.dryRun) {
|
|
1912
1962
|
printResult(
|
|
@@ -1914,14 +1964,14 @@ function registerCartCommands(program2, getClient2, getFormat2) {
|
|
|
1914
1964
|
dryRun: true,
|
|
1915
1965
|
valid: true,
|
|
1916
1966
|
action: "cart remove-discount",
|
|
1917
|
-
data: {
|
|
1967
|
+
data: { cartToken }
|
|
1918
1968
|
},
|
|
1919
1969
|
getFormat2()
|
|
1920
1970
|
);
|
|
1921
1971
|
return;
|
|
1922
1972
|
}
|
|
1923
1973
|
const client = getClient2();
|
|
1924
|
-
const result = await client.commerce.cart.removeDiscount({
|
|
1974
|
+
const result = await client.commerce.cart.removeDiscount({ cartToken });
|
|
1925
1975
|
printResult(result, getFormat2());
|
|
1926
1976
|
} catch (e) {
|
|
1927
1977
|
exitWithError(e);
|