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,452 @@
|
|
|
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 app_billing_exports = {};
|
|
20
|
+
__export(app_billing_exports, {
|
|
21
|
+
runAppBilling: () => runAppBilling
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(app_billing_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 appInstallationSelection = {
|
|
32
|
+
id: true,
|
|
33
|
+
activeSubscriptions: {
|
|
34
|
+
id: true,
|
|
35
|
+
name: true,
|
|
36
|
+
status: true
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const getAppInstallationSelection = (view) => {
|
|
40
|
+
if (view === "ids") return { id: true };
|
|
41
|
+
if (view === "raw") return {};
|
|
42
|
+
return appInstallationSelection;
|
|
43
|
+
};
|
|
44
|
+
const parseMoneyInput = ({ amount, currency }) => {
|
|
45
|
+
if (!amount) return void 0;
|
|
46
|
+
const num = Number(amount);
|
|
47
|
+
if (!Number.isFinite(num)) throw new import_errors.CliError("--amount must be a number", 2);
|
|
48
|
+
return { amount: num, currencyCode: currency };
|
|
49
|
+
};
|
|
50
|
+
const runAppBilling = async ({
|
|
51
|
+
ctx,
|
|
52
|
+
verb,
|
|
53
|
+
argv
|
|
54
|
+
}) => {
|
|
55
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
56
|
+
console.log(
|
|
57
|
+
[
|
|
58
|
+
"Usage:",
|
|
59
|
+
" shop app-billing <verb> [flags]",
|
|
60
|
+
"",
|
|
61
|
+
"Verbs:",
|
|
62
|
+
" create-one-time|create-subscription|cancel-subscription",
|
|
63
|
+
" update-line-item|extend-trial|create-usage-record",
|
|
64
|
+
" get-installation|list-subscriptions",
|
|
65
|
+
"",
|
|
66
|
+
"Plan 5 verbs:",
|
|
67
|
+
" purchase-one-time-create|subscription-create",
|
|
68
|
+
" subscription-trial-extend|usage-record-create",
|
|
69
|
+
" uninstall|revoke-access-scopes"
|
|
70
|
+
].join("\n")
|
|
71
|
+
);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (verb === "purchase-one-time-create") {
|
|
75
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
76
|
+
argv,
|
|
77
|
+
extraOptions: {
|
|
78
|
+
name: { type: "string" },
|
|
79
|
+
amount: { type: "string" },
|
|
80
|
+
currency: { type: "string" },
|
|
81
|
+
"return-url": { type: "string" },
|
|
82
|
+
test: { type: "boolean" }
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const name = args.name;
|
|
86
|
+
const returnUrl = args["return-url"];
|
|
87
|
+
const amountRaw = args.amount;
|
|
88
|
+
const currency = args.currency;
|
|
89
|
+
const test = args.test;
|
|
90
|
+
if (!name) throw new import_errors.CliError("Missing --name", 2);
|
|
91
|
+
if (!returnUrl) throw new import_errors.CliError("Missing --return-url", 2);
|
|
92
|
+
if (!amountRaw) throw new import_errors.CliError("Missing --amount", 2);
|
|
93
|
+
if (!currency) throw new import_errors.CliError("Missing --currency", 2);
|
|
94
|
+
const amount = Number(amountRaw);
|
|
95
|
+
if (!Number.isFinite(amount)) throw new import_errors.CliError("--amount must be a number", 2);
|
|
96
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
97
|
+
appPurchaseOneTimeCreate: {
|
|
98
|
+
__args: { name, returnUrl, price: { amount, currencyCode: currency }, ...test === void 0 ? {} : { test } },
|
|
99
|
+
appPurchaseOneTime: { id: true, name: true, status: true },
|
|
100
|
+
confirmationUrl: true,
|
|
101
|
+
userErrors: { field: true, message: true }
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
if (result === void 0) return;
|
|
105
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.appPurchaseOneTimeCreate, failOnUserErrors: ctx.failOnUserErrors });
|
|
106
|
+
if (ctx.quiet) return console.log(result.appPurchaseOneTimeCreate?.appPurchaseOneTime?.id ?? "");
|
|
107
|
+
(0, import_output.printJson)(result.appPurchaseOneTimeCreate, ctx.format !== "raw");
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (verb === "subscription-create") {
|
|
111
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
112
|
+
argv,
|
|
113
|
+
extraOptions: {
|
|
114
|
+
name: { type: "string" },
|
|
115
|
+
"return-url": { type: "string" },
|
|
116
|
+
"line-items": { type: "string" },
|
|
117
|
+
test: { type: "boolean" },
|
|
118
|
+
"trial-days": { type: "string" },
|
|
119
|
+
"replacement-behavior": { type: "string" }
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
const name = args.name;
|
|
123
|
+
const returnUrl = args["return-url"];
|
|
124
|
+
if (!name) throw new import_errors.CliError("Missing --name", 2);
|
|
125
|
+
if (!returnUrl) throw new import_errors.CliError("Missing --return-url", 2);
|
|
126
|
+
const lineItemsRaw = args["line-items"];
|
|
127
|
+
const parsedLineItems = lineItemsRaw ? (0, import_shared.parseJsonArg)(lineItemsRaw, "--line-items") : [];
|
|
128
|
+
if (!Array.isArray(parsedLineItems)) throw new import_errors.CliError("--line-items must be a JSON array", 2);
|
|
129
|
+
const trialDaysRaw = args["trial-days"];
|
|
130
|
+
const trialDays = trialDaysRaw === void 0 ? void 0 : Number.isFinite(Number(trialDaysRaw)) ? Math.floor(Number(trialDaysRaw)) : void 0;
|
|
131
|
+
if (trialDaysRaw !== void 0 && trialDays === void 0) throw new import_errors.CliError("--trial-days must be an integer", 2);
|
|
132
|
+
const replacementBehavior = args["replacement-behavior"];
|
|
133
|
+
const test = args.test;
|
|
134
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
135
|
+
appSubscriptionCreate: {
|
|
136
|
+
__args: {
|
|
137
|
+
name,
|
|
138
|
+
returnUrl,
|
|
139
|
+
lineItems: parsedLineItems,
|
|
140
|
+
...replacementBehavior ? { replacementBehavior } : {},
|
|
141
|
+
...test === void 0 ? {} : { test },
|
|
142
|
+
...trialDays === void 0 ? {} : { trialDays }
|
|
143
|
+
},
|
|
144
|
+
appSubscription: { id: true, name: true, status: true },
|
|
145
|
+
confirmationUrl: true,
|
|
146
|
+
userErrors: { field: true, message: true }
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
if (result === void 0) return;
|
|
150
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.appSubscriptionCreate, failOnUserErrors: ctx.failOnUserErrors });
|
|
151
|
+
if (ctx.quiet) return console.log(result.appSubscriptionCreate?.appSubscription?.id ?? "");
|
|
152
|
+
(0, import_output.printJson)(result.appSubscriptionCreate, ctx.format !== "raw");
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (verb === "subscription-trial-extend") {
|
|
156
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { days: { type: "string" } } });
|
|
157
|
+
const id = (0, import_shared.requireId)(args.id, "AppSubscription");
|
|
158
|
+
const days = Number(args.days);
|
|
159
|
+
if (!Number.isFinite(days) || days <= 0) throw new import_errors.CliError("--days must be a positive integer", 2);
|
|
160
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
161
|
+
appSubscriptionTrialExtend: {
|
|
162
|
+
__args: { id, days: Math.floor(days) },
|
|
163
|
+
appSubscription: { id: true, name: true, status: true },
|
|
164
|
+
userErrors: { field: true, message: true }
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
if (result === void 0) return;
|
|
168
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.appSubscriptionTrialExtend, failOnUserErrors: ctx.failOnUserErrors });
|
|
169
|
+
if (ctx.quiet) return console.log(result.appSubscriptionTrialExtend?.appSubscription?.id ?? "");
|
|
170
|
+
(0, import_output.printJson)(result.appSubscriptionTrialExtend, ctx.format !== "raw");
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (verb === "usage-record-create") {
|
|
174
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
175
|
+
argv,
|
|
176
|
+
extraOptions: {
|
|
177
|
+
"subscription-line-item-id": { type: "string" },
|
|
178
|
+
description: { type: "string" },
|
|
179
|
+
amount: { type: "string" },
|
|
180
|
+
currency: { type: "string" },
|
|
181
|
+
"idempotency-key": { type: "string" }
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
const subscriptionLineItemId = args["subscription-line-item-id"];
|
|
185
|
+
const description = args.description;
|
|
186
|
+
const amountRaw = args.amount;
|
|
187
|
+
const currency = args.currency;
|
|
188
|
+
const idempotencyKey = args["idempotency-key"];
|
|
189
|
+
if (!subscriptionLineItemId) throw new import_errors.CliError("Missing --subscription-line-item-id", 2);
|
|
190
|
+
if (!description) throw new import_errors.CliError("Missing --description", 2);
|
|
191
|
+
if (!amountRaw) throw new import_errors.CliError("Missing --amount", 2);
|
|
192
|
+
if (!currency) throw new import_errors.CliError("Missing --currency", 2);
|
|
193
|
+
const amount = Number(amountRaw);
|
|
194
|
+
if (!Number.isFinite(amount)) throw new import_errors.CliError("--amount must be a number", 2);
|
|
195
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
196
|
+
appUsageRecordCreate: {
|
|
197
|
+
__args: {
|
|
198
|
+
subscriptionLineItemId,
|
|
199
|
+
description,
|
|
200
|
+
price: { amount, currencyCode: currency },
|
|
201
|
+
...idempotencyKey ? { idempotencyKey } : {}
|
|
202
|
+
},
|
|
203
|
+
appUsageRecord: { id: true, description: true },
|
|
204
|
+
userErrors: { field: true, message: true }
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
if (result === void 0) return;
|
|
208
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.appUsageRecordCreate, failOnUserErrors: ctx.failOnUserErrors });
|
|
209
|
+
if (ctx.quiet) return console.log(result.appUsageRecordCreate?.appUsageRecord?.id ?? "");
|
|
210
|
+
(0, import_output.printJson)(result.appUsageRecordCreate, ctx.format !== "raw");
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (verb === "uninstall") {
|
|
214
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
215
|
+
appUninstall: {
|
|
216
|
+
app: { id: true, handle: true, apiKey: true },
|
|
217
|
+
userErrors: { field: true, message: true, code: true }
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
if (result === void 0) return;
|
|
221
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.appUninstall, failOnUserErrors: ctx.failOnUserErrors });
|
|
222
|
+
if (ctx.quiet) return console.log(result.appUninstall?.app?.id ?? "");
|
|
223
|
+
(0, import_output.printJson)(result.appUninstall, ctx.format !== "raw");
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (verb === "revoke-access-scopes") {
|
|
227
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { scopes: { type: "string" } } });
|
|
228
|
+
const raw = args.scopes;
|
|
229
|
+
if (!raw) throw new import_errors.CliError("Missing --scopes", 2);
|
|
230
|
+
const scopes = (0, import_shared.parseCsv)(raw, "--scopes");
|
|
231
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
232
|
+
appRevokeAccessScopes: {
|
|
233
|
+
__args: { scopes },
|
|
234
|
+
revoked: { handle: true, description: true },
|
|
235
|
+
userErrors: { field: true, message: true, code: true }
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
if (result === void 0) return;
|
|
239
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.appRevokeAccessScopes, failOnUserErrors: ctx.failOnUserErrors });
|
|
240
|
+
if (ctx.quiet) return console.log(result.appRevokeAccessScopes?.revoked ?? "");
|
|
241
|
+
(0, import_output.printJson)(result.appRevokeAccessScopes, ctx.format !== "raw");
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (verb === "create-one-time") {
|
|
245
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
246
|
+
argv,
|
|
247
|
+
extraOptions: {
|
|
248
|
+
name: { type: "string" },
|
|
249
|
+
amount: { type: "string" },
|
|
250
|
+
currency: { type: "string" },
|
|
251
|
+
"return-url": { type: "string" },
|
|
252
|
+
test: { type: "boolean" }
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
const built = (0, import_input.buildInput)({
|
|
256
|
+
inputArg: args.input,
|
|
257
|
+
setArgs: args.set,
|
|
258
|
+
setJsonArgs: args["set-json"]
|
|
259
|
+
});
|
|
260
|
+
const input = built.used ? built.input : {};
|
|
261
|
+
const name = args.name ?? input.name;
|
|
262
|
+
const returnUrl = args["return-url"] ?? input.returnUrl;
|
|
263
|
+
const test = args.test !== void 0 ? Boolean(args.test) : input.test;
|
|
264
|
+
const price = input.price ?? parseMoneyInput({ amount: args.amount, currency: args.currency });
|
|
265
|
+
if (!name || !returnUrl || !price) {
|
|
266
|
+
throw new import_errors.CliError("Missing required fields (name, returnUrl, price)", 2);
|
|
267
|
+
}
|
|
268
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
269
|
+
appPurchaseOneTimeCreate: {
|
|
270
|
+
__args: { name, price, returnUrl, ...test === void 0 ? {} : { test } },
|
|
271
|
+
appPurchaseOneTime: { id: true, name: true, status: true },
|
|
272
|
+
confirmationUrl: true,
|
|
273
|
+
userErrors: { field: true, message: true }
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
if (result === void 0) return;
|
|
277
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.appPurchaseOneTimeCreate, failOnUserErrors: ctx.failOnUserErrors });
|
|
278
|
+
if (ctx.quiet) return console.log(result.appPurchaseOneTimeCreate?.appPurchaseOneTime?.id ?? "");
|
|
279
|
+
(0, import_output.printJson)(result.appPurchaseOneTimeCreate, ctx.format !== "raw");
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (verb === "create-subscription") {
|
|
283
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
284
|
+
const built = (0, import_input.buildInput)({
|
|
285
|
+
inputArg: args.input,
|
|
286
|
+
setArgs: args.set,
|
|
287
|
+
setJsonArgs: args["set-json"]
|
|
288
|
+
});
|
|
289
|
+
if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
|
|
290
|
+
const input = built.input;
|
|
291
|
+
const { lineItems, name, returnUrl, replacementBehavior, test, trialDays } = input;
|
|
292
|
+
if (!lineItems || !name || !returnUrl) {
|
|
293
|
+
throw new import_errors.CliError("Subscription input must include lineItems, name, and returnUrl", 2);
|
|
294
|
+
}
|
|
295
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
296
|
+
appSubscriptionCreate: {
|
|
297
|
+
__args: {
|
|
298
|
+
lineItems,
|
|
299
|
+
name,
|
|
300
|
+
returnUrl,
|
|
301
|
+
...replacementBehavior ? { replacementBehavior } : {},
|
|
302
|
+
...test === void 0 ? {} : { test },
|
|
303
|
+
...trialDays === void 0 ? {} : { trialDays }
|
|
304
|
+
},
|
|
305
|
+
appSubscription: { id: true, name: true, status: true },
|
|
306
|
+
confirmationUrl: true,
|
|
307
|
+
userErrors: { field: true, message: true }
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
if (result === void 0) return;
|
|
311
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.appSubscriptionCreate, failOnUserErrors: ctx.failOnUserErrors });
|
|
312
|
+
if (ctx.quiet) return console.log(result.appSubscriptionCreate?.appSubscription?.id ?? "");
|
|
313
|
+
(0, import_output.printJson)(result.appSubscriptionCreate, ctx.format !== "raw");
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
if (verb === "cancel-subscription") {
|
|
317
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { prorate: { type: "boolean" } } });
|
|
318
|
+
const id = (0, import_shared.requireId)(args.id, "AppSubscription");
|
|
319
|
+
const prorate = args.prorate;
|
|
320
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
321
|
+
appSubscriptionCancel: {
|
|
322
|
+
__args: { id, ...prorate === void 0 ? {} : { prorate } },
|
|
323
|
+
appSubscription: { id: true, name: true, status: true },
|
|
324
|
+
userErrors: { field: true, message: true }
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
if (result === void 0) return;
|
|
328
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.appSubscriptionCancel, failOnUserErrors: ctx.failOnUserErrors });
|
|
329
|
+
if (ctx.quiet) return console.log(result.appSubscriptionCancel?.appSubscription?.id ?? "");
|
|
330
|
+
(0, import_output.printJson)(result.appSubscriptionCancel, ctx.format !== "raw");
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (verb === "update-line-item") {
|
|
334
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
335
|
+
argv,
|
|
336
|
+
extraOptions: { "line-item-id": { type: "string" }, amount: { type: "string" }, currency: { type: "string" } }
|
|
337
|
+
});
|
|
338
|
+
const lineItemId = args["line-item-id"] ?? args.id;
|
|
339
|
+
if (!lineItemId) throw new import_errors.CliError("Missing --line-item-id", 2);
|
|
340
|
+
const cappedAmount = parseMoneyInput({
|
|
341
|
+
amount: args.amount,
|
|
342
|
+
currency: args.currency
|
|
343
|
+
});
|
|
344
|
+
const inputCapped = args.input ? (0, import_shared.parseJsonArg)(args.input, "--input", { allowEmpty: true }) : void 0;
|
|
345
|
+
const money = inputCapped ?? cappedAmount;
|
|
346
|
+
if (!money) throw new import_errors.CliError("Missing --amount/--currency or --input", 2);
|
|
347
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
348
|
+
appSubscriptionLineItemUpdate: {
|
|
349
|
+
__args: { id: lineItemId, cappedAmount: money },
|
|
350
|
+
appSubscription: { id: true, name: true },
|
|
351
|
+
confirmationUrl: true,
|
|
352
|
+
userErrors: { field: true, message: true }
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
if (result === void 0) return;
|
|
356
|
+
(0, import_userErrors.maybeFailOnUserErrors)({
|
|
357
|
+
payload: result.appSubscriptionLineItemUpdate,
|
|
358
|
+
failOnUserErrors: ctx.failOnUserErrors
|
|
359
|
+
});
|
|
360
|
+
(0, import_output.printJson)(result.appSubscriptionLineItemUpdate, ctx.format !== "raw");
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (verb === "extend-trial") {
|
|
364
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { days: { type: "string" } } });
|
|
365
|
+
const id = (0, import_shared.requireId)(args.id, "AppSubscription");
|
|
366
|
+
const days = Number(args.days);
|
|
367
|
+
if (!Number.isFinite(days) || days <= 0) throw new import_errors.CliError("--days must be a positive integer", 2);
|
|
368
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
369
|
+
appSubscriptionTrialExtend: {
|
|
370
|
+
__args: { id, days: Math.floor(days) },
|
|
371
|
+
appSubscription: { id: true, name: true, status: true },
|
|
372
|
+
userErrors: { field: true, message: true }
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
if (result === void 0) return;
|
|
376
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.appSubscriptionTrialExtend, failOnUserErrors: ctx.failOnUserErrors });
|
|
377
|
+
(0, import_output.printJson)(result.appSubscriptionTrialExtend, ctx.format !== "raw");
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (verb === "create-usage-record") {
|
|
381
|
+
const args = (0, import_router.parseStandardArgs)({
|
|
382
|
+
argv,
|
|
383
|
+
extraOptions: {
|
|
384
|
+
"subscription-line-item-id": { type: "string" },
|
|
385
|
+
description: { type: "string" },
|
|
386
|
+
amount: { type: "string" },
|
|
387
|
+
currency: { type: "string" },
|
|
388
|
+
"idempotency-key": { type: "string" }
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
const subscriptionLineItemId = args["subscription-line-item-id"];
|
|
392
|
+
if (!subscriptionLineItemId) throw new import_errors.CliError("Missing --subscription-line-item-id", 2);
|
|
393
|
+
const built = (0, import_input.buildInput)({
|
|
394
|
+
inputArg: args.input,
|
|
395
|
+
setArgs: args.set,
|
|
396
|
+
setJsonArgs: args["set-json"]
|
|
397
|
+
});
|
|
398
|
+
const input = built.used ? built.input : {};
|
|
399
|
+
const description = args.description ?? input.description;
|
|
400
|
+
const idempotencyKey = args["idempotency-key"] ?? input.idempotencyKey;
|
|
401
|
+
const price = input.price ?? parseMoneyInput({ amount: args.amount, currency: args.currency });
|
|
402
|
+
if (!description || !price) {
|
|
403
|
+
throw new import_errors.CliError("Missing required fields (description, price)", 2);
|
|
404
|
+
}
|
|
405
|
+
const result = await (0, import_router.runMutation)(ctx, {
|
|
406
|
+
appUsageRecordCreate: {
|
|
407
|
+
__args: {
|
|
408
|
+
subscriptionLineItemId,
|
|
409
|
+
description,
|
|
410
|
+
price,
|
|
411
|
+
...idempotencyKey ? { idempotencyKey } : {}
|
|
412
|
+
},
|
|
413
|
+
appUsageRecord: { id: true, description: true },
|
|
414
|
+
userErrors: { field: true, message: true }
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
if (result === void 0) return;
|
|
418
|
+
(0, import_userErrors.maybeFailOnUserErrors)({ payload: result.appUsageRecordCreate, failOnUserErrors: ctx.failOnUserErrors });
|
|
419
|
+
if (ctx.quiet) return console.log(result.appUsageRecordCreate?.appUsageRecord?.id ?? "");
|
|
420
|
+
(0, import_output.printJson)(result.appUsageRecordCreate, ctx.format !== "raw");
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
if (verb === "get-installation" || verb === "list-subscriptions") {
|
|
424
|
+
const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
|
|
425
|
+
const id = args.id ? (0, import_shared.requireId)(args.id, "AppInstallation") : void 0;
|
|
426
|
+
const selection = (0, import_select.resolveSelection)({
|
|
427
|
+
resource: "app-billing",
|
|
428
|
+
typeName: "AppInstallation",
|
|
429
|
+
view: ctx.view,
|
|
430
|
+
baseSelection: getAppInstallationSelection(ctx.view),
|
|
431
|
+
select: args.select,
|
|
432
|
+
selection: args.selection,
|
|
433
|
+
include: args.include,
|
|
434
|
+
ensureId: ctx.quiet
|
|
435
|
+
});
|
|
436
|
+
const result = await (0, import_router.runQuery)(ctx, { appInstallation: { __args: { ...id ? { id } : {} }, ...selection } });
|
|
437
|
+
if (result === void 0) return;
|
|
438
|
+
if (verb === "get-installation") {
|
|
439
|
+
(0, import_output.printNode)({ node: result.appInstallation, format: ctx.format, quiet: ctx.quiet });
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
const subscriptions = result.appInstallation?.activeSubscriptions ?? [];
|
|
443
|
+
(0, import_output.printJson)(subscriptions, ctx.format !== "raw");
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
throw new import_errors.CliError(`Unknown verb for app-billing: ${verb}`, 2);
|
|
447
|
+
};
|
|
448
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
449
|
+
0 && (module.exports = {
|
|
450
|
+
runAppBilling
|
|
451
|
+
});
|
|
452
|
+
//# sourceMappingURL=app-billing.js.map
|