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,467 @@
|
|
|
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 company_locations_exports = {};
|
|
20
|
+
__export(company_locations_exports, {
|
|
21
|
+
runCompanyLocations: () => runCompanyLocations
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(company_locations_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_shared = require("./_shared");
|
|
31
|
+
const companyLocationSummarySelection = {
|
|
32
|
+
id: true,
|
|
33
|
+
name: true,
|
|
34
|
+
company: { id: true, name: true },
|
|
35
|
+
billingAddress: { address1: true, city: true, countryCode: true },
|
|
36
|
+
shippingAddress: { address1: true, city: true, countryCode: true }
|
|
37
|
+
};
|
|
38
|
+
const companyLocationFullSelection = {
|
|
39
|
+
...companyLocationSummarySelection,
|
|
40
|
+
locale: true,
|
|
41
|
+
note: true,
|
|
42
|
+
taxSettings: { taxExempt: true, taxRegistrationId: true }
|
|
43
|
+
};
|
|
44
|
+
const getCompanyLocationSelection = (view) => {
|
|
45
|
+
if (view === "ids") return { id: true };
|
|
46
|
+
if (view === "full") return companyLocationFullSelection;
|
|
47
|
+
if (view === "raw") return {};
|
|
48
|
+
return companyLocationSummarySelection;
|
|
49
|
+
};
|
|
50
|
+
const resolveStaffAssignmentIds = async ({
|
|
51
|
+
ctx,
|
|
52
|
+
locationId,
|
|
53
|
+
staffMemberIds
|
|
54
|
+
}) => {
|
|
55
|
+
if (staffMemberIds.length === 0) return [];
|
|
56
|
+
if (ctx.dryRun) {
|
|
57
|
+
throw new import_errors.CliError("--dry-run cannot resolve --staff-member-ids; pass --assignment-ids instead", 2);
|
|
58
|
+
}
|
|
59
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
60
|
+
companyLocation: {
|
|
61
|
+
__args: { id: locationId },
|
|
62
|
+
staffMemberAssignments: {
|
|
63
|
+
__args: { first: 100 },
|
|
64
|
+
nodes: { id: true, staffMember: { id: true } }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const nodes = result?.companyLocation?.staffMemberAssignments?.nodes ?? [];
|
|
69
|
+
const byStaffId = /* @__PURE__ */ new Map();
|
|
70
|
+
for (const node of nodes) {
|
|
71
|
+
if (node?.staffMember?.id && node?.id) {
|
|
72
|
+
byStaffId.set(node.staffMember.id, node.id);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const assignmentIds = [];
|
|
76
|
+
const missing = [];
|
|
77
|
+
for (const staffId of staffMemberIds) {
|
|
78
|
+
const assignmentId = byStaffId.get(staffId);
|
|
79
|
+
if (!assignmentId) missing.push(staffId);
|
|
80
|
+
else assignmentIds.push(assignmentId);
|
|
81
|
+
}
|
|
82
|
+
if (missing.length > 0) {
|
|
83
|
+
throw new import_errors.CliError(
|
|
84
|
+
`Could not resolve staff member assignments for: ${missing.join(", ")}`,
|
|
85
|
+
2
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
return assignmentIds;
|
|
89
|
+
};
|
|
90
|
+
const runCompanyLocations = async ({
|
|
91
|
+
ctx,
|
|
92
|
+
verb,
|
|
93
|
+
argv
|
|
94
|
+
}) => {
|
|
95
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
96
|
+
console.log(
|
|
97
|
+
[
|
|
98
|
+
"Usage:",
|
|
99
|
+
" shop company-locations <verb> [flags]",
|
|
100
|
+
"",
|
|
101
|
+
"Verbs:",
|
|
102
|
+
" create|get|list|update|delete|bulk-delete",
|
|
103
|
+
" assign-address|assign-roles|revoke-roles",
|
|
104
|
+
" assign-staff|remove-staff",
|
|
105
|
+
" assign-tax-exemptions|revoke-tax-exemptions",
|
|
106
|
+
" create-tax-registration|revoke-tax-registration|update-tax-settings",
|
|
107
|
+
"",
|
|
108
|
+
"Common output flags:",
|
|
109
|
+
" --view summary|ids|full|raw",
|
|
110
|
+
" --select <path> (repeatable; dot paths; adds to base view selection)",
|
|
111
|
+
" --selection <graphql> (selection override; can be @file.gql)"
|
|
112
|
+
].join("\n")
|
|
113
|
+
);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (verb === "get") {
|
|
117
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
118
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
119
|
+
const selection = (0, import_select.resolveSelection)({
|
|
120
|
+
resource: "company-locations",
|
|
121
|
+
view: ctx.view,
|
|
122
|
+
baseSelection: getCompanyLocationSelection(ctx.view),
|
|
123
|
+
select: args.select,
|
|
124
|
+
selection: args.selection,
|
|
125
|
+
include: args.include,
|
|
126
|
+
ensureId: ctx.quiet
|
|
127
|
+
});
|
|
128
|
+
const result = await (0, import_router.runQuery)(ctx, { companyLocation: { __args: { id }, ...selection } });
|
|
129
|
+
if (result === void 0) return;
|
|
130
|
+
(0, import_output.printNode)({ node: result.companyLocation, format: ctx.format, quiet: ctx.quiet });
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (verb === "list") {
|
|
134
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
135
|
+
const first = (0, import_shared.parseFirst)(args.first);
|
|
136
|
+
const after = args.after;
|
|
137
|
+
const query = args.query;
|
|
138
|
+
const reverse = args.reverse;
|
|
139
|
+
const sortKey = args.sort;
|
|
140
|
+
const nodeSelection = (0, import_select.resolveSelection)({
|
|
141
|
+
resource: "company-locations",
|
|
142
|
+
view: ctx.view,
|
|
143
|
+
baseSelection: getCompanyLocationSelection(ctx.view),
|
|
144
|
+
select: args.select,
|
|
145
|
+
selection: args.selection,
|
|
146
|
+
include: args.include,
|
|
147
|
+
ensureId: ctx.quiet
|
|
148
|
+
});
|
|
149
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
150
|
+
companyLocations: {
|
|
151
|
+
__args: { first, after, query, reverse, sortKey },
|
|
152
|
+
pageInfo: { hasNextPage: true, endCursor: true },
|
|
153
|
+
nodes: nodeSelection
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
if (result === void 0) return;
|
|
157
|
+
(0, import_output.printConnection)({
|
|
158
|
+
connection: result.companyLocations,
|
|
159
|
+
format: ctx.format,
|
|
160
|
+
quiet: ctx.quiet,
|
|
161
|
+
nextPageArgs: (0, import_shared.buildListNextPageArgs)("company-locations", { first, query, sort: sortKey, reverse })
|
|
162
|
+
});
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (verb === "create") {
|
|
166
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "company-id": { type: "string" } } });
|
|
167
|
+
const companyId = (0, import_shared.requireId)(args["company-id"], "Company");
|
|
168
|
+
const built = (0, import_input.buildInput)({
|
|
169
|
+
inputArg: args.input,
|
|
170
|
+
setArgs: args.set,
|
|
171
|
+
setJsonArgs: args["set-json"]
|
|
172
|
+
});
|
|
173
|
+
if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
|
|
174
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
175
|
+
companyLocationCreate: {
|
|
176
|
+
__args: { companyId, input: built.input },
|
|
177
|
+
companyLocation: companyLocationSummarySelection,
|
|
178
|
+
userErrors: { field: true, message: true }
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
if (result === void 0) return;
|
|
182
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyLocationCreate, failOnUserErrors: ctx.failOnUserErrors });
|
|
183
|
+
if (ctx.quiet) return console.log(result.companyLocationCreate?.companyLocation?.id ?? "");
|
|
184
|
+
(0, import_output.printJson)(result.companyLocationCreate, ctx.format !== "raw");
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (verb === "update") {
|
|
188
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
189
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
190
|
+
const built = (0, import_input.buildInput)({
|
|
191
|
+
inputArg: args.input,
|
|
192
|
+
setArgs: args.set,
|
|
193
|
+
setJsonArgs: args["set-json"]
|
|
194
|
+
});
|
|
195
|
+
if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
|
|
196
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
197
|
+
companyLocationUpdate: {
|
|
198
|
+
__args: { companyLocationId: id, input: built.input },
|
|
199
|
+
companyLocation: companyLocationSummarySelection,
|
|
200
|
+
userErrors: { field: true, message: true }
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
if (result === void 0) return;
|
|
204
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyLocationUpdate, failOnUserErrors: ctx.failOnUserErrors });
|
|
205
|
+
if (ctx.quiet) return console.log(result.companyLocationUpdate?.companyLocation?.id ?? "");
|
|
206
|
+
(0, import_output.printJson)(result.companyLocationUpdate, ctx.format !== "raw");
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (verb === "delete") {
|
|
210
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
211
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
212
|
+
if (!args.yes) throw new import_errors.CliError("Refusing to delete without --yes", 2);
|
|
213
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
214
|
+
companyLocationDelete: {
|
|
215
|
+
__args: { companyLocationId: id },
|
|
216
|
+
deletedCompanyLocationId: true,
|
|
217
|
+
userErrors: { field: true, message: true }
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
if (result === void 0) return;
|
|
221
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyLocationDelete, failOnUserErrors: ctx.failOnUserErrors });
|
|
222
|
+
if (ctx.quiet) return console.log(result.companyLocationDelete?.deletedCompanyLocationId ?? "");
|
|
223
|
+
(0, import_output.printJson)(result.companyLocationDelete, ctx.format !== "raw");
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (verb === "bulk-delete") {
|
|
227
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
228
|
+
if (!args.yes) throw new import_errors.CliError("Refusing to bulk-delete without --yes", 2);
|
|
229
|
+
const companyLocationIds = (0, import_shared.parseIds)(args.ids, "CompanyLocation");
|
|
230
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
231
|
+
companyLocationsDelete: {
|
|
232
|
+
__args: { companyLocationIds },
|
|
233
|
+
deletedCompanyLocationIds: true,
|
|
234
|
+
userErrors: { field: true, message: true }
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
if (result === void 0) return;
|
|
238
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyLocationsDelete, failOnUserErrors: ctx.failOnUserErrors });
|
|
239
|
+
if (ctx.quiet) return console.log((result.companyLocationsDelete?.deletedCompanyLocationIds ?? []).join("\n"));
|
|
240
|
+
(0, import_output.printJson)(result.companyLocationsDelete, ctx.format !== "raw");
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (verb === "assign-address") {
|
|
244
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "address-type": { type: "string", multiple: true }, address: { type: "string" } } });
|
|
245
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
246
|
+
const addressTypes = (0, import_shared.parseStringList)(args["address-type"], "--address-type");
|
|
247
|
+
const address = (0, import_shared.parseJsonArg)(args.address, "--address");
|
|
248
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
249
|
+
companyLocationAssignAddress: {
|
|
250
|
+
__args: { locationId: id, addressTypes, address },
|
|
251
|
+
addresses: { id: true, address1: true, city: true, countryCode: true },
|
|
252
|
+
userErrors: { field: true, message: true }
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
if (result === void 0) return;
|
|
256
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyLocationAssignAddress, failOnUserErrors: ctx.failOnUserErrors });
|
|
257
|
+
(0, import_output.printJson)(result.companyLocationAssignAddress, ctx.format !== "raw");
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (verb === "assign-roles") {
|
|
261
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "role-assignments": { type: "string" } } });
|
|
262
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
263
|
+
const rolesToAssign = (0, import_shared.parseJsonArg)(args["role-assignments"], "--role-assignments");
|
|
264
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
265
|
+
companyLocationAssignRoles: {
|
|
266
|
+
__args: { companyLocationId: id, rolesToAssign },
|
|
267
|
+
roleAssignments: { id: true },
|
|
268
|
+
userErrors: { field: true, message: true }
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
if (result === void 0) return;
|
|
272
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyLocationAssignRoles, failOnUserErrors: ctx.failOnUserErrors });
|
|
273
|
+
(0, import_output.printJson)(result.companyLocationAssignRoles, ctx.format !== "raw");
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (verb === "revoke-roles") {
|
|
277
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "role-assignment-ids": { type: "string", multiple: true } } });
|
|
278
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
279
|
+
const rolesToRevoke = (0, import_shared.parseStringList)(args["role-assignment-ids"], "--role-assignment-ids");
|
|
280
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
281
|
+
companyLocationRevokeRoles: {
|
|
282
|
+
__args: { companyLocationId: id, rolesToRevoke },
|
|
283
|
+
revokedRoleAssignmentIds: true,
|
|
284
|
+
userErrors: { field: true, message: true }
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
if (result === void 0) return;
|
|
288
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyLocationRevokeRoles, failOnUserErrors: ctx.failOnUserErrors });
|
|
289
|
+
(0, import_output.printJson)(result.companyLocationRevokeRoles, ctx.format !== "raw");
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (verb === "assign-staff") {
|
|
293
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "staff-member-ids": { type: "string", multiple: true } } });
|
|
294
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
295
|
+
const staffMemberIds = (0, import_shared.parseStringList)(args["staff-member-ids"], "--staff-member-ids");
|
|
296
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
297
|
+
companyLocationAssignStaffMembers: {
|
|
298
|
+
__args: { companyLocationId: id, staffMemberIds },
|
|
299
|
+
companyLocationStaffMemberAssignments: { id: true },
|
|
300
|
+
userErrors: { field: true, message: true }
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
if (result === void 0) return;
|
|
304
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
305
|
+
payload: result.companyLocationAssignStaffMembers,
|
|
306
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
307
|
+
});
|
|
308
|
+
(0, import_output.printJson)(result.companyLocationAssignStaffMembers, ctx.format !== "raw");
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (verb === "remove-staff") {
|
|
312
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
313
|
+
argv,
|
|
314
|
+
extraOptions: {
|
|
315
|
+
"assignment-ids": { type: "string", multiple: true },
|
|
316
|
+
"staff-member-ids": { type: "string", multiple: true }
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
320
|
+
const assignmentIdsRaw = args["assignment-ids"];
|
|
321
|
+
const staffMemberIdsRaw = args["staff-member-ids"];
|
|
322
|
+
let assignmentIds = assignmentIdsRaw ? (0, import_shared.parseStringList)(assignmentIdsRaw, "--assignment-ids") : [];
|
|
323
|
+
if (assignmentIds.length === 0) {
|
|
324
|
+
const staffMemberIds = staffMemberIdsRaw ? (0, import_shared.parseStringList)(staffMemberIdsRaw, "--staff-member-ids") : [];
|
|
325
|
+
if (staffMemberIds.length === 0) throw new import_errors.CliError("Missing --assignment-ids or --staff-member-ids", 2);
|
|
326
|
+
assignmentIds = await resolveStaffAssignmentIds({ ctx, locationId: id, staffMemberIds });
|
|
327
|
+
}
|
|
328
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
329
|
+
companyLocationRemoveStaffMembers: {
|
|
330
|
+
__args: { companyLocationStaffMemberAssignmentIds: assignmentIds },
|
|
331
|
+
deletedCompanyLocationStaffMemberAssignmentIds: true,
|
|
332
|
+
userErrors: { field: true, message: true }
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
if (result === void 0) return;
|
|
336
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
337
|
+
payload: result.companyLocationRemoveStaffMembers,
|
|
338
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
339
|
+
});
|
|
340
|
+
(0, import_output.printJson)(result.companyLocationRemoveStaffMembers, ctx.format !== "raw");
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (verb === "assign-tax-exemptions") {
|
|
344
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { exemptions: { type: "string", multiple: true } } });
|
|
345
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
346
|
+
const taxExemptions = (0, import_shared.parseStringList)(args.exemptions, "--exemptions");
|
|
347
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
348
|
+
companyLocationAssignTaxExemptions: {
|
|
349
|
+
__args: { companyLocationId: id, taxExemptions },
|
|
350
|
+
companyLocation: companyLocationSummarySelection,
|
|
351
|
+
userErrors: { field: true, message: true }
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
if (result === void 0) return;
|
|
355
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
356
|
+
payload: result.companyLocationAssignTaxExemptions,
|
|
357
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
358
|
+
});
|
|
359
|
+
(0, import_output.printJson)(result.companyLocationAssignTaxExemptions, ctx.format !== "raw");
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
if (verb === "revoke-tax-exemptions") {
|
|
363
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { exemptions: { type: "string", multiple: true } } });
|
|
364
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
365
|
+
const taxExemptions = (0, import_shared.parseStringList)(args.exemptions, "--exemptions");
|
|
366
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
367
|
+
companyLocationRevokeTaxExemptions: {
|
|
368
|
+
__args: { companyLocationId: id, taxExemptions },
|
|
369
|
+
companyLocation: companyLocationSummarySelection,
|
|
370
|
+
userErrors: { field: true, message: true }
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
if (result === void 0) return;
|
|
374
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
375
|
+
payload: result.companyLocationRevokeTaxExemptions,
|
|
376
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
377
|
+
});
|
|
378
|
+
(0, import_output.printJson)(result.companyLocationRevokeTaxExemptions, ctx.format !== "raw");
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
if (verb === "create-tax-registration") {
|
|
382
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "tax-id": { type: "string" } } });
|
|
383
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
384
|
+
const taxId = args["tax-id"];
|
|
385
|
+
if (!taxId) throw new import_errors.CliError("Missing --tax-id", 2);
|
|
386
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
387
|
+
companyLocationCreateTaxRegistration: {
|
|
388
|
+
__args: { locationId: id, taxId },
|
|
389
|
+
companyLocation: companyLocationSummarySelection,
|
|
390
|
+
userErrors: { field: true, message: true }
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
if (result === void 0) return;
|
|
394
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
395
|
+
payload: result.companyLocationCreateTaxRegistration,
|
|
396
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
397
|
+
});
|
|
398
|
+
(0, import_output.printJson)(result.companyLocationCreateTaxRegistration, ctx.format !== "raw");
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
if (verb === "revoke-tax-registration") {
|
|
402
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
403
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
404
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
405
|
+
companyLocationRevokeTaxRegistration: {
|
|
406
|
+
__args: { companyLocationId: id },
|
|
407
|
+
companyLocation: companyLocationSummarySelection,
|
|
408
|
+
userErrors: { field: true, message: true }
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
if (result === void 0) return;
|
|
412
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
413
|
+
payload: result.companyLocationRevokeTaxRegistration,
|
|
414
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
415
|
+
});
|
|
416
|
+
(0, import_output.printJson)(result.companyLocationRevokeTaxRegistration, ctx.format !== "raw");
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
if (verb === "update-tax-settings") {
|
|
420
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
421
|
+
argv,
|
|
422
|
+
extraOptions: {
|
|
423
|
+
exemptions: { type: "string", multiple: true },
|
|
424
|
+
"remove-exemptions": { type: "string", multiple: true },
|
|
425
|
+
"tax-exempt": { type: "boolean" },
|
|
426
|
+
"tax-id": { type: "string" }
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
const id = (0, import_shared.requireId)(args.id, "CompanyLocation");
|
|
430
|
+
const exemptionsToAssign = args.exemptions ? (0, import_shared.parseStringList)(args.exemptions, "--exemptions") : void 0;
|
|
431
|
+
const exemptionsToRemove = args["remove-exemptions"] ? (0, import_shared.parseStringList)(args["remove-exemptions"], "--remove-exemptions") : void 0;
|
|
432
|
+
const taxExempt = args["tax-exempt"];
|
|
433
|
+
const taxRegistrationId = args["tax-id"];
|
|
434
|
+
if (!exemptionsToAssign && !exemptionsToRemove && taxExempt === void 0 && !taxRegistrationId) {
|
|
435
|
+
throw new import_errors.CliError(
|
|
436
|
+
"Missing --exemptions, --remove-exemptions, --tax-exempt, or --tax-id",
|
|
437
|
+
2
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
441
|
+
companyLocationTaxSettingsUpdate: {
|
|
442
|
+
__args: {
|
|
443
|
+
companyLocationId: id,
|
|
444
|
+
...exemptionsToAssign ? { exemptionsToAssign } : {},
|
|
445
|
+
...exemptionsToRemove ? { exemptionsToRemove } : {},
|
|
446
|
+
...taxExempt === void 0 ? {} : { taxExempt },
|
|
447
|
+
...taxRegistrationId ? { taxRegistrationId } : {}
|
|
448
|
+
},
|
|
449
|
+
companyLocation: companyLocationSummarySelection,
|
|
450
|
+
userErrors: { field: true, message: true }
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
if (result === void 0) return;
|
|
454
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
455
|
+
payload: result.companyLocationTaxSettingsUpdate,
|
|
456
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
457
|
+
});
|
|
458
|
+
(0, import_output.printJson)(result.companyLocationTaxSettingsUpdate, ctx.format !== "raw");
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
throw new import_errors.CliError(`Unknown verb for company-locations: ${verb}`, 2);
|
|
462
|
+
};
|
|
463
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
464
|
+
0 && (module.exports = {
|
|
465
|
+
runCompanyLocations
|
|
466
|
+
});
|
|
467
|
+
//# sourceMappingURL=company-locations.js.map
|
|
@@ -0,0 +1,97 @@
|
|
|
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_account_pages_exports = {};
|
|
20
|
+
__export(customer_account_pages_exports, {
|
|
21
|
+
runCustomerAccountPages: () => runCustomerAccountPages
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(customer_account_pages_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_shared = require("./_shared");
|
|
29
|
+
const pageSummarySelection = {
|
|
30
|
+
id: true,
|
|
31
|
+
handle: true,
|
|
32
|
+
title: true
|
|
33
|
+
};
|
|
34
|
+
const getPageSelection = (view) => {
|
|
35
|
+
if (view === "ids") return { id: true };
|
|
36
|
+
if (view === "raw") return {};
|
|
37
|
+
return pageSummarySelection;
|
|
38
|
+
};
|
|
39
|
+
const runCustomerAccountPages = async ({
|
|
40
|
+
ctx,
|
|
41
|
+
verb,
|
|
42
|
+
argv
|
|
43
|
+
}) => {
|
|
44
|
+
if (verb === "get") {
|
|
45
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
46
|
+
const id = (0, import_shared.requireId)(args.id, "CustomerAccountPage");
|
|
47
|
+
const selection = (0, import_select.resolveSelection)({
|
|
48
|
+
resource: "customer-account-pages",
|
|
49
|
+
view: ctx.view,
|
|
50
|
+
baseSelection: getPageSelection(ctx.view),
|
|
51
|
+
select: args.select,
|
|
52
|
+
selection: args.selection,
|
|
53
|
+
include: args.include,
|
|
54
|
+
ensureId: ctx.quiet
|
|
55
|
+
});
|
|
56
|
+
const result = await (0, import_router.runQuery)(ctx, { customerAccountPage: { __args: { id }, ...selection } });
|
|
57
|
+
if (result === void 0) return;
|
|
58
|
+
(0, import_output.printNode)({ node: result.customerAccountPage, format: ctx.format, quiet: ctx.quiet });
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (verb === "list") {
|
|
62
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
63
|
+
const first = (0, import_shared.parseFirst)(args.first);
|
|
64
|
+
const after = args.after;
|
|
65
|
+
const reverse = args.reverse;
|
|
66
|
+
const nodeSelection = (0, import_select.resolveSelection)({
|
|
67
|
+
resource: "customer-account-pages",
|
|
68
|
+
view: ctx.view,
|
|
69
|
+
baseSelection: getPageSelection(ctx.view),
|
|
70
|
+
select: args.select,
|
|
71
|
+
selection: args.selection,
|
|
72
|
+
include: args.include,
|
|
73
|
+
ensureId: ctx.quiet
|
|
74
|
+
});
|
|
75
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
76
|
+
customerAccountPages: {
|
|
77
|
+
__args: { first, after, reverse },
|
|
78
|
+
pageInfo: { hasNextPage: true, endCursor: true },
|
|
79
|
+
nodes: nodeSelection
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
if (result === void 0) return;
|
|
83
|
+
(0, import_output.printConnection)({
|
|
84
|
+
connection: result.customerAccountPages,
|
|
85
|
+
format: ctx.format,
|
|
86
|
+
quiet: ctx.quiet,
|
|
87
|
+
nextPageArgs: (0, import_shared.buildListNextPageArgs)("customer-account-pages", { first, reverse })
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
throw new import_errors.CliError(`Unknown verb for customer-account-pages: ${verb}`, 2);
|
|
92
|
+
};
|
|
93
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
+
0 && (module.exports = {
|
|
95
|
+
runCustomerAccountPages
|
|
96
|
+
});
|
|
97
|
+
//# sourceMappingURL=customer-account-pages.js.map
|