ecomcoder-cli 1.3.13 → 1.3.15
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 +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/collection/get-product-collections.d.ts +7 -0
- package/dist/commands/collection/get-product-collections.d.ts.map +1 -0
- package/dist/commands/collection/get-product-collections.js +99 -0
- package/dist/commands/collection/get-product-collections.js.map +1 -0
- package/dist/commands/collection/get.d.ts +7 -0
- package/dist/commands/collection/get.d.ts.map +1 -0
- package/dist/commands/collection/get.js +80 -0
- package/dist/commands/collection/get.js.map +1 -0
- package/dist/commands/collection/index.d.ts +10 -0
- package/dist/commands/collection/index.d.ts.map +1 -0
- package/dist/commands/collection/index.js +54 -0
- package/dist/commands/collection/index.js.map +1 -0
- package/dist/commands/collection/list-products.d.ts +7 -0
- package/dist/commands/collection/list-products.d.ts.map +1 -0
- package/dist/commands/collection/list-products.js +105 -0
- package/dist/commands/collection/list-products.js.map +1 -0
- package/dist/commands/collection/list.d.ts +7 -0
- package/dist/commands/collection/list.d.ts.map +1 -0
- package/dist/commands/collection/list.js +105 -0
- package/dist/commands/collection/list.js.map +1 -0
- package/dist/commands/collection/queries.d.ts +32 -0
- package/dist/commands/collection/queries.d.ts.map +1 -0
- package/dist/commands/collection/queries.js +158 -0
- package/dist/commands/collection/queries.js.map +1 -0
- package/dist/commands/collection/service.d.ts +53 -0
- package/dist/commands/collection/service.d.ts.map +1 -0
- package/dist/commands/collection/service.js +232 -0
- package/dist/commands/collection/service.js.map +1 -0
- package/dist/commands/collection/types.d.ts +156 -0
- package/dist/commands/collection/types.d.ts.map +1 -0
- package/dist/commands/collection/types.js +6 -0
- package/dist/commands/collection/types.js.map +1 -0
- package/dist/commands/collection/utils.d.ts +33 -0
- package/dist/commands/collection/utils.d.ts.map +1 -0
- package/dist/commands/collection/utils.js +84 -0
- package/dist/commands/collection/utils.js.map +1 -0
- package/dist/commands/image/generate.d.ts +6 -0
- package/dist/commands/image/generate.d.ts.map +1 -0
- package/dist/commands/image/generate.js +135 -0
- package/dist/commands/image/generate.js.map +1 -0
- package/dist/commands/image/index.d.ts +5 -0
- package/dist/commands/image/index.d.ts.map +1 -0
- package/dist/commands/image/index.js +25 -0
- package/dist/commands/image/index.js.map +1 -0
- package/dist/commands/image/openai.d.ts +19 -0
- package/dist/commands/image/openai.d.ts.map +1 -0
- package/dist/commands/image/openai.js +35 -0
- package/dist/commands/image/openai.js.map +1 -0
- package/dist/commands/image/service.d.ts +31 -0
- package/dist/commands/image/service.d.ts.map +1 -0
- package/dist/commands/image/service.js +72 -0
- package/dist/commands/image/service.js.map +1 -0
- package/dist/lib/approval.d.ts +19 -4
- package/dist/lib/approval.d.ts.map +1 -1
- package/dist/lib/approval.js +26 -5
- package/dist/lib/approval.js.map +1 -1
- package/dist/lib/config.d.ts +52 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +83 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/types.d.ts +5 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +4 -2
package/dist/cli.js
CHANGED
|
@@ -24,6 +24,8 @@ import { registerProductsCommands } from './commands/products/index.js';
|
|
|
24
24
|
import { registerDocsCommands } from './commands/docs/index.js';
|
|
25
25
|
import { registerDiscountCommands } from './commands/discount/index.js';
|
|
26
26
|
import { registerAssetCommands } from './commands/asset/index.js';
|
|
27
|
+
import { registerImageCommands } from './commands/image/index.js';
|
|
28
|
+
import { registerCollectionCommands } from './commands/collection/index.js';
|
|
27
29
|
// Initialize registry
|
|
28
30
|
registerProductCommands();
|
|
29
31
|
registerShopCommands();
|
|
@@ -32,6 +34,8 @@ registerProductsCommands();
|
|
|
32
34
|
registerDocsCommands();
|
|
33
35
|
registerDiscountCommands();
|
|
34
36
|
registerAssetCommands();
|
|
37
|
+
registerImageCommands();
|
|
38
|
+
registerCollectionCommands();
|
|
35
39
|
function showMainHelp() {
|
|
36
40
|
console.log(HelpGenerator.generateMainHelp());
|
|
37
41
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/C,8BAA8B;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,OAAO,GAAG,a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7B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAExD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,uBAAuB;YACvB,MAAM,iBAAiB,GAAG,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC;iBAC3D,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC;iBAC1B,MAAM,CAAC,OAAO,CAAC,CAAC;YAEnB,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,gBAAgB,UAAU,EAAE,CAAC,CAAC;YAC9D,OAAO,CAAC,KAAK,CAAC,sBAAsB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,kDAAkD;QAClD,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB;IAE1D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QACtG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-product-collections.d.ts","sourceRoot":"","sources":["../../../src/commands/collection/get-product-collections.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA+DH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,iBAwCvC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get Product Collections Command
|
|
3
|
+
*
|
|
4
|
+
* View which collections a product belongs to
|
|
5
|
+
*/
|
|
6
|
+
import { parseArgs } from '../../lib/args-parser.js';
|
|
7
|
+
import { getCredentials } from '../../lib/api-client.js';
|
|
8
|
+
import { CollectionService } from './service.js';
|
|
9
|
+
function showHelp() {
|
|
10
|
+
console.log(`
|
|
11
|
+
Get Product Collections
|
|
12
|
+
|
|
13
|
+
View which collections a product belongs to with pagination support.
|
|
14
|
+
|
|
15
|
+
USAGE:
|
|
16
|
+
ecomcoder collection get-product-collections [OPTIONS]
|
|
17
|
+
|
|
18
|
+
REQUIRED OPTIONS:
|
|
19
|
+
--product-id <id> Product ID (numeric or GID format)
|
|
20
|
+
|
|
21
|
+
OPTIONAL OPTIONS:
|
|
22
|
+
--limit <number> Max results per page (default: 50, max: 250)
|
|
23
|
+
--cursor <cursor> Pagination cursor from previous response
|
|
24
|
+
--session-id <id> Session ID for authentication
|
|
25
|
+
|
|
26
|
+
EXAMPLES:
|
|
27
|
+
# Get collections for a product
|
|
28
|
+
ecomcoder collection get-product-collections --product-id=456
|
|
29
|
+
|
|
30
|
+
# Get by GID
|
|
31
|
+
ecomcoder collection get-product-collections --product-id="gid://shopify/Product/456"
|
|
32
|
+
|
|
33
|
+
# With pagination
|
|
34
|
+
ecomcoder collection get-product-collections --product-id=456 --limit=100
|
|
35
|
+
|
|
36
|
+
# Get next page
|
|
37
|
+
ecomcoder collection get-product-collections --product-id=456 --cursor="eyJsYXN0X2lkIjoxMjN9"
|
|
38
|
+
|
|
39
|
+
OUTPUT:
|
|
40
|
+
JSON object with product info and collections:
|
|
41
|
+
{
|
|
42
|
+
"success": true,
|
|
43
|
+
"data": {
|
|
44
|
+
"product": {
|
|
45
|
+
"id": "gid://shopify/Product/456",
|
|
46
|
+
"title": "Summer Dress"
|
|
47
|
+
},
|
|
48
|
+
"collections": [
|
|
49
|
+
{
|
|
50
|
+
"id": "gid://shopify/Collection/123",
|
|
51
|
+
"title": "Summer Collection",
|
|
52
|
+
"handle": "summer-collection"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "gid://shopify/Collection/789",
|
|
56
|
+
"title": "Women's Clothing",
|
|
57
|
+
"handle": "womens-clothing"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"count": 2
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`);
|
|
64
|
+
}
|
|
65
|
+
export async function run(argv) {
|
|
66
|
+
const args = parseArgs(argv);
|
|
67
|
+
if (args.help) {
|
|
68
|
+
showHelp();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// Validate input
|
|
72
|
+
if (!args.productId) {
|
|
73
|
+
console.error('Error: --product-id is required\n');
|
|
74
|
+
showHelp();
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
const credentials = await getCredentials(args.sessionId);
|
|
78
|
+
// Parse and validate limit
|
|
79
|
+
let limit;
|
|
80
|
+
if (args.limit) {
|
|
81
|
+
limit = parseInt(args.limit, 10);
|
|
82
|
+
if (isNaN(limit) || limit <= 0) {
|
|
83
|
+
console.error('Error: --limit must be a positive number\n');
|
|
84
|
+
showHelp();
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Call service
|
|
89
|
+
const result = await CollectionService.getProductCollections(credentials, {
|
|
90
|
+
productId: args.productId,
|
|
91
|
+
limit,
|
|
92
|
+
cursor: args.cursor
|
|
93
|
+
});
|
|
94
|
+
console.log(JSON.stringify(result, null, 2));
|
|
95
|
+
if (!result.success) {
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=get-product-collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-product-collections.js","sourceRoot":"","sources":["../../../src/commands/collection/get-product-collections.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,yBA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CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAE7C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/collection/get.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuDH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,iBA4BvC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection Get Command
|
|
3
|
+
*
|
|
4
|
+
* Get detailed collection information by ID or handle
|
|
5
|
+
*/
|
|
6
|
+
import { parseArgs } from '../../lib/args-parser.js';
|
|
7
|
+
import { getCredentials } from '../../lib/api-client.js';
|
|
8
|
+
import { CollectionService } from './service.js';
|
|
9
|
+
function showHelp() {
|
|
10
|
+
console.log(`
|
|
11
|
+
Get Collection Details
|
|
12
|
+
|
|
13
|
+
Get detailed information about a collection by ID or handle.
|
|
14
|
+
|
|
15
|
+
USAGE:
|
|
16
|
+
ecomcoder collection get [OPTIONS]
|
|
17
|
+
|
|
18
|
+
REQUIRED OPTIONS (one of):
|
|
19
|
+
--id <id> Collection ID (numeric or GID format)
|
|
20
|
+
--handle <handle> Collection handle (URL slug)
|
|
21
|
+
|
|
22
|
+
OPTIONAL OPTIONS:
|
|
23
|
+
--session-id <id> Session ID for authentication
|
|
24
|
+
|
|
25
|
+
EXAMPLES:
|
|
26
|
+
# Get by numeric ID
|
|
27
|
+
ecomcoder collection get --id=123
|
|
28
|
+
|
|
29
|
+
# Get by GID
|
|
30
|
+
ecomcoder collection get --id="gid://shopify/Collection/123"
|
|
31
|
+
|
|
32
|
+
# Get by handle
|
|
33
|
+
ecomcoder collection get --handle=summer-collection
|
|
34
|
+
|
|
35
|
+
OUTPUT:
|
|
36
|
+
JSON object with collection details:
|
|
37
|
+
{
|
|
38
|
+
"success": true,
|
|
39
|
+
"data": {
|
|
40
|
+
"collection": {
|
|
41
|
+
"id": "gid://shopify/Collection/123",
|
|
42
|
+
"title": "Summer Collection",
|
|
43
|
+
"handle": "summer-collection",
|
|
44
|
+
"description": "Summer products and accessories",
|
|
45
|
+
"productsCount": 42,
|
|
46
|
+
"sortOrder": "BEST_SELLING",
|
|
47
|
+
"updatedAt": "2026-02-03T12:00:00Z",
|
|
48
|
+
"image": {
|
|
49
|
+
"url": "https://cdn.shopify.com/...",
|
|
50
|
+
"altText": "Summer collection banner"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`);
|
|
56
|
+
}
|
|
57
|
+
export async function run(argv) {
|
|
58
|
+
const args = parseArgs(argv);
|
|
59
|
+
if (args.help) {
|
|
60
|
+
showHelp();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// Validate input
|
|
64
|
+
if (!args.id && !args.handle) {
|
|
65
|
+
console.error('Error: Either --id or --handle must be provided\n');
|
|
66
|
+
showHelp();
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
const credentials = await getCredentials(args.sessionId);
|
|
70
|
+
// Call service
|
|
71
|
+
const result = await CollectionService.getCollection(credentials, {
|
|
72
|
+
id: args.id,
|
|
73
|
+
handle: args.handle
|
|
74
|
+
});
|
|
75
|
+
console.log(JSON.stringify(result, null, 2));
|
|
76
|
+
if (!result.success) {
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/collection/get.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;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selves
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Register all collection commands
|
|
8
|
+
*/
|
|
9
|
+
export declare function registerCollectionCommands(): void;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/collection/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CA8CjD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection Commands Registration
|
|
3
|
+
*
|
|
4
|
+
* Following Open/Closed Principle - commands register themselves
|
|
5
|
+
*/
|
|
6
|
+
import { registry } from '../../lib/command-registry.js';
|
|
7
|
+
import { HelpGenerator } from '../../lib/help-generator.js';
|
|
8
|
+
/**
|
|
9
|
+
* Register all collection commands
|
|
10
|
+
*/
|
|
11
|
+
export function registerCollectionCommands() {
|
|
12
|
+
// Register command group
|
|
13
|
+
registry.registerGroup({
|
|
14
|
+
command: 'collection',
|
|
15
|
+
description: 'View collections and product-collection relationships',
|
|
16
|
+
showHelp: () => {
|
|
17
|
+
console.log(HelpGenerator.generateGroupHelp('collection'));
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
// Register individual subcommands
|
|
21
|
+
registry.register({
|
|
22
|
+
command: 'collection',
|
|
23
|
+
subcommand: 'get',
|
|
24
|
+
description: 'Get collection details by ID or handle',
|
|
25
|
+
category: 'CRUD',
|
|
26
|
+
quickExample: 'ecomcoder collection get --id=123',
|
|
27
|
+
handler: async () => await import('./get.js')
|
|
28
|
+
});
|
|
29
|
+
registry.register({
|
|
30
|
+
command: 'collection',
|
|
31
|
+
subcommand: 'list',
|
|
32
|
+
description: 'List all collections with filtering and pagination',
|
|
33
|
+
category: 'Manage',
|
|
34
|
+
quickExample: 'ecomcoder collection list --query="summer" --sort=TITLE',
|
|
35
|
+
handler: async () => await import('./list.js')
|
|
36
|
+
});
|
|
37
|
+
registry.register({
|
|
38
|
+
command: 'collection',
|
|
39
|
+
subcommand: 'list-products',
|
|
40
|
+
description: 'List products within a specific collection',
|
|
41
|
+
category: 'Manage',
|
|
42
|
+
quickExample: 'ecomcoder collection list-products --id=123',
|
|
43
|
+
handler: async () => await import('./list-products.js')
|
|
44
|
+
});
|
|
45
|
+
registry.register({
|
|
46
|
+
command: 'collection',
|
|
47
|
+
subcommand: 'get-product-collections',
|
|
48
|
+
description: 'View which collections a product belongs to',
|
|
49
|
+
category: 'Manage',
|
|
50
|
+
quickExample: 'ecomcoder collection get-product-collections --product-id=456',
|
|
51
|
+
handler: async () => await import('./get-product-collections.js')
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/collection/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;GAEG;AACH,MAAM,UAAU,0BAA0B;IACxC,yBAAyB;IACzB,QAAQ,CAAC,aAAa,CAAC;QACrB,OAAO,EAAE,YAAY;QACrB,WAAW,EAAE,uDAAuD;QACpE,QAAQ,EAAE,GAAG,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC;QAC7D,CAAC;KACF,CAAC,CAAC;IAEH,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,YAAY;QACrB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,wCAAwC;QACrD,QAAQ,EAAE,MAAM;QAChB,YAAY,EAAE,mCAAmC;QACjD,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC;KAC9C,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,YAAY;QACrB,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,oDAAoD;QACjE,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,yDAAyD;QACvE,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,WAAW,CAAC;KAC/C,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,YAAY;QACrB,UAAU,EAAE,eAAe;QAC3B,WAAW,EAAE,4CAA4C;QACzD,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,6CAA6C;QAC3D,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,oBAAoB,CAAC;KACxD,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,YAAY;QACrB,UAAU,EAAE,yBAAyB;QACrC,WAAW,EAAE,6CAA6C;QAC1D,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,+DAA+D;QAC7E,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,8BAA8B,CAAC;KAClE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-products.d.ts","sourceRoot":"","sources":["../../../src/commands/collection/list-products.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoEH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,iBAyCvC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection List Products Command
|
|
3
|
+
*
|
|
4
|
+
* List all products within a specific collection
|
|
5
|
+
*/
|
|
6
|
+
import { parseArgs } from '../../lib/args-parser.js';
|
|
7
|
+
import { getCredentials } from '../../lib/api-client.js';
|
|
8
|
+
import { CollectionService } from './service.js';
|
|
9
|
+
function showHelp() {
|
|
10
|
+
console.log(`
|
|
11
|
+
List Products in Collection
|
|
12
|
+
|
|
13
|
+
List all products within a specific collection with pagination support.
|
|
14
|
+
|
|
15
|
+
USAGE:
|
|
16
|
+
ecomcoder collection list-products [OPTIONS]
|
|
17
|
+
|
|
18
|
+
REQUIRED OPTIONS (one of):
|
|
19
|
+
--id <id> Collection ID (numeric or GID format)
|
|
20
|
+
--handle <handle> Collection handle (URL slug)
|
|
21
|
+
|
|
22
|
+
OPTIONAL OPTIONS:
|
|
23
|
+
--limit <number> Max results per page (default: 50, max: 250)
|
|
24
|
+
--cursor <cursor> Pagination cursor from previous response
|
|
25
|
+
--session-id <id> Session ID for authentication
|
|
26
|
+
|
|
27
|
+
EXAMPLES:
|
|
28
|
+
# List products in collection by ID
|
|
29
|
+
ecomcoder collection list-products --id=123
|
|
30
|
+
|
|
31
|
+
# List products by handle
|
|
32
|
+
ecomcoder collection list-products --handle=summer-collection
|
|
33
|
+
|
|
34
|
+
# Limit results
|
|
35
|
+
ecomcoder collection list-products --id=123 --limit=100
|
|
36
|
+
|
|
37
|
+
# Pagination - get next page
|
|
38
|
+
ecomcoder collection list-products --id=123 --cursor="eyJsYXN0X2lkIjo0NTZ9"
|
|
39
|
+
|
|
40
|
+
OUTPUT:
|
|
41
|
+
JSON object with collection info and products:
|
|
42
|
+
{
|
|
43
|
+
"success": true,
|
|
44
|
+
"data": {
|
|
45
|
+
"collection": {
|
|
46
|
+
"id": "gid://shopify/Collection/123",
|
|
47
|
+
"title": "Summer Collection"
|
|
48
|
+
},
|
|
49
|
+
"products": [
|
|
50
|
+
{
|
|
51
|
+
"id": "gid://shopify/Product/456",
|
|
52
|
+
"title": "Summer Dress",
|
|
53
|
+
"handle": "summer-dress",
|
|
54
|
+
"status": "ACTIVE",
|
|
55
|
+
"priceRange": {
|
|
56
|
+
"min": "49.99",
|
|
57
|
+
"max": "49.99",
|
|
58
|
+
"currencyCode": "USD"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"pageInfo": {
|
|
63
|
+
"hasNextPage": true,
|
|
64
|
+
"endCursor": "eyJsYXN0X2lkIjo0NTZ9"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
`);
|
|
69
|
+
}
|
|
70
|
+
export async function run(argv) {
|
|
71
|
+
const args = parseArgs(argv);
|
|
72
|
+
if (args.help) {
|
|
73
|
+
showHelp();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// Validate input
|
|
77
|
+
if (!args.id && !args.handle) {
|
|
78
|
+
console.error('Error: Either --id or --handle must be provided\n');
|
|
79
|
+
showHelp();
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
const credentials = await getCredentials(args.sessionId);
|
|
83
|
+
// Parse and validate limit
|
|
84
|
+
let limit;
|
|
85
|
+
if (args.limit) {
|
|
86
|
+
limit = parseInt(args.limit, 10);
|
|
87
|
+
if (isNaN(limit) || limit <= 0) {
|
|
88
|
+
console.error('Error: --limit must be a positive number\n');
|
|
89
|
+
showHelp();
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Call service
|
|
94
|
+
const result = await CollectionService.listProducts(credentials, {
|
|
95
|
+
id: args.id,
|
|
96
|
+
handle: args.handle,
|
|
97
|
+
limit,
|
|
98
|
+
cursor: args.cursor
|
|
99
|
+
});
|
|
100
|
+
console.log(JSON.stringify(result, null, 2));
|
|
101
|
+
if (!result.success) {
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=list-products.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-products.js","sourceRoot":"","sources":["../../../src/commands/collection/list-products.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE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AAM;QACnB,KAAK;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAE7C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/collection/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkEH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,iBA2CvC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection List Command
|
|
3
|
+
*
|
|
4
|
+
* List all collections in the store with filtering and pagination
|
|
5
|
+
*/
|
|
6
|
+
import { parseArgs } from '../../lib/args-parser.js';
|
|
7
|
+
import { getCredentials } from '../../lib/api-client.js';
|
|
8
|
+
import { CollectionService } from './service.js';
|
|
9
|
+
function showHelp() {
|
|
10
|
+
console.log(`
|
|
11
|
+
List Collections
|
|
12
|
+
|
|
13
|
+
List all collections in your store with filtering and pagination support.
|
|
14
|
+
|
|
15
|
+
USAGE:
|
|
16
|
+
ecomcoder collection list [OPTIONS]
|
|
17
|
+
|
|
18
|
+
OPTIONAL OPTIONS:
|
|
19
|
+
--limit <number> Max results per page (default: 50, max: 250)
|
|
20
|
+
--cursor <cursor> Pagination cursor from previous response
|
|
21
|
+
--query <query> Search/filter collections by title
|
|
22
|
+
--sort <key> Sort by: TITLE, UPDATED_AT, ID (default: ID)
|
|
23
|
+
--reverse Reverse sort order
|
|
24
|
+
--session-id <id> Session ID for authentication
|
|
25
|
+
|
|
26
|
+
EXAMPLES:
|
|
27
|
+
# List first 50 collections
|
|
28
|
+
ecomcoder collection list
|
|
29
|
+
|
|
30
|
+
# List 100 collections
|
|
31
|
+
ecomcoder collection list --limit=100
|
|
32
|
+
|
|
33
|
+
# Search for collections containing "summer"
|
|
34
|
+
ecomcoder collection list --query="summer"
|
|
35
|
+
|
|
36
|
+
# Sort by title
|
|
37
|
+
ecomcoder collection list --sort=TITLE
|
|
38
|
+
|
|
39
|
+
# Sort by most recently updated
|
|
40
|
+
ecomcoder collection list --sort=UPDATED_AT --reverse
|
|
41
|
+
|
|
42
|
+
# Pagination - get next page
|
|
43
|
+
ecomcoder collection list --cursor="eyJsYXN0X2lkIjoxMjN9"
|
|
44
|
+
|
|
45
|
+
OUTPUT:
|
|
46
|
+
JSON object with collections list and pagination:
|
|
47
|
+
{
|
|
48
|
+
"success": true,
|
|
49
|
+
"data": {
|
|
50
|
+
"collections": [
|
|
51
|
+
{
|
|
52
|
+
"id": "gid://shopify/Collection/123",
|
|
53
|
+
"title": "Summer Collection",
|
|
54
|
+
"handle": "summer-collection",
|
|
55
|
+
"productsCount": 42,
|
|
56
|
+
"updatedAt": "2026-02-03T12:00:00Z"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"pageInfo": {
|
|
60
|
+
"hasNextPage": true,
|
|
61
|
+
"endCursor": "eyJsYXN0X2lkIjoxMjN9"
|
|
62
|
+
},
|
|
63
|
+
"count": 1
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`);
|
|
67
|
+
}
|
|
68
|
+
export async function run(argv) {
|
|
69
|
+
const args = parseArgs(argv);
|
|
70
|
+
if (args.help) {
|
|
71
|
+
showHelp();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const credentials = await getCredentials(args.sessionId);
|
|
75
|
+
// Parse and validate limit
|
|
76
|
+
let limit;
|
|
77
|
+
if (args.limit) {
|
|
78
|
+
limit = parseInt(args.limit, 10);
|
|
79
|
+
if (isNaN(limit) || limit <= 0) {
|
|
80
|
+
console.error('Error: --limit must be a positive number\n');
|
|
81
|
+
showHelp();
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// Validate sort key
|
|
86
|
+
const validSortKeys = ['TITLE', 'UPDATED_AT', 'ID'];
|
|
87
|
+
if (args.sort && !validSortKeys.includes(args.sort)) {
|
|
88
|
+
console.error(`Error: --sort must be one of: ${validSortKeys.join(', ')}\n`);
|
|
89
|
+
showHelp();
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
// Call service
|
|
93
|
+
const result = await CollectionService.listCollections(credentials, {
|
|
94
|
+
limit,
|
|
95
|
+
cursor: args.cursor,
|
|
96
|
+
query: args.query,
|
|
97
|
+
sortKey: args.sort,
|
|
98
|
+
reverse: !!args.reverse
|
|
99
|
+
});
|
|
100
|
+
console.log(JSON.stringify(result, null, 2));
|
|
101
|
+
if (!result.success) {
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/collection/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDb,CAAC,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAc;IACtC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAE7B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,QAAQ,EAAE,CAAC;QACX,OAAO;IACT,CAAC;IAED,MAAM,WAAW,GAAG,M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,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection GraphQL Queries
|
|
3
|
+
* All queries verified against Shopify GraphQL Admin API 2026-01
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Get collection by ID
|
|
7
|
+
*/
|
|
8
|
+
export declare const GET_COLLECTION = "\n query GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n handle\n description\n descriptionHtml\n sortOrder\n productsCount\n updatedAt\n image {\n url\n altText\n }\n }\n }\n";
|
|
9
|
+
/**
|
|
10
|
+
* Get collection by handle
|
|
11
|
+
*/
|
|
12
|
+
export declare const GET_COLLECTION_BY_HANDLE = "\n query GetCollectionByHandle($handle: String!) {\n collectionByHandle(handle: $handle) {\n id\n title\n handle\n description\n descriptionHtml\n sortOrder\n productsCount\n updatedAt\n image {\n url\n altText\n }\n }\n }\n";
|
|
13
|
+
/**
|
|
14
|
+
* Get collection with products
|
|
15
|
+
* Used by list-products command
|
|
16
|
+
*/
|
|
17
|
+
export declare const GET_COLLECTION_PRODUCTS = "\n query GetCollectionProducts($id: ID!, $first: Int!, $after: String) {\n collection(id: $id) {\n id\n title\n products(first: $first, after: $after) {\n nodes {\n id\n title\n handle\n status\n priceRangeV2 {\n minVariantPrice {\n amount\n currencyCode\n }\n maxVariantPrice {\n amount\n currencyCode\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n";
|
|
18
|
+
/**
|
|
19
|
+
* Get collection by handle with products
|
|
20
|
+
*/
|
|
21
|
+
export declare const GET_COLLECTION_PRODUCTS_BY_HANDLE = "\n query GetCollectionProductsByHandle($handle: String!, $first: Int!, $after: String) {\n collectionByHandle(handle: $handle) {\n id\n title\n products(first: $first, after: $after) {\n nodes {\n id\n title\n handle\n status\n priceRangeV2 {\n minVariantPrice {\n amount\n currencyCode\n }\n maxVariantPrice {\n amount\n currencyCode\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n";
|
|
22
|
+
/**
|
|
23
|
+
* Get product's collections
|
|
24
|
+
* Used by get-product-collections command
|
|
25
|
+
*/
|
|
26
|
+
export declare const GET_PRODUCT_COLLECTIONS = "\n query GetProductCollections($id: ID!, $first: Int!, $after: String) {\n product(id: $id) {\n id\n title\n collections(first: $first, after: $after) {\n nodes {\n id\n title\n handle\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n";
|
|
27
|
+
/**
|
|
28
|
+
* List all collections
|
|
29
|
+
* Used by list command
|
|
30
|
+
*/
|
|
31
|
+
export declare const LIST_COLLECTIONS = "\n query ListCollections($first: Int!, $after: String, $query: String, $sortKey: CollectionSortKeys, $reverse: Boolean) {\n collections(first: $first, after: $after, query: $query, sortKey: $sortKey, reverse: $reverse) {\n nodes {\n id\n title\n handle\n productsCount\n updatedAt\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n";
|
|
32
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/commands/collection/queries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,6QAiB1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,6SAiBpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,wlBA6BnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC,wnBA6B7C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,+VAkBnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,maAgB5B,CAAC"}
|