ecomcoder-cli 1.3.1 → 1.3.3
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/cli.js +21 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/discount/create-basic.d.ts +6 -0
- package/dist/commands/discount/create-basic.d.ts.map +1 -0
- package/dist/commands/discount/create-basic.js +156 -0
- package/dist/commands/discount/create-basic.js.map +1 -0
- package/dist/commands/discount/create-bxgy.d.ts +17 -0
- package/dist/commands/discount/create-bxgy.d.ts.map +1 -0
- package/dist/commands/discount/create-bxgy.js +230 -0
- package/dist/commands/discount/create-bxgy.js.map +1 -0
- package/dist/commands/discount/create-shipping.d.ts +17 -0
- package/dist/commands/discount/create-shipping.d.ts.map +1 -0
- package/dist/commands/discount/create-shipping.js +170 -0
- package/dist/commands/discount/create-shipping.js.map +1 -0
- package/dist/commands/discount/delete.d.ts +6 -0
- package/dist/commands/discount/delete.d.ts.map +1 -0
- package/dist/commands/discount/delete.js +45 -0
- package/dist/commands/discount/delete.js.map +1 -0
- package/dist/commands/discount/index.d.ts +10 -0
- package/dist/commands/discount/index.d.ts.map +1 -0
- package/dist/commands/discount/index.js +98 -0
- package/dist/commands/discount/index.js.map +1 -0
- package/dist/commands/discount/list.d.ts +6 -0
- package/dist/commands/discount/list.d.ts.map +1 -0
- package/dist/commands/discount/list.js +84 -0
- package/dist/commands/discount/list.js.map +1 -0
- package/dist/commands/discount/queries.d.ts +14 -0
- package/dist/commands/discount/queries.d.ts.map +1 -0
- package/dist/commands/discount/queries.js +574 -0
- package/dist/commands/discount/queries.js.map +1 -0
- package/dist/commands/discount/service.d.ts +31 -0
- package/dist/commands/discount/service.d.ts.map +1 -0
- package/dist/commands/discount/service.js +684 -0
- package/dist/commands/discount/service.js.map +1 -0
- package/dist/commands/discount/types.d.ts +228 -0
- package/dist/commands/discount/types.d.ts.map +1 -0
- package/dist/commands/discount/types.js +5 -0
- package/dist/commands/discount/types.js.map +1 -0
- package/dist/commands/discount/utils.d.ts +51 -0
- package/dist/commands/discount/utils.d.ts.map +1 -0
- package/dist/commands/discount/utils.js +153 -0
- package/dist/commands/discount/utils.js.map +1 -0
- package/dist/commands/product/__tests__/update-description.test.js +1 -0
- package/dist/commands/product/__tests__/update-description.test.js.map +1 -1
- package/dist/commands/product/create-variants.d.ts +8 -0
- package/dist/commands/product/create-variants.d.ts.map +1 -0
- package/dist/commands/product/create-variants.js +160 -0
- package/dist/commands/product/create-variants.js.map +1 -0
- package/dist/commands/product/delete-variants.d.ts +8 -0
- package/dist/commands/product/delete-variants.d.ts.map +1 -0
- package/dist/commands/product/delete-variants.js +105 -0
- package/dist/commands/product/delete-variants.js.map +1 -0
- package/dist/commands/product/index.d.ts.map +1 -1
- package/dist/commands/product/index.js +30 -0
- package/dist/commands/product/index.js.map +1 -1
- package/dist/commands/product/queries.d.ts +12 -2
- package/dist/commands/product/queries.d.ts.map +1 -1
- package/dist/commands/product/queries.js +62 -0
- package/dist/commands/product/queries.js.map +1 -1
- package/dist/commands/product/service.d.ts +41 -1
- package/dist/commands/product/service.d.ts.map +1 -1
- package/dist/commands/product/service.js +159 -1
- package/dist/commands/product/service.js.map +1 -1
- package/dist/commands/product/types.d.ts +78 -0
- package/dist/commands/product/types.d.ts.map +1 -1
- package/dist/commands/product/update-title.d.ts +8 -0
- package/dist/commands/product/update-title.d.ts.map +1 -0
- package/dist/commands/product/update-title.js +94 -0
- package/dist/commands/product/update-title.js.map +1 -0
- package/dist/commands/product/utils.d.ts.map +1 -1
- package/dist/commands/product/utils.js +1 -0
- package/dist/commands/product/utils.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create Product Variants Command
|
|
3
|
+
*
|
|
4
|
+
* Following Command Pattern - thin orchestration layer
|
|
5
|
+
* Delegates business logic to ProductService
|
|
6
|
+
*/
|
|
7
|
+
import { getCredentials, getSessionId } from '../../lib/api-client.js';
|
|
8
|
+
import { parseArgs, hasHelpFlag } from '../../lib/args-parser.js';
|
|
9
|
+
import { ProductService } from './service.js';
|
|
10
|
+
function showHelp() {
|
|
11
|
+
console.log(`
|
|
12
|
+
Create Product Variants
|
|
13
|
+
|
|
14
|
+
USAGE:
|
|
15
|
+
ecomcoder product create-variants [OPTIONS]
|
|
16
|
+
|
|
17
|
+
OPTIONS:
|
|
18
|
+
--product-id <id> Product ID (required)
|
|
19
|
+
--variants <json> JSON array of variant objects (required)
|
|
20
|
+
--session-id Session ID (auto-provided via SESSION_ID env var)
|
|
21
|
+
--help, -h Show this help message
|
|
22
|
+
|
|
23
|
+
VARIANT OBJECT FORMAT:
|
|
24
|
+
{
|
|
25
|
+
"price": "29.99", // Required: Variant price
|
|
26
|
+
"compareAtPrice": "39.99", // Optional: Original/sale price
|
|
27
|
+
"barcode": "123456789", // Optional: Product barcode
|
|
28
|
+
"optionValues": [ // Optional: Option values (Size, Color, etc.)
|
|
29
|
+
{ "optionName": "Size", "name": "Medium" },
|
|
30
|
+
{ "optionName": "Color", "name": "Blue" }
|
|
31
|
+
],
|
|
32
|
+
"inventoryItem": { // Optional: Inventory settings
|
|
33
|
+
"sku": "SHIRT-BLU-M", // SKU (must be in inventoryItem)
|
|
34
|
+
"tracked": true // Track inventory (default: false)
|
|
35
|
+
},
|
|
36
|
+
"inventoryQuantities": [ // Optional: Set initial inventory
|
|
37
|
+
{
|
|
38
|
+
"availableQuantity": 100,
|
|
39
|
+
"locationId": "gid://shopify/Location/123"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"taxable": true // Optional: Tax applicability (default: true)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
EXAMPLES:
|
|
46
|
+
# Create single variant
|
|
47
|
+
ecomcoder product create-variants \\
|
|
48
|
+
--product-id=123456789 \\
|
|
49
|
+
--variants='[{"price":"29.99","inventoryItem":{"sku":"TEST-001"}}]'
|
|
50
|
+
|
|
51
|
+
# Create multiple size variants
|
|
52
|
+
ecomcoder product create-variants \\
|
|
53
|
+
--product-id="gid://shopify/Product/123" \\
|
|
54
|
+
--variants='[
|
|
55
|
+
{"price":"29.99","inventoryItem":{"sku":"SHIRT-S"},"optionValues":[{"optionName":"Size","name":"Small"}]},
|
|
56
|
+
{"price":"29.99","inventoryItem":{"sku":"SHIRT-M"},"optionValues":[{"optionName":"Size","name":"Medium"}]},
|
|
57
|
+
{"price":"29.99","inventoryItem":{"sku":"SHIRT-L"},"optionValues":[{"optionName":"Size","name":"Large"}]}
|
|
58
|
+
]'
|
|
59
|
+
|
|
60
|
+
# Create variant with sale pricing
|
|
61
|
+
ecomcoder product create-variants \\
|
|
62
|
+
--product-id=123 \\
|
|
63
|
+
--variants='[{"price":"24.99","compareAtPrice":"39.99","inventoryItem":{"sku":"SALE-001"}}]'
|
|
64
|
+
|
|
65
|
+
# Create variant with inventory tracking
|
|
66
|
+
ecomcoder product create-variants \\
|
|
67
|
+
--product-id=123 \\
|
|
68
|
+
--variants='[{
|
|
69
|
+
"price":"29.99",
|
|
70
|
+
"inventoryItem":{"sku":"INV-001","tracked":true},
|
|
71
|
+
"inventoryQuantities":[{"availableQuantity":100,"locationId":"gid://shopify/Location/123"}]
|
|
72
|
+
}]'
|
|
73
|
+
|
|
74
|
+
IMPORTANT RESTRICTIONS:
|
|
75
|
+
- Maximum 2,048 variants per product
|
|
76
|
+
- SKU must be unique across all products (if provided)
|
|
77
|
+
- Option values must match product's existing option names
|
|
78
|
+
- Cannot create variants for products with no options defined
|
|
79
|
+
|
|
80
|
+
NOTES:
|
|
81
|
+
- Use JSON array format for variants (can be single or multiple)
|
|
82
|
+
- Option names are case-sensitive
|
|
83
|
+
- First variant of a product doesn't need option values
|
|
84
|
+
- Inventory tracking requires valid location ID
|
|
85
|
+
`);
|
|
86
|
+
process.exit(0);
|
|
87
|
+
}
|
|
88
|
+
export async function run(argv = process.argv.slice(2)) {
|
|
89
|
+
if (hasHelpFlag(argv)) {
|
|
90
|
+
showHelp();
|
|
91
|
+
}
|
|
92
|
+
const args = parseArgs(argv);
|
|
93
|
+
// Validate required arguments
|
|
94
|
+
if (!args.productId) {
|
|
95
|
+
console.error(JSON.stringify({
|
|
96
|
+
success: false,
|
|
97
|
+
error: 'Missing required argument: --product-id'
|
|
98
|
+
}));
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
if (!args.variants) {
|
|
102
|
+
console.error(JSON.stringify({
|
|
103
|
+
success: false,
|
|
104
|
+
error: 'Missing required argument: --variants'
|
|
105
|
+
}));
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
// Parse variants JSON
|
|
110
|
+
let variants;
|
|
111
|
+
try {
|
|
112
|
+
variants = JSON.parse(args.variants);
|
|
113
|
+
if (!Array.isArray(variants)) {
|
|
114
|
+
console.error(JSON.stringify({
|
|
115
|
+
success: false,
|
|
116
|
+
error: 'Variants must be a JSON array'
|
|
117
|
+
}));
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (parseError) {
|
|
122
|
+
console.error(JSON.stringify({
|
|
123
|
+
success: false,
|
|
124
|
+
error: `Invalid JSON format: ${parseError.message}`
|
|
125
|
+
}));
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
// Validate each variant has required price field
|
|
129
|
+
for (let i = 0; i < variants.length; i++) {
|
|
130
|
+
if (!variants[i].price) {
|
|
131
|
+
console.error(JSON.stringify({
|
|
132
|
+
success: false,
|
|
133
|
+
error: `Variant at index ${i} is missing required field: price`
|
|
134
|
+
}));
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Get credentials
|
|
139
|
+
const sessionId = getSessionId(args.sessionId);
|
|
140
|
+
const credentials = await getCredentials(sessionId, args.backendUrl, args.jwt);
|
|
141
|
+
// Execute create via service
|
|
142
|
+
const result = await ProductService.createVariants(credentials, {
|
|
143
|
+
productId: args.productId,
|
|
144
|
+
variants
|
|
145
|
+
});
|
|
146
|
+
// Output result
|
|
147
|
+
console.log(JSON.stringify(result, null, 2));
|
|
148
|
+
if (!result.success) {
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
console.error(JSON.stringify({
|
|
154
|
+
success: false,
|
|
155
|
+
error: error.message || 'Unknown error occurred'
|
|
156
|
+
}));
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=create-variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-variants.js","sourceRoot":"","sources":["../../../src/commands/product/create-variants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Eb,CAAC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAiB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9D,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,QAAQ,EAAE,CAAC;IACb,CAAC;IAED,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAE7B,8BAA8B;IAC9B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;YAC3B,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}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete Product Variants Command
|
|
3
|
+
*
|
|
4
|
+
* Following Command Pattern - thin orchestration layer
|
|
5
|
+
* Delegates business logic to ProductService
|
|
6
|
+
*/
|
|
7
|
+
import { getCredentials, getSessionId } from '../../lib/api-client.js';
|
|
8
|
+
import { parseArgs, hasHelpFlag } from '../../lib/args-parser.js';
|
|
9
|
+
import { ProductService } from './service.js';
|
|
10
|
+
function showHelp() {
|
|
11
|
+
console.log(`
|
|
12
|
+
Delete Product Variants
|
|
13
|
+
|
|
14
|
+
USAGE:
|
|
15
|
+
ecomcoder product delete-variants [OPTIONS]
|
|
16
|
+
|
|
17
|
+
OPTIONS:
|
|
18
|
+
--product-id <id> Product ID (required)
|
|
19
|
+
--variant-ids <ids> Comma-separated variant IDs to delete (required)
|
|
20
|
+
--session-id Session ID (auto-provided via SESSION_ID env var)
|
|
21
|
+
--help, -h Show this help message
|
|
22
|
+
|
|
23
|
+
EXAMPLES:
|
|
24
|
+
# Delete single variant
|
|
25
|
+
ecomcoder product delete-variants \
|
|
26
|
+
--product-id=123456789 \
|
|
27
|
+
--variant-ids="gid://shopify/ProductVariant/987654321"
|
|
28
|
+
|
|
29
|
+
# Delete multiple variants
|
|
30
|
+
ecomcoder product delete-variants \
|
|
31
|
+
--product-id="gid://shopify/Product/123456789" \
|
|
32
|
+
--variant-ids="gid://shopify/ProductVariant/111,gid://shopify/ProductVariant/222"
|
|
33
|
+
|
|
34
|
+
# Delete using numeric IDs
|
|
35
|
+
ecomcoder product delete-variants \
|
|
36
|
+
--product-id=123 \
|
|
37
|
+
--variant-ids="456,789"
|
|
38
|
+
|
|
39
|
+
IMPORTANT RESTRICTIONS:
|
|
40
|
+
- Cannot delete the last variant of a product (every product must have at least one variant)
|
|
41
|
+
- All variant IDs must belong to the specified product
|
|
42
|
+
- Cannot delete variants associated with active or unfulfilled orders
|
|
43
|
+
- Deletion is permanent - inventory data will be lost
|
|
44
|
+
|
|
45
|
+
NOTES:
|
|
46
|
+
- Deleted variants cannot be recovered
|
|
47
|
+
- Existing orders are NOT affected (historical data preserved)
|
|
48
|
+
- Inventory for deleted variants is permanently removed
|
|
49
|
+
- Use comma-separated list for multiple variants (no spaces)
|
|
50
|
+
`);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
export async function run(argv = process.argv.slice(2)) {
|
|
54
|
+
if (hasHelpFlag(argv)) {
|
|
55
|
+
showHelp();
|
|
56
|
+
}
|
|
57
|
+
const args = parseArgs(argv);
|
|
58
|
+
// Validate required arguments
|
|
59
|
+
if (!args.productId) {
|
|
60
|
+
console.error(JSON.stringify({
|
|
61
|
+
success: false,
|
|
62
|
+
error: 'Missing required argument: --product-id'
|
|
63
|
+
}));
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
if (!args.variantIds) {
|
|
67
|
+
console.error(JSON.stringify({
|
|
68
|
+
success: false,
|
|
69
|
+
error: 'Missing required argument: --variant-ids'
|
|
70
|
+
}));
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
// Parse variant IDs from comma-separated string
|
|
75
|
+
const variantIds = args.variantIds.split(',').map((id) => id.trim()).filter(Boolean);
|
|
76
|
+
if (variantIds.length === 0) {
|
|
77
|
+
console.error(JSON.stringify({
|
|
78
|
+
success: false,
|
|
79
|
+
error: 'No valid variant IDs provided'
|
|
80
|
+
}));
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
// Get credentials
|
|
84
|
+
const sessionId = getSessionId(args.sessionId);
|
|
85
|
+
const credentials = await getCredentials(sessionId, args.backendUrl, args.jwt);
|
|
86
|
+
// Execute delete via service
|
|
87
|
+
const result = await ProductService.deleteVariants(credentials, {
|
|
88
|
+
productId: args.productId,
|
|
89
|
+
variantIds
|
|
90
|
+
});
|
|
91
|
+
// Output result
|
|
92
|
+
console.log(JSON.stringify(result, null, 2));
|
|
93
|
+
if (!result.success) {
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.error(JSON.stringify({
|
|
99
|
+
success: false,
|
|
100
|
+
error: error.message || 'Unknown error occurred'
|
|
101
|
+
}));
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=delete-variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-variants.js","sourceRoot":"","sources":["../../../src/commands/product/delete-variants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCb,CAAC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAiB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9D,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,QAAQ,EAAE,CAAC;IACb,CAAC;IAED,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAE7B,8BAA8B;IAC9B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;YAC3B,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,yCAAyC;SACjD,CAAC,CAAC,CAAC;QACJ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC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AC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;YAC3B,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,wBAAwB;SACjD,CAAC,CAAC,CAAC;QACJ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/product/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/product/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAmG9C"}
|
|
@@ -21,15 +21,21 @@ USAGE:
|
|
|
21
21
|
|
|
22
22
|
SUBCOMMANDS:
|
|
23
23
|
get Get product details by ID, title, or handle
|
|
24
|
+
update-title Update product title
|
|
24
25
|
update-description Update product description
|
|
25
26
|
update-price Update product price and compare-at price
|
|
26
27
|
update-template Change product template assignment
|
|
28
|
+
create-variants Create product variants (bulk operation)
|
|
29
|
+
delete-variants Delete product variants (bulk operation)
|
|
27
30
|
|
|
28
31
|
EXAMPLES:
|
|
29
32
|
# Get product details
|
|
30
33
|
ecomcoder product get --title="Blue T-Shirt"
|
|
31
34
|
ecomcoder product get --id=123456789
|
|
32
35
|
|
|
36
|
+
# Update title
|
|
37
|
+
ecomcoder product update-title --id=123 --title="Premium Cotton T-Shirt"
|
|
38
|
+
|
|
33
39
|
# Update description
|
|
34
40
|
ecomcoder product update-description --id=123 --description="Premium cotton t-shirt"
|
|
35
41
|
|
|
@@ -39,6 +45,12 @@ EXAMPLES:
|
|
|
39
45
|
# Change template
|
|
40
46
|
ecomcoder product update-template --id=123 --template=premium
|
|
41
47
|
|
|
48
|
+
# Create variants
|
|
49
|
+
ecomcoder product create-variants --product-id=123 --variants='[{"price":"29.99","inventoryItem":{"sku":"TEST-001"}}]'
|
|
50
|
+
|
|
51
|
+
# Delete variants
|
|
52
|
+
ecomcoder product delete-variants --product-id=123 --variant-ids="456,789"
|
|
53
|
+
|
|
42
54
|
For detailed help on a specific subcommand:
|
|
43
55
|
ecomcoder product <subcommand> --help
|
|
44
56
|
`);
|
|
@@ -51,6 +63,12 @@ For detailed help on a specific subcommand:
|
|
|
51
63
|
description: 'Get product details by ID, title, or handle',
|
|
52
64
|
handler: async () => await import('./get.js')
|
|
53
65
|
});
|
|
66
|
+
registry.register({
|
|
67
|
+
command: 'product',
|
|
68
|
+
subcommand: 'update-title',
|
|
69
|
+
description: 'Update product title',
|
|
70
|
+
handler: async () => await import('./update-title.js')
|
|
71
|
+
});
|
|
54
72
|
registry.register({
|
|
55
73
|
command: 'product',
|
|
56
74
|
subcommand: 'update-description',
|
|
@@ -69,5 +87,17 @@ For detailed help on a specific subcommand:
|
|
|
69
87
|
description: 'Change product template assignment',
|
|
70
88
|
handler: async () => await import('./update-template.js')
|
|
71
89
|
});
|
|
90
|
+
registry.register({
|
|
91
|
+
command: 'product',
|
|
92
|
+
subcommand: 'create-variants',
|
|
93
|
+
description: 'Create product variants (bulk operation)',
|
|
94
|
+
handler: async () => await import('./create-variants.js')
|
|
95
|
+
});
|
|
96
|
+
registry.register({
|
|
97
|
+
command: 'product',
|
|
98
|
+
subcommand: 'delete-variants',
|
|
99
|
+
description: 'Delete product variants (bulk operation)',
|
|
100
|
+
handler: async () => await import('./delete-variants.js')
|
|
101
|
+
});
|
|
72
102
|
}
|
|
73
103
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/product/index.ts"],"names":[],"mappings":"AAAA;;;;GA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AK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,yBAAyB,CAAC;KAC7D,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,cAAc;QAC1B,WAAW,EAAE,2CAA2C;QACxD,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,mBAAmB,CAAC;KACvD,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,oCAAoC;QACjD,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,sBAAsB,CAAC;KAC1D,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,0CAA0C;QACvD,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,sBAAsB,CAAC;KAC1D,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,0CAA0C;QACvD,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,sBAAsB,CAAC;KAC1D,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Fetch product by ID with complete details
|
|
8
8
|
*/
|
|
9
|
-
export declare const GET_PRODUCT_BY_ID = "\n query getProduct($id: ID!) {\n product(id: $id) {\n id\n title\n description\n descriptionHtml\n handle\n productType\n vendor\n tags\n status\n templateSuffix\n variants(first: 100) {\n edges {\n node {\n id\n title\n sku\n price\n compareAtPrice\n inventoryQuantity\n availableForSale\n }\n }\n }\n images(first: 10) {\n edges {\n node {\n id\n url\n altText\n width\n height\n }\n }\n }\n priceRangeV2 {\n minVariantPrice {\n amount\n currencyCode\n }\n maxVariantPrice {\n amount\n currencyCode\n }\n }\n }\n }\n";
|
|
9
|
+
export declare const GET_PRODUCT_BY_ID = "\n query getProduct($id: ID!) {\n product(id: $id) {\n id\n title\n description\n descriptionHtml\n handle\n productType\n vendor\n tags\n status\n templateSuffix\n options {\n id\n name\n position\n values\n }\n variants(first: 100) {\n edges {\n node {\n id\n title\n sku\n price\n compareAtPrice\n inventoryQuantity\n availableForSale\n }\n }\n }\n images(first: 10) {\n edges {\n node {\n id\n url\n altText\n width\n height\n }\n }\n }\n priceRangeV2 {\n minVariantPrice {\n amount\n currencyCode\n }\n maxVariantPrice {\n amount\n currencyCode\n }\n }\n }\n }\n";
|
|
10
10
|
/**
|
|
11
11
|
* Search products by title
|
|
12
12
|
*/
|
|
@@ -14,7 +14,7 @@ export declare const SEARCH_PRODUCTS_BY_TITLE = "\n query searchProducts($query
|
|
|
14
14
|
/**
|
|
15
15
|
* Fetch product by handle
|
|
16
16
|
*/
|
|
17
|
-
export declare const GET_PRODUCT_BY_HANDLE = "\n query getProductByHandle($handle: String!) {\n productByHandle(handle: $handle) {\n id\n title\n description\n descriptionHtml\n handle\n productType\n vendor\n tags\n status\n templateSuffix\n variants(first: 100) {\n edges {\n node {\n id\n title\n sku\n price\n compareAtPrice\n inventoryQuantity\n availableForSale\n }\n }\n }\n images(first: 10) {\n edges {\n node {\n id\n url\n altText\n width\n height\n }\n }\n }\n priceRangeV2 {\n minVariantPrice {\n amount\n currencyCode\n }\n maxVariantPrice {\n amount\n currencyCode\n }\n }\n }\n }\n";
|
|
17
|
+
export declare const GET_PRODUCT_BY_HANDLE = "\n query getProductByHandle($handle: String!) {\n productByHandle(handle: $handle) {\n id\n title\n description\n descriptionHtml\n handle\n productType\n vendor\n tags\n status\n templateSuffix\n options {\n id\n name\n position\n values\n }\n variants(first: 100) {\n edges {\n node {\n id\n title\n sku\n price\n compareAtPrice\n inventoryQuantity\n availableForSale\n }\n }\n }\n images(first: 10) {\n edges {\n node {\n id\n url\n altText\n width\n height\n }\n }\n }\n priceRangeV2 {\n minVariantPrice {\n amount\n currencyCode\n }\n maxVariantPrice {\n amount\n currencyCode\n }\n }\n }\n }\n";
|
|
18
18
|
/**
|
|
19
19
|
* Update product fields (description, title, template, etc.)
|
|
20
20
|
*/
|
|
@@ -29,4 +29,14 @@ export declare const UPDATE_VARIANT = "\n mutation productVariantUpdate($input:
|
|
|
29
29
|
* Replaces deprecated productVariantUpdate mutation
|
|
30
30
|
*/
|
|
31
31
|
export declare const PRODUCT_VARIANTS_BULK_UPDATE = "\n mutation productVariantsBulkUpdate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) {\n productVariantsBulkUpdate(productId: $productId, variants: $variants) {\n productVariants {\n id\n price\n compareAtPrice\n }\n userErrors {\n field\n message\n }\n }\n }\n";
|
|
32
|
+
/**
|
|
33
|
+
* Delete product variants (bulk operation)
|
|
34
|
+
* Note: Cannot delete the last variant of a product
|
|
35
|
+
*/
|
|
36
|
+
export declare const PRODUCT_VARIANTS_BULK_DELETE = "\n mutation productVariantsBulkDelete($productId: ID!, $variantsIds: [ID!]!) {\n productVariantsBulkDelete(productId: $productId, variantsIds: $variantsIds) {\n product {\n id\n title\n variants(first: 100) {\n edges {\n node {\n id\n title\n sku\n price\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\n";
|
|
37
|
+
/**
|
|
38
|
+
* Create product variants (bulk operation)
|
|
39
|
+
* Maximum 2,048 variants per product
|
|
40
|
+
*/
|
|
41
|
+
export declare const PRODUCT_VARIANTS_BULK_CREATE = "\n mutation productVariantsBulkCreate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) {\n productVariantsBulkCreate(productId: $productId, variants: $variants) {\n productVariants {\n id\n title\n sku\n price\n compareAtPrice\n inventoryQuantity\n }\n userErrors {\n field\n message\n }\n }\n }\n";
|
|
32
42
|
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/commands/product/queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/commands/product/queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB,87BAuD7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,gaAqBpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,89BAuDjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,kSAgB1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,gRAc1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,oVAcxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,oeAuBxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,2YAiBxC,CAAC"}
|
|
@@ -19,6 +19,12 @@ export const GET_PRODUCT_BY_ID = `
|
|
|
19
19
|
tags
|
|
20
20
|
status
|
|
21
21
|
templateSuffix
|
|
22
|
+
options {
|
|
23
|
+
id
|
|
24
|
+
name
|
|
25
|
+
position
|
|
26
|
+
values
|
|
27
|
+
}
|
|
22
28
|
variants(first: 100) {
|
|
23
29
|
edges {
|
|
24
30
|
node {
|
|
@@ -97,6 +103,12 @@ export const GET_PRODUCT_BY_HANDLE = `
|
|
|
97
103
|
tags
|
|
98
104
|
status
|
|
99
105
|
templateSuffix
|
|
106
|
+
options {
|
|
107
|
+
id
|
|
108
|
+
name
|
|
109
|
+
position
|
|
110
|
+
values
|
|
111
|
+
}
|
|
100
112
|
variants(first: 100) {
|
|
101
113
|
edges {
|
|
102
114
|
node {
|
|
@@ -192,4 +204,54 @@ export const PRODUCT_VARIANTS_BULK_UPDATE = `
|
|
|
192
204
|
}
|
|
193
205
|
}
|
|
194
206
|
`;
|
|
207
|
+
/**
|
|
208
|
+
* Delete product variants (bulk operation)
|
|
209
|
+
* Note: Cannot delete the last variant of a product
|
|
210
|
+
*/
|
|
211
|
+
export const PRODUCT_VARIANTS_BULK_DELETE = `
|
|
212
|
+
mutation productVariantsBulkDelete($productId: ID!, $variantsIds: [ID!]!) {
|
|
213
|
+
productVariantsBulkDelete(productId: $productId, variantsIds: $variantsIds) {
|
|
214
|
+
product {
|
|
215
|
+
id
|
|
216
|
+
title
|
|
217
|
+
variants(first: 100) {
|
|
218
|
+
edges {
|
|
219
|
+
node {
|
|
220
|
+
id
|
|
221
|
+
title
|
|
222
|
+
sku
|
|
223
|
+
price
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
userErrors {
|
|
229
|
+
field
|
|
230
|
+
message
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
`;
|
|
235
|
+
/**
|
|
236
|
+
* Create product variants (bulk operation)
|
|
237
|
+
* Maximum 2,048 variants per product
|
|
238
|
+
*/
|
|
239
|
+
export const PRODUCT_VARIANTS_BULK_CREATE = `
|
|
240
|
+
mutation productVariantsBulkCreate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) {
|
|
241
|
+
productVariantsBulkCreate(productId: $productId, variants: $variants) {
|
|
242
|
+
productVariants {
|
|
243
|
+
id
|
|
244
|
+
title
|
|
245
|
+
sku
|
|
246
|
+
price
|
|
247
|
+
compareAtPrice
|
|
248
|
+
inventoryQuantity
|
|
249
|
+
}
|
|
250
|
+
userErrors {
|
|
251
|
+
field
|
|
252
|
+
message
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
`;
|
|
195
257
|
//# sourceMappingURL=queries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/commands/product/queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/commands/product/queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDhC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBvC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDpC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;CAgB7B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;CAc7B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;CAc3C,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuB3C,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;CAiB3C,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Follows Dependency Injection - accepts dependencies as parameters
|
|
6
6
|
*/
|
|
7
7
|
import type { ShopifyCredentials } from '../../lib/types.js';
|
|
8
|
-
import type { ShopifyProduct, FormattedProduct, UpdateDescriptionInput, UpdatePriceInput, UpdateTemplateInput, CommandResult } from './types.js';
|
|
8
|
+
import type { ShopifyProduct, FormattedProduct, UpdateDescriptionInput, UpdateTitleInput, UpdatePriceInput, UpdateTemplateInput, DeleteVariantsInput, CreateVariantsInput, CommandResult } from './types.js';
|
|
9
9
|
/**
|
|
10
10
|
* Product Service
|
|
11
11
|
*
|
|
@@ -27,6 +27,14 @@ export declare class ProductService {
|
|
|
27
27
|
static updateDescription(credentials: ShopifyCredentials, input: UpdateDescriptionInput): Promise<CommandResult<{
|
|
28
28
|
product: FormattedProduct;
|
|
29
29
|
}>>;
|
|
30
|
+
/**
|
|
31
|
+
* Update product title
|
|
32
|
+
*
|
|
33
|
+
* @returns Formatted result with updated product data
|
|
34
|
+
*/
|
|
35
|
+
static updateTitle(credentials: ShopifyCredentials, input: UpdateTitleInput): Promise<CommandResult<{
|
|
36
|
+
product: FormattedProduct;
|
|
37
|
+
}>>;
|
|
30
38
|
/**
|
|
31
39
|
* Update product variant price
|
|
32
40
|
* Uses productVariantsBulkUpdate mutation (current Shopify API)
|
|
@@ -47,5 +55,37 @@ export declare class ProductService {
|
|
|
47
55
|
static updateTemplate(credentials: ShopifyCredentials, input: UpdateTemplateInput): Promise<CommandResult<{
|
|
48
56
|
product: FormattedProduct;
|
|
49
57
|
}>>;
|
|
58
|
+
/**
|
|
59
|
+
* Delete product variants in bulk
|
|
60
|
+
* Uses productVariantsBulkDelete mutation (current Shopify API)
|
|
61
|
+
*
|
|
62
|
+
* IMPORTANT:
|
|
63
|
+
* - Cannot delete the last variant of a product
|
|
64
|
+
* - All variants must belong to the specified product
|
|
65
|
+
* - Cannot delete variants with active/unfulfilled orders
|
|
66
|
+
*
|
|
67
|
+
* @returns Formatted result with remaining variants
|
|
68
|
+
*/
|
|
69
|
+
static deleteVariants(credentials: ShopifyCredentials, input: DeleteVariantsInput): Promise<CommandResult<{
|
|
70
|
+
product: FormattedProduct;
|
|
71
|
+
deletedCount: number;
|
|
72
|
+
remainingVariants: number;
|
|
73
|
+
}>>;
|
|
74
|
+
/**
|
|
75
|
+
* Create product variants in bulk
|
|
76
|
+
* Uses productVariantsBulkCreate mutation (current Shopify API)
|
|
77
|
+
*
|
|
78
|
+
* IMPORTANT:
|
|
79
|
+
* - Maximum 2,048 variants per product
|
|
80
|
+
* - SKU must be unique across all products (if provided)
|
|
81
|
+
* - Option values must match product options
|
|
82
|
+
*
|
|
83
|
+
* @returns Formatted result with created variants
|
|
84
|
+
*/
|
|
85
|
+
static createVariants(credentials: ShopifyCredentials, input: CreateVariantsInput): Promise<CommandResult<{
|
|
86
|
+
product: FormattedProduct;
|
|
87
|
+
createdCount: number;
|
|
88
|
+
createdVariants: any[];
|
|
89
|
+
}>>;
|
|
50
90
|
}
|
|
51
91
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/commands/product/service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/commands/product/service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAmB7D,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EAKnB,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,qBAAa,cAAc;IACzB;;;;OAIG;WACU,cAAc,CACzB,WAAW,EAAE,kBAAkB,EAC/B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;IAkB1B;;;;OAIG;WACU,iBAAiB,CAC5B,WAAW,EAAE,kBAAkB,EAC/B,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,aAAa,CAAC;QAAE,OAAO,EAAE,gBAAgB,CAAA;KAAE,CAAC,CAAC;IAkDxD;;;;OAIG;WACU,WAAW,CACtB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