shop-cli 0.1.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/LICENSE +21 -0
- package/README.md +392 -0
- package/bin/shop-cli.js +17 -0
- package/bin/shop.js +16 -0
- package/dist/adminClient.d.ts +34 -0
- package/dist/adminClient.js +144 -0
- package/dist/cli/client.d.ts +10 -0
- package/dist/cli/client.js +56 -0
- package/dist/cli/command.d.ts +5 -0
- package/dist/cli/command.js +62 -0
- package/dist/cli/errors.d.ts +4 -0
- package/dist/cli/errors.js +35 -0
- package/dist/cli/gid.d.ts +3 -0
- package/dist/cli/gid.js +42 -0
- package/dist/cli/globalFlags.d.ts +15 -0
- package/dist/cli/globalFlags.js +100 -0
- package/dist/cli/headers.d.ts +2 -0
- package/dist/cli/headers.js +79 -0
- package/dist/cli/help/format.d.ts +8 -0
- package/dist/cli/help/format.js +78 -0
- package/dist/cli/help/registry.d.ts +5 -0
- package/dist/cli/help/registry.js +6443 -0
- package/dist/cli/help/render.d.ts +8 -0
- package/dist/cli/help/render.js +399 -0
- package/dist/cli/help/spec.d.ts +39 -0
- package/dist/cli/help/spec.js +17 -0
- package/dist/cli/input.d.ts +9 -0
- package/dist/cli/input.js +104 -0
- package/dist/cli/introspection/deprecations.d.ts +1 -0
- package/dist/cli/introspection/deprecations.js +83 -0
- package/dist/cli/introspection/format.d.ts +6 -0
- package/dist/cli/introspection/format.js +63 -0
- package/dist/cli/introspection/index.d.ts +14 -0
- package/dist/cli/introspection/index.js +89 -0
- package/dist/cli/introspection/resources.d.ts +1 -0
- package/dist/cli/introspection/resources.js +127 -0
- package/dist/cli/output/computedFields.d.ts +39 -0
- package/dist/cli/output/computedFields.js +104 -0
- package/dist/cli/output.d.ts +37 -0
- package/dist/cli/output.js +332 -0
- package/dist/cli/parse-command.d.ts +18 -0
- package/dist/cli/parse-command.js +109 -0
- package/dist/cli/router.d.ts +29 -0
- package/dist/cli/router.js +480 -0
- package/dist/cli/selection/buildAllSelection.d.ts +13 -0
- package/dist/cli/selection/buildAllSelection.js +108 -0
- package/dist/cli/selection/graphqlSelection.d.ts +5 -0
- package/dist/cli/selection/graphqlSelection.js +301 -0
- package/dist/cli/selection/select.d.ts +13 -0
- package/dist/cli/selection/select.js +136 -0
- package/dist/cli/selection/stripDeprecated.d.ts +2 -0
- package/dist/cli/selection/stripDeprecated.js +63 -0
- package/dist/cli/suggest.d.ts +5 -0
- package/dist/cli/suggest.js +88 -0
- package/dist/cli/userErrors.d.ts +4 -0
- package/dist/cli/userErrors.js +41 -0
- package/dist/cli/verbs/_shared.d.ts +38 -0
- package/dist/cli/verbs/_shared.js +181 -0
- package/dist/cli/verbs/abandoned-checkouts.d.ts +6 -0
- package/dist/cli/verbs/abandoned-checkouts.js +259 -0
- package/dist/cli/verbs/app-billing.d.ts +6 -0
- package/dist/cli/verbs/app-billing.js +452 -0
- package/dist/cli/verbs/apps.d.ts +6 -0
- package/dist/cli/verbs/apps.js +296 -0
- package/dist/cli/verbs/articles.d.ts +6 -0
- package/dist/cli/verbs/articles.js +251 -0
- package/dist/cli/verbs/backup.d.ts +6 -0
- package/dist/cli/verbs/backup.js +94 -0
- package/dist/cli/verbs/blogs.d.ts +6 -0
- package/dist/cli/verbs/blogs.js +273 -0
- package/dist/cli/verbs/bulk-operations.d.ts +6 -0
- package/dist/cli/verbs/bulk-operations.js +272 -0
- package/dist/cli/verbs/business-entities.d.ts +6 -0
- package/dist/cli/verbs/business-entities.js +102 -0
- package/dist/cli/verbs/carrier-services.d.ts +6 -0
- package/dist/cli/verbs/carrier-services.js +195 -0
- package/dist/cli/verbs/cart-transforms.d.ts +6 -0
- package/dist/cli/verbs/cart-transforms.js +141 -0
- package/dist/cli/verbs/cash-tracking.d.ts +6 -0
- package/dist/cli/verbs/cash-tracking.js +118 -0
- package/dist/cli/verbs/catalogs.d.ts +6 -0
- package/dist/cli/verbs/catalogs.js +267 -0
- package/dist/cli/verbs/channels.d.ts +6 -0
- package/dist/cli/verbs/channels.js +120 -0
- package/dist/cli/verbs/checkout-branding.d.ts +6 -0
- package/dist/cli/verbs/checkout-branding.js +144 -0
- package/dist/cli/verbs/checkout-profiles.d.ts +6 -0
- package/dist/cli/verbs/checkout-profiles.js +124 -0
- package/dist/cli/verbs/collections.d.ts +6 -0
- package/dist/cli/verbs/collections.js +620 -0
- package/dist/cli/verbs/comments.d.ts +6 -0
- package/dist/cli/verbs/comments.js +160 -0
- package/dist/cli/verbs/companies.d.ts +6 -0
- package/dist/cli/verbs/companies.js +313 -0
- package/dist/cli/verbs/company-contacts.d.ts +6 -0
- package/dist/cli/verbs/company-contacts.js +318 -0
- package/dist/cli/verbs/company-locations.d.ts +6 -0
- package/dist/cli/verbs/company-locations.js +467 -0
- package/dist/cli/verbs/customer-account-pages.d.ts +6 -0
- package/dist/cli/verbs/customer-account-pages.js +97 -0
- package/dist/cli/verbs/customer-payment-methods.d.ts +6 -0
- package/dist/cli/verbs/customer-payment-methods.js +358 -0
- package/dist/cli/verbs/customer-privacy.d.ts +6 -0
- package/dist/cli/verbs/customer-privacy.js +167 -0
- package/dist/cli/verbs/customer-segments.d.ts +6 -0
- package/dist/cli/verbs/customer-segments.js +193 -0
- package/dist/cli/verbs/customers.d.ts +6 -0
- package/dist/cli/verbs/customers.js +793 -0
- package/dist/cli/verbs/delegate-tokens.d.ts +6 -0
- package/dist/cli/verbs/delegate-tokens.js +95 -0
- package/dist/cli/verbs/delivery-customizations.d.ts +6 -0
- package/dist/cli/verbs/delivery-customizations.js +205 -0
- package/dist/cli/verbs/delivery-profile-locations.d.ts +6 -0
- package/dist/cli/verbs/delivery-profile-locations.js +90 -0
- package/dist/cli/verbs/delivery-profiles.d.ts +6 -0
- package/dist/cli/verbs/delivery-profiles.js +207 -0
- package/dist/cli/verbs/delivery-promises.d.ts +6 -0
- package/dist/cli/verbs/delivery-promises.js +262 -0
- package/dist/cli/verbs/delivery-settings.d.ts +6 -0
- package/dist/cli/verbs/delivery-settings.js +85 -0
- package/dist/cli/verbs/discount-nodes.d.ts +6 -0
- package/dist/cli/verbs/discount-nodes.js +169 -0
- package/dist/cli/verbs/discount-redeem-codes.d.ts +6 -0
- package/dist/cli/verbs/discount-redeem-codes.js +102 -0
- package/dist/cli/verbs/discount-saved-searches.d.ts +6 -0
- package/dist/cli/verbs/discount-saved-searches.js +113 -0
- package/dist/cli/verbs/discounts-automatic.d.ts +6 -0
- package/dist/cli/verbs/discounts-automatic.js +501 -0
- package/dist/cli/verbs/discounts-code.d.ts +6 -0
- package/dist/cli/verbs/discounts-code.js +540 -0
- package/dist/cli/verbs/disputes.d.ts +6 -0
- package/dist/cli/verbs/disputes.js +154 -0
- package/dist/cli/verbs/draft-orders.d.ts +6 -0
- package/dist/cli/verbs/draft-orders.js +475 -0
- package/dist/cli/verbs/events.d.ts +6 -0
- package/dist/cli/verbs/events.js +182 -0
- package/dist/cli/verbs/file-saved-searches.d.ts +6 -0
- package/dist/cli/verbs/file-saved-searches.js +83 -0
- package/dist/cli/verbs/files.d.ts +6 -0
- package/dist/cli/verbs/files.js +329 -0
- package/dist/cli/verbs/finance.d.ts +6 -0
- package/dist/cli/verbs/finance.js +115 -0
- package/dist/cli/verbs/flow.d.ts +6 -0
- package/dist/cli/verbs/flow.js +94 -0
- package/dist/cli/verbs/fulfillment-constraint-rules.d.ts +6 -0
- package/dist/cli/verbs/fulfillment-constraint-rules.js +139 -0
- package/dist/cli/verbs/fulfillment-orders.d.ts +6 -0
- package/dist/cli/verbs/fulfillment-orders.js +689 -0
- package/dist/cli/verbs/fulfillment-services.d.ts +6 -0
- package/dist/cli/verbs/fulfillment-services.js +212 -0
- package/dist/cli/verbs/fulfillments.d.ts +6 -0
- package/dist/cli/verbs/fulfillments.js +279 -0
- package/dist/cli/verbs/gift-cards.d.ts +6 -0
- package/dist/cli/verbs/gift-cards.js +359 -0
- package/dist/cli/verbs/graphql.d.ts +14 -0
- package/dist/cli/verbs/graphql.js +285 -0
- package/dist/cli/verbs/inventory-items.d.ts +6 -0
- package/dist/cli/verbs/inventory-items.js +164 -0
- package/dist/cli/verbs/inventory-shipments.d.ts +6 -0
- package/dist/cli/verbs/inventory-shipments.js +276 -0
- package/dist/cli/verbs/inventory-transfers.d.ts +6 -0
- package/dist/cli/verbs/inventory-transfers.js +396 -0
- package/dist/cli/verbs/inventory.d.ts +6 -0
- package/dist/cli/verbs/inventory.js +557 -0
- package/dist/cli/verbs/locales.d.ts +6 -0
- package/dist/cli/verbs/locales.js +61 -0
- package/dist/cli/verbs/locations.d.ts +6 -0
- package/dist/cli/verbs/locations.js +385 -0
- package/dist/cli/verbs/market-localizations.d.ts +6 -0
- package/dist/cli/verbs/market-localizations.js +291 -0
- package/dist/cli/verbs/market-web-presences.d.ts +6 -0
- package/dist/cli/verbs/market-web-presences.js +139 -0
- package/dist/cli/verbs/marketing-activities.d.ts +6 -0
- package/dist/cli/verbs/marketing-activities.js +353 -0
- package/dist/cli/verbs/marketing-events.d.ts +6 -0
- package/dist/cli/verbs/marketing-events.js +132 -0
- package/dist/cli/verbs/markets.d.ts +6 -0
- package/dist/cli/verbs/markets.js +357 -0
- package/dist/cli/verbs/menus.d.ts +6 -0
- package/dist/cli/verbs/menus.js +251 -0
- package/dist/cli/verbs/metafield-definition-tools.d.ts +6 -0
- package/dist/cli/verbs/metafield-definition-tools.js +289 -0
- package/dist/cli/verbs/metafield-definitions.d.ts +6 -0
- package/dist/cli/verbs/metafield-definitions.js +240 -0
- package/dist/cli/verbs/metafields.d.ts +6 -0
- package/dist/cli/verbs/metafields.js +112 -0
- package/dist/cli/verbs/metaobject-definition-tools.d.ts +6 -0
- package/dist/cli/verbs/metaobject-definition-tools.js +83 -0
- package/dist/cli/verbs/metaobject-definitions.d.ts +6 -0
- package/dist/cli/verbs/metaobject-definitions.js +176 -0
- package/dist/cli/verbs/metaobjects.d.ts +6 -0
- package/dist/cli/verbs/metaobjects.js +306 -0
- package/dist/cli/verbs/mobile-platform-applications.d.ts +6 -0
- package/dist/cli/verbs/mobile-platform-applications.js +247 -0
- package/dist/cli/verbs/order-edit.d.ts +6 -0
- package/dist/cli/verbs/order-edit.js +596 -0
- package/dist/cli/verbs/orders.d.ts +6 -0
- package/dist/cli/verbs/orders.js +853 -0
- package/dist/cli/verbs/pages.d.ts +6 -0
- package/dist/cli/verbs/pages.js +234 -0
- package/dist/cli/verbs/payment-customizations.d.ts +6 -0
- package/dist/cli/verbs/payment-customizations.js +193 -0
- package/dist/cli/verbs/payment-terms.d.ts +6 -0
- package/dist/cli/verbs/payment-terms.js +228 -0
- package/dist/cli/verbs/point-of-sale.d.ts +6 -0
- package/dist/cli/verbs/point-of-sale.js +57 -0
- package/dist/cli/verbs/price-lists.d.ts +6 -0
- package/dist/cli/verbs/price-lists.js +426 -0
- package/dist/cli/verbs/product-feeds.d.ts +6 -0
- package/dist/cli/verbs/product-feeds.js +187 -0
- package/dist/cli/verbs/product-variants.d.ts +6 -0
- package/dist/cli/verbs/product-variants.js +439 -0
- package/dist/cli/verbs/products.d.ts +6 -0
- package/dist/cli/verbs/products.js +2309 -0
- package/dist/cli/verbs/publications.d.ts +6 -0
- package/dist/cli/verbs/publications.js +256 -0
- package/dist/cli/verbs/publishables.d.ts +6 -0
- package/dist/cli/verbs/publishables.js +73 -0
- package/dist/cli/verbs/refunds.d.ts +6 -0
- package/dist/cli/verbs/refunds.js +226 -0
- package/dist/cli/verbs/resource-feedback.d.ts +6 -0
- package/dist/cli/verbs/resource-feedback.js +119 -0
- package/dist/cli/verbs/returnable-fulfillments.d.ts +6 -0
- package/dist/cli/verbs/returnable-fulfillments.js +102 -0
- package/dist/cli/verbs/returns.d.ts +6 -0
- package/dist/cli/verbs/returns.js +506 -0
- package/dist/cli/verbs/reverse-deliveries.d.ts +6 -0
- package/dist/cli/verbs/reverse-deliveries.js +203 -0
- package/dist/cli/verbs/reverse-fulfillment-orders.d.ts +6 -0
- package/dist/cli/verbs/reverse-fulfillment-orders.js +157 -0
- package/dist/cli/verbs/saved-searches.d.ts +6 -0
- package/dist/cli/verbs/saved-searches.js +150 -0
- package/dist/cli/verbs/script-tags.d.ts +6 -0
- package/dist/cli/verbs/script-tags.js +179 -0
- package/dist/cli/verbs/segments.d.ts +6 -0
- package/dist/cli/verbs/segments.js +343 -0
- package/dist/cli/verbs/selling-plan-group-products.d.ts +6 -0
- package/dist/cli/verbs/selling-plan-group-products.js +115 -0
- package/dist/cli/verbs/selling-plan-groups.d.ts +6 -0
- package/dist/cli/verbs/selling-plan-groups.js +230 -0
- package/dist/cli/verbs/server-pixels.d.ts +6 -0
- package/dist/cli/verbs/server-pixels.js +172 -0
- package/dist/cli/verbs/shipping-packages.d.ts +6 -0
- package/dist/cli/verbs/shipping-packages.js +107 -0
- package/dist/cli/verbs/shop-policies.d.ts +6 -0
- package/dist/cli/verbs/shop-policies.js +91 -0
- package/dist/cli/verbs/shop-utils.d.ts +6 -0
- package/dist/cli/verbs/shop-utils.js +147 -0
- package/dist/cli/verbs/shop.d.ts +6 -0
- package/dist/cli/verbs/shop.js +177 -0
- package/dist/cli/verbs/shopify-functions.d.ts +6 -0
- package/dist/cli/verbs/shopify-functions.js +127 -0
- package/dist/cli/verbs/shopify-payments.d.ts +6 -0
- package/dist/cli/verbs/shopify-payments.js +111 -0
- package/dist/cli/verbs/staff.d.ts +6 -0
- package/dist/cli/verbs/staff.js +127 -0
- package/dist/cli/verbs/staged-uploads.d.ts +6 -0
- package/dist/cli/verbs/staged-uploads.js +128 -0
- package/dist/cli/verbs/store-credit.d.ts +6 -0
- package/dist/cli/verbs/store-credit.js +209 -0
- package/dist/cli/verbs/storefront-access-tokens.d.ts +6 -0
- package/dist/cli/verbs/storefront-access-tokens.js +183 -0
- package/dist/cli/verbs/subscription-billing-cycles.d.ts +6 -0
- package/dist/cli/verbs/subscription-billing-cycles.js +391 -0
- package/dist/cli/verbs/subscription-billing.d.ts +6 -0
- package/dist/cli/verbs/subscription-billing.js +391 -0
- package/dist/cli/verbs/subscription-contracts.d.ts +6 -0
- package/dist/cli/verbs/subscription-contracts.js +392 -0
- package/dist/cli/verbs/subscription-drafts.d.ts +6 -0
- package/dist/cli/verbs/subscription-drafts.js +315 -0
- package/dist/cli/verbs/tags.d.ts +6 -0
- package/dist/cli/verbs/tags.js +73 -0
- package/dist/cli/verbs/tax.d.ts +6 -0
- package/dist/cli/verbs/tax.js +114 -0
- package/dist/cli/verbs/taxonomy.d.ts +6 -0
- package/dist/cli/verbs/taxonomy.js +99 -0
- package/dist/cli/verbs/tender-transactions.d.ts +6 -0
- package/dist/cli/verbs/tender-transactions.js +105 -0
- package/dist/cli/verbs/themes.d.ts +6 -0
- package/dist/cli/verbs/themes.js +315 -0
- package/dist/cli/verbs/translations.d.ts +6 -0
- package/dist/cli/verbs/translations.js +221 -0
- package/dist/cli/verbs/types.d.ts +4 -0
- package/dist/cli/verbs/types.js +224 -0
- package/dist/cli/verbs/url-redirects.d.ts +6 -0
- package/dist/cli/verbs/url-redirects.js +465 -0
- package/dist/cli/verbs/validations.d.ts +6 -0
- package/dist/cli/verbs/validations.js +181 -0
- package/dist/cli/verbs/web-pixels.d.ts +6 -0
- package/dist/cli/verbs/web-pixels.js +145 -0
- package/dist/cli/verbs/web-presences.d.ts +6 -0
- package/dist/cli/verbs/web-presences.js +186 -0
- package/dist/cli/verbs/webhooks.d.ts +6 -0
- package/dist/cli/verbs/webhooks.js +336 -0
- package/dist/cli/workflows/files/stagedUploads.d.ts +28 -0
- package/dist/cli/workflows/files/stagedUploads.js +227 -0
- package/dist/cli/workflows/files/stdinFile.d.ts +7 -0
- package/dist/cli/workflows/files/stdinFile.js +65 -0
- package/dist/cli/workflows/files/urlDownloads.d.ts +14 -0
- package/dist/cli/workflows/files/urlDownloads.js +114 -0
- package/dist/cli/workflows/files/waitForReady.d.ts +20 -0
- package/dist/cli/workflows/files/waitForReady.js +114 -0
- package/dist/cli/workflows/inventory/resolveInventoryItemId.d.ts +6 -0
- package/dist/cli/workflows/inventory/resolveInventoryItemId.js +59 -0
- package/dist/cli/workflows/productVariants/upsert.d.ts +8 -0
- package/dist/cli/workflows/productVariants/upsert.js +110 -0
- package/dist/cli/workflows/products/metafieldsUpsert.d.ts +6 -0
- package/dist/cli/workflows/products/metafieldsUpsert.js +94 -0
- package/dist/cli/workflows/products/publishablePublish.d.ts +21 -0
- package/dist/cli/workflows/products/publishablePublish.js +131 -0
- package/dist/cli/workflows/publications/resolvePublicationId.d.ts +17 -0
- package/dist/cli/workflows/publications/resolvePublicationId.js +93 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +238 -0
- package/dist/defaults.d.ts +2 -0
- package/dist/defaults.js +38 -0
- package/dist/generated/admin-2026-04/index.d.ts +25 -0
- package/dist/generated/admin-2026-04/index.js +70 -0
- package/dist/generated/admin-2026-04/runtime/batcher.d.ts +105 -0
- package/dist/generated/admin-2026-04/runtime/batcher.js +203 -0
- package/dist/generated/admin-2026-04/runtime/createClient.d.ts +17 -0
- package/dist/generated/admin-2026-04/runtime/createClient.js +59 -0
- package/dist/generated/admin-2026-04/runtime/error.d.ts +18 -0
- package/dist/generated/admin-2026-04/runtime/error.js +44 -0
- package/dist/generated/admin-2026-04/runtime/fetcher.d.ts +10 -0
- package/dist/generated/admin-2026-04/runtime/fetcher.js +104 -0
- package/dist/generated/admin-2026-04/runtime/generateGraphqlOperation.d.ts +30 -0
- package/dist/generated/admin-2026-04/runtime/generateGraphqlOperation.js +191 -0
- package/dist/generated/admin-2026-04/runtime/index.d.ts +11 -0
- package/dist/generated/admin-2026-04/runtime/index.js +46 -0
- package/dist/generated/admin-2026-04/runtime/linkTypeMap.d.ts +9 -0
- package/dist/generated/admin-2026-04/runtime/linkTypeMap.js +142 -0
- package/dist/generated/admin-2026-04/runtime/typeSelection.d.ts +28 -0
- package/dist/generated/admin-2026-04/runtime/typeSelection.js +17 -0
- package/dist/generated/admin-2026-04/runtime/types.d.ts +55 -0
- package/dist/generated/admin-2026-04/runtime/types.js +17 -0
- package/dist/generated/admin-2026-04/schema.d.ts +102240 -0
- package/dist/generated/admin-2026-04/schema.graphql +91596 -0
- package/dist/generated/admin-2026-04/schema.js +20322 -0
- package/dist/generated/admin-2026-04/types.d.ts +24224 -0
- package/dist/generated/admin-2026-04/types.js +62299 -0
- package/dist/generated/help/schema-help.d.ts +30 -0
- package/dist/generated/help/schema-help.js +61833 -0
- package/dist/graphqlValidator.d.ts +17 -0
- package/dist/graphqlValidator.js +84 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +23 -0
- package/package.json +66 -0
- package/schema/2026-04.graphql +61256 -0
- package/schema/2026-04.introspection.json +1 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var publishablePublish_exports = {};
|
|
20
|
+
__export(publishablePublish_exports, {
|
|
21
|
+
parsePublishDate: () => parsePublishDate,
|
|
22
|
+
publishProduct: () => publishProduct,
|
|
23
|
+
resolvePublicationIds: () => resolvePublicationIds,
|
|
24
|
+
unpublishProduct: () => unpublishProduct
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(publishablePublish_exports);
|
|
27
|
+
var import_errors = require("../../errors");
|
|
28
|
+
var import_gid = require("../../gid");
|
|
29
|
+
var import_router = require("../../router");
|
|
30
|
+
var import_userErrors = require("../../userErrors");
|
|
31
|
+
var import_resolvePublicationId = require("../publications/resolvePublicationId");
|
|
32
|
+
const requireProductId = (id) => {
|
|
33
|
+
if (!id) throw new import_errors.CliError("Missing --id", 2);
|
|
34
|
+
return (0, import_gid.coerceGid)(id, "Product");
|
|
35
|
+
};
|
|
36
|
+
const parsePublishDate = ({
|
|
37
|
+
at,
|
|
38
|
+
now
|
|
39
|
+
}) => {
|
|
40
|
+
if (at && now) throw new import_errors.CliError("Pass either --at <iso> or --now, not both", 2);
|
|
41
|
+
if (now) return (/* @__PURE__ */ new Date()).toISOString();
|
|
42
|
+
return at;
|
|
43
|
+
};
|
|
44
|
+
const normalizePublicationId = (value) => {
|
|
45
|
+
const raw = value.trim();
|
|
46
|
+
if (!raw) throw new import_errors.CliError("publication ID cannot be empty", 2);
|
|
47
|
+
if ((0, import_gid.isGid)(raw)) {
|
|
48
|
+
if (!raw.startsWith("gid://shopify/Publication/")) {
|
|
49
|
+
throw new import_errors.CliError(`Expected a Publication GID (gid://shopify/Publication/...). Got: ${value}`, 2);
|
|
50
|
+
}
|
|
51
|
+
return raw;
|
|
52
|
+
}
|
|
53
|
+
if (/^\d+$/.test(raw)) return (0, import_gid.coerceGid)(raw, "Publication");
|
|
54
|
+
throw new import_errors.CliError(`Expected a numeric ID or full GID for Publication. Got: ${value}`, 2);
|
|
55
|
+
};
|
|
56
|
+
const resolvePublicationIds = async ({
|
|
57
|
+
ctx,
|
|
58
|
+
publicationIds,
|
|
59
|
+
publicationNames
|
|
60
|
+
}) => {
|
|
61
|
+
if (ctx.dryRun && publicationNames.length > 0) {
|
|
62
|
+
throw new import_errors.CliError(
|
|
63
|
+
"In --dry-run mode, --publication cannot be resolved without executing a query. Use --publication-id <gid|num> instead.",
|
|
64
|
+
2
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
const ids = publicationIds.map(normalizePublicationId);
|
|
68
|
+
if (publicationNames.length > 0) {
|
|
69
|
+
const publications = await (0, import_resolvePublicationId.listPublications)(ctx);
|
|
70
|
+
for (const name of publicationNames) {
|
|
71
|
+
ids.push((0, import_resolvePublicationId.resolvePublicationIdFromList)({ publications, identifier: name }));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const unique = Array.from(new Set(ids));
|
|
75
|
+
if (unique.length === 0) throw new import_errors.CliError("Missing --publication-id or --publication", 2);
|
|
76
|
+
return unique;
|
|
77
|
+
};
|
|
78
|
+
const publishProduct = async ({
|
|
79
|
+
ctx,
|
|
80
|
+
id,
|
|
81
|
+
publicationIds,
|
|
82
|
+
publishDate
|
|
83
|
+
}) => {
|
|
84
|
+
const productId = requireProductId(id);
|
|
85
|
+
const input = publicationIds.map((publicationId) => ({
|
|
86
|
+
publicationId,
|
|
87
|
+
...publishDate ? { publishDate } : {}
|
|
88
|
+
}));
|
|
89
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
90
|
+
publishablePublish: {
|
|
91
|
+
__args: { id: productId, input },
|
|
92
|
+
publishable: { __typename: true, on_Product: { id: true } },
|
|
93
|
+
userErrors: { field: true, message: true }
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
if (result === void 0) return void 0;
|
|
97
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
98
|
+
payload: result.publishablePublish,
|
|
99
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
100
|
+
});
|
|
101
|
+
return result.publishablePublish;
|
|
102
|
+
};
|
|
103
|
+
const unpublishProduct = async ({
|
|
104
|
+
ctx,
|
|
105
|
+
id,
|
|
106
|
+
publicationIds
|
|
107
|
+
}) => {
|
|
108
|
+
const productId = requireProductId(id);
|
|
109
|
+
const input = publicationIds.map((publicationId) => ({ publicationId }));
|
|
110
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
111
|
+
publishableUnpublish: {
|
|
112
|
+
__args: { id: productId, input },
|
|
113
|
+
publishable: { __typename: true, on_Product: { id: true } },
|
|
114
|
+
userErrors: { field: true, message: true }
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
if (result === void 0) return void 0;
|
|
118
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
119
|
+
payload: result.publishableUnpublish,
|
|
120
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
121
|
+
});
|
|
122
|
+
return result.publishableUnpublish;
|
|
123
|
+
};
|
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
+
0 && (module.exports = {
|
|
126
|
+
parsePublishDate,
|
|
127
|
+
publishProduct,
|
|
128
|
+
resolvePublicationIds,
|
|
129
|
+
unpublishProduct
|
|
130
|
+
});
|
|
131
|
+
//# sourceMappingURL=publishablePublish.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CommandContext } from '../../router';
|
|
2
|
+
export type PublicationSummary = {
|
|
3
|
+
id: string;
|
|
4
|
+
name?: string | null;
|
|
5
|
+
catalogTitle?: string | null;
|
|
6
|
+
autoPublish?: boolean | null;
|
|
7
|
+
};
|
|
8
|
+
export declare const listPublications: (ctx: CommandContext) => Promise<PublicationSummary[]>;
|
|
9
|
+
export declare const resolvePublicationIdFromList: ({ publications, identifier, }: {
|
|
10
|
+
publications: PublicationSummary[];
|
|
11
|
+
identifier: string;
|
|
12
|
+
}) => string;
|
|
13
|
+
export declare const resolvePublicationId: ({ ctx, publications, identifier, }: {
|
|
14
|
+
ctx: CommandContext;
|
|
15
|
+
publications?: PublicationSummary[];
|
|
16
|
+
identifier: string;
|
|
17
|
+
}) => Promise<string>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var resolvePublicationId_exports = {};
|
|
20
|
+
__export(resolvePublicationId_exports, {
|
|
21
|
+
listPublications: () => listPublications,
|
|
22
|
+
resolvePublicationId: () => resolvePublicationId,
|
|
23
|
+
resolvePublicationIdFromList: () => resolvePublicationIdFromList
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(resolvePublicationId_exports);
|
|
26
|
+
var import_errors = require("../../errors");
|
|
27
|
+
var import_gid = require("../../gid");
|
|
28
|
+
var import_router = require("../../router");
|
|
29
|
+
const listPublications = async (ctx) => {
|
|
30
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
31
|
+
publications: {
|
|
32
|
+
__args: { first: 250 },
|
|
33
|
+
nodes: {
|
|
34
|
+
id: true,
|
|
35
|
+
name: true,
|
|
36
|
+
autoPublish: true,
|
|
37
|
+
catalog: { title: true }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
if (result === void 0) return [];
|
|
42
|
+
const nodes = result.publications?.nodes ?? [];
|
|
43
|
+
return nodes.map((p) => ({
|
|
44
|
+
id: p?.id,
|
|
45
|
+
name: p?.name,
|
|
46
|
+
catalogTitle: p?.catalog?.title,
|
|
47
|
+
autoPublish: p?.autoPublish
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
const normalize = (value) => value.trim().toLowerCase();
|
|
51
|
+
const resolvePublicationIdFromList = ({
|
|
52
|
+
publications,
|
|
53
|
+
identifier
|
|
54
|
+
}) => {
|
|
55
|
+
const raw = identifier.trim();
|
|
56
|
+
if (!raw) throw new import_errors.CliError("Missing publication identifier", 2);
|
|
57
|
+
if ((0, import_gid.isGid)(raw)) {
|
|
58
|
+
if (!raw.startsWith("gid://shopify/Publication/")) {
|
|
59
|
+
throw new import_errors.CliError(`Expected a Publication GID (gid://shopify/Publication/...). Got: ${raw}`, 2);
|
|
60
|
+
}
|
|
61
|
+
return raw;
|
|
62
|
+
}
|
|
63
|
+
if (/^\d+$/.test(raw)) return (0, import_gid.coerceGid)(raw, "Publication");
|
|
64
|
+
const target = normalize(raw);
|
|
65
|
+
const matches = publications.filter((p) => {
|
|
66
|
+
const names = [p.name, p.catalogTitle].filter((v) => Boolean(v));
|
|
67
|
+
return names.some((n) => normalize(n) === target);
|
|
68
|
+
});
|
|
69
|
+
if (matches.length === 1) return matches[0].id;
|
|
70
|
+
if (matches.length > 1) {
|
|
71
|
+
throw new import_errors.CliError(
|
|
72
|
+
`Publication name is ambiguous (${raw}): ${matches.map((m) => `${m.name ?? m.catalogTitle ?? "(unknown)"} (${m.id})`).join(", ")}`,
|
|
73
|
+
2
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
const hint = publications.length === 0 ? "" : ` Known publications: ${publications.map((p) => p.name ?? p.catalogTitle ?? "(unknown)").filter((v, i, arr) => v && arr.indexOf(v) === i).slice(0, 12).join(", ")}`;
|
|
77
|
+
throw new import_errors.CliError(`No publication found matching: ${raw}.${hint}`, 2);
|
|
78
|
+
};
|
|
79
|
+
const resolvePublicationId = async ({
|
|
80
|
+
ctx,
|
|
81
|
+
publications,
|
|
82
|
+
identifier
|
|
83
|
+
}) => {
|
|
84
|
+
const list = publications ?? await listPublications(ctx);
|
|
85
|
+
return resolvePublicationIdFromList({ publications: list, identifier });
|
|
86
|
+
};
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
listPublications,
|
|
90
|
+
resolvePublicationId,
|
|
91
|
+
resolvePublicationIdFromList
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=resolvePublicationId.js.map
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var import_dotenv = __toESM(require("dotenv"));
|
|
25
|
+
var import_path = require("path");
|
|
26
|
+
var import_client = require("./cli/client");
|
|
27
|
+
var import_errors = require("./cli/errors");
|
|
28
|
+
var import_globalFlags = require("./cli/globalFlags");
|
|
29
|
+
var import_headers = require("./cli/headers");
|
|
30
|
+
var import_render = require("./cli/help/render");
|
|
31
|
+
var import_registry = require("./cli/help/registry");
|
|
32
|
+
var import_router = require("./cli/router");
|
|
33
|
+
var import_adminClient = require("./adminClient");
|
|
34
|
+
var import_defaults = require("./defaults");
|
|
35
|
+
var import_command = require("./cli/command");
|
|
36
|
+
var import_parse_command = require("./cli/parse-command");
|
|
37
|
+
var import_output = require("./cli/output");
|
|
38
|
+
var import_suggest = require("./cli/suggest");
|
|
39
|
+
import_dotenv.default.config({ path: (0, import_path.resolve)(process.cwd(), ".env"), quiet: true });
|
|
40
|
+
const helpFlags = /* @__PURE__ */ new Set(["--help", "-h", "--help-full", "--help-all"]);
|
|
41
|
+
const versionFlags = /* @__PURE__ */ new Set(["--version", "-v"]);
|
|
42
|
+
const hasHelpFlag = (args) => args.some((arg) => helpFlags.has(arg));
|
|
43
|
+
const hasVersionFlag = (args) => args.some((arg) => versionFlags.has(arg));
|
|
44
|
+
const wantsFullHelp = (args) => args.some((arg) => arg === "--help-full" || arg === "--help-all");
|
|
45
|
+
const formatDidYouMean = (suggestions) => {
|
|
46
|
+
if (suggestions.length === 0) return "";
|
|
47
|
+
return ["Did you mean:", ...suggestions.map((s) => ` ${s}`)].join("\n");
|
|
48
|
+
};
|
|
49
|
+
const printVersion = async () => {
|
|
50
|
+
const fs = await import("fs");
|
|
51
|
+
const path = await import("path");
|
|
52
|
+
let dir = __dirname;
|
|
53
|
+
for (let i = 0; i < 5; i++) {
|
|
54
|
+
const pkgPath = path.join(dir, "package.json");
|
|
55
|
+
if (fs.existsSync(pkgPath)) {
|
|
56
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
57
|
+
console.log(pkg.version);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
dir = path.dirname(dir);
|
|
61
|
+
}
|
|
62
|
+
console.log("unknown");
|
|
63
|
+
};
|
|
64
|
+
const main = async () => {
|
|
65
|
+
const command = (0, import_command.resolveCliCommand)();
|
|
66
|
+
(0, import_output.setGlobalCommand)(command);
|
|
67
|
+
const argv = process.argv.slice(2);
|
|
68
|
+
if (hasVersionFlag(argv)) {
|
|
69
|
+
await printVersion();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (argv.length === 0 || argv[0] === "help" || hasHelpFlag([argv[0]])) {
|
|
73
|
+
console.log((0, import_render.renderTopLevelHelp)(command));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const resource = argv[0];
|
|
77
|
+
if (!resource) {
|
|
78
|
+
console.log((0, import_render.renderTopLevelHelp)(command));
|
|
79
|
+
throw new import_errors.CliError("Missing <resource>", 2);
|
|
80
|
+
}
|
|
81
|
+
const afterResource = argv.slice(1);
|
|
82
|
+
const { verb, rest } = (0, import_parse_command.parseVerbAndRest)({ resource, afterResource });
|
|
83
|
+
const rewrittenRest = (0, import_parse_command.rewritePositionalIdAsFlag)({ resource, verb, rest });
|
|
84
|
+
const isTypesCommand = resource === "types";
|
|
85
|
+
if (!verb) {
|
|
86
|
+
if (isTypesCommand && hasHelpFlag(afterResource)) {
|
|
87
|
+
} else {
|
|
88
|
+
const resourceHelp = (0, import_render.renderResourceHelp)(resource, command);
|
|
89
|
+
if (resourceHelp) {
|
|
90
|
+
console.log(resourceHelp);
|
|
91
|
+
if (hasHelpFlag(afterResource)) return;
|
|
92
|
+
throw new import_errors.CliError(`
|
|
93
|
+
Missing <verb> for "${resource}"`, 2);
|
|
94
|
+
} else if (!isTypesCommand) {
|
|
95
|
+
const resources = import_registry.commandRegistry.map((r) => r.resource);
|
|
96
|
+
const matches = (0, import_suggest.findSuggestions)({ query: resource, candidates: resources, limit: 3 });
|
|
97
|
+
const suggestions = matches.map(
|
|
98
|
+
(r) => [command, r, ...afterResource].filter(Boolean).join(" ").trim()
|
|
99
|
+
);
|
|
100
|
+
const didYouMean = formatDidYouMean(suggestions);
|
|
101
|
+
throw new import_errors.CliError(
|
|
102
|
+
[`Unknown resource: ${resource}`, didYouMean].filter(Boolean).join("\n"),
|
|
103
|
+
2
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (hasHelpFlag(rewrittenRest)) {
|
|
109
|
+
if (isTypesCommand) {
|
|
110
|
+
} else {
|
|
111
|
+
const verbHelp = (0, import_render.renderVerbHelp)(resource, verb, { showAllFields: wantsFullHelp(rewrittenRest) }, command);
|
|
112
|
+
if (verbHelp) {
|
|
113
|
+
console.log(verbHelp);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const verbGroupHelp = (0, import_render.renderVerbGroupHelp)(resource, verb, command);
|
|
117
|
+
if (verbGroupHelp) {
|
|
118
|
+
console.log(verbGroupHelp);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const resourceHelp = (0, import_render.renderResourceHelp)(resource, command);
|
|
122
|
+
if (resourceHelp) {
|
|
123
|
+
console.log(resourceHelp);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
console.log((0, import_render.renderTopLevelHelp)(command));
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const unexpectedPositionalHint = (0, import_parse_command.buildUnexpectedPositionalHint)({ command, resource, verb, rest: rewrittenRest });
|
|
131
|
+
if (unexpectedPositionalHint) {
|
|
132
|
+
throw new import_errors.CliError(unexpectedPositionalHint, 2);
|
|
133
|
+
}
|
|
134
|
+
const parsed = (0, import_globalFlags.parseGlobalFlags)(rewrittenRest);
|
|
135
|
+
const dryRun = parsed.dryRun ?? false;
|
|
136
|
+
const isOfflineCommand = verb === "fields" || isTypesCommand;
|
|
137
|
+
const shopDomain = parsed.shopDomain;
|
|
138
|
+
const graphqlEndpoint = parsed.graphqlEndpoint;
|
|
139
|
+
const accessToken = parsed.accessToken;
|
|
140
|
+
const envHeaders = (0, import_headers.parseHeadersFromEnv)(process.env.SHOPIFY_HEADERS);
|
|
141
|
+
const cliHeaders = (0, import_headers.parseHeaderValues)(parsed.headers, "--header");
|
|
142
|
+
const headers = { ...envHeaders, ...cliHeaders };
|
|
143
|
+
const resolvedAccessToken = accessToken ?? process.env.SHOPIFY_ACCESS_TOKEN;
|
|
144
|
+
const hasAuthHeader = Object.keys(headers).some((name) => {
|
|
145
|
+
const normalized = name.toLowerCase();
|
|
146
|
+
return normalized === "authorization" || normalized === "x-shopify-access-token";
|
|
147
|
+
});
|
|
148
|
+
const apiVersion = parsed.apiVersion;
|
|
149
|
+
const warnMissingAccessToken = !resolvedAccessToken && !hasAuthHeader;
|
|
150
|
+
const verbose = parsed.verbose ?? false;
|
|
151
|
+
const resolvedApiVersion = (0, import_defaults.resolveAdminApiVersion)(apiVersion ?? process.env.SHOPIFY_API_VERSION);
|
|
152
|
+
const client = dryRun || isOfflineCommand ? (0, import_adminClient.createShopifyAdminClient)({
|
|
153
|
+
shopDomain: shopDomain ?? process.env.SHOPIFY_SHOP ?? "example.myshopify.com",
|
|
154
|
+
graphqlEndpoint: graphqlEndpoint ?? process.env.GRAPHQL_ENDPOINT,
|
|
155
|
+
accessToken: resolvedAccessToken ?? "DUMMY",
|
|
156
|
+
apiVersion: resolvedApiVersion,
|
|
157
|
+
headers,
|
|
158
|
+
verbose
|
|
159
|
+
}) : (0, import_client.createCliClientFromEnv)({
|
|
160
|
+
shopDomain,
|
|
161
|
+
graphqlEndpoint,
|
|
162
|
+
accessToken,
|
|
163
|
+
apiVersion,
|
|
164
|
+
headers,
|
|
165
|
+
verbose
|
|
166
|
+
});
|
|
167
|
+
try {
|
|
168
|
+
await (0, import_router.runCommand)({
|
|
169
|
+
client,
|
|
170
|
+
resource,
|
|
171
|
+
verb,
|
|
172
|
+
argv: parsed.passthrough,
|
|
173
|
+
format: parsed.format ?? (isOfflineCommand ? "table" : "json"),
|
|
174
|
+
quiet: parsed.quiet ?? false,
|
|
175
|
+
view: parsed.view ?? "summary",
|
|
176
|
+
dryRun,
|
|
177
|
+
failOnUserErrors: !(parsed.noFailOnUserErrors ?? false),
|
|
178
|
+
warnMissingAccessToken,
|
|
179
|
+
// Raw GraphQL client options (for graphql command)
|
|
180
|
+
shopDomain: shopDomain ?? process.env.SHOPIFY_SHOP,
|
|
181
|
+
graphqlEndpoint: graphqlEndpoint ?? process.env.GRAPHQL_ENDPOINT,
|
|
182
|
+
accessToken: resolvedAccessToken,
|
|
183
|
+
apiVersion: resolvedApiVersion,
|
|
184
|
+
headers
|
|
185
|
+
});
|
|
186
|
+
} catch (err) {
|
|
187
|
+
if (!(err instanceof import_errors.CliError)) throw err;
|
|
188
|
+
let message = err.message;
|
|
189
|
+
const unknownResourceMatch = message.match(/^Unknown resource: (.+)$/);
|
|
190
|
+
if (unknownResourceMatch) {
|
|
191
|
+
const unknown = unknownResourceMatch[1] ?? resource;
|
|
192
|
+
const resources = import_registry.commandRegistry.map((r) => r.resource);
|
|
193
|
+
const matches = (0, import_suggest.findSuggestions)({ query: unknown, candidates: resources, limit: 3 });
|
|
194
|
+
const suggestions = matches.map(
|
|
195
|
+
(r) => [command, r, ...afterResource].filter(Boolean).join(" ").trim()
|
|
196
|
+
);
|
|
197
|
+
const didYouMean = formatDidYouMean(suggestions);
|
|
198
|
+
message = [`Unknown resource: ${unknown}`, didYouMean].filter(Boolean).join("\n");
|
|
199
|
+
throw new import_errors.CliError(message, err.exitCode);
|
|
200
|
+
}
|
|
201
|
+
const unknownVerbMatch = message.match(/^Unknown verb for ([^:]+): (.+)$/);
|
|
202
|
+
if (unknownVerbMatch) {
|
|
203
|
+
const resourceName = unknownVerbMatch[1];
|
|
204
|
+
const unknownVerb = unknownVerbMatch[2];
|
|
205
|
+
const spec = import_registry.commandRegistry.find((r) => r.resource === resourceName);
|
|
206
|
+
if (spec) {
|
|
207
|
+
const groups = new Set(
|
|
208
|
+
spec.verbs.map((v) => v.verb).filter((v) => v.includes(" ")).map((v) => v.split(" ")[0]).filter(Boolean)
|
|
209
|
+
);
|
|
210
|
+
const candidates = Array.from(
|
|
211
|
+
/* @__PURE__ */ new Set([...spec.verbs.map((v) => v.verb), ...Array.from(groups)])
|
|
212
|
+
);
|
|
213
|
+
const matches = (0, import_suggest.findSuggestions)({ query: unknownVerb, candidates, limit: 3 });
|
|
214
|
+
const suggestions = matches.map((v) => `${command} ${resourceName} ${v}`.trim());
|
|
215
|
+
const didYouMean = formatDidYouMean(suggestions);
|
|
216
|
+
if (didYouMean) {
|
|
217
|
+
message = [`Unknown verb for ${resourceName}: ${unknownVerb}`, didYouMean].join("\n");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
throw new import_errors.CliError(message, err.exitCode);
|
|
221
|
+
}
|
|
222
|
+
if (err.exitCode === 2 && verb && !message.includes("See help:") && message.includes("--") && !message.startsWith("Unknown resource:") && !message.startsWith("Unknown verb for ")) {
|
|
223
|
+
message = `${message}
|
|
224
|
+
See help:
|
|
225
|
+
${command} ${resource} ${verb} --help`;
|
|
226
|
+
}
|
|
227
|
+
throw new import_errors.CliError(message, err.exitCode);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
main().catch((err) => {
|
|
231
|
+
if (err instanceof import_errors.CliError) {
|
|
232
|
+
console.error(err.message);
|
|
233
|
+
process.exit(err.exitCode);
|
|
234
|
+
}
|
|
235
|
+
console.error(err);
|
|
236
|
+
process.exit(1);
|
|
237
|
+
});
|
|
238
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/defaults.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var defaults_exports = {};
|
|
20
|
+
__export(defaults_exports, {
|
|
21
|
+
DEFAULT_ADMIN_API_VERSION: () => DEFAULT_ADMIN_API_VERSION,
|
|
22
|
+
resolveAdminApiVersion: () => resolveAdminApiVersion
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(defaults_exports);
|
|
25
|
+
const DEFAULT_ADMIN_API_VERSION = "2026-04";
|
|
26
|
+
const resolveAdminApiVersion = (apiVersion) => {
|
|
27
|
+
if (typeof apiVersion === "string") {
|
|
28
|
+
const trimmed = apiVersion.trim();
|
|
29
|
+
if (trimmed.length > 0) return trimmed;
|
|
30
|
+
}
|
|
31
|
+
return DEFAULT_ADMIN_API_VERSION;
|
|
32
|
+
};
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
DEFAULT_ADMIN_API_VERSION,
|
|
36
|
+
resolveAdminApiVersion
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { QueryRootGenqlSelection, QueryRoot, MutationGenqlSelection, Mutation } from './schema';
|
|
2
|
+
import { type FieldsSelection, type GraphqlOperation, type ClientOptions, GenqlError } from './runtime';
|
|
3
|
+
export type { FieldsSelection } from './runtime';
|
|
4
|
+
export { GenqlError };
|
|
5
|
+
export * from './schema';
|
|
6
|
+
export interface Client {
|
|
7
|
+
query<R extends QueryRootGenqlSelection>(request: R & {
|
|
8
|
+
__name?: string;
|
|
9
|
+
}): Promise<FieldsSelection<QueryRoot, R>>;
|
|
10
|
+
mutation<R extends MutationGenqlSelection>(request: R & {
|
|
11
|
+
__name?: string;
|
|
12
|
+
}): Promise<FieldsSelection<Mutation, R>>;
|
|
13
|
+
}
|
|
14
|
+
export declare const createClient: (options?: ClientOptions) => Client;
|
|
15
|
+
export declare const everything: {
|
|
16
|
+
__scalar: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type QueryResult<fields extends QueryRootGenqlSelection> = FieldsSelection<QueryRoot, fields>;
|
|
19
|
+
export declare const generateQueryOp: (fields: QueryRootGenqlSelection & {
|
|
20
|
+
__name?: string;
|
|
21
|
+
}) => GraphqlOperation;
|
|
22
|
+
export type MutationResult<fields extends MutationGenqlSelection> = FieldsSelection<Mutation, fields>;
|
|
23
|
+
export declare const generateMutationOp: (fields: MutationGenqlSelection & {
|
|
24
|
+
__name?: string;
|
|
25
|
+
}) => GraphqlOperation;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var admin_2026_04_exports = {};
|
|
31
|
+
__export(admin_2026_04_exports, {
|
|
32
|
+
GenqlError: () => import_runtime.GenqlError,
|
|
33
|
+
createClient: () => createClient,
|
|
34
|
+
everything: () => everything,
|
|
35
|
+
generateMutationOp: () => generateMutationOp,
|
|
36
|
+
generateQueryOp: () => generateQueryOp
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(admin_2026_04_exports);
|
|
39
|
+
var import_runtime = require("./runtime");
|
|
40
|
+
var import_types = __toESM(require("./types"));
|
|
41
|
+
__reExport(admin_2026_04_exports, require("./schema"), module.exports);
|
|
42
|
+
const typeMap = (0, import_runtime.linkTypeMap)(import_types.default);
|
|
43
|
+
const createClient = function(options) {
|
|
44
|
+
return (0, import_runtime.createClient)({
|
|
45
|
+
url: void 0,
|
|
46
|
+
...options,
|
|
47
|
+
queryRoot: typeMap.Query,
|
|
48
|
+
mutationRoot: typeMap.Mutation,
|
|
49
|
+
subscriptionRoot: typeMap.Subscription
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const everything = {
|
|
53
|
+
__scalar: true
|
|
54
|
+
};
|
|
55
|
+
const generateQueryOp = function(fields) {
|
|
56
|
+
return (0, import_runtime.generateGraphqlOperation)("query", typeMap.Query, fields);
|
|
57
|
+
};
|
|
58
|
+
const generateMutationOp = function(fields) {
|
|
59
|
+
return (0, import_runtime.generateGraphqlOperation)("mutation", typeMap.Mutation, fields);
|
|
60
|
+
};
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
GenqlError,
|
|
64
|
+
createClient,
|
|
65
|
+
everything,
|
|
66
|
+
generateMutationOp,
|
|
67
|
+
generateQueryOp,
|
|
68
|
+
...require("./schema")
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=index.js.map
|