@01.software/cli 0.14.2 → 0.15.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 +60 -26
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1043,6 +1043,7 @@ var VariantInputSchema = z2.object({
|
|
|
1043
1043
|
compareAtPrice: z2.number().min(0).optional().nullable(),
|
|
1044
1044
|
stock: z2.number().int().min(0).optional(),
|
|
1045
1045
|
isUnlimited: z2.boolean().optional(),
|
|
1046
|
+
inventoryPolicy: z2.enum(["deny", "continue"]).optional(),
|
|
1046
1047
|
weight: z2.number().int().min(0).optional().nullable(),
|
|
1047
1048
|
requiresShipping: z2.boolean().optional(),
|
|
1048
1049
|
barcode: z2.string().optional().nullable(),
|
|
@@ -1142,6 +1143,7 @@ var orderDisplayFulfillmentStatusSchema = z3.enum([
|
|
|
1142
1143
|
"unfulfilled",
|
|
1143
1144
|
"in_progress",
|
|
1144
1145
|
"on_hold",
|
|
1146
|
+
"partially_fulfilled",
|
|
1145
1147
|
"shipped",
|
|
1146
1148
|
"fulfilled",
|
|
1147
1149
|
"canceled"
|
|
@@ -1193,7 +1195,7 @@ var createOrderSchema = z3.object({
|
|
|
1193
1195
|
deliveryMessage: z3.string().optional(),
|
|
1194
1196
|
recipientName: z3.string().optional(),
|
|
1195
1197
|
phone: z3.string().optional()
|
|
1196
|
-
}).strict(),
|
|
1198
|
+
}).strict().optional(),
|
|
1197
1199
|
orderItems: z3.array(createOrderItemSchema).min(1, "At least one order item is required").max(100, "Maximum 100 items per order"),
|
|
1198
1200
|
totalAmount: z3.number().nonnegative("totalAmount must be non-negative"),
|
|
1199
1201
|
shippingAmount: z3.number().min(0).optional(),
|
|
@@ -1235,13 +1237,20 @@ var confirmPaymentSchema = z3.object({
|
|
|
1235
1237
|
),
|
|
1236
1238
|
metadata: z3.record(z3.string(), z3.unknown()).optional()
|
|
1237
1239
|
}).strict();
|
|
1238
|
-
var
|
|
1240
|
+
var confirmPaymentResponseSchema = z3.object({
|
|
1241
|
+
orderId: z3.string().min(1),
|
|
1242
|
+
transactionId: z3.string().min(1),
|
|
1243
|
+
status: z3.literal("paid"),
|
|
1244
|
+
alreadyConfirmed: z3.boolean().optional()
|
|
1245
|
+
}).strict();
|
|
1246
|
+
var RETURN_REASON_CODES = [
|
|
1239
1247
|
"change_of_mind",
|
|
1240
1248
|
"defective",
|
|
1241
1249
|
"wrong_delivery",
|
|
1242
1250
|
"damaged",
|
|
1243
1251
|
"other"
|
|
1244
|
-
]
|
|
1252
|
+
];
|
|
1253
|
+
var returnReasonSchema = z3.enum(RETURN_REASON_CODES);
|
|
1245
1254
|
var restockActionSchema = z3.enum(["return_to_stock", "discard"]);
|
|
1246
1255
|
var returnWithRefundItemSchema = z3.object({
|
|
1247
1256
|
orderItem: z3.union([z3.string().min(1), z3.number()]).transform(String),
|
|
@@ -1280,14 +1289,23 @@ var createReturnSchema = z3.object({
|
|
|
1280
1289
|
"Operator audit note required when overriding policy suggestion"
|
|
1281
1290
|
)
|
|
1282
1291
|
}).strict();
|
|
1283
|
-
var
|
|
1292
|
+
var CANCEL_REASON_CODES = [
|
|
1284
1293
|
"customer",
|
|
1285
1294
|
"inventory",
|
|
1286
1295
|
"fraud",
|
|
1287
1296
|
"declined",
|
|
1288
1297
|
"staff",
|
|
1289
1298
|
"other"
|
|
1290
|
-
]
|
|
1299
|
+
];
|
|
1300
|
+
var cancelReasonCodeSchema = z3.enum(CANCEL_REASON_CODES);
|
|
1301
|
+
var FORCE_RESOLUTION_REASON_CODES = [
|
|
1302
|
+
"staff_error",
|
|
1303
|
+
"wrong_fulfillment",
|
|
1304
|
+
"other"
|
|
1305
|
+
];
|
|
1306
|
+
var forceResolutionReasonCodeSchema = z3.enum(
|
|
1307
|
+
FORCE_RESOLUTION_REASON_CODES
|
|
1308
|
+
);
|
|
1291
1309
|
var idempotencyKeySchema = z3.string().trim().min(1, "idempotencyKey is required").max(255, "idempotencyKey must be 255 characters or fewer").regex(
|
|
1292
1310
|
/^[\x21-\x7E]+$/,
|
|
1293
1311
|
"idempotencyKey must contain only printable header-safe characters"
|
|
@@ -1804,14 +1822,30 @@ function registerReturnCommands(program2, getClient2, getFormat2) {
|
|
|
1804
1822
|
// src/commands/cart.ts
|
|
1805
1823
|
function registerCartCommands(program2, getClient2, getFormat2) {
|
|
1806
1824
|
const cart = program2.command("cart").description("Cart management");
|
|
1807
|
-
cart.command("
|
|
1825
|
+
cart.command("create").description("Create a cart and print its cartToken handle").option("--dry-run", "Validate inputs without executing").action(async (opts) => {
|
|
1826
|
+
try {
|
|
1827
|
+
if (opts.dryRun) {
|
|
1828
|
+
printResult(
|
|
1829
|
+
{ dryRun: true, valid: true, action: "cart create", data: {} },
|
|
1830
|
+
getFormat2()
|
|
1831
|
+
);
|
|
1832
|
+
return;
|
|
1833
|
+
}
|
|
1834
|
+
const client = getClient2();
|
|
1835
|
+
const result = await client.commerce.cart.create();
|
|
1836
|
+
printResult(result, getFormat2());
|
|
1837
|
+
} catch (e) {
|
|
1838
|
+
exitWithError(e);
|
|
1839
|
+
}
|
|
1840
|
+
});
|
|
1841
|
+
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
1842
|
"--quantity <n>",
|
|
1809
1843
|
"Quantity",
|
|
1810
1844
|
(v) => parseInt(v, 10)
|
|
1811
|
-
).option("--dry-run", "Validate inputs without executing").action(async (
|
|
1845
|
+
).option("--dry-run", "Validate inputs without executing").action(async (cartToken, opts) => {
|
|
1812
1846
|
try {
|
|
1813
1847
|
const data = {
|
|
1814
|
-
|
|
1848
|
+
cartToken,
|
|
1815
1849
|
product: opts.product,
|
|
1816
1850
|
variant: opts.variant,
|
|
1817
1851
|
option: opts.option,
|
|
@@ -1831,13 +1865,17 @@ function registerCartCommands(program2, getClient2, getFormat2) {
|
|
|
1831
1865
|
exitWithError(e);
|
|
1832
1866
|
}
|
|
1833
1867
|
});
|
|
1834
|
-
cart.command("update <cartItemId>").description("Update cart item quantity").requiredOption(
|
|
1868
|
+
cart.command("update <cartItemId>").description("Update cart item quantity").requiredOption("--cart-token <token>", "Cart token (cart handle)").requiredOption(
|
|
1835
1869
|
"--quantity <n>",
|
|
1836
1870
|
"New quantity",
|
|
1837
1871
|
(v) => parseInt(v, 10)
|
|
1838
1872
|
).option("--dry-run", "Validate inputs without executing").action(async (cartItemId, opts) => {
|
|
1839
1873
|
try {
|
|
1840
|
-
const data = {
|
|
1874
|
+
const data = {
|
|
1875
|
+
cartToken: opts.cartToken,
|
|
1876
|
+
cartItemId,
|
|
1877
|
+
quantity: opts.quantity
|
|
1878
|
+
};
|
|
1841
1879
|
if (opts.dryRun) {
|
|
1842
1880
|
printResult(
|
|
1843
1881
|
{ dryRun: true, valid: true, action: "cart update", data },
|
|
@@ -1852,46 +1890,42 @@ function registerCartCommands(program2, getClient2, getFormat2) {
|
|
|
1852
1890
|
exitWithError(e);
|
|
1853
1891
|
}
|
|
1854
1892
|
});
|
|
1855
|
-
cart.command("remove <cartItemId>").description("Remove an item from cart").option("--dry-run", "Validate inputs without executing").action(async (cartItemId, opts) => {
|
|
1893
|
+
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
1894
|
try {
|
|
1895
|
+
const data = { cartToken: opts.cartToken, cartItemId };
|
|
1857
1896
|
if (opts.dryRun) {
|
|
1858
1897
|
printResult(
|
|
1859
|
-
{
|
|
1860
|
-
dryRun: true,
|
|
1861
|
-
valid: true,
|
|
1862
|
-
action: "cart remove",
|
|
1863
|
-
data: { cartItemId }
|
|
1864
|
-
},
|
|
1898
|
+
{ dryRun: true, valid: true, action: "cart remove", data },
|
|
1865
1899
|
getFormat2()
|
|
1866
1900
|
);
|
|
1867
1901
|
return;
|
|
1868
1902
|
}
|
|
1869
1903
|
const client = getClient2();
|
|
1870
|
-
const result = await client.commerce.cart.removeItem(
|
|
1904
|
+
const result = await client.commerce.cart.removeItem(data);
|
|
1871
1905
|
printResult(result, getFormat2());
|
|
1872
1906
|
} catch (e) {
|
|
1873
1907
|
exitWithError(e);
|
|
1874
1908
|
}
|
|
1875
1909
|
});
|
|
1876
|
-
cart.command("clear <
|
|
1910
|
+
cart.command("clear <cartToken>").description("Remove all items from a cart").option("--dry-run", "Validate inputs without executing").action(async (cartToken, opts) => {
|
|
1877
1911
|
try {
|
|
1878
1912
|
if (opts.dryRun) {
|
|
1879
1913
|
printResult(
|
|
1880
|
-
{ dryRun: true, valid: true, action: "cart clear", data: {
|
|
1914
|
+
{ dryRun: true, valid: true, action: "cart clear", data: { cartToken } },
|
|
1881
1915
|
getFormat2()
|
|
1882
1916
|
);
|
|
1883
1917
|
return;
|
|
1884
1918
|
}
|
|
1885
1919
|
const client = getClient2();
|
|
1886
|
-
const result = await client.commerce.cart.clear({
|
|
1920
|
+
const result = await client.commerce.cart.clear({ cartToken });
|
|
1887
1921
|
printResult(result, getFormat2());
|
|
1888
1922
|
} catch (e) {
|
|
1889
1923
|
exitWithError(e);
|
|
1890
1924
|
}
|
|
1891
1925
|
});
|
|
1892
|
-
cart.command("apply-discount <
|
|
1926
|
+
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
1927
|
try {
|
|
1894
|
-
const data = {
|
|
1928
|
+
const data = { cartToken, discountCode: opts.code };
|
|
1895
1929
|
if (opts.dryRun) {
|
|
1896
1930
|
printResult(
|
|
1897
1931
|
{ dryRun: true, valid: true, action: "cart apply-discount", data },
|
|
@@ -1906,7 +1940,7 @@ function registerCartCommands(program2, getClient2, getFormat2) {
|
|
|
1906
1940
|
exitWithError(e);
|
|
1907
1941
|
}
|
|
1908
1942
|
});
|
|
1909
|
-
cart.command("remove-discount <
|
|
1943
|
+
cart.command("remove-discount <cartToken>").description("Remove the discount from a cart").option("--dry-run", "Validate inputs without executing").action(async (cartToken, opts) => {
|
|
1910
1944
|
try {
|
|
1911
1945
|
if (opts.dryRun) {
|
|
1912
1946
|
printResult(
|
|
@@ -1914,14 +1948,14 @@ function registerCartCommands(program2, getClient2, getFormat2) {
|
|
|
1914
1948
|
dryRun: true,
|
|
1915
1949
|
valid: true,
|
|
1916
1950
|
action: "cart remove-discount",
|
|
1917
|
-
data: {
|
|
1951
|
+
data: { cartToken }
|
|
1918
1952
|
},
|
|
1919
1953
|
getFormat2()
|
|
1920
1954
|
);
|
|
1921
1955
|
return;
|
|
1922
1956
|
}
|
|
1923
1957
|
const client = getClient2();
|
|
1924
|
-
const result = await client.commerce.cart.removeDiscount({
|
|
1958
|
+
const result = await client.commerce.cart.removeDiscount({ cartToken });
|
|
1925
1959
|
printResult(result, getFormat2());
|
|
1926
1960
|
} catch (e) {
|
|
1927
1961
|
exitWithError(e);
|