ecomcoder-cli 1.2.15 → 1.3.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/__tests__/test-utils.d.ts +123 -0
- package/dist/__tests__/test-utils.d.ts.map +1 -0
- package/dist/__tests__/test-utils.js +133 -0
- package/dist/__tests__/test-utils.js.map +1 -0
- package/dist/cli.d.ts +8 -7
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +70 -65
- package/dist/cli.js.map +1 -1
- package/dist/commands/docs/index.d.ts +10 -0
- package/dist/commands/docs/index.d.ts.map +1 -0
- package/dist/commands/docs/index.js +43 -0
- package/dist/commands/docs/index.js.map +1 -0
- package/dist/commands/metafield/index.d.ts +10 -0
- package/dist/commands/metafield/index.d.ts.map +1 -0
- package/dist/commands/metafield/index.js +55 -0
- package/dist/commands/metafield/index.js.map +1 -0
- package/dist/commands/product/__tests__/service.test.d.ts +7 -0
- package/dist/commands/product/__tests__/service.test.d.ts.map +1 -0
- package/dist/commands/product/__tests__/service.test.js +299 -0
- package/dist/commands/product/__tests__/service.test.js.map +1 -0
- package/dist/commands/product/__tests__/update-description.test.d.ts +5 -0
- package/dist/commands/product/__tests__/update-description.test.d.ts.map +1 -0
- package/dist/commands/product/__tests__/update-description.test.js +110 -0
- package/dist/commands/product/__tests__/update-description.test.js.map +1 -0
- package/dist/commands/product/get.d.ts +2 -0
- package/dist/commands/product/get.d.ts.map +1 -0
- package/dist/commands/product/get.js +305 -0
- package/dist/commands/product/get.js.map +1 -0
- package/dist/commands/product/index.d.ts +10 -0
- package/dist/commands/product/index.d.ts.map +1 -0
- package/dist/commands/product/index.js +73 -0
- package/dist/commands/product/index.js.map +1 -0
- package/dist/commands/product/queries.d.ts +32 -0
- package/dist/commands/product/queries.d.ts.map +1 -0
- package/dist/commands/product/queries.js +195 -0
- package/dist/commands/product/queries.js.map +1 -0
- package/dist/commands/product/service.d.ts +51 -0
- package/dist/commands/product/service.d.ts.map +1 -0
- package/dist/commands/product/service.js +237 -0
- package/dist/commands/product/service.js.map +1 -0
- package/dist/commands/product/types.d.ts +165 -0
- package/dist/commands/product/types.d.ts.map +1 -0
- package/dist/commands/product/types.js +6 -0
- package/dist/commands/product/types.js.map +1 -0
- package/dist/commands/product/update-description.d.ts +8 -0
- package/dist/commands/product/update-description.d.ts.map +1 -0
- package/dist/commands/product/update-description.js +86 -0
- package/dist/commands/product/update-description.js.map +1 -0
- package/dist/commands/product/update-price.d.ts +8 -0
- package/dist/commands/product/update-price.d.ts.map +1 -0
- package/dist/commands/product/update-price.js +101 -0
- package/dist/commands/product/update-price.js.map +1 -0
- package/dist/commands/product/update-template.d.ts +8 -0
- package/dist/commands/product/update-template.d.ts.map +1 -0
- package/dist/commands/product/update-template.js +114 -0
- package/dist/commands/product/update-template.js.map +1 -0
- package/dist/commands/product/utils.d.ts +69 -0
- package/dist/commands/product/utils.d.ts.map +1 -0
- package/dist/commands/product/utils.js +180 -0
- package/dist/commands/product/utils.js.map +1 -0
- package/dist/commands/products/index.d.ts +10 -0
- package/dist/commands/products/index.d.ts.map +1 -0
- package/dist/commands/products/index.js +62 -0
- package/dist/commands/products/index.js.map +1 -0
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +11 -0
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/args-parser.d.ts.map +1 -1
- package/dist/lib/args-parser.js +2 -1
- package/dist/lib/args-parser.js.map +1 -1
- package/dist/lib/command-registry.d.ts +64 -0
- package/dist/lib/command-registry.d.ts.map +1 -0
- package/dist/lib/command-registry.js +76 -0
- package/dist/lib/command-registry.js.map +1 -0
- package/package.json +10 -2
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { getCredentials, getSessionId } from '../../lib/api-client.js';
|
|
2
|
+
import { shopifyGraphQL } from '../../lib/shopify-client.js';
|
|
3
|
+
import { parseArgs, hasHelpFlag } from '../../lib/args-parser.js';
|
|
4
|
+
function showHelp() {
|
|
5
|
+
console.log(`
|
|
6
|
+
Get Shopify Product Data
|
|
7
|
+
|
|
8
|
+
USAGE:
|
|
9
|
+
ecomcoder product get [OPTIONS]
|
|
10
|
+
|
|
11
|
+
OPTIONS:
|
|
12
|
+
--id <id> Product ID (numeric or full GID)
|
|
13
|
+
--title <title> Search by product title
|
|
14
|
+
--handle <handle> Product handle (URL slug)
|
|
15
|
+
--session-id Session ID (auto-provided via SESSION_ID env var)
|
|
16
|
+
--help, -h Show this help message
|
|
17
|
+
|
|
18
|
+
EXAMPLES:
|
|
19
|
+
# Get by product ID
|
|
20
|
+
ecomcoder product get --id=123456789
|
|
21
|
+
ecomcoder product get --id=gid://shopify/Product/123456789
|
|
22
|
+
|
|
23
|
+
# Search by title
|
|
24
|
+
ecomcoder product get --title="Blue T-Shirt"
|
|
25
|
+
|
|
26
|
+
# Get by handle
|
|
27
|
+
ecomcoder product get --handle="blue-t-shirt"
|
|
28
|
+
|
|
29
|
+
NOTES:
|
|
30
|
+
- At least one of --id, --title, or --handle must be provided
|
|
31
|
+
- If --title returns multiple products, you'll see a list to choose from
|
|
32
|
+
- Use --id for the most precise results
|
|
33
|
+
`);
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
const GET_PRODUCT_BY_ID = `
|
|
37
|
+
query getProduct($id: ID!) {
|
|
38
|
+
product(id: $id) {
|
|
39
|
+
id
|
|
40
|
+
title
|
|
41
|
+
description
|
|
42
|
+
descriptionHtml
|
|
43
|
+
handle
|
|
44
|
+
productType
|
|
45
|
+
vendor
|
|
46
|
+
tags
|
|
47
|
+
status
|
|
48
|
+
templateSuffix
|
|
49
|
+
variants(first: 100) {
|
|
50
|
+
edges {
|
|
51
|
+
node {
|
|
52
|
+
id
|
|
53
|
+
title
|
|
54
|
+
sku
|
|
55
|
+
price
|
|
56
|
+
compareAtPrice
|
|
57
|
+
inventoryQuantity
|
|
58
|
+
availableForSale
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
images(first: 10) {
|
|
63
|
+
edges {
|
|
64
|
+
node {
|
|
65
|
+
id
|
|
66
|
+
url
|
|
67
|
+
altText
|
|
68
|
+
width
|
|
69
|
+
height
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
priceRangeV2 {
|
|
74
|
+
minVariantPrice {
|
|
75
|
+
amount
|
|
76
|
+
currencyCode
|
|
77
|
+
}
|
|
78
|
+
maxVariantPrice {
|
|
79
|
+
amount
|
|
80
|
+
currencyCode
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
const SEARCH_PRODUCTS_BY_TITLE = `
|
|
87
|
+
query searchProducts($query: String!, $first: Int!) {
|
|
88
|
+
products(first: $first, query: $query) {
|
|
89
|
+
edges {
|
|
90
|
+
node {
|
|
91
|
+
id
|
|
92
|
+
title
|
|
93
|
+
handle
|
|
94
|
+
status
|
|
95
|
+
productType
|
|
96
|
+
vendor
|
|
97
|
+
priceRangeV2 {
|
|
98
|
+
minVariantPrice {
|
|
99
|
+
amount
|
|
100
|
+
currencyCode
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
const GET_PRODUCT_BY_HANDLE = `
|
|
109
|
+
query getProductByHandle($handle: String!) {
|
|
110
|
+
productByHandle(handle: $handle) {
|
|
111
|
+
id
|
|
112
|
+
title
|
|
113
|
+
description
|
|
114
|
+
descriptionHtml
|
|
115
|
+
handle
|
|
116
|
+
productType
|
|
117
|
+
vendor
|
|
118
|
+
tags
|
|
119
|
+
status
|
|
120
|
+
templateSuffix
|
|
121
|
+
variants(first: 100) {
|
|
122
|
+
edges {
|
|
123
|
+
node {
|
|
124
|
+
id
|
|
125
|
+
title
|
|
126
|
+
sku
|
|
127
|
+
price
|
|
128
|
+
compareAtPrice
|
|
129
|
+
inventoryQuantity
|
|
130
|
+
availableForSale
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
images(first: 10) {
|
|
135
|
+
edges {
|
|
136
|
+
node {
|
|
137
|
+
id
|
|
138
|
+
url
|
|
139
|
+
altText
|
|
140
|
+
width
|
|
141
|
+
height
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
priceRangeV2 {
|
|
146
|
+
minVariantPrice {
|
|
147
|
+
amount
|
|
148
|
+
currencyCode
|
|
149
|
+
}
|
|
150
|
+
maxVariantPrice {
|
|
151
|
+
amount
|
|
152
|
+
currencyCode
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
`;
|
|
158
|
+
function normalizeProductId(id) {
|
|
159
|
+
// Accept numeric ID or full GID
|
|
160
|
+
if (id.startsWith('gid://shopify/Product/')) {
|
|
161
|
+
return id;
|
|
162
|
+
}
|
|
163
|
+
return `gid://shopify/Product/${id}`;
|
|
164
|
+
}
|
|
165
|
+
function formatProductOutput(product) {
|
|
166
|
+
return {
|
|
167
|
+
id: product.id,
|
|
168
|
+
title: product.title,
|
|
169
|
+
description: product.description,
|
|
170
|
+
handle: product.handle,
|
|
171
|
+
status: product.status,
|
|
172
|
+
productType: product.productType,
|
|
173
|
+
vendor: product.vendor,
|
|
174
|
+
template: product.templateSuffix ? `product.${product.templateSuffix}` : 'product',
|
|
175
|
+
tags: product.tags,
|
|
176
|
+
priceRange: {
|
|
177
|
+
min: product.priceRangeV2.minVariantPrice,
|
|
178
|
+
max: product.priceRangeV2.maxVariantPrice
|
|
179
|
+
},
|
|
180
|
+
variants: product.variants.edges.map((e) => ({
|
|
181
|
+
id: e.node.id,
|
|
182
|
+
title: e.node.title,
|
|
183
|
+
price: e.node.price,
|
|
184
|
+
compareAtPrice: e.node.compareAtPrice,
|
|
185
|
+
sku: e.node.sku,
|
|
186
|
+
inventory: e.node.inventoryQuantity,
|
|
187
|
+
available: e.node.availableForSale
|
|
188
|
+
})),
|
|
189
|
+
images: product.images.edges.map((e) => ({
|
|
190
|
+
id: e.node.id,
|
|
191
|
+
url: e.node.url,
|
|
192
|
+
altText: e.node.altText,
|
|
193
|
+
width: e.node.width,
|
|
194
|
+
height: e.node.height
|
|
195
|
+
}))
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
export async function run(argv = process.argv.slice(2)) {
|
|
199
|
+
if (hasHelpFlag(argv)) {
|
|
200
|
+
showHelp();
|
|
201
|
+
}
|
|
202
|
+
const args = parseArgs(argv);
|
|
203
|
+
// Validate options
|
|
204
|
+
if (!args.id && !args.title && !args.handle) {
|
|
205
|
+
console.error(JSON.stringify({
|
|
206
|
+
success: false,
|
|
207
|
+
error: 'Must provide --id, --title, or --handle'
|
|
208
|
+
}));
|
|
209
|
+
process.exit(1);
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
const sessionId = getSessionId(args.sessionId);
|
|
213
|
+
const credentials = await getCredentials(sessionId, args.backendUrl, args.jwt);
|
|
214
|
+
let product = null;
|
|
215
|
+
if (args.id) {
|
|
216
|
+
// Fetch by ID
|
|
217
|
+
const productId = normalizeProductId(args.id);
|
|
218
|
+
const response = await shopifyGraphQL(credentials, GET_PRODUCT_BY_ID, { id: productId });
|
|
219
|
+
if (response.errors) {
|
|
220
|
+
throw new Error(response.errors.map((e) => e.message).join(', '));
|
|
221
|
+
}
|
|
222
|
+
product = response.data?.product;
|
|
223
|
+
if (!product) {
|
|
224
|
+
console.error(JSON.stringify({
|
|
225
|
+
success: false,
|
|
226
|
+
error: 'Product not found'
|
|
227
|
+
}));
|
|
228
|
+
process.exit(1);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else if (args.handle) {
|
|
232
|
+
// Fetch by handle
|
|
233
|
+
const response = await shopifyGraphQL(credentials, GET_PRODUCT_BY_HANDLE, { handle: args.handle });
|
|
234
|
+
if (response.errors) {
|
|
235
|
+
throw new Error(response.errors.map((e) => e.message).join(', '));
|
|
236
|
+
}
|
|
237
|
+
product = response.data?.productByHandle;
|
|
238
|
+
if (!product) {
|
|
239
|
+
console.error(JSON.stringify({
|
|
240
|
+
success: false,
|
|
241
|
+
error: `Product with handle "${args.handle}" not found`
|
|
242
|
+
}));
|
|
243
|
+
process.exit(1);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else if (args.title) {
|
|
247
|
+
// Search by title
|
|
248
|
+
const response = await shopifyGraphQL(credentials, SEARCH_PRODUCTS_BY_TITLE, {
|
|
249
|
+
query: `title:*${args.title}*`,
|
|
250
|
+
first: 10
|
|
251
|
+
});
|
|
252
|
+
if (response.errors) {
|
|
253
|
+
throw new Error(response.errors.map((e) => e.message).join(', '));
|
|
254
|
+
}
|
|
255
|
+
const products = response.data?.products?.edges || [];
|
|
256
|
+
if (products.length === 0) {
|
|
257
|
+
console.error(JSON.stringify({
|
|
258
|
+
success: false,
|
|
259
|
+
error: `No products found with title containing "${args.title}"`
|
|
260
|
+
}));
|
|
261
|
+
process.exit(1);
|
|
262
|
+
}
|
|
263
|
+
if (products.length > 1) {
|
|
264
|
+
// Multiple matches - return list
|
|
265
|
+
console.log(JSON.stringify({
|
|
266
|
+
success: true,
|
|
267
|
+
multiple: true,
|
|
268
|
+
count: products.length,
|
|
269
|
+
data: {
|
|
270
|
+
message: `Found ${products.length} products matching "${args.title}"`,
|
|
271
|
+
products: products.map((e) => ({
|
|
272
|
+
id: e.node.id,
|
|
273
|
+
title: e.node.title,
|
|
274
|
+
handle: e.node.handle,
|
|
275
|
+
status: e.node.status,
|
|
276
|
+
price: e.node.priceRangeV2.minVariantPrice
|
|
277
|
+
})),
|
|
278
|
+
hint: 'Use --id with a specific product ID to get full details'
|
|
279
|
+
}
|
|
280
|
+
}));
|
|
281
|
+
process.exit(0);
|
|
282
|
+
}
|
|
283
|
+
// Single match - fetch full details
|
|
284
|
+
const productId = products[0].node.id;
|
|
285
|
+
const detailResponse = await shopifyGraphQL(credentials, GET_PRODUCT_BY_ID, { id: productId });
|
|
286
|
+
if (detailResponse.errors) {
|
|
287
|
+
throw new Error(detailResponse.errors.map((e) => e.message).join(', '));
|
|
288
|
+
}
|
|
289
|
+
product = detailResponse.data?.product;
|
|
290
|
+
}
|
|
291
|
+
// Output product data
|
|
292
|
+
console.log(JSON.stringify({
|
|
293
|
+
success: true,
|
|
294
|
+
data: formatProductOutput(product)
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
console.error(JSON.stringify({
|
|
299
|
+
success: false,
|
|
300
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
301
|
+
}));
|
|
302
|
+
process.exit(1);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/product/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAElE,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Bb,CAAC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDzB,CAAC;AAEF,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBhC,CAAC;AAEF,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiD7B,CAAC;AAEF,SAAS,kBAAkB,CAAC,EAAU;IACpC,gCAAgC;IAChC,IA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d,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC,CAAC,CAAC;QACJ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +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,CAkE9C"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product Commands Registration
|
|
3
|
+
*
|
|
4
|
+
* Following Open/Closed Principle - commands register themselves
|
|
5
|
+
*/
|
|
6
|
+
import { registry } from '../../lib/command-registry.js';
|
|
7
|
+
/**
|
|
8
|
+
* Register all product commands
|
|
9
|
+
*/
|
|
10
|
+
export function registerProductCommands() {
|
|
11
|
+
// Register command group
|
|
12
|
+
registry.registerGroup({
|
|
13
|
+
command: 'product',
|
|
14
|
+
description: 'View and modify Shopify product data',
|
|
15
|
+
showHelp: () => {
|
|
16
|
+
console.log(`
|
|
17
|
+
Product Commands - View and modify Shopify product data
|
|
18
|
+
|
|
19
|
+
USAGE:
|
|
20
|
+
ecomcoder product <subcommand> [options]
|
|
21
|
+
|
|
22
|
+
SUBCOMMANDS:
|
|
23
|
+
get Get product details by ID, title, or handle
|
|
24
|
+
update-description Update product description
|
|
25
|
+
update-price Update product price and compare-at price
|
|
26
|
+
update-template Change product template assignment
|
|
27
|
+
|
|
28
|
+
EXAMPLES:
|
|
29
|
+
# Get product details
|
|
30
|
+
ecomcoder product get --title="Blue T-Shirt"
|
|
31
|
+
ecomcoder product get --id=123456789
|
|
32
|
+
|
|
33
|
+
# Update description
|
|
34
|
+
ecomcoder product update-description --id=123 --description="Premium cotton t-shirt"
|
|
35
|
+
|
|
36
|
+
# Update price
|
|
37
|
+
ecomcoder product update-price --id=123 --price=34.99 --compare-at-price=49.99
|
|
38
|
+
|
|
39
|
+
# Change template
|
|
40
|
+
ecomcoder product update-template --id=123 --template=premium
|
|
41
|
+
|
|
42
|
+
For detailed help on a specific subcommand:
|
|
43
|
+
ecomcoder product <subcommand> --help
|
|
44
|
+
`);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
// Register individual subcommands
|
|
48
|
+
registry.register({
|
|
49
|
+
command: 'product',
|
|
50
|
+
subcommand: 'get',
|
|
51
|
+
description: 'Get product details by ID, title, or handle',
|
|
52
|
+
handler: async () => await import('./get.js')
|
|
53
|
+
});
|
|
54
|
+
registry.register({
|
|
55
|
+
command: 'product',
|
|
56
|
+
subcommand: 'update-description',
|
|
57
|
+
description: 'Update product description',
|
|
58
|
+
handler: async () => await import('./update-description.js')
|
|
59
|
+
});
|
|
60
|
+
registry.register({
|
|
61
|
+
command: 'product',
|
|
62
|
+
subcommand: 'update-price',
|
|
63
|
+
description: 'Update product price and compare-at price',
|
|
64
|
+
handler: async () => await import('./update-price.js')
|
|
65
|
+
});
|
|
66
|
+
registry.register({
|
|
67
|
+
command: 'product',
|
|
68
|
+
subcommand: 'update-template',
|
|
69
|
+
description: 'Change product template assignment',
|
|
70
|
+
handler: async () => await import('./update-template.js')
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/product/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,yBAAyB;IACzB,QAAQ,CAAC,aAAa,CAAC;QACrB,OAAO,EAAE,SAAS;QAClB,WAAW,EAAE,sCAAsC;QACnD,QAAQ,EAAE,GAAG,EAAE;YACb,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BjB,CAAC,CAAC;QACC,CAAC;KACF,CAAC,CAAC;IAEH,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,6CAA6C;QAC1D,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC;KAC9C,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,oBAAoB;QAChC,WAAW,EAAE,4BAA4B;QACzC,OAAO,EAAE,KAAK,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;AACL,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL Queries and Mutations for Product Operations
|
|
3
|
+
*
|
|
4
|
+
* Following Single Responsibility Principle - this module only contains GraphQL strings
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Fetch product by ID with complete details
|
|
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";
|
|
10
|
+
/**
|
|
11
|
+
* Search products by title
|
|
12
|
+
*/
|
|
13
|
+
export declare const SEARCH_PRODUCTS_BY_TITLE = "\n query searchProducts($query: String!, $first: Int!) {\n products(first: $first, query: $query) {\n edges {\n node {\n id\n title\n handle\n status\n productType\n vendor\n priceRangeV2 {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n }\n }\n }\n }\n";
|
|
14
|
+
/**
|
|
15
|
+
* Fetch product by handle
|
|
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";
|
|
18
|
+
/**
|
|
19
|
+
* Update product fields (description, title, template, etc.)
|
|
20
|
+
*/
|
|
21
|
+
export declare const UPDATE_PRODUCT = "\n mutation productUpdate($input: ProductInput!) {\n productUpdate(input: $input) {\n product {\n id\n title\n description\n descriptionHtml\n templateSuffix\n }\n userErrors {\n field\n message\n }\n }\n }\n";
|
|
22
|
+
/**
|
|
23
|
+
* Update product variant (price, compareAtPrice, inventory, etc.)
|
|
24
|
+
* @deprecated Use PRODUCT_VARIANTS_BULK_UPDATE instead
|
|
25
|
+
*/
|
|
26
|
+
export declare const UPDATE_VARIANT = "\n mutation productVariantUpdate($input: ProductVariantInput!) {\n productVariantUpdate(input: $input) {\n productVariant {\n id\n price\n compareAtPrice\n }\n userErrors {\n field\n message\n }\n }\n }\n";
|
|
27
|
+
/**
|
|
28
|
+
* Bulk update product variants (current API for price updates)
|
|
29
|
+
* Replaces deprecated productVariantUpdate mutation
|
|
30
|
+
*/
|
|
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
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +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,w2BAiD7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,gaAqBpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,w4BAiDjC,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"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL Queries and Mutations for Product Operations
|
|
3
|
+
*
|
|
4
|
+
* Following Single Responsibility Principle - this module only contains GraphQL strings
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Fetch product by ID with complete details
|
|
8
|
+
*/
|
|
9
|
+
export const GET_PRODUCT_BY_ID = `
|
|
10
|
+
query getProduct($id: ID!) {
|
|
11
|
+
product(id: $id) {
|
|
12
|
+
id
|
|
13
|
+
title
|
|
14
|
+
description
|
|
15
|
+
descriptionHtml
|
|
16
|
+
handle
|
|
17
|
+
productType
|
|
18
|
+
vendor
|
|
19
|
+
tags
|
|
20
|
+
status
|
|
21
|
+
templateSuffix
|
|
22
|
+
variants(first: 100) {
|
|
23
|
+
edges {
|
|
24
|
+
node {
|
|
25
|
+
id
|
|
26
|
+
title
|
|
27
|
+
sku
|
|
28
|
+
price
|
|
29
|
+
compareAtPrice
|
|
30
|
+
inventoryQuantity
|
|
31
|
+
availableForSale
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
images(first: 10) {
|
|
36
|
+
edges {
|
|
37
|
+
node {
|
|
38
|
+
id
|
|
39
|
+
url
|
|
40
|
+
altText
|
|
41
|
+
width
|
|
42
|
+
height
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
priceRangeV2 {
|
|
47
|
+
minVariantPrice {
|
|
48
|
+
amount
|
|
49
|
+
currencyCode
|
|
50
|
+
}
|
|
51
|
+
maxVariantPrice {
|
|
52
|
+
amount
|
|
53
|
+
currencyCode
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
/**
|
|
60
|
+
* Search products by title
|
|
61
|
+
*/
|
|
62
|
+
export const SEARCH_PRODUCTS_BY_TITLE = `
|
|
63
|
+
query searchProducts($query: String!, $first: Int!) {
|
|
64
|
+
products(first: $first, query: $query) {
|
|
65
|
+
edges {
|
|
66
|
+
node {
|
|
67
|
+
id
|
|
68
|
+
title
|
|
69
|
+
handle
|
|
70
|
+
status
|
|
71
|
+
productType
|
|
72
|
+
vendor
|
|
73
|
+
priceRangeV2 {
|
|
74
|
+
minVariantPrice {
|
|
75
|
+
amount
|
|
76
|
+
currencyCode
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
/**
|
|
85
|
+
* Fetch product by handle
|
|
86
|
+
*/
|
|
87
|
+
export const GET_PRODUCT_BY_HANDLE = `
|
|
88
|
+
query getProductByHandle($handle: String!) {
|
|
89
|
+
productByHandle(handle: $handle) {
|
|
90
|
+
id
|
|
91
|
+
title
|
|
92
|
+
description
|
|
93
|
+
descriptionHtml
|
|
94
|
+
handle
|
|
95
|
+
productType
|
|
96
|
+
vendor
|
|
97
|
+
tags
|
|
98
|
+
status
|
|
99
|
+
templateSuffix
|
|
100
|
+
variants(first: 100) {
|
|
101
|
+
edges {
|
|
102
|
+
node {
|
|
103
|
+
id
|
|
104
|
+
title
|
|
105
|
+
sku
|
|
106
|
+
price
|
|
107
|
+
compareAtPrice
|
|
108
|
+
inventoryQuantity
|
|
109
|
+
availableForSale
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
images(first: 10) {
|
|
114
|
+
edges {
|
|
115
|
+
node {
|
|
116
|
+
id
|
|
117
|
+
url
|
|
118
|
+
altText
|
|
119
|
+
width
|
|
120
|
+
height
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
priceRangeV2 {
|
|
125
|
+
minVariantPrice {
|
|
126
|
+
amount
|
|
127
|
+
currencyCode
|
|
128
|
+
}
|
|
129
|
+
maxVariantPrice {
|
|
130
|
+
amount
|
|
131
|
+
currencyCode
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
137
|
+
/**
|
|
138
|
+
* Update product fields (description, title, template, etc.)
|
|
139
|
+
*/
|
|
140
|
+
export const UPDATE_PRODUCT = `
|
|
141
|
+
mutation productUpdate($input: ProductInput!) {
|
|
142
|
+
productUpdate(input: $input) {
|
|
143
|
+
product {
|
|
144
|
+
id
|
|
145
|
+
title
|
|
146
|
+
description
|
|
147
|
+
descriptionHtml
|
|
148
|
+
templateSuffix
|
|
149
|
+
}
|
|
150
|
+
userErrors {
|
|
151
|
+
field
|
|
152
|
+
message
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
`;
|
|
157
|
+
/**
|
|
158
|
+
* Update product variant (price, compareAtPrice, inventory, etc.)
|
|
159
|
+
* @deprecated Use PRODUCT_VARIANTS_BULK_UPDATE instead
|
|
160
|
+
*/
|
|
161
|
+
export const UPDATE_VARIANT = `
|
|
162
|
+
mutation productVariantUpdate($input: ProductVariantInput!) {
|
|
163
|
+
productVariantUpdate(input: $input) {
|
|
164
|
+
productVariant {
|
|
165
|
+
id
|
|
166
|
+
price
|
|
167
|
+
compareAtPrice
|
|
168
|
+
}
|
|
169
|
+
userErrors {
|
|
170
|
+
field
|
|
171
|
+
message
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
`;
|
|
176
|
+
/**
|
|
177
|
+
* Bulk update product variants (current API for price updates)
|
|
178
|
+
* Replaces deprecated productVariantUpdate mutation
|
|
179
|
+
*/
|
|
180
|
+
export const PRODUCT_VARIANTS_BULK_UPDATE = `
|
|
181
|
+
mutation productVariantsBulkUpdate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) {
|
|
182
|
+
productVariantsBulkUpdate(productId: $productId, variants: $variants) {
|
|
183
|
+
productVariants {
|
|
184
|
+
id
|
|
185
|
+
price
|
|
186
|
+
compareAtPrice
|
|
187
|
+
}
|
|
188
|
+
userErrors {
|
|
189
|
+
field
|
|
190
|
+
message
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
`;
|
|
195
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDhC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBvC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDpC,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"}
|