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,551 @@
|
|
|
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 inventory_exports = {};
|
|
20
|
+
__export(inventory_exports, {
|
|
21
|
+
runInventory: () => runInventory
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(inventory_exports);
|
|
24
|
+
var import_node_crypto = require("node:crypto");
|
|
25
|
+
var import_errors = require("../errors");
|
|
26
|
+
var import_gid = require("../gid");
|
|
27
|
+
var import_router = require("../router");
|
|
28
|
+
var import_userErrors = require("../userErrors");
|
|
29
|
+
var import_resolveInventoryItemId = require("../workflows/inventory/resolveInventoryItemId");
|
|
30
|
+
var import_output = require("../output");
|
|
31
|
+
var import_shared = require("./_shared");
|
|
32
|
+
const inventoryAdjustmentGroupSelection = ({
|
|
33
|
+
inventoryItemId,
|
|
34
|
+
locationIds
|
|
35
|
+
}) => ({
|
|
36
|
+
id: true,
|
|
37
|
+
reason: true,
|
|
38
|
+
createdAt: true,
|
|
39
|
+
referenceDocumentUri: true,
|
|
40
|
+
changes: {
|
|
41
|
+
__args: {
|
|
42
|
+
inventoryItemIds: [inventoryItemId],
|
|
43
|
+
locationIds,
|
|
44
|
+
quantityNames: ["available"]
|
|
45
|
+
},
|
|
46
|
+
name: true,
|
|
47
|
+
delta: true,
|
|
48
|
+
quantityAfterChange: true,
|
|
49
|
+
item: { id: true },
|
|
50
|
+
location: { id: true, name: true }
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const runInventory = async ({
|
|
54
|
+
ctx,
|
|
55
|
+
verb,
|
|
56
|
+
argv
|
|
57
|
+
}) => {
|
|
58
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
59
|
+
console.log(
|
|
60
|
+
[
|
|
61
|
+
"Usage:",
|
|
62
|
+
" shop inventory <verb> [flags]",
|
|
63
|
+
"",
|
|
64
|
+
"Verbs:",
|
|
65
|
+
" list|set|adjust|move",
|
|
66
|
+
" properties|level",
|
|
67
|
+
" activate|deactivate|bulk-toggle-activation",
|
|
68
|
+
" set-on-hand-quantities|set-scheduled-changes|transfer-set-items",
|
|
69
|
+
"",
|
|
70
|
+
"Notes:",
|
|
71
|
+
" - set/adjust support --inventory-item-id or --variant-id",
|
|
72
|
+
" - move requires --from-location-id, --to-location-id, and --reference-document-uri"
|
|
73
|
+
].join("\n")
|
|
74
|
+
);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const parseOptionalInt = (value, flag) => {
|
|
78
|
+
if (value === void 0) return void 0;
|
|
79
|
+
return (0, import_shared.parseIntFlag)(flag, value);
|
|
80
|
+
};
|
|
81
|
+
const requireInventoryLevelId = (value) => {
|
|
82
|
+
if (typeof value !== "string" || !value) throw new import_errors.CliError("Missing --inventory-level-id", 2);
|
|
83
|
+
return (0, import_gid.coerceGid)(value, "InventoryLevel");
|
|
84
|
+
};
|
|
85
|
+
const requireInventoryTransferId = (value) => {
|
|
86
|
+
if (typeof value !== "string" || !value) throw new import_errors.CliError("Missing --transfer-id", 2);
|
|
87
|
+
return (0, import_gid.coerceGid)(value, "InventoryTransfer");
|
|
88
|
+
};
|
|
89
|
+
const inventoryLevelSelection = {
|
|
90
|
+
id: true,
|
|
91
|
+
updatedAt: true,
|
|
92
|
+
item: { id: true, sku: true, tracked: true },
|
|
93
|
+
location: { id: true, name: true },
|
|
94
|
+
quantities: {
|
|
95
|
+
__args: { names: ["available", "on_hand"] },
|
|
96
|
+
name: true,
|
|
97
|
+
quantity: true,
|
|
98
|
+
updatedAt: true
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
if (verb === "properties") {
|
|
102
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
103
|
+
inventoryProperties: {
|
|
104
|
+
quantityNames: {
|
|
105
|
+
name: true,
|
|
106
|
+
displayName: true,
|
|
107
|
+
isInUse: true,
|
|
108
|
+
belongsTo: true,
|
|
109
|
+
comprises: true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
if (result === void 0) return;
|
|
114
|
+
(0, import_output.printJson)(result.inventoryProperties, ctx.format !== "raw");
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (verb === "level") {
|
|
118
|
+
const args2 = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
119
|
+
const id = requireInventoryLevelId(args2.id);
|
|
120
|
+
const result = await (0, import_router.runQuery)(ctx, { inventoryLevel: { __args: { id }, ...inventoryLevelSelection } });
|
|
121
|
+
if (result === void 0) return;
|
|
122
|
+
(0, import_output.printNode)({ node: result.inventoryLevel, format: ctx.format, quiet: ctx.quiet });
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (verb === "activate") {
|
|
126
|
+
const args2 = (0, import_router.parseStandardArgs)({
|
|
127
|
+
argv,
|
|
128
|
+
extraOptions: {
|
|
129
|
+
"inventory-item-id": { type: "string" },
|
|
130
|
+
"variant-id": { type: "string" },
|
|
131
|
+
"location-id": { type: "string" },
|
|
132
|
+
available: { type: "string" },
|
|
133
|
+
"on-hand": { type: "string" },
|
|
134
|
+
"stock-at-legacy-location": { type: "string" }
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
const locationId2 = (0, import_shared.requireLocationId)(args2["location-id"]);
|
|
138
|
+
const inventoryItemId2 = await (0, import_resolveInventoryItemId.resolveInventoryItemId)({
|
|
139
|
+
ctx,
|
|
140
|
+
inventoryItemId: args2["inventory-item-id"],
|
|
141
|
+
variantId: args2["variant-id"]
|
|
142
|
+
});
|
|
143
|
+
const available = parseOptionalInt(args2.available, "--available");
|
|
144
|
+
const onHand = parseOptionalInt(args2["on-hand"], "--on-hand");
|
|
145
|
+
const stockAtLegacyLocation = (() => {
|
|
146
|
+
const raw = args2["stock-at-legacy-location"];
|
|
147
|
+
if (raw === void 0) return void 0;
|
|
148
|
+
const v = raw.trim().toLowerCase();
|
|
149
|
+
if (v === "true" || v === "1" || v === "yes") return true;
|
|
150
|
+
if (v === "false" || v === "0" || v === "no") return false;
|
|
151
|
+
throw new import_errors.CliError("--stock-at-legacy-location must be true|false", 2);
|
|
152
|
+
})();
|
|
153
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
154
|
+
inventoryActivate: {
|
|
155
|
+
__directives: { idempotent: { key: (0, import_node_crypto.randomUUID)() } },
|
|
156
|
+
__args: {
|
|
157
|
+
inventoryItemId: inventoryItemId2,
|
|
158
|
+
locationId: locationId2,
|
|
159
|
+
...available === void 0 ? {} : { available },
|
|
160
|
+
...onHand === void 0 ? {} : { onHand },
|
|
161
|
+
...stockAtLegacyLocation === void 0 ? {} : { stockAtLegacyLocation }
|
|
162
|
+
},
|
|
163
|
+
inventoryLevel: inventoryLevelSelection,
|
|
164
|
+
userErrors: { field: true, message: true }
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
if (result === void 0) return;
|
|
168
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.inventoryActivate, failOnUserErrors: ctx.failOnUserErrors });
|
|
169
|
+
if (ctx.quiet) return console.log(result.inventoryActivate?.inventoryLevel?.id ?? "");
|
|
170
|
+
(0, import_output.printJson)(result.inventoryActivate, ctx.format !== "raw");
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (verb === "deactivate") {
|
|
174
|
+
const args2 = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "inventory-level-id": { type: "string" } } });
|
|
175
|
+
const inventoryLevelIdRaw = args2["inventory-level-id"];
|
|
176
|
+
if (!inventoryLevelIdRaw) throw new import_errors.CliError("Missing --inventory-level-id", 2);
|
|
177
|
+
const inventoryLevelId = requireInventoryLevelId(inventoryLevelIdRaw);
|
|
178
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
179
|
+
inventoryDeactivate: {
|
|
180
|
+
__args: { inventoryLevelId },
|
|
181
|
+
userErrors: { field: true, message: true }
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
if (result === void 0) return;
|
|
185
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.inventoryDeactivate, failOnUserErrors: ctx.failOnUserErrors });
|
|
186
|
+
(0, import_output.printJson)(result.inventoryDeactivate, ctx.format !== "raw");
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (verb === "bulk-toggle-activation") {
|
|
190
|
+
const args2 = (0, import_router.parseStandardArgs)({
|
|
191
|
+
argv,
|
|
192
|
+
extraOptions: {
|
|
193
|
+
"inventory-item-id": { type: "string" },
|
|
194
|
+
"variant-id": { type: "string" },
|
|
195
|
+
updates: { type: "string" },
|
|
196
|
+
"location-id": { type: "string" },
|
|
197
|
+
activate: { type: "string" }
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
const inventoryItemId2 = await (0, import_resolveInventoryItemId.resolveInventoryItemId)({
|
|
201
|
+
ctx,
|
|
202
|
+
inventoryItemId: args2["inventory-item-id"],
|
|
203
|
+
variantId: args2["variant-id"]
|
|
204
|
+
});
|
|
205
|
+
const updatesRaw = args2.updates;
|
|
206
|
+
const parsedUpdates = updatesRaw ? (0, import_shared.parseJsonArg)(updatesRaw, "--updates") : void 0;
|
|
207
|
+
const inventoryItemUpdates = (() => {
|
|
208
|
+
if (Array.isArray(parsedUpdates)) return parsedUpdates;
|
|
209
|
+
const locationIdRaw = args2["location-id"];
|
|
210
|
+
const activateRaw = args2.activate;
|
|
211
|
+
if (locationIdRaw && activateRaw !== void 0) {
|
|
212
|
+
const v = activateRaw.trim().toLowerCase();
|
|
213
|
+
const activate = v === "true" || v === "1" || v === "yes" ? true : v === "false" || v === "0" || v === "no" ? false : (() => {
|
|
214
|
+
throw new import_errors.CliError("--activate must be true|false", 2);
|
|
215
|
+
})();
|
|
216
|
+
return [{ locationId: (0, import_gid.coerceGid)(locationIdRaw, "Location"), activate }];
|
|
217
|
+
}
|
|
218
|
+
throw new import_errors.CliError("Missing --updates or (--location-id and --activate)", 2);
|
|
219
|
+
})();
|
|
220
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
221
|
+
inventoryBulkToggleActivation: {
|
|
222
|
+
__args: { inventoryItemId: inventoryItemId2, inventoryItemUpdates },
|
|
223
|
+
inventoryItem: { id: true, sku: true, tracked: true },
|
|
224
|
+
inventoryLevels: { id: true },
|
|
225
|
+
userErrors: { field: true, message: true, code: true }
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
if (result === void 0) return;
|
|
229
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.inventoryBulkToggleActivation, failOnUserErrors: ctx.failOnUserErrors });
|
|
230
|
+
(0, import_output.printJson)(result.inventoryBulkToggleActivation, ctx.format !== "raw");
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (verb === "set-on-hand-quantities") {
|
|
234
|
+
const args2 = (0, import_router.parseStandardArgs)({
|
|
235
|
+
argv,
|
|
236
|
+
extraOptions: {
|
|
237
|
+
"inventory-item-id": { type: "string" },
|
|
238
|
+
"variant-id": { type: "string" },
|
|
239
|
+
"location-id": { type: "string" },
|
|
240
|
+
"on-hand": { type: "string" },
|
|
241
|
+
"set-quantities": { type: "string" },
|
|
242
|
+
reason: { type: "string" },
|
|
243
|
+
"reference-document-uri": { type: "string" }
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
const reason2 = args2.reason ?? "correction";
|
|
247
|
+
const referenceDocumentUri2 = args2["reference-document-uri"];
|
|
248
|
+
const setQuantitiesRaw = args2["set-quantities"];
|
|
249
|
+
const parsed = setQuantitiesRaw ? (0, import_shared.parseJsonArg)(setQuantitiesRaw, "--set-quantities") : void 0;
|
|
250
|
+
if (parsed !== void 0 && !Array.isArray(parsed)) {
|
|
251
|
+
throw new import_errors.CliError("--set-quantities must be a JSON array", 2);
|
|
252
|
+
}
|
|
253
|
+
const setQuantities = (() => {
|
|
254
|
+
if (Array.isArray(parsed)) return parsed;
|
|
255
|
+
return void 0;
|
|
256
|
+
})();
|
|
257
|
+
const locationIdRaw = args2["location-id"];
|
|
258
|
+
const onHandRaw = args2["on-hand"];
|
|
259
|
+
const builtSetQuantities = setQuantities ?? (locationIdRaw && onHandRaw !== void 0 ? [
|
|
260
|
+
{
|
|
261
|
+
inventoryItemId: "__RESOLVE__",
|
|
262
|
+
locationId: (0, import_shared.requireLocationId)(locationIdRaw),
|
|
263
|
+
quantity: (0, import_shared.parseIntFlag)("--on-hand", onHandRaw)
|
|
264
|
+
}
|
|
265
|
+
] : void 0);
|
|
266
|
+
const finalSetQuantities = builtSetQuantities;
|
|
267
|
+
if (!finalSetQuantities) throw new import_errors.CliError("Missing --set-quantities (or --location-id and --on-hand)", 2);
|
|
268
|
+
for (const q of finalSetQuantities) {
|
|
269
|
+
if (q && typeof q === "object" && q.inventoryItemId === "__RESOLVE__") {
|
|
270
|
+
const inventoryItemId2 = await (0, import_resolveInventoryItemId.resolveInventoryItemId)({
|
|
271
|
+
ctx,
|
|
272
|
+
inventoryItemId: args2["inventory-item-id"],
|
|
273
|
+
variantId: args2["variant-id"]
|
|
274
|
+
});
|
|
275
|
+
q.inventoryItemId = inventoryItemId2;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
279
|
+
inventorySetOnHandQuantities: {
|
|
280
|
+
__directives: { idempotent: { key: (0, import_node_crypto.randomUUID)() } },
|
|
281
|
+
__args: { input: { reason: reason2, ...referenceDocumentUri2 ? { referenceDocumentUri: referenceDocumentUri2 } : {}, setQuantities: finalSetQuantities } },
|
|
282
|
+
inventoryAdjustmentGroup: { id: true, reason: true, createdAt: true },
|
|
283
|
+
userErrors: { field: true, message: true, code: true }
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
if (result === void 0) return;
|
|
287
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
288
|
+
payload: result.inventorySetOnHandQuantities,
|
|
289
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
290
|
+
});
|
|
291
|
+
if (ctx.quiet) return console.log(result.inventorySetOnHandQuantities?.inventoryAdjustmentGroup?.id ?? "");
|
|
292
|
+
(0, import_output.printJson)(result.inventorySetOnHandQuantities, ctx.format !== "raw");
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (verb === "set-scheduled-changes") {
|
|
296
|
+
const args2 = (0, import_router.parseStandardArgs)({
|
|
297
|
+
argv,
|
|
298
|
+
extraOptions: {
|
|
299
|
+
reason: { type: "string" },
|
|
300
|
+
items: { type: "string" },
|
|
301
|
+
"reference-document-uri": { type: "string" }
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
const reason2 = args2.reason ?? "correction";
|
|
305
|
+
const referenceDocumentUriRaw = args2["reference-document-uri"];
|
|
306
|
+
if (referenceDocumentUriRaw === void 0) throw new import_errors.CliError("Missing --reference-document-uri", 2);
|
|
307
|
+
const referenceDocumentUri2 = (0, import_shared.parseTextArg)(referenceDocumentUriRaw, "--reference-document-uri");
|
|
308
|
+
const itemsRaw = args2.items;
|
|
309
|
+
if (itemsRaw === void 0) throw new import_errors.CliError("Missing --items", 2);
|
|
310
|
+
const items = (0, import_shared.parseJsonArg)(itemsRaw, "--items");
|
|
311
|
+
if (!Array.isArray(items)) throw new import_errors.CliError("--items must be a JSON array", 2);
|
|
312
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
313
|
+
inventorySetScheduledChanges: {
|
|
314
|
+
__directives: { idempotent: { key: (0, import_node_crypto.randomUUID)() } },
|
|
315
|
+
__args: { input: { reason: reason2, items, referenceDocumentUri: referenceDocumentUri2 } },
|
|
316
|
+
scheduledChanges: { expectedAt: true },
|
|
317
|
+
userErrors: { field: true, message: true, code: true }
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
if (result === void 0) return;
|
|
321
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
322
|
+
payload: result.inventorySetScheduledChanges,
|
|
323
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
324
|
+
});
|
|
325
|
+
(0, import_output.printJson)(result.inventorySetScheduledChanges, ctx.format !== "raw");
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
if (verb === "transfer-set-items") {
|
|
329
|
+
const args2 = (0, import_router.parseStandardArgs)({
|
|
330
|
+
argv,
|
|
331
|
+
extraOptions: {
|
|
332
|
+
"transfer-id": { type: "string" },
|
|
333
|
+
"line-items": { type: "string" }
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
const transferIdRaw = args2["transfer-id"];
|
|
337
|
+
if (!transferIdRaw) throw new import_errors.CliError("Missing --transfer-id", 2);
|
|
338
|
+
const transferId = requireInventoryTransferId(transferIdRaw);
|
|
339
|
+
if (args2["line-items"] === void 0) throw new import_errors.CliError("Missing --line-items", 2);
|
|
340
|
+
const lineItems = (0, import_shared.parseJsonArg)(args2["line-items"], "--line-items");
|
|
341
|
+
if (!Array.isArray(lineItems)) throw new import_errors.CliError("--line-items must be a JSON array", 2);
|
|
342
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
343
|
+
inventoryTransferSetItems: {
|
|
344
|
+
__directives: { idempotent: { key: (0, import_node_crypto.randomUUID)() } },
|
|
345
|
+
__args: { input: { id: transferId, lineItems } },
|
|
346
|
+
inventoryTransfer: { id: true, status: true },
|
|
347
|
+
updatedLineItems: { inventoryItemId: true, deltaQuantity: true, newQuantity: true },
|
|
348
|
+
userErrors: { field: true, message: true, code: true }
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
if (result === void 0) return;
|
|
352
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
353
|
+
payload: result.inventoryTransferSetItems,
|
|
354
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
355
|
+
});
|
|
356
|
+
if (ctx.quiet) return console.log(result.inventoryTransferSetItems?.inventoryTransfer?.id ?? "");
|
|
357
|
+
(0, import_output.printJson)(result.inventoryTransferSetItems, ctx.format !== "raw");
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (verb === "list") {
|
|
361
|
+
const args2 = (0, import_router.parseStandardArgs)({
|
|
362
|
+
argv,
|
|
363
|
+
extraOptions: {
|
|
364
|
+
"location-id": { type: "string" }
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
const locationId2 = (0, import_shared.requireLocationId)(args2["location-id"]);
|
|
368
|
+
const first = (0, import_shared.parseFirst)(args2.first);
|
|
369
|
+
const after = args2.after;
|
|
370
|
+
const query = args2.query;
|
|
371
|
+
const result = await (0, import_router.runQuery)(ctx, {
|
|
372
|
+
location: {
|
|
373
|
+
__args: { id: locationId2 },
|
|
374
|
+
id: true,
|
|
375
|
+
name: true,
|
|
376
|
+
inventoryLevels: {
|
|
377
|
+
__args: { first, after, query },
|
|
378
|
+
pageInfo: { hasNextPage: true, endCursor: true },
|
|
379
|
+
nodes: {
|
|
380
|
+
id: true,
|
|
381
|
+
updatedAt: true,
|
|
382
|
+
item: { id: true, sku: true, tracked: true },
|
|
383
|
+
quantities: { __args: { names: ["available"] }, name: true, quantity: true, updatedAt: true }
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
if (result === void 0) return;
|
|
389
|
+
const connection = result.location?.inventoryLevels ?? { nodes: [], pageInfo: void 0 };
|
|
390
|
+
(0, import_output.printConnection)({
|
|
391
|
+
connection,
|
|
392
|
+
format: ctx.format,
|
|
393
|
+
quiet: ctx.quiet,
|
|
394
|
+
nextPageArgs: (0, import_shared.buildListNextPageArgs)(
|
|
395
|
+
"inventory",
|
|
396
|
+
{ first, query },
|
|
397
|
+
[{ flag: "--location-id", value: locationId2 }]
|
|
398
|
+
)
|
|
399
|
+
});
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (verb !== "set" && verb !== "adjust" && verb !== "move") {
|
|
403
|
+
throw new import_errors.CliError(`Unknown verb for inventory: ${verb}`, 2);
|
|
404
|
+
}
|
|
405
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
406
|
+
argv,
|
|
407
|
+
extraOptions: {
|
|
408
|
+
"inventory-item-id": { type: "string" },
|
|
409
|
+
"variant-id": { type: "string" },
|
|
410
|
+
"location-id": { type: "string" },
|
|
411
|
+
"from-location-id": { type: "string" },
|
|
412
|
+
"to-location-id": { type: "string" },
|
|
413
|
+
available: { type: "string" },
|
|
414
|
+
delta: { type: "string" },
|
|
415
|
+
quantity: { type: "string" },
|
|
416
|
+
"quantity-name": { type: "string" },
|
|
417
|
+
reason: { type: "string" },
|
|
418
|
+
"reference-document-uri": { type: "string" }
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
const locationId = verb === "move" ? void 0 : (0, import_shared.requireLocationId)(args["location-id"]);
|
|
422
|
+
const inventoryItemId = await (0, import_resolveInventoryItemId.resolveInventoryItemId)({
|
|
423
|
+
ctx,
|
|
424
|
+
inventoryItemId: args["inventory-item-id"],
|
|
425
|
+
variantId: args["variant-id"]
|
|
426
|
+
});
|
|
427
|
+
const reason = args.reason ?? "correction";
|
|
428
|
+
const referenceDocumentUri = args["reference-document-uri"];
|
|
429
|
+
if (verb === "set") {
|
|
430
|
+
const available = (0, import_shared.parseIntFlag)("--available", args.available);
|
|
431
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
432
|
+
inventorySetQuantities: {
|
|
433
|
+
__directives: { idempotent: { key: (0, import_node_crypto.randomUUID)() } },
|
|
434
|
+
__args: {
|
|
435
|
+
input: {
|
|
436
|
+
name: "available",
|
|
437
|
+
reason,
|
|
438
|
+
...referenceDocumentUri ? { referenceDocumentUri } : {},
|
|
439
|
+
quantities: [
|
|
440
|
+
{
|
|
441
|
+
inventoryItemId,
|
|
442
|
+
locationId,
|
|
443
|
+
quantity: available,
|
|
444
|
+
changeFromQuantity: null
|
|
445
|
+
}
|
|
446
|
+
]
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
inventoryAdjustmentGroup: inventoryAdjustmentGroupSelection({
|
|
450
|
+
inventoryItemId,
|
|
451
|
+
locationIds: [locationId]
|
|
452
|
+
}),
|
|
453
|
+
userErrors: { field: true, message: true }
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
if (result === void 0) return;
|
|
457
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
458
|
+
payload: result.inventorySetQuantities,
|
|
459
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
460
|
+
});
|
|
461
|
+
if (ctx.quiet) return console.log(result.inventorySetQuantities?.inventoryAdjustmentGroup?.id ?? "");
|
|
462
|
+
(0, import_output.printJson)(result.inventorySetQuantities);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
if (verb === "adjust") {
|
|
466
|
+
const delta = (0, import_shared.parseIntFlag)("--delta", args.delta);
|
|
467
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
468
|
+
inventoryAdjustQuantities: {
|
|
469
|
+
__directives: { idempotent: { key: (0, import_node_crypto.randomUUID)() } },
|
|
470
|
+
__args: {
|
|
471
|
+
input: {
|
|
472
|
+
name: "available",
|
|
473
|
+
reason,
|
|
474
|
+
...referenceDocumentUri ? { referenceDocumentUri } : {},
|
|
475
|
+
changes: [
|
|
476
|
+
{
|
|
477
|
+
inventoryItemId,
|
|
478
|
+
locationId,
|
|
479
|
+
delta,
|
|
480
|
+
changeFromQuantity: null
|
|
481
|
+
}
|
|
482
|
+
]
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
inventoryAdjustmentGroup: inventoryAdjustmentGroupSelection({
|
|
486
|
+
inventoryItemId,
|
|
487
|
+
locationIds: [locationId]
|
|
488
|
+
}),
|
|
489
|
+
userErrors: { field: true, message: true }
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
if (result === void 0) return;
|
|
493
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
494
|
+
payload: result.inventoryAdjustQuantities,
|
|
495
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
496
|
+
});
|
|
497
|
+
if (ctx.quiet) return console.log(result.inventoryAdjustQuantities?.inventoryAdjustmentGroup?.id ?? "");
|
|
498
|
+
(0, import_output.printJson)(result.inventoryAdjustQuantities);
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
if (verb === "move") {
|
|
502
|
+
const fromLocationIdRaw = args["from-location-id"];
|
|
503
|
+
const toLocationIdRaw = args["to-location-id"];
|
|
504
|
+
if (!fromLocationIdRaw) throw new import_errors.CliError("Missing --from-location-id", 2);
|
|
505
|
+
if (!toLocationIdRaw) throw new import_errors.CliError("Missing --to-location-id", 2);
|
|
506
|
+
const fromLocationId = (0, import_shared.requireLocationId)(fromLocationIdRaw, "--from-location-id");
|
|
507
|
+
const toLocationId = (0, import_shared.requireLocationId)(toLocationIdRaw, "--to-location-id");
|
|
508
|
+
const quantity = (0, import_shared.parseIntFlag)("--quantity", args.quantity);
|
|
509
|
+
const quantityName = args["quantity-name"] ?? "available";
|
|
510
|
+
if (!referenceDocumentUri) {
|
|
511
|
+
throw new import_errors.CliError("Missing --reference-document-uri (required for inventory move)", 2);
|
|
512
|
+
}
|
|
513
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
514
|
+
inventoryMoveQuantities: {
|
|
515
|
+
__directives: { idempotent: { key: (0, import_node_crypto.randomUUID)() } },
|
|
516
|
+
__args: {
|
|
517
|
+
input: {
|
|
518
|
+
reason,
|
|
519
|
+
referenceDocumentUri,
|
|
520
|
+
changes: [
|
|
521
|
+
{
|
|
522
|
+
inventoryItemId,
|
|
523
|
+
quantity,
|
|
524
|
+
from: { locationId: fromLocationId, name: quantityName, changeFromQuantity: null },
|
|
525
|
+
to: { locationId: toLocationId, name: quantityName, changeFromQuantity: null }
|
|
526
|
+
}
|
|
527
|
+
]
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
inventoryAdjustmentGroup: inventoryAdjustmentGroupSelection({
|
|
531
|
+
inventoryItemId,
|
|
532
|
+
locationIds: [fromLocationId, toLocationId]
|
|
533
|
+
}),
|
|
534
|
+
userErrors: { field: true, message: true, code: true }
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
if (result === void 0) return;
|
|
538
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
539
|
+
payload: result.inventoryMoveQuantities,
|
|
540
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
541
|
+
});
|
|
542
|
+
if (ctx.quiet) return console.log(result.inventoryMoveQuantities?.inventoryAdjustmentGroup?.id ?? "");
|
|
543
|
+
(0, import_output.printJson)(result.inventoryMoveQuantities);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
548
|
+
0 && (module.exports = {
|
|
549
|
+
runInventory
|
|
550
|
+
});
|
|
551
|
+
//# sourceMappingURL=inventory.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
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 locales_exports = {};
|
|
20
|
+
__export(locales_exports, {
|
|
21
|
+
runLocales: () => runLocales
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(locales_exports);
|
|
24
|
+
var import_errors = require("../errors");
|
|
25
|
+
var import_output = require("../output");
|
|
26
|
+
var import_router = require("../router");
|
|
27
|
+
const localeSelection = {
|
|
28
|
+
isoCode: true,
|
|
29
|
+
name: true
|
|
30
|
+
};
|
|
31
|
+
const runLocales = async ({
|
|
32
|
+
ctx,
|
|
33
|
+
verb,
|
|
34
|
+
argv
|
|
35
|
+
}) => {
|
|
36
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
37
|
+
console.log(
|
|
38
|
+
[
|
|
39
|
+
"Usage:",
|
|
40
|
+
" shop locales <verb> [flags]",
|
|
41
|
+
"",
|
|
42
|
+
"Verbs:",
|
|
43
|
+
" available"
|
|
44
|
+
].join("\n")
|
|
45
|
+
);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (verb === "available") {
|
|
49
|
+
const result = await (0, import_router.runQuery)(ctx, { availableLocales: localeSelection });
|
|
50
|
+
if (result === void 0) return;
|
|
51
|
+
if (ctx.quiet) return;
|
|
52
|
+
(0, import_output.printJson)(result.availableLocales, ctx.format !== "raw");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
throw new import_errors.CliError(`Unknown verb for locales: ${verb}`, 2);
|
|
56
|
+
};
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
runLocales
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=locales.js.map
|