ecomcoder-cli 1.3.2 → 1.3.4
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/README.md +0 -23
- package/dist/cli.js +32 -5
- package/dist/cli.js.map +1 -1
- 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/create.d.ts +8 -0
- package/dist/commands/product/create.d.ts.map +1 -0
- package/dist/commands/product/create.js +166 -0
- package/dist/commands/product/create.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/get-metafield.d.ts +8 -0
- package/dist/commands/product/get-metafield.d.ts.map +1 -0
- package/dist/commands/product/get-metafield.js +131 -0
- package/dist/commands/product/get-metafield.js.map +1 -0
- package/dist/commands/product/index.d.ts.map +1 -1
- package/dist/commands/product/index.js +62 -0
- package/dist/commands/product/index.js.map +1 -1
- package/dist/commands/product/queries.d.ts +31 -2
- package/dist/commands/product/queries.d.ts.map +1 -1
- package/dist/commands/product/queries.js +184 -0
- package/dist/commands/product/queries.js.map +1 -1
- package/dist/commands/product/service.d.ts +67 -1
- package/dist/commands/product/service.d.ts.map +1 -1
- package/dist/commands/product/service.js +363 -1
- package/dist/commands/product/service.js.map +1 -1
- package/dist/commands/product/set-metafield.d.ts +8 -0
- package/dist/commands/product/set-metafield.d.ts.map +1 -0
- package/dist/commands/product/set-metafield.js +174 -0
- package/dist/commands/product/set-metafield.js.map +1 -0
- package/dist/commands/product/types.d.ts +162 -0
- package/dist/commands/product/types.d.ts.map +1 -1
- package/dist/commands/product/update-status.d.ts +8 -0
- package/dist/commands/product/update-status.d.ts.map +1 -0
- package/dist/commands/product/update-status.js +105 -0
- package/dist/commands/product/update-status.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/dist/commands/products/index.d.ts.map +1 -1
- package/dist/commands/products/index.js +0 -10
- package/dist/commands/products/index.js.map +1 -1
- package/dist/commands/shop/get-metafield.d.ts +8 -0
- package/dist/commands/shop/get-metafield.d.ts.map +1 -0
- package/dist/commands/shop/get-metafield.js +117 -0
- package/dist/commands/shop/get-metafield.js.map +1 -0
- package/dist/commands/shop/index.d.ts +10 -0
- package/dist/commands/shop/index.d.ts.map +1 -0
- package/dist/commands/shop/index.js +61 -0
- package/dist/commands/shop/index.js.map +1 -0
- package/dist/commands/shop/queries.d.ts +24 -0
- package/dist/commands/shop/queries.d.ts.map +1 -0
- package/dist/commands/shop/queries.js +83 -0
- package/dist/commands/shop/queries.js.map +1 -0
- package/dist/commands/shop/service.d.ts +30 -0
- package/dist/commands/shop/service.d.ts.map +1 -0
- package/dist/commands/shop/service.js +131 -0
- package/dist/commands/shop/service.js.map +1 -0
- package/dist/commands/shop/set-metafield.d.ts +8 -0
- package/dist/commands/shop/set-metafield.d.ts.map +1 -0
- package/dist/commands/shop/set-metafield.js +174 -0
- package/dist/commands/shop/set-metafield.js.map +1 -0
- package/dist/commands/shop/types.d.ts +84 -0
- package/dist/commands/shop/types.d.ts.map +1 -0
- package/dist/commands/shop/types.js +6 -0
- package/dist/commands/shop/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-metafield.d.ts","sourceRoot":"","sources":["../../../src/commands/product/get-metafield.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmFH,wBAAsB,GAAG,CAAC,IAAI,GAAE,MAAM,EAA0B,iBAkD/D"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get Product Metafield 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
|
+
Get Product Metafield
|
|
13
|
+
|
|
14
|
+
USAGE:
|
|
15
|
+
ecomcoder product get-metafield [OPTIONS]
|
|
16
|
+
|
|
17
|
+
REQUIRED OPTIONS:
|
|
18
|
+
--id <id> Product ID (numeric or GID)
|
|
19
|
+
|
|
20
|
+
QUERY OPTIONS (choose one):
|
|
21
|
+
--namespace <ns> --key <key> Get specific metafield
|
|
22
|
+
--namespace <ns> Get all metafields in namespace
|
|
23
|
+
(no namespace/key) Get all metafields for product
|
|
24
|
+
|
|
25
|
+
OPTIONAL:
|
|
26
|
+
--session-id Session ID (auto-provided via SESSION_ID env var)
|
|
27
|
+
--help, -h Show this help message
|
|
28
|
+
|
|
29
|
+
EXAMPLES:
|
|
30
|
+
# Get specific metafield by namespace and key
|
|
31
|
+
ecomcoder product get-metafield \\
|
|
32
|
+
--id=123 \\
|
|
33
|
+
--namespace=bundles \\
|
|
34
|
+
--key=products
|
|
35
|
+
|
|
36
|
+
# Get all metafields in a namespace
|
|
37
|
+
ecomcoder product get-metafield \\
|
|
38
|
+
--id=123 \\
|
|
39
|
+
--namespace=custom
|
|
40
|
+
|
|
41
|
+
# Get all metafields for product (all namespaces)
|
|
42
|
+
ecomcoder product get-metafield --id=123
|
|
43
|
+
|
|
44
|
+
OUTPUT FORMATS:
|
|
45
|
+
Specific metafield (namespace + key):
|
|
46
|
+
{
|
|
47
|
+
"success": true,
|
|
48
|
+
"data": {
|
|
49
|
+
"metafield": {
|
|
50
|
+
"id": "gid://shopify/Metafield/123",
|
|
51
|
+
"namespace": "bundles",
|
|
52
|
+
"key": "products",
|
|
53
|
+
"value": "[\\"gid://shopify/Product/456\\"]",
|
|
54
|
+
"type": "list.product_reference",
|
|
55
|
+
"createdAt": "2024-01-20T10:30:00Z",
|
|
56
|
+
"updatedAt": "2024-01-20T15:45:00Z"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Multiple metafields (namespace or all):
|
|
62
|
+
{
|
|
63
|
+
"success": true,
|
|
64
|
+
"data": {
|
|
65
|
+
"metafields": [...],
|
|
66
|
+
"count": 5
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
Not found:
|
|
71
|
+
{
|
|
72
|
+
"success": true,
|
|
73
|
+
"data": {
|
|
74
|
+
"metafield": null
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
NOTES:
|
|
79
|
+
- Returns up to 250 metafields when querying multiple
|
|
80
|
+
- Namespace filter is optional (omit to get all namespaces)
|
|
81
|
+
- Key requires namespace (cannot query by key alone)
|
|
82
|
+
- Metafield values are always strings (parse JSON for complex types)
|
|
83
|
+
`);
|
|
84
|
+
process.exit(0);
|
|
85
|
+
}
|
|
86
|
+
export async function run(argv = process.argv.slice(2)) {
|
|
87
|
+
if (hasHelpFlag(argv)) {
|
|
88
|
+
showHelp();
|
|
89
|
+
}
|
|
90
|
+
const args = parseArgs(argv);
|
|
91
|
+
// Validate required arguments
|
|
92
|
+
if (!args.id) {
|
|
93
|
+
console.error(JSON.stringify({
|
|
94
|
+
success: false,
|
|
95
|
+
error: 'Missing required argument: --id'
|
|
96
|
+
}));
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
// Validate key requires namespace
|
|
100
|
+
if (args.key && !args.namespace) {
|
|
101
|
+
console.error(JSON.stringify({
|
|
102
|
+
success: false,
|
|
103
|
+
error: 'Key requires namespace. Use --namespace with --key'
|
|
104
|
+
}));
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
// Get credentials
|
|
109
|
+
const sessionId = getSessionId(args.sessionId);
|
|
110
|
+
const credentials = await getCredentials(sessionId, args.backendUrl, args.jwt);
|
|
111
|
+
// Execute get metafield via service
|
|
112
|
+
const result = await ProductService.getMetafield(credentials, {
|
|
113
|
+
id: args.id,
|
|
114
|
+
namespace: args.namespace,
|
|
115
|
+
key: args.key
|
|
116
|
+
});
|
|
117
|
+
// Output result
|
|
118
|
+
console.log(JSON.stringify(result, null, 2));
|
|
119
|
+
if (!result.success) {
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
console.error(JSON.stringify({
|
|
125
|
+
success: false,
|
|
126
|
+
error: error.message || 'Unknown error occurred'
|
|
127
|
+
}));
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=get-metafield.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-metafield.js","sourceRoot":"","sources":["../../../src/commands/product/get-metafield.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEb,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,CA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AAO,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,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,CAiJ9C"}
|
|
@@ -20,17 +20,34 @@ USAGE:
|
|
|
20
20
|
ecomcoder product <subcommand> [options]
|
|
21
21
|
|
|
22
22
|
SUBCOMMANDS:
|
|
23
|
+
create Create a new product from scratch
|
|
23
24
|
get Get product details by ID, title, or handle
|
|
25
|
+
get-metafield View product metafield values
|
|
26
|
+
set-metafield Set or update product metafield values
|
|
24
27
|
update-title Update product title
|
|
25
28
|
update-description Update product description
|
|
26
29
|
update-price Update product price and compare-at price
|
|
30
|
+
update-status Update product status (ACTIVE, DRAFT, ARCHIVED, UNLISTED)
|
|
27
31
|
update-template Change product template assignment
|
|
32
|
+
create-variants Create product variants (bulk operation)
|
|
33
|
+
delete-variants Delete product variants (bulk operation)
|
|
28
34
|
|
|
29
35
|
EXAMPLES:
|
|
36
|
+
# Create product
|
|
37
|
+
ecomcoder product create --title="Premium Hair Serum" --price=29.99 --sku="HAIR-001"
|
|
38
|
+
|
|
30
39
|
# Get product details
|
|
31
40
|
ecomcoder product get --title="Blue T-Shirt"
|
|
32
41
|
ecomcoder product get --id=123456789
|
|
33
42
|
|
|
43
|
+
# Get metafield value
|
|
44
|
+
ecomcoder product get-metafield --id=123 --namespace=bundles --key=products
|
|
45
|
+
|
|
46
|
+
# Set metafield (AI bundle automation)
|
|
47
|
+
ecomcoder product set-metafield --id=123 --namespace=bundles --key=products \\
|
|
48
|
+
--value='["gid://shopify/Product/456","gid://shopify/Product/789"]' \\
|
|
49
|
+
--type=list.product_reference
|
|
50
|
+
|
|
34
51
|
# Update title
|
|
35
52
|
ecomcoder product update-title --id=123 --title="Premium Cotton T-Shirt"
|
|
36
53
|
|
|
@@ -40,21 +57,48 @@ EXAMPLES:
|
|
|
40
57
|
# Update price
|
|
41
58
|
ecomcoder product update-price --id=123 --price=34.99 --compare-at-price=49.99
|
|
42
59
|
|
|
60
|
+
# Update status
|
|
61
|
+
ecomcoder product update-status --id=123 --status=ACTIVE
|
|
62
|
+
|
|
43
63
|
# Change template
|
|
44
64
|
ecomcoder product update-template --id=123 --template=premium
|
|
45
65
|
|
|
66
|
+
# Create variants
|
|
67
|
+
ecomcoder product create-variants --product-id=123 --variants='[{"price":"29.99","inventoryItem":{"sku":"TEST-001"}}]'
|
|
68
|
+
|
|
69
|
+
# Delete variants
|
|
70
|
+
ecomcoder product delete-variants --product-id=123 --variant-ids="456,789"
|
|
71
|
+
|
|
46
72
|
For detailed help on a specific subcommand:
|
|
47
73
|
ecomcoder product <subcommand> --help
|
|
48
74
|
`);
|
|
49
75
|
}
|
|
50
76
|
});
|
|
51
77
|
// Register individual subcommands
|
|
78
|
+
registry.register({
|
|
79
|
+
command: 'product',
|
|
80
|
+
subcommand: 'create',
|
|
81
|
+
description: 'Create a new product from scratch',
|
|
82
|
+
handler: async () => await import('./create.js')
|
|
83
|
+
});
|
|
52
84
|
registry.register({
|
|
53
85
|
command: 'product',
|
|
54
86
|
subcommand: 'get',
|
|
55
87
|
description: 'Get product details by ID, title, or handle',
|
|
56
88
|
handler: async () => await import('./get.js')
|
|
57
89
|
});
|
|
90
|
+
registry.register({
|
|
91
|
+
command: 'product',
|
|
92
|
+
subcommand: 'get-metafield',
|
|
93
|
+
description: 'View product metafield values',
|
|
94
|
+
handler: async () => await import('./get-metafield.js')
|
|
95
|
+
});
|
|
96
|
+
registry.register({
|
|
97
|
+
command: 'product',
|
|
98
|
+
subcommand: 'set-metafield',
|
|
99
|
+
description: 'Set or update product metafield values',
|
|
100
|
+
handler: async () => await import('./set-metafield.js')
|
|
101
|
+
});
|
|
58
102
|
registry.register({
|
|
59
103
|
command: 'product',
|
|
60
104
|
subcommand: 'update-title',
|
|
@@ -73,11 +117,29 @@ For detailed help on a specific subcommand:
|
|
|
73
117
|
description: 'Update product price and compare-at price',
|
|
74
118
|
handler: async () => await import('./update-price.js')
|
|
75
119
|
});
|
|
120
|
+
registry.register({
|
|
121
|
+
command: 'product',
|
|
122
|
+
subcommand: 'update-status',
|
|
123
|
+
description: 'Update product status (ACTIVE, DRAFT, ARCHIVED, UNLISTED)',
|
|
124
|
+
handler: async () => await import('./update-status.js')
|
|
125
|
+
});
|
|
76
126
|
registry.register({
|
|
77
127
|
command: 'product',
|
|
78
128
|
subcommand: 'update-template',
|
|
79
129
|
description: 'Change product template assignment',
|
|
80
130
|
handler: async () => await import('./update-template.js')
|
|
81
131
|
});
|
|
132
|
+
registry.register({
|
|
133
|
+
command: 'product',
|
|
134
|
+
subcommand: 'create-variants',
|
|
135
|
+
description: 'Create product variants (bulk operation)',
|
|
136
|
+
handler: async () => await import('./create-variants.js')
|
|
137
|
+
});
|
|
138
|
+
registry.register({
|
|
139
|
+
command: 'product',
|
|
140
|
+
subcommand: 'delete-variants',
|
|
141
|
+
description: 'Delete product variants (bulk operation)',
|
|
142
|
+
handler: async () => await import('./delete-variants.js')
|
|
143
|
+
});
|
|
82
144
|
}
|
|
83
145
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DjB,CAAC,CAAC;QACC,CAAC;KACF,CAAC,CAAC;IAEH,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,CAAC;QAChB,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,mCAAmC;QAChD,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC;KACjD,CAAC,CAAC;IAEH,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,C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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,33 @@ 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";
|
|
42
|
+
/**
|
|
43
|
+
* Get specific product metafield by namespace and key
|
|
44
|
+
*/
|
|
45
|
+
export declare const GET_PRODUCT_METAFIELD = "\n query getProductMetafield($id: ID!, $namespace: String!, $key: String!) {\n product(id: $id) {\n id\n metafield(namespace: $namespace, key: $key) {\n id\n namespace\n key\n value\n type\n createdAt\n updatedAt\n }\n }\n }\n";
|
|
46
|
+
/**
|
|
47
|
+
* Get product metafields (multiple)
|
|
48
|
+
* Used for querying all metafields or by namespace
|
|
49
|
+
*/
|
|
50
|
+
export declare const GET_PRODUCT_METAFIELDS = "\n query getProductMetafields($id: ID!, $namespace: String, $first: Int) {\n product(id: $id) {\n id\n metafields(namespace: $namespace, first: $first) {\n edges {\n node {\n id\n namespace\n key\n value\n type\n createdAt\n updatedAt\n }\n }\n }\n }\n }\n";
|
|
51
|
+
/**
|
|
52
|
+
* Set metafield values for a product
|
|
53
|
+
* Maximum 25 metafields per request, atomic operation
|
|
54
|
+
*/
|
|
55
|
+
export declare const METAFIELDS_SET = "\n mutation metafieldsSet($metafields: [MetafieldsSetInput!]!) {\n metafieldsSet(metafields: $metafields) {\n metafields {\n id\n namespace\n key\n value\n type\n createdAt\n updatedAt\n }\n userErrors {\n field\n message\n code\n }\n }\n }\n";
|
|
56
|
+
/**
|
|
57
|
+
* Create a new product from scratch
|
|
58
|
+
* Creates product with 1 initial variant
|
|
59
|
+
*/
|
|
60
|
+
export declare const PRODUCT_CREATE = "\n mutation productCreate($input: ProductInput!) {\n productCreate(input: $input) {\n product {\n id\n title\n description\n descriptionHtml\n handle\n status\n productType\n vendor\n tags\n templateSuffix\n options {\n id\n name\n position\n values\n }\n variants(first: 10) {\n edges {\n node {\n id\n title\n sku\n price\n compareAtPrice\n inventoryQuantity\n availableForSale\n }\n }\n }\n priceRangeV2 {\n minVariantPrice {\n amount\n currencyCode\n }\n maxVariantPrice {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\n";
|
|
32
61
|
//# 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;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,+SAejC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,yYAmBlC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,yVAmB1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,q8BAkD1B,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,176 @@ 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
|
+
`;
|
|
257
|
+
/**
|
|
258
|
+
* Get specific product metafield by namespace and key
|
|
259
|
+
*/
|
|
260
|
+
export const GET_PRODUCT_METAFIELD = `
|
|
261
|
+
query getProductMetafield($id: ID!, $namespace: String!, $key: String!) {
|
|
262
|
+
product(id: $id) {
|
|
263
|
+
id
|
|
264
|
+
metafield(namespace: $namespace, key: $key) {
|
|
265
|
+
id
|
|
266
|
+
namespace
|
|
267
|
+
key
|
|
268
|
+
value
|
|
269
|
+
type
|
|
270
|
+
createdAt
|
|
271
|
+
updatedAt
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
`;
|
|
276
|
+
/**
|
|
277
|
+
* Get product metafields (multiple)
|
|
278
|
+
* Used for querying all metafields or by namespace
|
|
279
|
+
*/
|
|
280
|
+
export const GET_PRODUCT_METAFIELDS = `
|
|
281
|
+
query getProductMetafields($id: ID!, $namespace: String, $first: Int) {
|
|
282
|
+
product(id: $id) {
|
|
283
|
+
id
|
|
284
|
+
metafields(namespace: $namespace, first: $first) {
|
|
285
|
+
edges {
|
|
286
|
+
node {
|
|
287
|
+
id
|
|
288
|
+
namespace
|
|
289
|
+
key
|
|
290
|
+
value
|
|
291
|
+
type
|
|
292
|
+
createdAt
|
|
293
|
+
updatedAt
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
`;
|
|
300
|
+
/**
|
|
301
|
+
* Set metafield values for a product
|
|
302
|
+
* Maximum 25 metafields per request, atomic operation
|
|
303
|
+
*/
|
|
304
|
+
export const METAFIELDS_SET = `
|
|
305
|
+
mutation metafieldsSet($metafields: [MetafieldsSetInput!]!) {
|
|
306
|
+
metafieldsSet(metafields: $metafields) {
|
|
307
|
+
metafields {
|
|
308
|
+
id
|
|
309
|
+
namespace
|
|
310
|
+
key
|
|
311
|
+
value
|
|
312
|
+
type
|
|
313
|
+
createdAt
|
|
314
|
+
updatedAt
|
|
315
|
+
}
|
|
316
|
+
userErrors {
|
|
317
|
+
field
|
|
318
|
+
message
|
|
319
|
+
code
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
`;
|
|
324
|
+
/**
|
|
325
|
+
* Create a new product from scratch
|
|
326
|
+
* Creates product with 1 initial variant
|
|
327
|
+
*/
|
|
328
|
+
export const PRODUCT_CREATE = `
|
|
329
|
+
mutation productCreate($input: ProductInput!) {
|
|
330
|
+
productCreate(input: $input) {
|
|
331
|
+
product {
|
|
332
|
+
id
|
|
333
|
+
title
|
|
334
|
+
description
|
|
335
|
+
descriptionHtml
|
|
336
|
+
handle
|
|
337
|
+
status
|
|
338
|
+
productType
|
|
339
|
+
vendor
|
|
340
|
+
tags
|
|
341
|
+
templateSuffix
|
|
342
|
+
options {
|
|
343
|
+
id
|
|
344
|
+
name
|
|
345
|
+
position
|
|
346
|
+
values
|
|
347
|
+
}
|
|
348
|
+
variants(first: 10) {
|
|
349
|
+
edges {
|
|
350
|
+
node {
|
|
351
|
+
id
|
|
352
|
+
title
|
|
353
|
+
sku
|
|
354
|
+
price
|
|
355
|
+
compareAtPrice
|
|
356
|
+
inventoryQuantity
|
|
357
|
+
availableForSale
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
priceRangeV2 {
|
|
362
|
+
minVariantPrice {
|
|
363
|
+
amount
|
|
364
|
+
currencyCode
|
|
365
|
+
}
|
|
366
|
+
maxVariantPrice {
|
|
367
|
+
amount
|
|
368
|
+
currencyCode
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
userErrors {
|
|
373
|
+
field
|
|
374
|
+
message
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
`;
|
|
195
379
|
//# 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;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;CAepC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;CAmBrC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;CAmB7B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD7B,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, UpdateTitleInput, UpdatePriceInput, UpdateTemplateInput, CommandResult } from './types.js';
|
|
8
|
+
import type { ShopifyProduct, FormattedProduct, UpdateDescriptionInput, UpdateTitleInput, UpdateStatusInput, UpdatePriceInput, UpdateTemplateInput, SetMetafieldInput, GetMetafieldInput, DeleteVariantsInput, CreateVariantsInput, CreateProductInput, CommandResult } from './types.js';
|
|
9
9
|
/**
|
|
10
10
|
* Product Service
|
|
11
11
|
*
|
|
@@ -19,6 +19,14 @@ export declare class ProductService {
|
|
|
19
19
|
* @throws Error if product not found or GraphQL errors occur
|
|
20
20
|
*/
|
|
21
21
|
static getProductById(credentials: ShopifyCredentials, productId: string): Promise<ShopifyProduct>;
|
|
22
|
+
/**
|
|
23
|
+
* Create a new product from scratch
|
|
24
|
+
*
|
|
25
|
+
* @returns Formatted result with created product data
|
|
26
|
+
*/
|
|
27
|
+
static createProduct(credentials: ShopifyCredentials, input: CreateProductInput): Promise<CommandResult<{
|
|
28
|
+
product: FormattedProduct;
|
|
29
|
+
}>>;
|
|
22
30
|
/**
|
|
23
31
|
* Update product description
|
|
24
32
|
*
|
|
@@ -35,6 +43,32 @@ export declare class ProductService {
|
|
|
35
43
|
static updateTitle(credentials: ShopifyCredentials, input: UpdateTitleInput): Promise<CommandResult<{
|
|
36
44
|
product: FormattedProduct;
|
|
37
45
|
}>>;
|
|
46
|
+
/**
|
|
47
|
+
* Update product status
|
|
48
|
+
*
|
|
49
|
+
* @returns Formatted result with updated product data
|
|
50
|
+
*/
|
|
51
|
+
static updateStatus(credentials: ShopifyCredentials, input: UpdateStatusInput): Promise<CommandResult<{
|
|
52
|
+
product: FormattedProduct;
|
|
53
|
+
}>>;
|
|
54
|
+
/**
|
|
55
|
+
* Set product metafield value
|
|
56
|
+
*
|
|
57
|
+
* @returns Formatted result with metafield data
|
|
58
|
+
*/
|
|
59
|
+
static setMetafield(credentials: ShopifyCredentials, input: SetMetafieldInput): Promise<CommandResult<{
|
|
60
|
+
metafield: any;
|
|
61
|
+
}>>;
|
|
62
|
+
/**
|
|
63
|
+
* Get product metafield(s)
|
|
64
|
+
*
|
|
65
|
+
* @returns Formatted result with metafield data
|
|
66
|
+
*/
|
|
67
|
+
static getMetafield(credentials: ShopifyCredentials, input: GetMetafieldInput): Promise<CommandResult<{
|
|
68
|
+
metafield?: any;
|
|
69
|
+
metafields?: any[];
|
|
70
|
+
count?: number;
|
|
71
|
+
}>>;
|
|
38
72
|
/**
|
|
39
73
|
* Update product variant price
|
|
40
74
|
* Uses productVariantsBulkUpdate mutation (current Shopify API)
|
|
@@ -55,5 +89,37 @@ export declare class ProductService {
|
|
|
55
89
|
static updateTemplate(credentials: ShopifyCredentials, input: UpdateTemplateInput): Promise<CommandResult<{
|
|
56
90
|
product: FormattedProduct;
|
|
57
91
|
}>>;
|
|
92
|
+
/**
|
|
93
|
+
* Delete product variants in bulk
|
|
94
|
+
* Uses productVariantsBulkDelete mutation (current Shopify API)
|
|
95
|
+
*
|
|
96
|
+
* IMPORTANT:
|
|
97
|
+
* - Cannot delete the last variant of a product
|
|
98
|
+
* - All variants must belong to the specified product
|
|
99
|
+
* - Cannot delete variants with active/unfulfilled orders
|
|
100
|
+
*
|
|
101
|
+
* @returns Formatted result with remaining variants
|
|
102
|
+
*/
|
|
103
|
+
static deleteVariants(credentials: ShopifyCredentials, input: DeleteVariantsInput): Promise<CommandResult<{
|
|
104
|
+
product: FormattedProduct;
|
|
105
|
+
deletedCount: number;
|
|
106
|
+
remainingVariants: number;
|
|
107
|
+
}>>;
|
|
108
|
+
/**
|
|
109
|
+
* Create product variants in bulk
|
|
110
|
+
* Uses productVariantsBulkCreate mutation (current Shopify API)
|
|
111
|
+
*
|
|
112
|
+
* IMPORTANT:
|
|
113
|
+
* - Maximum 2,048 variants per product
|
|
114
|
+
* - SKU must be unique across all products (if provided)
|
|
115
|
+
* - Option values must match product options
|
|
116
|
+
*
|
|
117
|
+
* @returns Formatted result with created variants
|
|
118
|
+
*/
|
|
119
|
+
static createVariants(credentials: ShopifyCredentials, input: CreateVariantsInput): Promise<CommandResult<{
|
|
120
|
+
product: FormattedProduct;
|
|
121
|
+
createdCount: number;
|
|
122
|
+
createdVariants: any[];
|
|
123
|
+
}>>;
|
|
58
124
|
}
|
|
59
125
|
//# 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;AAuB7D,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EASlB,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,aAAa,CACxB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,aAAa,CAAC;QAAE,OAAO,EAAE,gBAAgB,CAAA;KAAE,CAAC,CAAC;IA8HxD;;;;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,WAA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