shop-cli 0.1.0
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 +5651 -0
- package/dist/cli/help/render.d.ts +7 -0
- package/dist/cli/help/render.js +352 -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/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/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 +180 -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 +485 -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 +314 -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 +656 -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 +475 -0
- package/dist/cli/verbs/discounts-code.d.ts +6 -0
- package/dist/cli/verbs/discounts-code.js +523 -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 +429 -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 +213 -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 +674 -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 +273 -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 +551 -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 +324 -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 +297 -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 +781 -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 +388 -0
- package/dist/cli/verbs/products.d.ts +6 -0
- package/dist/cli/verbs/products.js +1257 -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 +208 -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 +391 -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 +297 -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 +407 -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 +175 -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 +152 -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 +65 -0
- package/schema/2026-04.graphql +61256 -0
- package/schema/2026-04.introspection.json +1 -0
|
@@ -0,0 +1,273 @@
|
|
|
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 blogs_exports = {};
|
|
20
|
+
__export(blogs_exports, {
|
|
21
|
+
runBlogs: () => runBlogs
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(blogs_exports);
|
|
24
|
+
var import_errors = require("../errors");
|
|
25
|
+
var import_input = require("../input");
|
|
26
|
+
var import_output = require("../output");
|
|
27
|
+
var import_router = require("../router");
|
|
28
|
+
var import_select = require("../selection/select");
|
|
29
|
+
var import_userErrors = require("../userErrors");
|
|
30
|
+
var import_publishablePublish = require("../workflows/products/publishablePublish");
|
|
31
|
+
var import_shared = require("./_shared");
|
|
32
|
+
const blogSummarySelection = {
|
|
33
|
+
id: true,
|
|
34
|
+
title: true,
|
|
35
|
+
handle: true,
|
|
36
|
+
updatedAt: true
|
|
37
|
+
};
|
|
38
|
+
const blogFullSelection = {
|
|
39
|
+
...blogSummarySelection,
|
|
40
|
+
templateSuffix: true,
|
|
41
|
+
tags: true
|
|
42
|
+
};
|
|
43
|
+
const getBlogSelection = (view) => {
|
|
44
|
+
if (view === "ids") return { id: true };
|
|
45
|
+
if (view === "full") return blogFullSelection;
|
|
46
|
+
if (view === "raw") return {};
|
|
47
|
+
return blogSummarySelection;
|
|
48
|
+
};
|
|
49
|
+
const runBlogs = async ({
|
|
50
|
+
ctx,
|
|
51
|
+
verb,
|
|
52
|
+
argv
|
|
53
|
+
}) => {
|
|
54
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
55
|
+
console.log(
|
|
56
|
+
[
|
|
57
|
+
"Usage:",
|
|
58
|
+
" shop blogs <verb> [flags]",
|
|
59
|
+
"",
|
|
60
|
+
"Verbs:",
|
|
61
|
+
" create|get|list|update|delete|publish|unpublish|count",
|
|
62
|
+
"",
|
|
63
|
+
"Common output flags:",
|
|
64
|
+
" --view summary|ids|full|raw",
|
|
65
|
+
" --select <path> (repeatable; dot paths; adds to base view selection)",
|
|
66
|
+
" --selection <graphql> (selection override; can be @file.gql)",
|
|
67
|
+
"",
|
|
68
|
+
"Notes:",
|
|
69
|
+
" Shopify blogs do not have a direct published/unpublished state.",
|
|
70
|
+
" blogs publish/unpublish updates isPublished for all articles in the blog."
|
|
71
|
+
].join("\n")
|
|
72
|
+
);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (verb === "count") {
|
|
76
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { limit: { type: "string" } } });
|
|
77
|
+
const query = args.query;
|
|
78
|
+
const limitRaw = args.limit;
|
|
79
|
+
const limit = limitRaw === void 0 || limitRaw === null || limitRaw === "" ? void 0 : Number(limitRaw);
|
|
80
|
+
if (limit !== void 0 && (!Number.isFinite(limit) || limit <= 0)) {
|
|
81
|
+
throw new import_errors.CliError("--limit must be a positive number", 2);
|
|
82
|
+
}
|
|
83
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
84
|
+
blogsCount: {
|
|
85
|
+
__args: {
|
|
86
|
+
...query ? { query } : {},
|
|
87
|
+
...limit !== void 0 ? { limit: Math.floor(limit) } : {}
|
|
88
|
+
},
|
|
89
|
+
count: true,
|
|
90
|
+
precision: true
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
if (result === void 0) return;
|
|
94
|
+
if (ctx.quiet) return console.log(result.blogsCount?.count ?? "");
|
|
95
|
+
(0, import_output.printJson)(result.blogsCount, ctx.format !== "raw");
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (verb === "publish" || verb === "unpublish") {
|
|
99
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
100
|
+
argv,
|
|
101
|
+
extraOptions: {
|
|
102
|
+
at: { type: "string" },
|
|
103
|
+
now: { type: "boolean" }
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
if (ctx.dryRun) {
|
|
107
|
+
throw new import_errors.CliError("blogs publish/unpublish is not supported in --dry-run mode (requires pagination)", 2);
|
|
108
|
+
}
|
|
109
|
+
const id = (0, import_shared.requireId)(args.id, "Blog");
|
|
110
|
+
const publishDate = verb === "publish" ? (0, import_publishablePublish.parsePublishDate)({ at: args.at, now: args.now }) : void 0;
|
|
111
|
+
const desired = verb === "publish" ? { isPublished: true, ...publishDate ? { publishDate } : {} } : { isPublished: false };
|
|
112
|
+
const updated = [];
|
|
113
|
+
let after = void 0;
|
|
114
|
+
for (; ; ) {
|
|
115
|
+
const page = await (0, import_router.runQuery)(ctx, {
|
|
116
|
+
blog: {
|
|
117
|
+
__args: { id },
|
|
118
|
+
id: true,
|
|
119
|
+
articles: {
|
|
120
|
+
__args: { first: 50, after },
|
|
121
|
+
pageInfo: { hasNextPage: true, endCursor: true },
|
|
122
|
+
nodes: { id: true, isPublished: true }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
if (page === void 0) return;
|
|
127
|
+
const connection = page.blog?.articles;
|
|
128
|
+
const nodes = connection?.nodes ?? [];
|
|
129
|
+
for (const a of nodes) {
|
|
130
|
+
const articleId = a?.id;
|
|
131
|
+
if (!articleId) continue;
|
|
132
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
133
|
+
articleUpdate: {
|
|
134
|
+
__args: { id: articleId, article: desired },
|
|
135
|
+
article: { id: true, isPublished: true, publishedAt: true, updatedAt: true },
|
|
136
|
+
userErrors: { field: true, message: true }
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
if (result === void 0) return;
|
|
140
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.articleUpdate, failOnUserErrors: ctx.failOnUserErrors });
|
|
141
|
+
updated.push(result.articleUpdate);
|
|
142
|
+
}
|
|
143
|
+
if (!connection?.pageInfo?.hasNextPage) break;
|
|
144
|
+
after = connection.pageInfo.endCursor;
|
|
145
|
+
if (!after) break;
|
|
146
|
+
}
|
|
147
|
+
if (ctx.quiet) {
|
|
148
|
+
for (const u of updated) {
|
|
149
|
+
const aid = u?.article?.id;
|
|
150
|
+
if (aid) process.stdout.write(`${aid}
|
|
151
|
+
`);
|
|
152
|
+
}
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
(0, import_output.printJson)(updated, ctx.format !== "raw");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (verb === "get") {
|
|
159
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
160
|
+
const id = (0, import_shared.requireId)(args.id, "Blog");
|
|
161
|
+
const selection = (0, import_select.resolveSelection)({
|
|
162
|
+
resource: "blogs",
|
|
163
|
+
view: ctx.view,
|
|
164
|
+
baseSelection: getBlogSelection(ctx.view),
|
|
165
|
+
select: args.select,
|
|
166
|
+
selection: args.selection,
|
|
167
|
+
include: args.include,
|
|
168
|
+
ensureId: ctx.quiet
|
|
169
|
+
});
|
|
170
|
+
const result = await (0, import_router.runQuery)(ctx, { blog: { __args: { id }, ...selection } });
|
|
171
|
+
if (result === void 0) return;
|
|
172
|
+
(0, import_output.printNode)({ node: result.blog, format: ctx.format, quiet: ctx.quiet });
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (verb === "list") {
|
|
176
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
177
|
+
const first = (0, import_shared.parseFirst)(args.first);
|
|
178
|
+
const after = args.after;
|
|
179
|
+
const query = args.query;
|
|
180
|
+
const reverse = args.reverse;
|
|
181
|
+
const sortKey = args.sort;
|
|
182
|
+
const nodeSelection = (0, import_select.resolveSelection)({
|
|
183
|
+
resource: "blogs",
|
|
184
|
+
view: ctx.view,
|
|
185
|
+
baseSelection: getBlogSelection(ctx.view),
|
|
186
|
+
select: args.select,
|
|
187
|
+
selection: args.selection,
|
|
188
|
+
include: args.include,
|
|
189
|
+
ensureId: ctx.quiet
|
|
190
|
+
});
|
|
191
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
192
|
+
blogs: {
|
|
193
|
+
__args: { first, after, query, reverse, sortKey },
|
|
194
|
+
pageInfo: { hasNextPage: true, endCursor: true },
|
|
195
|
+
nodes: nodeSelection
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
if (result === void 0) return;
|
|
199
|
+
(0, import_output.printConnection)({
|
|
200
|
+
connection: result.blogs,
|
|
201
|
+
format: ctx.format,
|
|
202
|
+
quiet: ctx.quiet,
|
|
203
|
+
nextPageArgs: (0, import_shared.buildListNextPageArgs)("blogs", { first, query, sort: sortKey, reverse })
|
|
204
|
+
});
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (verb === "create") {
|
|
208
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
209
|
+
const built = (0, import_input.buildInput)({
|
|
210
|
+
inputArg: args.input,
|
|
211
|
+
setArgs: args.set,
|
|
212
|
+
setJsonArgs: args["set-json"]
|
|
213
|
+
});
|
|
214
|
+
if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
|
|
215
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
216
|
+
blogCreate: {
|
|
217
|
+
__args: { blog: built.input },
|
|
218
|
+
blog: blogSummarySelection,
|
|
219
|
+
userErrors: { field: true, message: true }
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
if (result === void 0) return;
|
|
223
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.blogCreate, failOnUserErrors: ctx.failOnUserErrors });
|
|
224
|
+
if (ctx.quiet) return console.log(result.blogCreate?.blog?.id ?? "");
|
|
225
|
+
(0, import_output.printJson)(result.blogCreate, ctx.format !== "raw");
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (verb === "update") {
|
|
229
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
230
|
+
const id = (0, import_shared.requireId)(args.id, "Blog");
|
|
231
|
+
const built = (0, import_input.buildInput)({
|
|
232
|
+
inputArg: args.input,
|
|
233
|
+
setArgs: args.set,
|
|
234
|
+
setJsonArgs: args["set-json"]
|
|
235
|
+
});
|
|
236
|
+
if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
|
|
237
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
238
|
+
blogUpdate: {
|
|
239
|
+
__args: { id, blog: built.input },
|
|
240
|
+
blog: blogSummarySelection,
|
|
241
|
+
userErrors: { field: true, message: true }
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
if (result === void 0) return;
|
|
245
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.blogUpdate, failOnUserErrors: ctx.failOnUserErrors });
|
|
246
|
+
if (ctx.quiet) return console.log(result.blogUpdate?.blog?.id ?? "");
|
|
247
|
+
(0, import_output.printJson)(result.blogUpdate, ctx.format !== "raw");
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (verb === "delete") {
|
|
251
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
252
|
+
const id = (0, import_shared.requireId)(args.id, "Blog");
|
|
253
|
+
if (!args.yes) throw new import_errors.CliError("Refusing to delete without --yes", 2);
|
|
254
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
255
|
+
blogDelete: {
|
|
256
|
+
__args: { id },
|
|
257
|
+
deletedBlogId: true,
|
|
258
|
+
userErrors: { field: true, message: true }
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
if (result === void 0) return;
|
|
262
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.blogDelete, failOnUserErrors: ctx.failOnUserErrors });
|
|
263
|
+
if (ctx.quiet) return console.log(result.blogDelete?.deletedBlogId ?? "");
|
|
264
|
+
(0, import_output.printJson)(result.blogDelete, ctx.format !== "raw");
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
throw new import_errors.CliError(`Unknown verb for blogs: ${verb}`, 2);
|
|
268
|
+
};
|
|
269
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
270
|
+
0 && (module.exports = {
|
|
271
|
+
runBlogs
|
|
272
|
+
});
|
|
273
|
+
//# sourceMappingURL=blogs.js.map
|
|
@@ -0,0 +1,272 @@
|
|
|
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 bulk_operations_exports = {};
|
|
20
|
+
__export(bulk_operations_exports, {
|
|
21
|
+
runBulkOperations: () => runBulkOperations
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(bulk_operations_exports);
|
|
24
|
+
var import_errors = require("../errors");
|
|
25
|
+
var import_output = require("../output");
|
|
26
|
+
var import_router = require("../router");
|
|
27
|
+
var import_select = require("../selection/select");
|
|
28
|
+
var import_userErrors = require("../userErrors");
|
|
29
|
+
var import_shared = require("./_shared");
|
|
30
|
+
const bulkOperationSelection = {
|
|
31
|
+
id: true,
|
|
32
|
+
type: true,
|
|
33
|
+
status: true,
|
|
34
|
+
errorCode: true,
|
|
35
|
+
createdAt: true,
|
|
36
|
+
completedAt: true,
|
|
37
|
+
objectCount: true,
|
|
38
|
+
fileSize: true,
|
|
39
|
+
url: true,
|
|
40
|
+
partialDataUrl: true,
|
|
41
|
+
rootObjectCount: true,
|
|
42
|
+
query: true
|
|
43
|
+
};
|
|
44
|
+
const getBulkOperationSelection = (view) => {
|
|
45
|
+
if (view === "ids") return { id: true };
|
|
46
|
+
if (view === "raw") return {};
|
|
47
|
+
return bulkOperationSelection;
|
|
48
|
+
};
|
|
49
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
50
|
+
const waitForBulkOperation = async ({
|
|
51
|
+
ctx,
|
|
52
|
+
id,
|
|
53
|
+
intervalMs
|
|
54
|
+
}) => {
|
|
55
|
+
while (true) {
|
|
56
|
+
const result = await (0, import_router.runQuery)(ctx, { bulkOperation: { __args: { id }, ...bulkOperationSelection } });
|
|
57
|
+
if (result === void 0) return void 0;
|
|
58
|
+
const op = result.bulkOperation;
|
|
59
|
+
const status = op?.status;
|
|
60
|
+
if (status && ["COMPLETED", "FAILED", "CANCELED", "EXPIRED"].includes(status)) {
|
|
61
|
+
return op;
|
|
62
|
+
}
|
|
63
|
+
await sleep(intervalMs);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const runBulkOperations = async ({
|
|
67
|
+
ctx,
|
|
68
|
+
verb,
|
|
69
|
+
argv
|
|
70
|
+
}) => {
|
|
71
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
72
|
+
console.log(
|
|
73
|
+
[
|
|
74
|
+
"Usage:",
|
|
75
|
+
" shop bulk-operations <verb> [flags]",
|
|
76
|
+
"",
|
|
77
|
+
"Verbs:",
|
|
78
|
+
" run-query|run-mutation|get|list|current|cancel|job",
|
|
79
|
+
"",
|
|
80
|
+
"Common output flags:",
|
|
81
|
+
" --view summary|ids|raw",
|
|
82
|
+
" --select <path> (repeatable; dot paths; adds to base view selection)",
|
|
83
|
+
" --selection <graphql> (selection override; can be @file.gql)"
|
|
84
|
+
].join("\n")
|
|
85
|
+
);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (verb === "job") {
|
|
89
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
90
|
+
const id = args.id;
|
|
91
|
+
if (!id) throw new import_errors.CliError("Missing --id", 2);
|
|
92
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
93
|
+
job: { __args: { id }, id: true, done: true }
|
|
94
|
+
});
|
|
95
|
+
if (result === void 0) return;
|
|
96
|
+
(0, import_output.printNode)({ node: result.job, format: ctx.format, quiet: ctx.quiet });
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (verb === "run-query") {
|
|
100
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { wait: { type: "boolean" }, "wait-interval": { type: "string" } } });
|
|
101
|
+
const query = (0, import_shared.parseTextArg)(args.query, "--query");
|
|
102
|
+
const wait = Boolean(args.wait);
|
|
103
|
+
const intervalMs = args["wait-interval"] ? Number(args["wait-interval"]) * 1e3 : 2e3;
|
|
104
|
+
if (!Number.isFinite(intervalMs) || intervalMs <= 0) {
|
|
105
|
+
throw new import_errors.CliError("--wait-interval must be a positive number (seconds)", 2);
|
|
106
|
+
}
|
|
107
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
108
|
+
bulkOperationRunQuery: {
|
|
109
|
+
__args: { query },
|
|
110
|
+
bulkOperation: bulkOperationSelection,
|
|
111
|
+
userErrors: { field: true, message: true }
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
if (result === void 0) return;
|
|
115
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.bulkOperationRunQuery, failOnUserErrors: ctx.failOnUserErrors });
|
|
116
|
+
const op = result.bulkOperationRunQuery?.bulkOperation;
|
|
117
|
+
if (!wait) {
|
|
118
|
+
if (ctx.quiet) return console.log(op?.id ?? "");
|
|
119
|
+
(0, import_output.printJson)(result.bulkOperationRunQuery, ctx.format !== "raw");
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (!op?.id) throw new import_errors.CliError("Bulk operation did not return an ID", 2);
|
|
123
|
+
const finalOp = await waitForBulkOperation({ ctx, id: op.id, intervalMs });
|
|
124
|
+
if (!finalOp) return;
|
|
125
|
+
if (ctx.quiet) return console.log(finalOp.id ?? "");
|
|
126
|
+
(0, import_output.printJson)(finalOp, ctx.format !== "raw");
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (verb === "run-mutation") {
|
|
130
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
131
|
+
argv,
|
|
132
|
+
extraOptions: {
|
|
133
|
+
mutation: { type: "string" },
|
|
134
|
+
"staged-upload-path": { type: "string" },
|
|
135
|
+
"client-id": { type: "string" },
|
|
136
|
+
wait: { type: "boolean" },
|
|
137
|
+
"wait-interval": { type: "string" }
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
const mutation = (0, import_shared.parseTextArg)(args.mutation, "--mutation");
|
|
141
|
+
const stagedUploadPath = args["staged-upload-path"];
|
|
142
|
+
if (!stagedUploadPath) throw new import_errors.CliError("Missing --staged-upload-path", 2);
|
|
143
|
+
const clientIdentifier = args["client-id"];
|
|
144
|
+
const wait = Boolean(args.wait);
|
|
145
|
+
const intervalMs = args["wait-interval"] ? Number(args["wait-interval"]) * 1e3 : 2e3;
|
|
146
|
+
if (!Number.isFinite(intervalMs) || intervalMs <= 0) {
|
|
147
|
+
throw new import_errors.CliError("--wait-interval must be a positive number (seconds)", 2);
|
|
148
|
+
}
|
|
149
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
150
|
+
bulkOperationRunMutation: {
|
|
151
|
+
__args: {
|
|
152
|
+
mutation,
|
|
153
|
+
stagedUploadPath,
|
|
154
|
+
...clientIdentifier ? { clientIdentifier } : {}
|
|
155
|
+
},
|
|
156
|
+
bulkOperation: bulkOperationSelection,
|
|
157
|
+
userErrors: { field: true, message: true }
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
if (result === void 0) return;
|
|
161
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.bulkOperationRunMutation, failOnUserErrors: ctx.failOnUserErrors });
|
|
162
|
+
const op = result.bulkOperationRunMutation?.bulkOperation;
|
|
163
|
+
if (!wait) {
|
|
164
|
+
if (ctx.quiet) return console.log(op?.id ?? "");
|
|
165
|
+
(0, import_output.printJson)(result.bulkOperationRunMutation, ctx.format !== "raw");
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (!op?.id) throw new import_errors.CliError("Bulk operation did not return an ID", 2);
|
|
169
|
+
const finalOp = await waitForBulkOperation({ ctx, id: op.id, intervalMs });
|
|
170
|
+
if (!finalOp) return;
|
|
171
|
+
if (ctx.quiet) return console.log(finalOp.id ?? "");
|
|
172
|
+
(0, import_output.printJson)(finalOp, ctx.format !== "raw");
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (verb === "get") {
|
|
176
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
177
|
+
const id = (0, import_shared.requireId)(args.id, "BulkOperation");
|
|
178
|
+
const selection = (0, import_select.resolveSelection)({
|
|
179
|
+
resource: "bulk-operations",
|
|
180
|
+
view: ctx.view,
|
|
181
|
+
baseSelection: getBulkOperationSelection(ctx.view),
|
|
182
|
+
select: args.select,
|
|
183
|
+
selection: args.selection,
|
|
184
|
+
include: args.include,
|
|
185
|
+
ensureId: ctx.quiet
|
|
186
|
+
});
|
|
187
|
+
const result = await (0, import_router.runQuery)(ctx, { bulkOperation: { __args: { id }, ...selection } });
|
|
188
|
+
if (result === void 0) return;
|
|
189
|
+
(0, import_output.printNode)({ node: result.bulkOperation, format: ctx.format, quiet: ctx.quiet });
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (verb === "list") {
|
|
193
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { status: { type: "string" } } });
|
|
194
|
+
const first = (0, import_shared.parseFirst)(args.first);
|
|
195
|
+
const after = args.after;
|
|
196
|
+
const reverse = args.reverse;
|
|
197
|
+
const sortKey = args.sort;
|
|
198
|
+
const status = args.status;
|
|
199
|
+
const type = args.type;
|
|
200
|
+
const queryParts = [];
|
|
201
|
+
if (args.query) queryParts.push(args.query);
|
|
202
|
+
if (status) queryParts.push(`status:${status.toLowerCase()}`);
|
|
203
|
+
if (type) queryParts.push(`operation_type:${type.toLowerCase()}`);
|
|
204
|
+
const query = queryParts.length > 0 ? queryParts.join(" ") : void 0;
|
|
205
|
+
const nodeSelection = (0, import_select.resolveSelection)({
|
|
206
|
+
resource: "bulk-operations",
|
|
207
|
+
view: ctx.view,
|
|
208
|
+
baseSelection: getBulkOperationSelection(ctx.view),
|
|
209
|
+
select: args.select,
|
|
210
|
+
selection: args.selection,
|
|
211
|
+
include: args.include,
|
|
212
|
+
ensureId: ctx.quiet
|
|
213
|
+
});
|
|
214
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
215
|
+
bulkOperations: {
|
|
216
|
+
__args: { first, after, reverse, sortKey, ...query ? { query } : {} },
|
|
217
|
+
pageInfo: { hasNextPage: true, endCursor: true },
|
|
218
|
+
nodes: nodeSelection
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
if (result === void 0) return;
|
|
222
|
+
(0, import_output.printConnection)({
|
|
223
|
+
connection: result.bulkOperations,
|
|
224
|
+
format: ctx.format,
|
|
225
|
+
quiet: ctx.quiet,
|
|
226
|
+
nextPageArgs: (0, import_shared.buildListNextPageArgs)("bulk-operations", { first, query, sort: sortKey, reverse })
|
|
227
|
+
});
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (verb === "current") {
|
|
231
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { type: { type: "string" } } });
|
|
232
|
+
const type = args.type;
|
|
233
|
+
const selection = (0, import_select.resolveSelection)({
|
|
234
|
+
resource: "bulk-operations",
|
|
235
|
+
view: ctx.view,
|
|
236
|
+
baseSelection: getBulkOperationSelection(ctx.view),
|
|
237
|
+
select: args.select,
|
|
238
|
+
selection: args.selection,
|
|
239
|
+
include: args.include,
|
|
240
|
+
ensureId: ctx.quiet
|
|
241
|
+
});
|
|
242
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
243
|
+
currentBulkOperation: { __args: { ...type ? { type } : {} }, ...selection }
|
|
244
|
+
});
|
|
245
|
+
if (result === void 0) return;
|
|
246
|
+
(0, import_output.printNode)({ node: result.currentBulkOperation, format: ctx.format, quiet: ctx.quiet });
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (verb === "cancel") {
|
|
250
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
251
|
+
const id = (0, import_shared.requireId)(args.id, "BulkOperation");
|
|
252
|
+
if (!args.yes) throw new import_errors.CliError("Refusing to cancel without --yes", 2);
|
|
253
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
254
|
+
bulkOperationCancel: {
|
|
255
|
+
__args: { id },
|
|
256
|
+
bulkOperation: bulkOperationSelection,
|
|
257
|
+
userErrors: { field: true, message: true }
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
if (result === void 0) return;
|
|
261
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.bulkOperationCancel, failOnUserErrors: ctx.failOnUserErrors });
|
|
262
|
+
if (ctx.quiet) return console.log(result.bulkOperationCancel?.bulkOperation?.id ?? "");
|
|
263
|
+
(0, import_output.printJson)(result.bulkOperationCancel, ctx.format !== "raw");
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
throw new import_errors.CliError(`Unknown verb for bulk-operations: ${verb}`, 2);
|
|
267
|
+
};
|
|
268
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
269
|
+
0 && (module.exports = {
|
|
270
|
+
runBulkOperations
|
|
271
|
+
});
|
|
272
|
+
//# sourceMappingURL=bulk-operations.js.map
|
|
@@ -0,0 +1,102 @@
|
|
|
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 business_entities_exports = {};
|
|
20
|
+
__export(business_entities_exports, {
|
|
21
|
+
runBusinessEntities: () => runBusinessEntities
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(business_entities_exports);
|
|
24
|
+
var import_errors = require("../errors");
|
|
25
|
+
var import_output = require("../output");
|
|
26
|
+
var import_router = require("../router");
|
|
27
|
+
var import_select = require("../selection/select");
|
|
28
|
+
var import_gid = require("../gid");
|
|
29
|
+
var import_shared = require("./_shared");
|
|
30
|
+
const businessEntitySummarySelection = {
|
|
31
|
+
id: true,
|
|
32
|
+
displayName: true,
|
|
33
|
+
companyName: true,
|
|
34
|
+
primary: true,
|
|
35
|
+
archived: true,
|
|
36
|
+
address: { countryCode: true, city: true, province: true }
|
|
37
|
+
};
|
|
38
|
+
const businessEntityFullSelection = {
|
|
39
|
+
...businessEntitySummarySelection,
|
|
40
|
+
address: {
|
|
41
|
+
...businessEntitySummarySelection.address,
|
|
42
|
+
address1: true,
|
|
43
|
+
address2: true,
|
|
44
|
+
zip: true
|
|
45
|
+
},
|
|
46
|
+
shopifyPaymentsAccount: { id: true, activated: true }
|
|
47
|
+
};
|
|
48
|
+
const getBusinessEntitySelection = (view) => {
|
|
49
|
+
if (view === "ids") return { id: true };
|
|
50
|
+
if (view === "full") return businessEntityFullSelection;
|
|
51
|
+
if (view === "raw") return {};
|
|
52
|
+
return businessEntitySummarySelection;
|
|
53
|
+
};
|
|
54
|
+
const runBusinessEntities = async ({
|
|
55
|
+
ctx,
|
|
56
|
+
verb,
|
|
57
|
+
argv
|
|
58
|
+
}) => {
|
|
59
|
+
if (verb === "list") {
|
|
60
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
61
|
+
const first = (0, import_shared.parseFirst)(args.first);
|
|
62
|
+
const selection = (0, import_select.resolveSelection)({
|
|
63
|
+
resource: "business-entities",
|
|
64
|
+
view: ctx.view,
|
|
65
|
+
baseSelection: getBusinessEntitySelection(ctx.view),
|
|
66
|
+
select: args.select,
|
|
67
|
+
selection: args.selection,
|
|
68
|
+
include: args.include,
|
|
69
|
+
ensureId: ctx.quiet
|
|
70
|
+
});
|
|
71
|
+
const result = await (0, import_router.runQuery)(ctx, { businessEntities: selection });
|
|
72
|
+
if (result === void 0) return;
|
|
73
|
+
const nodes = (result.businessEntities ?? []).slice(0, first);
|
|
74
|
+
(0, import_output.printConnection)({ connection: { nodes }, format: ctx.format, quiet: ctx.quiet });
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (verb === "get") {
|
|
78
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
79
|
+
const idRaw = args.id;
|
|
80
|
+
const selection = (0, import_select.resolveSelection)({
|
|
81
|
+
resource: "business-entities",
|
|
82
|
+
view: ctx.view,
|
|
83
|
+
baseSelection: getBusinessEntitySelection(ctx.view),
|
|
84
|
+
select: args.select,
|
|
85
|
+
selection: args.selection,
|
|
86
|
+
include: args.include,
|
|
87
|
+
ensureId: ctx.quiet
|
|
88
|
+
});
|
|
89
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
90
|
+
businessEntity: { __args: { ...idRaw ? { id: (0, import_gid.coerceGid)(idRaw, "BusinessEntity") } : {} }, ...selection }
|
|
91
|
+
});
|
|
92
|
+
if (result === void 0) return;
|
|
93
|
+
(0, import_output.printNode)({ node: result.businessEntity, format: ctx.format, quiet: ctx.quiet });
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
throw new import_errors.CliError(`Unknown verb for business-entities: ${verb}`, 2);
|
|
97
|
+
};
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
runBusinessEntities
|
|
101
|
+
});
|
|
102
|
+
//# sourceMappingURL=business-entities.js.map
|