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,358 @@
|
|
|
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 customer_payment_methods_exports = {};
|
|
20
|
+
__export(customer_payment_methods_exports, {
|
|
21
|
+
runCustomerPaymentMethods: () => runCustomerPaymentMethods
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(customer_payment_methods_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 parseBool = (value, flag, { allowEmpty = false } = {}) => {
|
|
31
|
+
if (value === void 0 || value === null || value === "") {
|
|
32
|
+
if (allowEmpty) return void 0;
|
|
33
|
+
throw new import_errors.CliError(`Missing ${flag}`, 2);
|
|
34
|
+
}
|
|
35
|
+
if (typeof value !== "string") throw new import_errors.CliError(`${flag} must be a string`, 2);
|
|
36
|
+
const raw = value.trim().toLowerCase();
|
|
37
|
+
if (!raw) {
|
|
38
|
+
if (allowEmpty) return void 0;
|
|
39
|
+
throw new import_errors.CliError(`Missing ${flag}`, 2);
|
|
40
|
+
}
|
|
41
|
+
if (raw === "true" || raw === "1" || raw === "yes") return true;
|
|
42
|
+
if (raw === "false" || raw === "0" || raw === "no") return false;
|
|
43
|
+
throw new import_errors.CliError(`${flag} must be a boolean (true/false)`, 2);
|
|
44
|
+
};
|
|
45
|
+
const customerPaymentMethodSummarySelection = {
|
|
46
|
+
id: true,
|
|
47
|
+
revokedAt: true,
|
|
48
|
+
revokedReason: true,
|
|
49
|
+
customer: { id: true },
|
|
50
|
+
instrument: { __typename: true }
|
|
51
|
+
};
|
|
52
|
+
const customerPaymentMethodFullSelection = {
|
|
53
|
+
...customerPaymentMethodSummarySelection,
|
|
54
|
+
instrument: {
|
|
55
|
+
__typename: true,
|
|
56
|
+
on_CustomerCreditCard: {
|
|
57
|
+
brand: true,
|
|
58
|
+
lastDigits: true,
|
|
59
|
+
expiryMonth: true,
|
|
60
|
+
expiryYear: true,
|
|
61
|
+
name: true,
|
|
62
|
+
expiresSoon: true,
|
|
63
|
+
isRevocable: true,
|
|
64
|
+
maskedNumber: true
|
|
65
|
+
},
|
|
66
|
+
on_CustomerPaypalBillingAgreement: {
|
|
67
|
+
inactive: true,
|
|
68
|
+
paypalAccountEmail: true,
|
|
69
|
+
isRevocable: true,
|
|
70
|
+
billingAddress: { address1: true, city: true, countryCode: true, provinceCode: true, zip: true }
|
|
71
|
+
},
|
|
72
|
+
on_CustomerShopPayAgreement: {
|
|
73
|
+
inactive: true,
|
|
74
|
+
lastDigits: true,
|
|
75
|
+
expiryMonth: true,
|
|
76
|
+
expiryYear: true,
|
|
77
|
+
name: true,
|
|
78
|
+
expiresSoon: true,
|
|
79
|
+
isRevocable: true,
|
|
80
|
+
maskedNumber: true
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const getCustomerPaymentMethodSelection = (view) => {
|
|
85
|
+
if (view === "ids") return { id: true };
|
|
86
|
+
if (view === "full") return customerPaymentMethodFullSelection;
|
|
87
|
+
if (view === "raw") return {};
|
|
88
|
+
return customerPaymentMethodSummarySelection;
|
|
89
|
+
};
|
|
90
|
+
const runCustomerPaymentMethods = async ({
|
|
91
|
+
ctx,
|
|
92
|
+
verb,
|
|
93
|
+
argv
|
|
94
|
+
}) => {
|
|
95
|
+
if (verb === "get") {
|
|
96
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "show-revoked": { type: "boolean" } } });
|
|
97
|
+
const id = (0, import_shared.requireId)(args.id, "CustomerPaymentMethod");
|
|
98
|
+
const showRevoked = args["show-revoked"] === true ? true : void 0;
|
|
99
|
+
const selection = (0, import_select.resolveSelection)({
|
|
100
|
+
resource: "customer-payment-methods",
|
|
101
|
+
view: ctx.view,
|
|
102
|
+
baseSelection: getCustomerPaymentMethodSelection(ctx.view),
|
|
103
|
+
select: args.select,
|
|
104
|
+
selection: args.selection,
|
|
105
|
+
include: args.include,
|
|
106
|
+
ensureId: ctx.quiet
|
|
107
|
+
});
|
|
108
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
109
|
+
customerPaymentMethod: {
|
|
110
|
+
__args: { id, ...showRevoked ? { showRevoked } : {} },
|
|
111
|
+
...selection
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
if (result === void 0) return;
|
|
115
|
+
(0, import_output.printNode)({ node: result.customerPaymentMethod, format: ctx.format, quiet: ctx.quiet });
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (verb === "credit-card-create") {
|
|
119
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
120
|
+
argv,
|
|
121
|
+
extraOptions: { "customer-id": { type: "string" }, "billing-address": { type: "string" }, "session-id": { type: "string" } }
|
|
122
|
+
});
|
|
123
|
+
const customerId = (0, import_shared.requireGidFlag)(args["customer-id"], "--customer-id", "Customer");
|
|
124
|
+
const billingAddress = (0, import_shared.parseJsonArg)(args["billing-address"], "--billing-address");
|
|
125
|
+
const sessionId = (0, import_shared.requireStringFlag)(args["session-id"], "--session-id");
|
|
126
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
127
|
+
customerPaymentMethodCreditCardCreate: {
|
|
128
|
+
__args: { customerId, billingAddress, sessionId },
|
|
129
|
+
customerPaymentMethod: customerPaymentMethodSummarySelection,
|
|
130
|
+
processing: true,
|
|
131
|
+
userErrors: { field: true, message: true }
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
if (result === void 0) return;
|
|
135
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
136
|
+
payload: result.customerPaymentMethodCreditCardCreate,
|
|
137
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
138
|
+
});
|
|
139
|
+
if (ctx.quiet) return console.log(result.customerPaymentMethodCreditCardCreate?.customerPaymentMethod?.id ?? "");
|
|
140
|
+
(0, import_output.printJson)(result.customerPaymentMethodCreditCardCreate, ctx.format !== "raw");
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (verb === "credit-card-update") {
|
|
144
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
145
|
+
argv,
|
|
146
|
+
extraOptions: { "billing-address": { type: "string" }, "session-id": { type: "string" } }
|
|
147
|
+
});
|
|
148
|
+
const id = (0, import_shared.requireId)(args.id, "CustomerPaymentMethod");
|
|
149
|
+
const billingAddress = (0, import_shared.parseJsonArg)(args["billing-address"], "--billing-address");
|
|
150
|
+
const sessionId = (0, import_shared.requireStringFlag)(args["session-id"], "--session-id");
|
|
151
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
152
|
+
customerPaymentMethodCreditCardUpdate: {
|
|
153
|
+
__args: { id, billingAddress, sessionId },
|
|
154
|
+
customerPaymentMethod: customerPaymentMethodSummarySelection,
|
|
155
|
+
processing: true,
|
|
156
|
+
userErrors: { field: true, message: true }
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
if (result === void 0) return;
|
|
160
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
161
|
+
payload: result.customerPaymentMethodCreditCardUpdate,
|
|
162
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
163
|
+
});
|
|
164
|
+
if (ctx.quiet) return console.log(result.customerPaymentMethodCreditCardUpdate?.customerPaymentMethod?.id ?? "");
|
|
165
|
+
(0, import_output.printJson)(result.customerPaymentMethodCreditCardUpdate, ctx.format !== "raw");
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (verb === "paypal-billing-agreement-create") {
|
|
169
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
170
|
+
argv,
|
|
171
|
+
extraOptions: {
|
|
172
|
+
"customer-id": { type: "string" },
|
|
173
|
+
"billing-agreement-id": { type: "string" },
|
|
174
|
+
"billing-address": { type: "string" },
|
|
175
|
+
inactive: { type: "string" }
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
const customerId = (0, import_shared.requireGidFlag)(args["customer-id"], "--customer-id", "Customer");
|
|
179
|
+
const billingAgreementId = (0, import_shared.requireStringFlag)(args["billing-agreement-id"], "--billing-agreement-id");
|
|
180
|
+
const billingAddressRaw = args["billing-address"];
|
|
181
|
+
const billingAddress = billingAddressRaw ? (0, import_shared.parseJsonArg)(billingAddressRaw, "--billing-address") : void 0;
|
|
182
|
+
const inactive = parseBool(args.inactive, "--inactive", { allowEmpty: true });
|
|
183
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
184
|
+
customerPaymentMethodPaypalBillingAgreementCreate: {
|
|
185
|
+
__args: { customerId, billingAgreementId, ...billingAddress ? { billingAddress } : {}, ...inactive !== void 0 ? { inactive } : {} },
|
|
186
|
+
customerPaymentMethod: customerPaymentMethodSummarySelection,
|
|
187
|
+
userErrors: { field: true, message: true, code: true }
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
if (result === void 0) return;
|
|
191
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
192
|
+
payload: result.customerPaymentMethodPaypalBillingAgreementCreate,
|
|
193
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
194
|
+
});
|
|
195
|
+
if (ctx.quiet) return console.log(result.customerPaymentMethodPaypalBillingAgreementCreate?.customerPaymentMethod?.id ?? "");
|
|
196
|
+
(0, import_output.printJson)(result.customerPaymentMethodPaypalBillingAgreementCreate, ctx.format !== "raw");
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (verb === "paypal-billing-agreement-update") {
|
|
200
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "billing-address": { type: "string" } } });
|
|
201
|
+
const id = (0, import_shared.requireId)(args.id, "CustomerPaymentMethod");
|
|
202
|
+
const billingAddress = (0, import_shared.parseJsonArg)(args["billing-address"], "--billing-address");
|
|
203
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
204
|
+
customerPaymentMethodPaypalBillingAgreementUpdate: {
|
|
205
|
+
__args: { id, billingAddress },
|
|
206
|
+
customerPaymentMethod: customerPaymentMethodSummarySelection,
|
|
207
|
+
userErrors: { field: true, message: true, code: true }
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
if (result === void 0) return;
|
|
211
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
212
|
+
payload: result.customerPaymentMethodPaypalBillingAgreementUpdate,
|
|
213
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
214
|
+
});
|
|
215
|
+
if (ctx.quiet) return console.log(result.customerPaymentMethodPaypalBillingAgreementUpdate?.customerPaymentMethod?.id ?? "");
|
|
216
|
+
(0, import_output.printJson)(result.customerPaymentMethodPaypalBillingAgreementUpdate, ctx.format !== "raw");
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (verb === "remote-create") {
|
|
220
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
221
|
+
argv,
|
|
222
|
+
extraOptions: { "customer-id": { type: "string" }, "remote-reference": { type: "string" } }
|
|
223
|
+
});
|
|
224
|
+
const customerId = (0, import_shared.requireGidFlag)(args["customer-id"], "--customer-id", "Customer");
|
|
225
|
+
const remoteReference = (0, import_shared.parseJsonArg)(args["remote-reference"], "--remote-reference");
|
|
226
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
227
|
+
customerPaymentMethodRemoteCreate: {
|
|
228
|
+
__args: { customerId, remoteReference },
|
|
229
|
+
customerPaymentMethod: customerPaymentMethodSummarySelection,
|
|
230
|
+
userErrors: { field: true, message: true, code: true }
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
if (result === void 0) return;
|
|
234
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
235
|
+
payload: result.customerPaymentMethodRemoteCreate,
|
|
236
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
237
|
+
});
|
|
238
|
+
if (ctx.quiet) return console.log(result.customerPaymentMethodRemoteCreate?.customerPaymentMethod?.id ?? "");
|
|
239
|
+
(0, import_output.printJson)(result.customerPaymentMethodRemoteCreate, ctx.format !== "raw");
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (verb === "revoke") {
|
|
243
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
244
|
+
const customerPaymentMethodId = (0, import_shared.requireId)(args.id, "CustomerPaymentMethod");
|
|
245
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
246
|
+
customerPaymentMethodRevoke: {
|
|
247
|
+
__args: { customerPaymentMethodId },
|
|
248
|
+
revokedCustomerPaymentMethodId: true,
|
|
249
|
+
userErrors: { field: true, message: true }
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
if (result === void 0) return;
|
|
253
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
254
|
+
payload: result.customerPaymentMethodRevoke,
|
|
255
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
256
|
+
});
|
|
257
|
+
if (ctx.quiet) return console.log(result.customerPaymentMethodRevoke?.revokedCustomerPaymentMethodId ?? "");
|
|
258
|
+
(0, import_output.printJson)(result.customerPaymentMethodRevoke, ctx.format !== "raw");
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (verb === "send-update-email") {
|
|
262
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { email: { type: "string" } } });
|
|
263
|
+
const customerPaymentMethodId = (0, import_shared.requireId)(args.id, "CustomerPaymentMethod");
|
|
264
|
+
const email = args.email ? (0, import_shared.parseJsonArg)(args.email, "--email", { allowEmpty: true }) : void 0;
|
|
265
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
266
|
+
customerPaymentMethodSendUpdateEmail: {
|
|
267
|
+
__args: { customerPaymentMethodId, ...email ? { email } : {} },
|
|
268
|
+
customer: { id: true },
|
|
269
|
+
userErrors: { field: true, message: true }
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
if (result === void 0) return;
|
|
273
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
274
|
+
payload: result.customerPaymentMethodSendUpdateEmail,
|
|
275
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
276
|
+
});
|
|
277
|
+
if (ctx.quiet) return console.log(result.customerPaymentMethodSendUpdateEmail?.customer?.id ?? "");
|
|
278
|
+
(0, import_output.printJson)(result.customerPaymentMethodSendUpdateEmail, ctx.format !== "raw");
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (verb === "duplication-data-get") {
|
|
282
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
283
|
+
argv,
|
|
284
|
+
extraOptions: { "target-customer-id": { type: "string" }, "target-shop-id": { type: "string" } }
|
|
285
|
+
});
|
|
286
|
+
const customerPaymentMethodId = (0, import_shared.requireId)(args.id, "CustomerPaymentMethod");
|
|
287
|
+
const targetCustomerId = (0, import_shared.requireGidFlag)(args["target-customer-id"], "--target-customer-id", "Customer");
|
|
288
|
+
const targetShopId = (0, import_shared.requireGidFlag)(args["target-shop-id"], "--target-shop-id", "Shop");
|
|
289
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
290
|
+
customerPaymentMethodGetDuplicationData: {
|
|
291
|
+
__args: { customerPaymentMethodId, targetCustomerId, targetShopId },
|
|
292
|
+
encryptedDuplicationData: true,
|
|
293
|
+
userErrors: { field: true, message: true, code: true }
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
if (result === void 0) return;
|
|
297
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
298
|
+
payload: result.customerPaymentMethodGetDuplicationData,
|
|
299
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
300
|
+
});
|
|
301
|
+
if (ctx.quiet) return console.log(result.customerPaymentMethodGetDuplicationData?.encryptedDuplicationData ?? "");
|
|
302
|
+
(0, import_output.printJson)(result.customerPaymentMethodGetDuplicationData, ctx.format !== "raw");
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
if (verb === "duplication-create") {
|
|
306
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
307
|
+
argv,
|
|
308
|
+
extraOptions: {
|
|
309
|
+
"customer-id": { type: "string" },
|
|
310
|
+
"billing-address": { type: "string" },
|
|
311
|
+
"encrypted-duplication-data": { type: "string" }
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
const customerId = (0, import_shared.requireGidFlag)(args["customer-id"], "--customer-id", "Customer");
|
|
315
|
+
const billingAddress = (0, import_shared.parseJsonArg)(args["billing-address"], "--billing-address");
|
|
316
|
+
const encryptedDuplicationData = (0, import_shared.requireStringFlag)(args["encrypted-duplication-data"], "--encrypted-duplication-data");
|
|
317
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
318
|
+
customerPaymentMethodCreateFromDuplicationData: {
|
|
319
|
+
__args: { customerId, billingAddress, encryptedDuplicationData },
|
|
320
|
+
customerPaymentMethod: customerPaymentMethodSummarySelection,
|
|
321
|
+
userErrors: { field: true, message: true, code: true }
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
if (result === void 0) return;
|
|
325
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
326
|
+
payload: result.customerPaymentMethodCreateFromDuplicationData,
|
|
327
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
328
|
+
});
|
|
329
|
+
if (ctx.quiet) return console.log(result.customerPaymentMethodCreateFromDuplicationData?.customerPaymentMethod?.id ?? "");
|
|
330
|
+
(0, import_output.printJson)(result.customerPaymentMethodCreateFromDuplicationData, ctx.format !== "raw");
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (verb === "update-url-get") {
|
|
334
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
335
|
+
const customerPaymentMethodId = (0, import_shared.requireId)(args.id, "CustomerPaymentMethod");
|
|
336
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
337
|
+
customerPaymentMethodGetUpdateUrl: {
|
|
338
|
+
__args: { customerPaymentMethodId },
|
|
339
|
+
updatePaymentMethodUrl: true,
|
|
340
|
+
userErrors: { field: true, message: true, code: true }
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
if (result === void 0) return;
|
|
344
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
345
|
+
payload: result.customerPaymentMethodGetUpdateUrl,
|
|
346
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
347
|
+
});
|
|
348
|
+
if (ctx.quiet) return console.log(result.customerPaymentMethodGetUpdateUrl?.updatePaymentMethodUrl ?? "");
|
|
349
|
+
(0, import_output.printJson)(result.customerPaymentMethodGetUpdateUrl, ctx.format !== "raw");
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
throw new import_errors.CliError(`Unknown verb for customer-payment-methods: ${verb}`, 2);
|
|
353
|
+
};
|
|
354
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
355
|
+
0 && (module.exports = {
|
|
356
|
+
runCustomerPaymentMethods
|
|
357
|
+
});
|
|
358
|
+
//# sourceMappingURL=customer-payment-methods.js.map
|
|
@@ -0,0 +1,167 @@
|
|
|
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 customer_privacy_exports = {};
|
|
20
|
+
__export(customer_privacy_exports, {
|
|
21
|
+
runCustomerPrivacy: () => runCustomerPrivacy
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(customer_privacy_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_userErrors = require("../userErrors");
|
|
29
|
+
var import_shared = require("./_shared");
|
|
30
|
+
const parseBool = (value, flag) => {
|
|
31
|
+
if (typeof value !== "string" || !value.trim()) throw new import_errors.CliError(`Missing ${flag}`, 2);
|
|
32
|
+
const raw = value.trim().toLowerCase();
|
|
33
|
+
if (raw === "true" || raw === "1" || raw === "yes") return true;
|
|
34
|
+
if (raw === "false" || raw === "0" || raw === "no") return false;
|
|
35
|
+
throw new import_errors.CliError(`${flag} must be a boolean (true/false)`, 2);
|
|
36
|
+
};
|
|
37
|
+
const privacySettingsSelection = {
|
|
38
|
+
banner: { enabled: true, autoManaged: true },
|
|
39
|
+
dataSaleOptOutPage: { autoManaged: true },
|
|
40
|
+
privacyPolicy: { autoManaged: true, supportedLocales: true }
|
|
41
|
+
};
|
|
42
|
+
const consentPolicySelection = {
|
|
43
|
+
id: true,
|
|
44
|
+
countryCode: true,
|
|
45
|
+
regionCode: true,
|
|
46
|
+
consentRequired: true,
|
|
47
|
+
dataSaleOptOutRequired: true,
|
|
48
|
+
shopId: true
|
|
49
|
+
};
|
|
50
|
+
const consentPolicyRegionSelection = {
|
|
51
|
+
countryCode: true,
|
|
52
|
+
regionCode: true
|
|
53
|
+
};
|
|
54
|
+
const runCustomerPrivacy = async ({
|
|
55
|
+
ctx,
|
|
56
|
+
verb,
|
|
57
|
+
argv
|
|
58
|
+
}) => {
|
|
59
|
+
if (verb === "privacy-settings") {
|
|
60
|
+
const result = await (0, import_router.runQuery)(ctx, { privacySettings: privacySettingsSelection });
|
|
61
|
+
if (result === void 0) return;
|
|
62
|
+
(0, import_output.printNode)({ node: result.privacySettings, format: ctx.format, quiet: ctx.quiet });
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (verb === "privacy-features-disable") {
|
|
66
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { features: { type: "string" } } });
|
|
67
|
+
const features = (0, import_shared.parseCsv)(args.features, "--features");
|
|
68
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
69
|
+
privacyFeaturesDisable: {
|
|
70
|
+
__args: { featuresToDisable: features },
|
|
71
|
+
featuresDisabled: true,
|
|
72
|
+
userErrors: { code: true, field: true, message: true }
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
if (result === void 0) return;
|
|
76
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.privacyFeaturesDisable, failOnUserErrors: ctx.failOnUserErrors });
|
|
77
|
+
(0, import_output.printJson)(result.privacyFeaturesDisable, ctx.format !== "raw");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (verb === "consent-policy") {
|
|
81
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
82
|
+
argv,
|
|
83
|
+
extraOptions: {
|
|
84
|
+
"country-code": { type: "string" },
|
|
85
|
+
"region-code": { type: "string" },
|
|
86
|
+
"consent-required": { type: "string" },
|
|
87
|
+
"data-sale-opt-out-required": { type: "string" }
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const id = args.id;
|
|
91
|
+
const countryCode = args["country-code"];
|
|
92
|
+
const regionCode = args["region-code"];
|
|
93
|
+
const consentRequiredRaw = args["consent-required"];
|
|
94
|
+
const dataSaleOptOutRequiredRaw = args["data-sale-opt-out-required"];
|
|
95
|
+
const consentRequired = consentRequiredRaw === void 0 ? void 0 : parseBool(consentRequiredRaw, "--consent-required");
|
|
96
|
+
const dataSaleOptOutRequired = dataSaleOptOutRequiredRaw === void 0 ? void 0 : parseBool(dataSaleOptOutRequiredRaw, "--data-sale-opt-out-required");
|
|
97
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
98
|
+
consentPolicy: {
|
|
99
|
+
__args: {
|
|
100
|
+
...id ? { id } : {},
|
|
101
|
+
...countryCode ? { countryCode } : {},
|
|
102
|
+
...regionCode ? { regionCode } : {},
|
|
103
|
+
...consentRequired !== void 0 ? { consentRequired } : {},
|
|
104
|
+
...dataSaleOptOutRequired !== void 0 ? { dataSaleOptOutRequired } : {}
|
|
105
|
+
},
|
|
106
|
+
...consentPolicySelection
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
if (result === void 0) return;
|
|
110
|
+
(0, import_output.printNode)({ node: result.consentPolicy, format: ctx.format, quiet: ctx.quiet });
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (verb === "consent-policy-regions") {
|
|
114
|
+
const result = await (0, import_router.runQuery)(ctx, { consentPolicyRegions: consentPolicyRegionSelection });
|
|
115
|
+
if (result === void 0) return;
|
|
116
|
+
const nodes = result.consentPolicyRegions ?? [];
|
|
117
|
+
(0, import_output.printConnection)({ connection: { nodes }, format: ctx.format, quiet: ctx.quiet });
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (verb === "consent-policy-update") {
|
|
121
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
122
|
+
const built = (0, import_input.buildInput)({
|
|
123
|
+
inputArg: args.input,
|
|
124
|
+
setArgs: args.set,
|
|
125
|
+
setJsonArgs: args["set-json"]
|
|
126
|
+
});
|
|
127
|
+
if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
|
|
128
|
+
const raw = built.input;
|
|
129
|
+
const consentPolicies = Array.isArray(raw) ? raw : raw && typeof raw === "object" && Array.isArray(raw.consentPolicies) ? raw.consentPolicies : raw && typeof raw === "object" ? [raw] : [];
|
|
130
|
+
if (consentPolicies.length === 0) {
|
|
131
|
+
throw new import_errors.CliError("Consent policy input must be an object or array (or { consentPolicies: [...] })", 2);
|
|
132
|
+
}
|
|
133
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
134
|
+
consentPolicyUpdate: {
|
|
135
|
+
__args: { consentPolicies },
|
|
136
|
+
updatedPolicies: consentPolicySelection,
|
|
137
|
+
userErrors: { code: true, field: true, message: true }
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
if (result === void 0) return;
|
|
141
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.consentPolicyUpdate, failOnUserErrors: ctx.failOnUserErrors });
|
|
142
|
+
(0, import_output.printJson)(result.consentPolicyUpdate, ctx.format !== "raw");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (verb === "data-sale-opt-out") {
|
|
146
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "email-address": { type: "string" } } });
|
|
147
|
+
const email = (0, import_shared.requireStringFlag)(args["email-address"], "--email-address");
|
|
148
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
149
|
+
dataSaleOptOut: {
|
|
150
|
+
__args: { email },
|
|
151
|
+
customerId: true,
|
|
152
|
+
userErrors: { code: true, field: true, message: true }
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
if (result === void 0) return;
|
|
156
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.dataSaleOptOut, failOnUserErrors: ctx.failOnUserErrors });
|
|
157
|
+
if (ctx.quiet) return console.log(result.dataSaleOptOut?.customerId ?? "");
|
|
158
|
+
(0, import_output.printJson)(result.dataSaleOptOut, ctx.format !== "raw");
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
throw new import_errors.CliError(`Unknown verb for customer-privacy: ${verb}`, 2);
|
|
162
|
+
};
|
|
163
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
164
|
+
0 && (module.exports = {
|
|
165
|
+
runCustomerPrivacy
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=customer-privacy.js.map
|