@chargebee/code-sample-generator 0.5.8 → 0.6.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/dist/{LanguageSwitcher-BALS6ZSS.js → LanguageSwitcher-BGbaXdWc.js} +201 -113
- package/dist/LanguageSwitcher-BGbaXdWc.js.map +1 -0
- package/dist/browser/index.d.ts +12 -0
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser.js +23 -9
- package/dist/browser.js.map +1 -1
- package/dist/code-sample-generator.css +45 -0
- package/dist/components/Carousel.d.ts +9 -1
- package/dist/components/Carousel.d.ts.map +1 -1
- package/dist/components/CodeSamples.d.ts.map +1 -1
- package/dist/core/descriptor-extraction.d.ts +124 -0
- package/dist/core/descriptor-extraction.d.ts.map +1 -0
- package/dist/core/expander.d.ts.map +1 -1
- package/dist/core/ir-builder.d.ts +12 -0
- package/dist/core/ir-builder.d.ts.map +1 -1
- package/dist/core/minimal-types.d.ts +29 -0
- package/dist/core/minimal-types.d.ts.map +1 -1
- package/dist/core/spec-context.d.ts +17 -0
- package/dist/core/spec-context.d.ts.map +1 -0
- package/dist/core/types.d.ts +27 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/{generate-from-sample-Ckuf1a6B.js → generate-from-sample-DKnqaFrs.js} +5661 -2600
- package/dist/{generate-from-sample-Ckuf1a6B.js.map → generate-from-sample-DKnqaFrs.js.map} +1 -1
- package/dist/generated/ops/operation-ids.d.ts +3 -3
- package/dist/generated/ops/operation-ids.d.ts.map +1 -1
- package/dist/generated/ops/operation-params.d.ts +316 -103
- package/dist/generated/ops/operation-params.d.ts.map +1 -1
- package/dist/generated/ops/v1/checkout_existing_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v1/checkout_new_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v1/checkout_onetime_addons.d.ts.map +1 -1
- package/dist/generated/ops/v1/checkout_onetime_charge.d.ts.map +1 -1
- package/dist/generated/ops/v1/create_a_customer.d.ts.map +1 -1
- package/dist/generated/ops/v1/create_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v1/create_invoice_estimate.d.ts.map +1 -1
- package/dist/generated/ops/v1/create_subscription_estimate.d.ts.map +1 -1
- package/dist/generated/ops/v1/create_subscription_for_a_customer_estimate.d.ts.map +1 -1
- package/dist/generated/ops/v1/index.d.ts.map +1 -1
- package/dist/generated/ops/v1/record_refund_for_an_invoice.d.ts.map +1 -1
- package/dist/generated/ops/v1/update_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v1/update_subscription_estimate.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/checkout_existing_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/checkout_gift_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/checkout_new_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/checkout_one-time_payments.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/claim_a_gift_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/collect_payment_for_customer.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/convert_a_quote.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_a_customer.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_a_gift.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_a_payment_intent.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_a_refundable_credit_note.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_a_webhook_endpoint.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_an_invoice.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_quote_for_a_new_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_quote_for_updating_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_subscription_estimate.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_subscription_for_a_customer_estimate.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_subscription_for_customer.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_using_gateway_temporary_token.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_using_payment_intent.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/create_using_permanent_token.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/edit_quote_for_a_new_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/edit_quote_for_updating_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/export_subscriptions.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/export_transactions.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/gift_subscription_estimate.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/import_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/import_contract_term.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/import_credit_note.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/import_invoice.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/import_subscription_for_customer.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/import_unbilled_charges.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/index.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/list_events.d.ts.map +1 -1
- package/dist/generated/ops/{v1/update_payment_method.d.ts → v2-pcv1/list_grant_blocks.d.ts} +1 -1
- package/dist/generated/ops/v2-pcv1/list_grant_blocks.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv1/list_hosted_pages.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/list_invoices.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/list_payment_sources.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/list_subscriptions.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/list_transactions.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/override_billing_profile.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/reactivate_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/record_an_excess_payment_for_a_customer.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/record_an_invoice_payment.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/record_an_offline_refund.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/record_refund_for_a_credit_note.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/record_refund_for_an_invoice.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/refund_an_invoice.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/remove_scheduled_cancellation.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/resend_failed_einvoice_in_invoices.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/resume_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/retrieve_vaulted_payment_method.d.ts +4 -0
- package/dist/generated/ops/v2-pcv1/retrieve_vaulted_payment_method.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv1/send_an_einvoice_for_invoices.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/update_a_payment_intent.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/update_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/update_a_webhook_endpoint.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/update_credit_note_details.d.ts +4 -0
- package/dist/generated/ops/v2-pcv1/update_credit_note_details.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv1/update_payment_method_for_a_customer.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv1/update_subscription_estimate.d.ts.map +1 -1
- package/dist/generated/ops/{v2-pcv1/update_payment_method.d.ts → v2-pcv2/allocate.d.ts} +1 -1
- package/dist/generated/ops/v2-pcv2/allocate.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/{update_payment_method.d.ts → archive_a_credit_unit.d.ts} +1 -1
- package/dist/generated/ops/v2-pcv2/archive_a_credit_unit.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/archive_a_metered_feature.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/archive_a_metered_feature.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/authorize.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/authorize.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/cancel_subscription_for_items.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/cancel_subscription_for_items_estimate.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/capture.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/capture.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/capture_authorization.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/capture_authorization.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/checkout_charge-items_and_one-time_charges.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/claim_a_gift_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/collect_payment_for_customer.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/convert_a_quote.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_a_credit_unit.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/create_a_credit_unit.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/create_a_customer.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_a_gift_subscription_for_items.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_a_metered_feature.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/create_a_metered_feature.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/create_a_payment_intent.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_a_purchase.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_a_quote_for_a_new_subscription_items.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_a_quote_for_charge_and_charge_items.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_a_quote_for_update_subscription_items.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_a_ramp.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_a_refundable_credit_note.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_a_webhook_endpoint.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_an_alert.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_checkout_for_a_new_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_checkout_to_update_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_invoice_for_items_and_one-time_charges.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_invoice_for_items_estimate.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_pricing_page_for_existing_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_pricing_page_for_new_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_promotional_grant.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/create_promotional_grant.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/create_subscription_for_items.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_using_gateway_temporary_token.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_using_payment_intent.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/create_using_permanent_token.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/delete_a_metered_feature.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/delete_a_metered_feature.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/edit_create_subscription_quote_for_items.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/edit_quote_for_charge_items_and_charges.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/edit_update_subscription_quote_for_items.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/estimate_for_creating_a_customer_and_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/estimate_for_creating_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/estimate_for_updating_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/estimates_for_purchase.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/export_subscription_ramps.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/export_subscription_ramps.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/export_subscriptions.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/export_transactions.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/gift_subscription_estimate_for_items.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/import_contract_term.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/import_credit_note.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/import_invoice.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/import_subscription_for_items.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/import_unbilled_charges.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/index.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_alerts.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_all_available_meters.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/list_all_available_meters.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/list_applicable_alerts_for_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_credit_units.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/list_credit_units.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/list_events.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_features.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_grant_blocks.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/list_grant_blocks.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/list_hosted_pages.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_invoices.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_ledger_account_balances.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/list_ledger_account_balances.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/list_ledger_operations.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/list_ledger_operations.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/list_omnichannel_subscriptions.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_payment_sources.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_subscriptions.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_transactions.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/override_billing_profile.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/reactivate_a_credit_unit.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/reactivate_a_credit_unit.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/reactivate_a_metered_feature.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/reactivate_a_metered_feature.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/reactivate_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/record_a_purchase.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/record_an_excess_payment_for_a_customer.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/record_an_invoice_payment.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/record_an_offline_refund.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/record_refund_for_a_credit_note.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/record_refund_for_an_invoice.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/refund_an_invoice.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/release_authorization.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/release_authorization.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/remove_scheduled_cancellation.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/resend_failed_einvoice_in_invoices.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/resume_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/retrieve_ledger_operation.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/retrieve_ledger_operation.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/retrieve_vaulted_payment_method.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/retrieve_vaulted_payment_method.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/send_an_einvoice_for_invoices.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/update_a_credit_unit.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/update_a_credit_unit.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/update_a_payment_intent.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/update_a_subscription_ramp.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/update_a_webhook_endpoint.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/update_credit_note_details.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/update_credit_note_details.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/update_payment_method_for_a_customer.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/update_subscription_for_items.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/upsert_or_remove_entitlement_overrides_for_a_subscription.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/upsert_or_remove_entitlements_for_a_feature.d.ts.map +1 -1
- package/dist/generated/ops/v2-pcv2/upsert_or_remove_item_entitlements_for_a_feature.d.ts.map +1 -1
- package/dist/generators/curl.d.ts.map +1 -1
- package/dist/generators/dotnet.d.ts.map +1 -1
- package/dist/generators/enum-resolution.d.ts +45 -13
- package/dist/generators/enum-resolution.d.ts.map +1 -1
- package/dist/generators/go.d.ts.map +1 -1
- package/dist/generators/index.d.ts +4 -38
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/java/v3.d.ts.map +1 -1
- package/dist/generators/java/v4.d.ts.map +1 -1
- package/dist/generators/nodejs.d.ts.map +1 -1
- package/dist/generators/php.d.ts.map +1 -1
- package/dist/generators/python.d.ts.map +1 -1
- package/dist/generators/ruby.d.ts.map +1 -1
- package/dist/generators/utils.d.ts +35 -0
- package/dist/generators/utils.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -62
- package/dist/index.js.map +1 -1
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node.js +13 -7
- package/dist/node.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/generate-code-sample.d.ts +6 -0
- package/dist/utils/generate-code-sample.d.ts.map +1 -1
- package/dist/utils/generate-from-sample.d.ts.map +1 -1
- package/dist/utils/resolve-descriptor.d.ts +17 -0
- package/dist/utils/resolve-descriptor.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/LanguageSwitcher-BALS6ZSS.js.map +0 -1
- package/dist/generated/ops/v1/update_payment_method.d.ts.map +0 -1
- package/dist/generated/ops/v2-pcv1/update_payment_method.d.ts.map +0 -1
- package/dist/generated/ops/v2-pcv2/update_payment_method.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../src/generators/curl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA2B3D;;GAEG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,WAA6B,GACrC,MAAM,
|
|
1
|
+
{"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../src/generators/curl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA2B3D;;GAEG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,WAA6B,GACrC,MAAM,CA+ER;AAgCD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,cAI3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotnet.d.ts","sourceRoot":"","sources":["../../src/generators/dotnet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"dotnet.d.ts","sourceRoot":"","sources":["../../src/generators/dotnet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAuhB9C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA6GD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,aAA+B,GACvC,MAAM,CAwNR;AAogBD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAI7B,CAAC"}
|
|
@@ -42,21 +42,53 @@ export interface ResolvedEnum {
|
|
|
42
42
|
* in an export operation → owningResource="coupon" is always cross-resource).
|
|
43
43
|
*/
|
|
44
44
|
isCrossResource?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* From IR `tlr`: true when some resource declares this array-sub-object enum's
|
|
47
|
+
* attribute. Go v4 and .NET use this to keep the enum on its own class. Java v3 /
|
|
48
|
+
* Go v3 / Python v3 also use `isOperationSubResource` /
|
|
49
|
+
* `isGlobalResourceReference` / `isDependentAttribute` / `isExternalEnum`.
|
|
50
|
+
*/
|
|
51
|
+
isTopLevelResourceEnum?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* From IR `opsr`: the operation resource declares the enum's container with
|
|
54
|
+
* `x-cb-is-sub-resource`.
|
|
55
|
+
*/
|
|
56
|
+
isOperationSubResource?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* From IR `grr`: the container has `x-cb-is-global-resource-reference`.
|
|
59
|
+
*/
|
|
60
|
+
isGlobalResourceReference?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* From IR `dep`: the container has `x-cb-is-dependent-attribute`.
|
|
63
|
+
*/
|
|
64
|
+
isDependentAttribute?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* From schema `isExternalEnum` / IR `x`: `x-cb-is-external-enum`.
|
|
67
|
+
*/
|
|
68
|
+
isExternalEnum?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* From IR `ro`: the single-object form of `isTopLevelResourceEnum` (e.g.
|
|
71
|
+
* `contract_term` in `import_contract_term`). Only Go v4 uses it, writing the
|
|
72
|
+
* enum with the owning resource's type (`ContractTermActionAtTermEnd`).
|
|
73
|
+
*/
|
|
74
|
+
isResourceOwnedEnum?: boolean;
|
|
45
75
|
}
|
|
46
76
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* -
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
77
|
+
* Small hand-maintained set of resources whose enum is written on its own class
|
|
78
|
+
* even when the resource appears as a single sub-object param inside another
|
|
79
|
+
* operation (Python, Java, .NET).
|
|
80
|
+
*
|
|
81
|
+
* Example — `credit_note[reason_code]` in an invoice/order operation:
|
|
82
|
+
* - Python: `chargebee.CreditNote.ReasonCode.VALUE` (own class)
|
|
83
|
+
* - NOT: `chargebee.Invoice.CreditNoteReasonCode.VALUE` (nested under parent)
|
|
84
|
+
*
|
|
85
|
+
* This stays hand-maintained because the single sub-object case has no reliable
|
|
86
|
+
* spec signal: `contract_term` looks like a resource (has an id, declares
|
|
87
|
+
* `action_at_term_end`) yet the SDK nests it (`Subscription.ContractTerm…`), while
|
|
88
|
+
* `card` doesn't declare `preferred_scheme` in its own schema yet the SDK still
|
|
89
|
+
* puts it on the Card class. The array-of-sub-objects case IS reliable and is
|
|
90
|
+
* handled automatically by the `tlr` / `opsr` / `grr` / `dep` flags, so enums like
|
|
91
|
+
* filter_condition, unbilled_charge and payment_reference_number must NOT be added here.
|
|
60
92
|
*/
|
|
61
93
|
export declare const CROSS_RESOURCE_ENUM_OWNERS: Set<string>;
|
|
62
94
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum-resolution.d.ts","sourceRoot":"","sources":["../../src/generators/enum-resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAOjD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,QAAQ,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;;;OAOG;IACH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K,EAAE,MAAM,EACb,iBAAiB,CAAC,EAAE,MAAM,EAC1B,eAAe,GAAE,MAAa,GAC7B;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAoGjE;AA8BD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,MAAM,EACb,iBAAiB,CAAC,EAAE,MAAM,GACzB,MAAM,CA6BR;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,MAAM,EACb,iBAAiB,CAAC,EAAE,MAAM,EAC1B,MAAM,CAAC,EAAE,WAAW,GACnB,MAAM,CAsCR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go.d.ts","sourceRoot":"","sources":["../../src/generators/go.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"go.d.ts","sourceRoot":"","sources":["../../src/generators/go.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAuC9C;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8GAA8G;IAC9G,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AA6iBD;;GAEG;AACH,wBAAgB,UAAU,CACxB,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,SAA2B,GACnC,MAAM,CA+DR;AAokBD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,cAI3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,cAI3B,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,WAAW,EAAE,cAA8B,CAAC;AAEzD,eAAe,UAAU,CAAC"}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Code Generators - IR-based code generation.
|
|
3
3
|
*
|
|
4
4
|
* This module re-exports the browser-safe generator registry from ./registry
|
|
5
|
-
* and adds the legacy adapter
|
|
5
|
+
* and adds the legacy adapter used by the build-samples pipeline.
|
|
6
6
|
*
|
|
7
|
-
* **Browser code should import from ./registry directly** to avoid
|
|
8
|
-
*
|
|
7
|
+
* **Browser code should import from ./registry directly** to avoid pulling in
|
|
8
|
+
* every generator.
|
|
9
9
|
*/
|
|
10
10
|
export * from "./registry";
|
|
11
11
|
export { default } from "./registry";
|
|
12
|
-
import {
|
|
12
|
+
import type { OpenAPISpec } from "../core/descriptor-extraction";
|
|
13
13
|
/**
|
|
14
14
|
* Sample request interface (from cb-api-documentation).
|
|
15
15
|
*/
|
|
@@ -34,40 +34,6 @@ interface GeneratorConfig {
|
|
|
34
34
|
response?: unknown;
|
|
35
35
|
language?: string;
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Minimal OpenAPI spec structure for operation lookup.
|
|
39
|
-
*/
|
|
40
|
-
interface OpenAPISpec {
|
|
41
|
-
paths: Record<string, Record<string, OpenAPIOperation>>;
|
|
42
|
-
}
|
|
43
|
-
interface OpenAPIOperation {
|
|
44
|
-
operationId?: string;
|
|
45
|
-
[OpenAPIExtensions.RESOURCE_ID]?: string;
|
|
46
|
-
[OpenAPIExtensions.OPERATION_METHOD_NAME]?: string;
|
|
47
|
-
[OpenAPIExtensions.IS_LIST_OPERATION]?: boolean;
|
|
48
|
-
responses?: Record<string, {
|
|
49
|
-
content?: {
|
|
50
|
-
"application/json"?: {
|
|
51
|
-
schema?: unknown;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
}>;
|
|
55
|
-
requestBody?: {
|
|
56
|
-
content?: {
|
|
57
|
-
"application/x-www-form-urlencoded"?: {
|
|
58
|
-
schema?: unknown;
|
|
59
|
-
};
|
|
60
|
-
"application/json"?: {
|
|
61
|
-
schema?: unknown;
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
parameters?: Array<{
|
|
66
|
-
name: string;
|
|
67
|
-
in: string;
|
|
68
|
-
schema?: unknown;
|
|
69
|
-
}>;
|
|
70
|
-
}
|
|
71
37
|
/**
|
|
72
38
|
* Legacy generators registry (for build-samples.ts compatibility).
|
|
73
39
|
* Wraps generators with async interface for legacy build system.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAMrC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAMrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAejE;;GAEG;AACH,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAoED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,MAAM,EACN;IACE,QAAQ,EAAE,CACR,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,eAAe,KACpB,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB,CAgBF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v3.d.ts","sourceRoot":"","sources":["../../../src/generators/java/v3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"v3.d.ts","sourceRoot":"","sources":["../../../src/generators/java/v3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAoB/C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA8CD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,aAA+B,GACvC,MAAM,CA8RR;AAm2BD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAI7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v4.d.ts","sourceRoot":"","sources":["../../../src/generators/java/v4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"v4.d.ts","sourceRoot":"","sources":["../../../src/generators/java/v4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAsB/C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAyCD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,aAA+B,GACvC,MAAM,CAieR;AAmlCD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAI7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodejs.d.ts","sourceRoot":"","sources":["../../src/generators/nodejs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"nodejs.d.ts","sourceRoot":"","sources":["../../src/generators/nodejs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA+B9C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA4UD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,aAA+B,GACvC,MAAM,CAsER;AAqQD;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAI/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAI/B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"php.d.ts","sourceRoot":"","sources":["../../src/generators/php.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"php.d.ts","sourceRoot":"","sources":["../../src/generators/php.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAW9C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,qDAAqD;IACrD,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC1B;AA2cD;;GAEG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,UAA4B,GACpC,MAAM,CA+DR;AA+TD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAI5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAI5B,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../src/generators/python.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAO1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../src/generators/python.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAO1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAqD9C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC1B;AA+sBD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,aAA+B,GACvC,MAAM,CAwER;AAuxBD;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAI/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAI/B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ruby.d.ts","sourceRoot":"","sources":["../../src/generators/ruby.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ruby.d.ts","sourceRoot":"","sources":["../../src/generators/ruby.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAY9C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,qDAAqD;IACrD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAgDD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,WAA6B,GACrC,MAAM,CA+ER;AAklBD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,cAI3B,CAAC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Common formatting and value handling used across all generators.
|
|
5
5
|
*/
|
|
6
|
+
import type { IRFlatParam } from "../core/ir-builder";
|
|
6
7
|
import type { ParamSchema } from "../core/types";
|
|
7
8
|
/**
|
|
8
9
|
* Escapes a string value for shell/cURL.
|
|
@@ -78,6 +79,40 @@ export declare function isSchemalessObject(schema: ParamSchema | undefined): boo
|
|
|
78
79
|
* Builds a schema lookup function from flat params.
|
|
79
80
|
* Maps parameter keys to their schemas for enum detection.
|
|
80
81
|
*/
|
|
82
|
+
export declare const CUSTOM_FIELD_PREFIX = "cf_";
|
|
83
|
+
export declare const CONSENT_FIELD_PREFIX = "cs_";
|
|
84
|
+
/** True for `cf_*` keys (with or without `[operator]`). */
|
|
85
|
+
export declare function isCustomFieldKey(key: string): boolean;
|
|
86
|
+
/** True for `cs_*` keys (with or without `[operator]`). */
|
|
87
|
+
export declare function isConsentFieldKey(key: string): boolean;
|
|
88
|
+
/** True for `cf_*` or `cs_*` keys. */
|
|
89
|
+
export declare function isCustomOrConsentKey(key: string): boolean;
|
|
90
|
+
/** Inferred scalar type (from the caller's field description); picks the typed SDK filter. */
|
|
91
|
+
export type CustomFieldDataType = "string" | "number" | "boolean" | "timestamp";
|
|
92
|
+
/** A parsed custom/consent field param. */
|
|
93
|
+
export interface CustomFieldParam {
|
|
94
|
+
/** Field name, original casing preserved. */
|
|
95
|
+
name: string;
|
|
96
|
+
/** Filter operator (`is`, `gt`, …) for list filters; else undefined. */
|
|
97
|
+
operator?: string;
|
|
98
|
+
value: unknown;
|
|
99
|
+
/** "custom" (`cf_*`) or "consent" (`cs_*`). */
|
|
100
|
+
kind: "custom" | "consent";
|
|
101
|
+
/** Inferred scalar type; defaults to "string". */
|
|
102
|
+
dataType: CustomFieldDataType;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Splits flat params into custom/consent fields and `rest` (everything else).
|
|
106
|
+
* @param meta Map of field name -> data type (e.g. `{ cf_amount: "number" }`) for typed filters.
|
|
107
|
+
*/
|
|
108
|
+
export declare function partitionCustomFields(flatParams: IRFlatParam[], meta?: Record<string, string>): {
|
|
109
|
+
rest: IRFlatParam[];
|
|
110
|
+
customFields: CustomFieldParam[];
|
|
111
|
+
};
|
|
112
|
+
/** Formats a scalar for typed SDKs (Java/Go/.NET): quoted strings, literal bools/numbers. */
|
|
113
|
+
export declare function formatCustomFieldScalar(value: unknown): string;
|
|
114
|
+
/** Verbatim key (original casing + `[operator]` suffix) for object-literal generators (Node/PHP). */
|
|
115
|
+
export declare function customFieldFlatKey(field: CustomFieldParam): string;
|
|
81
116
|
export declare function buildSchemaLookup(flatParams: Array<{
|
|
82
117
|
key: string;
|
|
83
118
|
schema: ParamSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/generators/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,wB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9D;AAED,qGAAqG;AACrG,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAElE;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC,GACtD,CAAC,GAAG,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CA0C1C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -58,5 +58,6 @@ export { type GenerateCodeSampleOptions, type GenerateCodeSampleResult, generate
|
|
|
58
58
|
export { type ApiVersion, assertValid, buildIR, type CombinedApiVersion, compressDescriptor, type EnrichOptions, enrichDescriptorsWithOpenAPI, enrichDescriptorWithOpenAPI, expandDescriptor, extractReturnsByOperationId, extractReturnsFromOpenAPI, type FilterCode, findOperationById, formatValue, type HttpMethod, type IR, type IRFlatParam, type IROptions, type IRStructuredParam, isValid, LANGUAGES, type Language, type MinimalOperationDescriptor, type MinimalParamInfo, type MinimalReturnInfo, type MinimalType, type OperationDescriptor, type ParamSchema, type PcVersion, type ReturnDescriptor, type ValidationCode, ValidationError, type ValidationIssue, type ValidationOptions, validateParams, } from "./core";
|
|
59
59
|
export { fetchAllRequestSamples, getDefaultOperationResponse, getFirstAvailableOperationResponse, } from "./samples/repo";
|
|
60
60
|
export { generateFromSample } from "./utils/generate-from-sample";
|
|
61
|
+
export { resolveDescriptor } from "./utils/resolve-descriptor";
|
|
61
62
|
export { CodeGenerationError, LanguageNotSupportedError, OperationNotFoundError, } from "./errors";
|
|
62
63
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAMH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,yBAAyB,CAAC;AACj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/index.js
CHANGED
|
@@ -1,62 +1,10 @@
|
|
|
1
|
-
import { C, a, b, c, G, L, T, u, d } from "./LanguageSwitcher-
|
|
1
|
+
import { C, a, b, c, G, L, T, u, d } from "./LanguageSwitcher-BGbaXdWc.js";
|
|
2
|
+
import { p as pluralize } from "./generate-from-sample-DKnqaFrs.js";
|
|
3
|
+
import { c as c2, A, C as C2, D, d as d2, L as L2, s, O, t, V, k, l, m, n, o, b as b2, h, e, a as a2, g, f, i, j, q, r, v } from "./generate-from-sample-DKnqaFrs.js";
|
|
2
4
|
import { join } from "node:path";
|
|
3
5
|
import "node:url";
|
|
4
|
-
import { p as pluralize } from "./generate-from-sample-Ckuf1a6B.js";
|
|
5
|
-
import { d as d2, A, C as C2, D, e, L as L2, r, O, V, k, l, m, n, o, c as c2, h, b as b2, a as a2, g, f, i, j, q, v } from "./generate-from-sample-Ckuf1a6B.js";
|
|
6
6
|
import { LANGUAGES, enrichDescriptorWithOpenAPI, enrichDescriptorsWithOpenAPI, extractReturnsByOperationId, extractReturnsFromOpenAPI, findOperationById, generateCodeSample, generateCodeSamples, generateCodeSamplesBatch } from "./node.js";
|
|
7
7
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
8
|
-
const OpenAPIExtensions = Object.freeze({
|
|
9
|
-
// Resource Extensions
|
|
10
|
-
RESOURCE_ID: "x-cb-resource-id",
|
|
11
|
-
RESOURCE_NAME: "x-cb-resource-title",
|
|
12
|
-
RESOURCE_API_NAME_SINGULAR: "x-cb-resource-api-name-singular",
|
|
13
|
-
/** Plural route segment for API URLs (e.g. "customers" for resource id "customer") */
|
|
14
|
-
RESOURCE_PATH_NAME: "x-cb-resource-path-name",
|
|
15
|
-
IS_THIRD_PARTY_RESOURCE: "x-cb-is-third-party-resource",
|
|
16
|
-
HIDDEN_FROM_CLIENT_SDK: "x-cb-hidden-from-client-sdk",
|
|
17
|
-
HIDE_RESOURCE_IN_API_DOCS: "x-cb-hide-resource-in-api-docs",
|
|
18
|
-
HIDE_IN_API_DOCS_INDEX_PAGE: "x-cb-hide-in-api-docs-index-page",
|
|
19
|
-
// Operation Extensions
|
|
20
|
-
OPERATION_METHOD_NAME: "x-cb-operation-method-name",
|
|
21
|
-
METHOD_SYNTAX: "x-cb-method-syntax",
|
|
22
|
-
// SDK method call example
|
|
23
|
-
SDK_METHOD_NAME: "x-cb-sdk-method-name",
|
|
24
|
-
// SDK-specific method name (e.g., "retrieveStoreSubscriptions" for Java v4)
|
|
25
|
-
IS_LIST_OPERATION: "x-cb-operation-is-list",
|
|
26
|
-
IS_JSON_INPUT: "x-cb-is-operation-needs-json-input",
|
|
27
|
-
SUB_DOMAIN_NAME: "x-cb-operation-sub-domain-name",
|
|
28
|
-
IS_RESTRICTED: "x-cb-restricted",
|
|
29
|
-
MODULE: "x-cb-module",
|
|
30
|
-
API_CRITICALITY: "x-cb-api-criticality",
|
|
31
|
-
IS_IDEMPOTENT: "x-cb-operation-is-idempotent",
|
|
32
|
-
IS_OPERATION_NEEDS_INPUT_OBJECT: "x-cb-is-operation-needs-input-object",
|
|
33
|
-
IS_BATCH: "x-cb-operation-is-batch",
|
|
34
|
-
IS_BULK_OPERATION: "x-cb-operation-is-bulk",
|
|
35
|
-
// Operation is bulk, excluded from SDK
|
|
36
|
-
IS_INTERNAL: "x-cb-internal",
|
|
37
|
-
// Operation is internal, excluded from SDK
|
|
38
|
-
IS_COMPOSITE_ARRAY_REQUEST_BODY: "x-cb-is-composite-array-request-body",
|
|
39
|
-
SORT_ORDER: "x-cb-sort-order",
|
|
40
|
-
// Parameter Extensions
|
|
41
|
-
IS_FILTER_PARAMETER: "x-cb-is-filter-parameter",
|
|
42
|
-
SDK_FILTER_NAME: "x-cb-sdk-filter-name",
|
|
43
|
-
IS_GLOBAL_ENUM: "x-cb-is-global-enum",
|
|
44
|
-
GLOBAL_ENUM_REFERENCE: "x-cb-global-enum-reference",
|
|
45
|
-
IS_EXTERNAL_ENUM: "x-cb-is-external-enum",
|
|
46
|
-
IS_SDK_GEN_SEPARATE: "x-cb-is-sdk-gen-separate",
|
|
47
|
-
IS_GEN_SEPARATE: "x-cb-is-gen-separate",
|
|
48
|
-
SDK_ENUM_API_NAME: "x-cb-sdk-enum-api-name",
|
|
49
|
-
DEPRECATED_ENUM_VALUES: "x-cb-deprecated-enum-values",
|
|
50
|
-
HIDDEN_PARAMETER: "x-cb-hidden-parameter",
|
|
51
|
-
IS_MONEY_COLUMN: "x-cb-is-money-column",
|
|
52
|
-
IS_LONG_MONEY_COLUMN: "x-cb-is-long-money-column",
|
|
53
|
-
IS_SUB_RESOURCE: "x-cb-is-sub-resource",
|
|
54
|
-
META_MODEL_NAME: "x-cb-meta-model-name",
|
|
55
|
-
// Schema property / attribute extensions (cb-openapi-generator)
|
|
56
|
-
ATTRIBUTE_PCV: "x-cb-attribute-pcv",
|
|
57
|
-
GROUP_ID: "x-cb-group-id"
|
|
58
|
-
// Additional extensions as needed
|
|
59
|
-
});
|
|
60
8
|
function addCopyButton(options = {}) {
|
|
61
9
|
const { toggleDelay = 2e3 } = options;
|
|
62
10
|
return {
|
|
@@ -473,7 +421,7 @@ function fetchAllRequestSamples(resource, operation, apiVersion, pcVersion) {
|
|
|
473
421
|
}
|
|
474
422
|
}
|
|
475
423
|
export {
|
|
476
|
-
|
|
424
|
+
c2 as AVAILABLE_LANGUAGES,
|
|
477
425
|
A as AVAILABLE_LANGUAGE_IDS,
|
|
478
426
|
C as Carousel,
|
|
479
427
|
a as CodeBlock,
|
|
@@ -481,14 +429,14 @@ export {
|
|
|
481
429
|
b as CodeSampleHeader,
|
|
482
430
|
c as CodeSamples,
|
|
483
431
|
D as DEFAULT_LANGUAGE,
|
|
484
|
-
|
|
432
|
+
d2 as DEFAULT_THEME,
|
|
485
433
|
G as GoToApiExplorer,
|
|
486
434
|
LANGUAGES,
|
|
487
435
|
L2 as LANGUAGE_DISPLAY_NAMES,
|
|
488
|
-
|
|
436
|
+
s as LanguageNotSupportedError,
|
|
489
437
|
L as LanguageSwitcher,
|
|
490
|
-
OpenAPIExtensions,
|
|
491
|
-
|
|
438
|
+
O as OpenAPIExtensions,
|
|
439
|
+
t as OperationNotFoundError,
|
|
492
440
|
T as TryInApiExplorer,
|
|
493
441
|
V as ValidationError,
|
|
494
442
|
addCopyButton,
|
|
@@ -506,17 +454,18 @@ export {
|
|
|
506
454
|
generateCodeSample,
|
|
507
455
|
generateCodeSamples,
|
|
508
456
|
generateCodeSamplesBatch,
|
|
509
|
-
|
|
457
|
+
b2 as generateFromSample,
|
|
510
458
|
getDefaultOperationResponse,
|
|
511
459
|
getFirstAvailableOperationResponse,
|
|
512
460
|
h as getGenerator,
|
|
513
|
-
|
|
461
|
+
e as getOperation,
|
|
514
462
|
a2 as getOperationIds,
|
|
515
463
|
g as getOperationIdsForVersion,
|
|
516
464
|
f as getOperations,
|
|
517
465
|
i as getSupportedLanguages,
|
|
518
466
|
j as hasGenerator,
|
|
519
467
|
q as isValid,
|
|
468
|
+
r as resolveDescriptor,
|
|
520
469
|
u as useLanguageSelection,
|
|
521
470
|
d as useSampleLoader,
|
|
522
471
|
v as validateParams
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../openapi-utils/dist/openapi-extensions.js","../src/transformers/copy-button.ts","../src/samples/repo.ts"],"sourcesContent":["/**\n * OpenAPI Extension Constants\n *\n * Centralized constants for all Chargebee-specific OpenAPI extensions (x-cb-*).\n * These constants provide type safety and maintainability when working with\n * OpenAPI specifications across the monorepo.\n *\n * **Usage:**\n * ```typescript\n * import { OpenAPIExtensions } from '@cb-docs-platform/openapi-utils';\n *\n * const resourceId = operation[OpenAPIExtensions.RESOURCE_ID];\n * const isFilter = param[OpenAPIExtensions.IS_FILTER_PARAMETER];\n * ```\n *\n * @module openapi-extensions\n */\nexport const OpenAPIExtensions = Object.freeze({\n // Resource Extensions\n RESOURCE_ID: \"x-cb-resource-id\",\n RESOURCE_NAME: \"x-cb-resource-title\",\n RESOURCE_API_NAME_SINGULAR: \"x-cb-resource-api-name-singular\",\n /** Plural route segment for API URLs (e.g. \"customers\" for resource id \"customer\") */\n RESOURCE_PATH_NAME: \"x-cb-resource-path-name\",\n IS_THIRD_PARTY_RESOURCE: \"x-cb-is-third-party-resource\",\n HIDDEN_FROM_CLIENT_SDK: \"x-cb-hidden-from-client-sdk\",\n HIDE_RESOURCE_IN_API_DOCS: \"x-cb-hide-resource-in-api-docs\",\n HIDE_IN_API_DOCS_INDEX_PAGE: \"x-cb-hide-in-api-docs-index-page\",\n // Operation Extensions\n OPERATION_METHOD_NAME: \"x-cb-operation-method-name\",\n METHOD_SYNTAX: \"x-cb-method-syntax\", // SDK method call example\n SDK_METHOD_NAME: \"x-cb-sdk-method-name\", // SDK-specific method name (e.g., \"retrieveStoreSubscriptions\" for Java v4)\n IS_LIST_OPERATION: \"x-cb-operation-is-list\",\n IS_JSON_INPUT: \"x-cb-is-operation-needs-json-input\",\n SUB_DOMAIN_NAME: \"x-cb-operation-sub-domain-name\",\n IS_RESTRICTED: \"x-cb-restricted\",\n MODULE: \"x-cb-module\",\n API_CRITICALITY: \"x-cb-api-criticality\",\n IS_IDEMPOTENT: \"x-cb-operation-is-idempotent\",\n IS_OPERATION_NEEDS_INPUT_OBJECT: \"x-cb-is-operation-needs-input-object\",\n IS_BATCH: \"x-cb-operation-is-batch\",\n IS_BULK_OPERATION: \"x-cb-operation-is-bulk\", // Operation is bulk, excluded from SDK\n IS_INTERNAL: \"x-cb-internal\", // Operation is internal, excluded from SDK\n IS_COMPOSITE_ARRAY_REQUEST_BODY: \"x-cb-is-composite-array-request-body\",\n SORT_ORDER: \"x-cb-sort-order\",\n // Parameter Extensions\n IS_FILTER_PARAMETER: \"x-cb-is-filter-parameter\",\n SDK_FILTER_NAME: \"x-cb-sdk-filter-name\",\n IS_GLOBAL_ENUM: \"x-cb-is-global-enum\",\n GLOBAL_ENUM_REFERENCE: \"x-cb-global-enum-reference\",\n IS_EXTERNAL_ENUM: \"x-cb-is-external-enum\",\n IS_SDK_GEN_SEPARATE: \"x-cb-is-sdk-gen-separate\",\n IS_GEN_SEPARATE: \"x-cb-is-gen-separate\",\n SDK_ENUM_API_NAME: \"x-cb-sdk-enum-api-name\",\n DEPRECATED_ENUM_VALUES: \"x-cb-deprecated-enum-values\",\n HIDDEN_PARAMETER: \"x-cb-hidden-parameter\",\n IS_MONEY_COLUMN: \"x-cb-is-money-column\",\n IS_LONG_MONEY_COLUMN: \"x-cb-is-long-money-column\",\n IS_SUB_RESOURCE: \"x-cb-is-sub-resource\",\n META_MODEL_NAME: \"x-cb-meta-model-name\",\n // Schema property / attribute extensions (cb-openapi-generator)\n ATTRIBUTE_PCV: \"x-cb-attribute-pcv\",\n GROUP_ID: \"x-cb-group-id\",\n // Additional extensions as needed\n});\n","/**\n * Shiki Transformer: Copy Button\n *\n * Adds a copy-to-clipboard button to code blocks.\n * Based on the approach from https://github.com/shikijs/shiki/discussions/785\n *\n * The transformer:\n * 1. Stores the raw code string in a data attribute on the <pre> element\n * 2. Adds a copy button HTML element inside the <pre> element\n *\n * Client-side JavaScript (via React useEffect) handles the copy functionality.\n */\n\nimport type { ShikiTransformer } from \"shiki\";\n\nexport interface CopyButtonTransformerOptions {\n /** Delay in ms before resetting \"copied\" state (default: 2000) */\n toggleDelay?: number;\n}\n\n/**\n * Shiki transformer that adds a copy button to code blocks\n *\n * Uses the approach from: https://github.com/shikijs/shiki/discussions/785\n * Stores raw code in data attribute, button HTML is added via post-processing\n *\n * @param options - Configuration options\n * @returns Shiki transformer\n *\n * @example\n * ```ts\n * import { codeToHtml } from 'shiki';\n * import { addCopyButton } from './transformers/copy-button';\n *\n * const html = await codeToHtml(code, {\n * lang: 'javascript',\n * transformers: [addCopyButton()]\n * });\n * ```\n */\nexport function addCopyButton(\n options: CopyButtonTransformerOptions = {},\n): ShikiTransformer {\n const { toggleDelay = 2000 } = options;\n\n return {\n name: \"copy-button\",\n pre(node) {\n // Store the raw code string in a data attribute\n // this.source contains the original code before highlighting\n // Escape the code for safe HTML attribute storage\n const escapedCode = String(this.source)\n .replace(/&/g, \"&\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\");\n\n node.properties[\"data-code\"] = escapedCode;\n node.properties[\"data-copy-toggle-delay\"] = toggleDelay.toString();\n node.properties[\"data-copy-enabled\"] = \"true\";\n\n // Add class for styling\n const existingClass = (node.properties.class as string) || \"\";\n node.properties.class = `${existingClass} shiki-with-copy`.trim();\n\n return node;\n },\n };\n}\n","/**\n * Sample repository - loads request/response samples from filesystem\n */\n\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport pluralize from \"pluralize\";\nimport type {\n ApiVersion,\n ExtendedSampleRequest,\n PcVersion,\n PostmanCollection,\n SampleRequest,\n SampleResponse,\n} from \"./types\";\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/**\n * Base directory for all code samples within cb-api-documentation\n */\nconst SAMPLES_BASE_DIR = \"samples/cb-app\";\n\n/**\n * Subdirectory for request JSON files within an operation directory\n */\nconst REQUEST_SUBDIR = \"request\";\n\n/**\n * Subdirectory for response JSON files within an operation directory\n */\nconst RESPONSE_SUBDIR = \"response\";\n\n/**\n * Default JSON filename for requests/responses\n */\nconst DEFAULT_JSON_FILENAME = \"default.json\";\n\n/**\n * Standard JSON file extension\n */\nconst JSON_EXTENSION = \".json\";\n\n/**\n * File extension for Postman collection files\n */\nconst POSTMAN_COLLECTION_EXTENSION = \".postman_collection.json\";\n\n/**\n * Filename for manually added response override\n */\nconst MANUAL_RESPONSE_OVERRIDE_FILENAME =\n \"api_sample_manually_added_response_override.json\";\n\n/**\n * Filename for manually added response\n */\nconst MANUAL_RESPONSE_FILENAME = \"api_sample_manually_added_response.json\";\n\n/**\n * Filename for manually added request\n */\nconst MANUAL_REQUEST_FILENAME = \"api_sample_manually_added_request.json\";\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Get base path to cb-api-documentation\n * @throws Error if CB_API_DOCS_BASE_PATH environment variable is not set\n */\nfunction getContentBasePath(): string {\n const basePath = process.env.CB_API_DOCS_BASE_PATH;\n\n if (!basePath) {\n throw new Error(\n \"❌ Missing required environment variable: CB_API_DOCS_BASE_PATH\\n\\n\" +\n \"Please set:\\n\" +\n \" export CB_API_DOCS_BASE_PATH=/path/to/cb-api-documentation\\n\\n\" +\n \"Or create .env.local at monorepo root with:\\n\" +\n \" CB_API_DOCS_BASE_PATH=/path/to/cb-api-documentation\\n\\n\" +\n \"Run: ./setup-env.sh (from monorepo root)\",\n );\n }\n\n return basePath;\n}\n\n/**\n * Normalize resource name to match filesystem\n * Samples directories use SINGULAR form (customer, subscription, invoice)\n * URLs may use PLURAL form (customers, subscriptions, invoices)\n *\n * Strategy: Convert to singular form (most resources are singular in filesystem)\n */\nfunction normalizeResourceName(resource: string): string {\n // Convert to singular form - samples directories use singular\n // Examples:\n // \"customers\" → \"customer\"\n // \"subscriptions\" → \"subscription\"\n // \"invoices\" → \"invoice\"\n // \"customer\" → \"customer\" (already singular, no change)\n return pluralize.singular(resource);\n}\n\n/**\n * Get version path string\n */\nfunction getVersionPath(apiVersion: ApiVersion, pcVersion: PcVersion): string {\n if (apiVersion === \"v1\") {\n return \"v1\";\n }\n return pcVersion === \"v2\" ? \"v2-pcv2\" : \"v2-pcv1\";\n}\n\n/**\n * Trim response to keep samples concise\n * Recursively processes arrays and objects\n */\nfunction trimResponse(response: any): any {\n if (Array.isArray(response) && response.length > 0) {\n const trimmedFirst = trimResponse(response[0]);\n return [trimmedFirst, { d: \"d\" }];\n }\n\n if (typeof response === \"object\" && response !== null) {\n const trimmed: Record<string, any> = {};\n for (const key in response) {\n trimmed[key] = trimResponse(response[key]);\n }\n return trimmed;\n }\n\n return response;\n}\n\n/**\n * Fetch response sample from filesystem or Postman collection\n */\nfunction fetchResponse(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n sampleFileName?: string,\n): any | null {\n try {\n const basePath = getContentBasePath();\n const versionPath = getVersionPath(apiVersion, pcVersion);\n const normalizedResource = normalizeResourceName(resource);\n const normalizedOpId = normalizeOperationId(operation);\n\n // 1. Try exact match with raw operation ID (e.g. \"create_a_pre-cancel_hosted_page\")\n let operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n operation,\n );\n\n // 2. If valid directory doesn't exist, try normalized snake_case (fallback)\n if (!existsSync(operationDir)) {\n operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n normalizedOpId,\n );\n }\n\n // If exact match doesn't exist, return null\n if (!existsSync(operationDir)) {\n return null;\n }\n\n // 1. If sampleFileName is a Postman collection, extract response from it\n if (sampleFileName?.endsWith(POSTMAN_COLLECTION_EXTENSION)) {\n const collectionPath = join(operationDir, sampleFileName);\n if (existsSync(collectionPath)) {\n try {\n const content = readFileSync(collectionPath, \"utf-8\");\n const collection = JSON.parse(content);\n\n // Extract response body from first item's first response\n if (\n collection?.item?.length &&\n collection?.item[0]?.response?.length &&\n collection?.item[0]?.response[0]?.body\n ) {\n const responseBody = collection?.item[0]?.response[0]?.body;\n // Response body is a JSON string, parse it\n return typeof responseBody === \"string\"\n ? JSON.parse(responseBody)\n : responseBody;\n }\n } catch (error) {\n console.warn(\n `Failed to extract response from Postman collection ${sampleFileName}:`,\n error,\n );\n }\n }\n }\n\n // 2. Otherwise, look for response JSON file in response/ subdirectory\n const responseFileName = sampleFileName || DEFAULT_JSON_FILENAME;\n const responsePath = join(operationDir, RESPONSE_SUBDIR, responseFileName);\n\n if (!existsSync(responsePath)) {\n // Fallback to default.json if specific response doesn't exist\n const defaultPath = join(\n operationDir,\n RESPONSE_SUBDIR,\n DEFAULT_JSON_FILENAME,\n );\n if (!existsSync(defaultPath)) {\n return null;\n }\n const content = readFileSync(defaultPath, \"utf-8\");\n return JSON.parse(content);\n }\n\n const content = readFileSync(responsePath, \"utf-8\");\n return JSON.parse(content);\n } catch (error) {\n console.warn(\n `Failed to fetch response for ${resource}/${operation}:`,\n error,\n );\n return null;\n }\n}\n\n/**\n * Fetch from the override file (highest priority — takes precedence over filesystem responses)\n */\nfunction getManuallyAddedOverrideResponse(identifier: string): any | null {\n try {\n const basePath = getContentBasePath();\n const overridePath = join(\n basePath,\n SAMPLES_BASE_DIR,\n MANUAL_RESPONSE_OVERRIDE_FILENAME,\n );\n\n if (existsSync(overridePath)) {\n const content = readFileSync(overridePath, \"utf-8\");\n const data = JSON.parse(content);\n if (data[identifier]) {\n return data[identifier];\n }\n // Try singular form (URLs use plural, overrides may use singular)\n const singular = pluralize.singular(identifier);\n if (singular !== identifier && data[singular]) {\n return data[singular];\n }\n }\n\n return null;\n } catch (error) {\n console.error(`Error reading override response for ${identifier}:`, error);\n return null;\n }\n}\n\n/**\n * Fetch from the standard manual response file (fallback — used when no filesystem response exists)\n */\nfunction getManuallyAddedFallbackResponse(identifier: string): any | null {\n try {\n const basePath = getContentBasePath();\n const manualPath = join(\n basePath,\n SAMPLES_BASE_DIR,\n MANUAL_RESPONSE_FILENAME,\n );\n\n if (!existsSync(manualPath)) {\n return null;\n }\n\n const content = readFileSync(manualPath, \"utf-8\");\n const data = JSON.parse(content);\n\n if (data[identifier]) {\n return data[identifier];\n }\n // Try singular form (URLs use plural, manual entries may use singular)\n const singular = pluralize.singular(identifier);\n if (singular !== identifier && data[singular]) {\n return data[singular];\n }\n\n return null;\n } catch (error) {\n console.error(`Error reading manual response for ${identifier}:`, error);\n return null;\n }\n}\n\n/**\n * Get default operation response with fallbacks\n */\nexport function getDefaultOperationResponse(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n sampleFileName?: string,\n): SampleResponse | null {\n // Check override file first (highest priority) — by operation, then by resource\n let response = getManuallyAddedOverrideResponse(operation);\n if (response == null) {\n response = getManuallyAddedOverrideResponse(resource);\n }\n\n // Try response matching the sample filename (e.g., create_with_card_details.json)\n if (response == null) {\n response = fetchResponse(\n resource,\n operation,\n apiVersion,\n pcVersion,\n sampleFileName,\n );\n }\n\n // Try manual fallback by operation\n if (response == null) {\n response = getManuallyAddedFallbackResponse(operation);\n }\n\n // Try manual fallback by resource\n if (response == null) {\n response = getManuallyAddedFallbackResponse(resource);\n }\n\n if (response) {\n return {\n statusCode: 200,\n body: trimResponse(response),\n };\n }\n\n return null;\n}\n\n/**\n * Get the first available operation's response for a resource\n * Used to display the resource model when no specific operation is requested\n * Mimics the Nuxt app behavior\n */\nexport function getFirstAvailableOperationResponse(\n resource: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n): SampleResponse | null {\n try {\n // Check override file first (highest priority)\n const overrideResponse = getManuallyAddedOverrideResponse(resource);\n if (overrideResponse) {\n return {\n statusCode: 200,\n body: overrideResponse,\n };\n }\n\n const basePath = getContentBasePath();\n const versionPath = getVersionPath(apiVersion, pcVersion);\n const normalizedResource = normalizeResourceName(resource);\n\n const resourceDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n );\n\n // Try to find response in operation directories\n if (existsSync(resourceDir)) {\n // Get all operation directories, filtering out estimate operations\n // Estimate operations return estimate objects, not the resource object\n const operationDirs = readdirSync(resourceDir, { withFileTypes: true })\n .filter((dirent) => dirent.isDirectory())\n .map((dirent) => dirent.name)\n .filter((opId) => !opId.toLowerCase().includes(\"estimate\"));\n\n // Sort operations by priority (retrieve > list > create > others)\n // This is a filesystem fallback, so we use heuristics instead of OpenAPI x-cb-sort-order\n const sortedOps = operationDirs.sort((a, b) => {\n const aLower = a.toLowerCase();\n const bLower = b.toLowerCase();\n const resourceLower = resource.toLowerCase();\n const singularResource = pluralize.singular(resourceLower);\n\n // Priority: retrieve > list > create > others\n const getPriority = (op: string): number => {\n if (op.includes(\"retrieve\") && op.includes(singularResource))\n return 1;\n if (op.startsWith(\"list_\")) return 2;\n if (op.startsWith(\"create_\")) return 3;\n if (op.startsWith(\"update_\")) return 4;\n return 5;\n };\n\n return getPriority(aLower) - getPriority(bLower);\n });\n\n // Try each operation in priority order until we find one with a valid response\n // Since we've filtered out estimate operations by directory name, responses should be valid\n for (const operationId of sortedOps) {\n const responsePath = join(\n resourceDir,\n operationId,\n RESPONSE_SUBDIR,\n DEFAULT_JSON_FILENAME,\n );\n\n if (existsSync(responsePath)) {\n const content = readFileSync(responsePath, \"utf-8\");\n const response = JSON.parse(content);\n\n return {\n statusCode: 200,\n body: response,\n };\n }\n }\n }\n\n // Fallback: Check manually added response files\n const manualResponse = getManuallyAddedFallbackResponse(resource);\n if (manualResponse) {\n return {\n statusCode: 200,\n body: manualResponse,\n };\n }\n\n return null;\n } catch (error) {\n console.error(`Error in getFirstAvailableOperationResponse:`, error);\n return null;\n }\n}\n\n/**\n * Fetch request samples from filesystem\n */\n/**\n * Convert URL operation format (kebab-case) to filesystem format (snake_case)\n * Example: \"create-subscription\" -> \"create_subscription\"\n */\nfunction normalizeOperationId(operation: string): string {\n // Replace slashes with dashes first (for nested paths)\n let normalized = operation.replace(/\\//g, \"-\");\n // Convert kebab-case to snake_case\n normalized = normalized.replace(/-/g, \"_\");\n return normalized;\n}\n\nfunction _fetchRequestSamples(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n): SampleRequest[] {\n try {\n const basePath = getContentBasePath();\n const versionPath = getVersionPath(apiVersion, pcVersion);\n const normalizedResource = normalizeResourceName(resource);\n const operationId = normalizeOperationId(operation);\n\n const requestPath = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n operationId,\n REQUEST_SUBDIR,\n DEFAULT_JSON_FILENAME,\n );\n\n if (!existsSync(requestPath)) {\n return [];\n }\n\n const content = readFileSync(requestPath, \"utf-8\");\n const data = JSON.parse(content);\n\n // Handle both single request and array of requests\n if (Array.isArray(data)) {\n return data;\n }\n\n return [data];\n } catch (error) {\n console.warn(\n `Failed to fetch requests for ${resource}/${operation}:`,\n error,\n );\n return [];\n }\n}\n\nexport function fetchAllRequestSamples(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n): Array<{ filename: string; name: string; sample: ExtendedSampleRequest }> {\n try {\n const basePath = getContentBasePath();\n const versionPath = getVersionPath(apiVersion, pcVersion);\n const normalizedResource = normalizeResourceName(resource);\n const normalizedOpId = normalizeOperationId(operation);\n\n // 1. Try exact match with raw operation ID (e.g. \"create_a_pre-cancel_hosted_page\")\n let operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n operation,\n );\n\n // 2. If valid directory doesn't exist, try normalized snake_case (fallback)\n if (!existsSync(operationDir)) {\n operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n normalizedOpId,\n );\n }\n\n const samples: Array<{\n filename: string;\n name: string;\n sample: ExtendedSampleRequest;\n }> = [];\n\n // If directory exists, load samples from filesystem\n if (existsSync(operationDir)) {\n const requestDir = join(operationDir, REQUEST_SUBDIR);\n\n // 1. Load individual request JSON files from request/ subdirectory\n if (existsSync(requestDir)) {\n const files = readdirSync(requestDir).filter((file) =>\n file.endsWith(JSON_EXTENSION),\n );\n\n for (const filename of files) {\n try {\n const filePath = join(requestDir, filename);\n const content = readFileSync(filePath, \"utf-8\");\n const data = JSON.parse(content);\n\n // Convert filename to display name\n // \"default.json\" → \"Default\"\n // \"pause_with_options.json\" → \"Pause with options\"\n const name = filename\n .replace(JSON_EXTENSION, \"\")\n .replace(/_/g, \" \")\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n\n // Handle both single request and array\n const sampleData = Array.isArray(data) ? data[0] : data;\n\n samples.push({\n filename,\n name,\n sample: sampleData,\n });\n } catch (error) {\n console.warn(`Failed to load ${filename}:`, error);\n }\n }\n }\n\n // 2. Load Postman collections from operation root directory\n if (existsSync(operationDir)) {\n const collectionFiles = readdirSync(operationDir).filter((file) =>\n file.endsWith(POSTMAN_COLLECTION_EXTENSION),\n );\n\n for (const collectionFile of collectionFiles) {\n try {\n const collectionPath = join(operationDir, collectionFile);\n const content = readFileSync(collectionPath, \"utf-8\");\n const collection = JSON.parse(content);\n\n // Parse Postman collection (usually has one item)\n if (collection.item && collection.item.length > 0) {\n const item = collection.item[0];\n const request = item.request;\n\n // Extract URI\n let uri = \"\";\n if (typeof request.url === \"string\") {\n uri = request.url;\n } else if (request.url?.path) {\n uri = `/${request.url.path.join(\"/\")}`;\n }\n\n // Extract parameters from body\n const params: Record<string, any> = {};\n if (\n request.body?.mode === \"urlencoded\" &&\n request.body.urlencoded\n ) {\n for (const param of request.body.urlencoded) {\n params[param.key] = param.value;\n }\n }\n\n // Extract description from response\n let description = item.name;\n if (\n item.response &&\n item.response.length > 0 &&\n item.response[0].originalRequest?.description?.content\n ) {\n description =\n item.response[0].originalRequest.description.content;\n }\n\n // Clean up collection filename for display name\n // \"updating_auto_collection_and_enabling_direct_debit_for_a_customer-update_a_customer-26_09_2025_22_38_41.postman_collection.json\"\n // → \"Updating auto collection and enabling direct debit for a customer\"\n const cleanName = collectionFile\n .replace(POSTMAN_COLLECTION_EXTENSION, \"\")\n .split(\"-\")[0] // Take first part before timestamp\n .replace(/_/g, \" \")\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n\n samples.push({\n filename: collectionFile,\n name: cleanName,\n sample: {\n uri,\n method: request.method || \"POST\",\n params,\n desc: description,\n description: cleanName,\n } as ExtendedSampleRequest,\n });\n }\n } catch (error) {\n console.warn(\n `Failed to load Postman collection ${collectionFile}:`,\n error,\n );\n }\n }\n }\n } // end if (existsSync(operationDir))\n\n // Fallback: Check manually added request file if no samples found\n if (samples.length === 0) {\n try {\n const manualRequestPath = join(\n basePath,\n SAMPLES_BASE_DIR,\n MANUAL_REQUEST_FILENAME,\n );\n\n if (existsSync(manualRequestPath)) {\n const content = readFileSync(manualRequestPath, \"utf-8\");\n const manualData = JSON.parse(content);\n\n // Check if this operation has a manual request\n // The key could be the operation name or resource_operation\n const possibleKeys = [\n normalizedOpId,\n `${normalizedResource}_${normalizedOpId}`,\n `${resource}_${operation}`,\n ];\n\n for (const key of possibleKeys) {\n if (manualData[key]) {\n const sampleData = Array.isArray(manualData[key])\n ? manualData[key][0]\n : manualData[key];\n samples.push({\n filename: \"manual\",\n name: \"Default\",\n sample: sampleData,\n });\n break;\n }\n }\n }\n } catch (error) {\n console.warn(`Failed to load manual request file:`, error);\n }\n }\n\n // Sort to ensure 'default.json' comes first, Postman collections last\n samples.sort((a, b) => {\n if (a.filename === DEFAULT_JSON_FILENAME) return -1;\n if (b.filename === DEFAULT_JSON_FILENAME) return 1;\n if (a.filename.endsWith(POSTMAN_COLLECTION_EXTENSION)) return 1;\n if (b.filename.endsWith(POSTMAN_COLLECTION_EXTENSION)) return -1;\n return a.filename.localeCompare(b.filename);\n });\n\n return samples;\n } catch (error) {\n console.warn(\n `Failed to fetch all requests for ${resource}/${operation}:`,\n error,\n );\n return [];\n }\n}\n\n/**\n * Fetch Postman collection if available\n */\nfunction fetchPostmanCollections(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n): PostmanCollection[] {\n try {\n const basePath = getContentBasePath();\n const versionPath = getVersionPath(apiVersion, pcVersion);\n const normalizedResource = normalizeResourceName(resource);\n // Remove strict normalization - try raw first, then fallback\n // const normalizedOpId = normalizeOperationId(operation);\n\n // 1. Try exact match with raw operation ID (e.g. \"create_a_pre-cancel_hosted_page\")\n let operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n operation,\n );\n\n // 2. If valid directory doesn't exist, try normalized snake_case (fallback)\n if (!existsSync(operationDir)) {\n const normalizedOpId = normalizeOperationId(operation);\n operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n normalizedOpId,\n );\n }\n\n if (!existsSync(operationDir)) {\n return [];\n }\n\n // Find all Postman collection files in the directory\n const files = readdirSync(operationDir);\n const postmanFiles = files.filter((file) =>\n file.endsWith(POSTMAN_COLLECTION_EXTENSION),\n );\n\n const collections: PostmanCollection[] = [];\n\n for (const file of postmanFiles) {\n try {\n const filePath = join(operationDir, file);\n const content = readFileSync(filePath, \"utf-8\");\n collections.push(JSON.parse(content));\n } catch (fileError) {\n console.warn(`Failed to parse Postman collection ${file}:`, fileError);\n }\n }\n\n return collections;\n } catch (error) {\n console.warn(\n `Failed to fetch Postman collections for ${resource}/${operation}:`,\n error,\n );\n return [];\n }\n}\n\n// Legacy function for backward compatibility\nfunction _fetchPostmanCollection(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n): PostmanCollection | null {\n const collections = fetchPostmanCollections(\n resource,\n operation,\n apiVersion,\n pcVersion,\n );\n return collections.length > 0 ? collections[0] : null;\n}\n\n/**\n * Convert Postman collection to sample requests\n */\nfunction _convertPostmanToRequests(\n collection: PostmanCollection,\n): SampleRequest[] {\n const requests: SampleRequest[] = [];\n\n try {\n for (const item of collection.item) {\n const request = item.request;\n\n // Extract URI from Postman URL structure\n let uri = \"\";\n if (typeof request.url === \"string\") {\n uri = request.url;\n } else if (request.url.path) {\n // Convert path array to string: [\"api\", \"v2\", \"subscriptions\", \"xyz\", \"pause\"] => \"/api/v2/subscriptions/xyz/pause\"\n uri = `/${request.url.path.join(\"/\")}`;\n } else if (request.url.raw) {\n uri = request.url.raw;\n }\n\n const params: Record<string, any> = {};\n\n // Extract URL-encoded body parameters\n if (request.body?.mode === \"urlencoded\" && request.body.urlencoded) {\n for (const param of request.body.urlencoded) {\n params[param.key] = param.value;\n }\n }\n\n // Extract form-data parameters\n if (request.body?.mode === \"formdata\" && request.body.formdata) {\n for (const param of request.body.formdata) {\n params[param.key] = param.value;\n }\n }\n\n // Extract clean display name from collection info name\n // Example: \"pause_on_a_specific_date-pause_a_subscription-16_06_2025_18_06_49.postman_collection.json\"\n // Should become: \"Pause on a specific date\"\n let displayName = item.name; // Default to item name\n\n if (collection.info?.name) {\n // Remove .postman_collection.json extension and timestamp\n const cleanName = collection.info.name\n .replace(/\\.postman_collection\\.json$/, \"\")\n .split(\"-\")[0]; // Take only the first part before the first hyphen\n\n // Convert snake_case to Title Case\n displayName = cleanName\n .split(\"_\")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n }\n\n requests.push({\n uri,\n method: request.method || \"POST\",\n params,\n name: item.name,\n description: displayName,\n } as ExtendedSampleRequest);\n }\n } catch (error) {\n console.warn(\"Failed to convert Postman collection:\", error);\n }\n\n return requests;\n}\n"],"names":["content","a","b"],"mappings":";;;;;;;AAiBY,MAAC,oBAAoB,OAAO,OAAO;AAAA;AAAA,EAE3C,aAAa;AAAA,EACb,eAAe;AAAA,EACf,4BAA4B;AAAA;AAAA,EAE5B,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA;AAAA,EAE7B,uBAAuB;AAAA,EACvB,eAAe;AAAA;AAAA,EACf,iBAAiB;AAAA;AAAA,EACjB,mBAAmB;AAAA,EACnB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iCAAiC;AAAA,EACjC,UAAU;AAAA,EACV,mBAAmB;AAAA;AAAA,EACnB,aAAa;AAAA;AAAA,EACb,iCAAiC;AAAA,EACjC,YAAY;AAAA;AAAA,EAEZ,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,wBAAwB;AAAA,EACxB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA;AAAA,EAEjB,eAAe;AAAA,EACf,UAAU;AAA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E,SAAS,SAAS,4BAA4B,EAAG,QAAO;AAC9D,UAAIC,GAAE,SAAS,SAAS,4BAA4B,EAAG,QAAO;AAC9D,aAAOD,GAAE,SAAS,cAAcC,GAAE,QAAQ;AAAA,IAC5C,CAAC;AAED,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ;AAAA,MACN,oCAAoC,QAAQ,IAAI,SAAS;AAAA,MACzD;AAAA,IAAA;AAEF,WAAO,CAAA;AAAA,EACT;AACF;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/transformers/copy-button.ts","../src/samples/repo.ts"],"sourcesContent":["/**\n * Shiki Transformer: Copy Button\n *\n * Adds a copy-to-clipboard button to code blocks.\n * Based on the approach from https://github.com/shikijs/shiki/discussions/785\n *\n * The transformer:\n * 1. Stores the raw code string in a data attribute on the <pre> element\n * 2. Adds a copy button HTML element inside the <pre> element\n *\n * Client-side JavaScript (via React useEffect) handles the copy functionality.\n */\n\nimport type { ShikiTransformer } from \"shiki\";\n\nexport interface CopyButtonTransformerOptions {\n /** Delay in ms before resetting \"copied\" state (default: 2000) */\n toggleDelay?: number;\n}\n\n/**\n * Shiki transformer that adds a copy button to code blocks\n *\n * Uses the approach from: https://github.com/shikijs/shiki/discussions/785\n * Stores raw code in data attribute, button HTML is added via post-processing\n *\n * @param options - Configuration options\n * @returns Shiki transformer\n *\n * @example\n * ```ts\n * import { codeToHtml } from 'shiki';\n * import { addCopyButton } from './transformers/copy-button';\n *\n * const html = await codeToHtml(code, {\n * lang: 'javascript',\n * transformers: [addCopyButton()]\n * });\n * ```\n */\nexport function addCopyButton(\n options: CopyButtonTransformerOptions = {},\n): ShikiTransformer {\n const { toggleDelay = 2000 } = options;\n\n return {\n name: \"copy-button\",\n pre(node) {\n // Store the raw code string in a data attribute\n // this.source contains the original code before highlighting\n // Escape the code for safe HTML attribute storage\n const escapedCode = String(this.source)\n .replace(/&/g, \"&\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\");\n\n node.properties[\"data-code\"] = escapedCode;\n node.properties[\"data-copy-toggle-delay\"] = toggleDelay.toString();\n node.properties[\"data-copy-enabled\"] = \"true\";\n\n // Add class for styling\n const existingClass = (node.properties.class as string) || \"\";\n node.properties.class = `${existingClass} shiki-with-copy`.trim();\n\n return node;\n },\n };\n}\n","/**\n * Sample repository - loads request/response samples from filesystem\n */\n\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport pluralize from \"pluralize\";\nimport type {\n ApiVersion,\n ExtendedSampleRequest,\n PcVersion,\n PostmanCollection,\n SampleRequest,\n SampleResponse,\n} from \"./types\";\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/**\n * Base directory for all code samples within cb-api-documentation\n */\nconst SAMPLES_BASE_DIR = \"samples/cb-app\";\n\n/**\n * Subdirectory for request JSON files within an operation directory\n */\nconst REQUEST_SUBDIR = \"request\";\n\n/**\n * Subdirectory for response JSON files within an operation directory\n */\nconst RESPONSE_SUBDIR = \"response\";\n\n/**\n * Default JSON filename for requests/responses\n */\nconst DEFAULT_JSON_FILENAME = \"default.json\";\n\n/**\n * Standard JSON file extension\n */\nconst JSON_EXTENSION = \".json\";\n\n/**\n * File extension for Postman collection files\n */\nconst POSTMAN_COLLECTION_EXTENSION = \".postman_collection.json\";\n\n/**\n * Filename for manually added response override\n */\nconst MANUAL_RESPONSE_OVERRIDE_FILENAME =\n \"api_sample_manually_added_response_override.json\";\n\n/**\n * Filename for manually added response\n */\nconst MANUAL_RESPONSE_FILENAME = \"api_sample_manually_added_response.json\";\n\n/**\n * Filename for manually added request\n */\nconst MANUAL_REQUEST_FILENAME = \"api_sample_manually_added_request.json\";\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Get base path to cb-api-documentation\n * @throws Error if CB_API_DOCS_BASE_PATH environment variable is not set\n */\nfunction getContentBasePath(): string {\n const basePath = process.env.CB_API_DOCS_BASE_PATH;\n\n if (!basePath) {\n throw new Error(\n \"❌ Missing required environment variable: CB_API_DOCS_BASE_PATH\\n\\n\" +\n \"Please set:\\n\" +\n \" export CB_API_DOCS_BASE_PATH=/path/to/cb-api-documentation\\n\\n\" +\n \"Or create .env.local at monorepo root with:\\n\" +\n \" CB_API_DOCS_BASE_PATH=/path/to/cb-api-documentation\\n\\n\" +\n \"Run: ./setup-env.sh (from monorepo root)\",\n );\n }\n\n return basePath;\n}\n\n/**\n * Normalize resource name to match filesystem\n * Samples directories use SINGULAR form (customer, subscription, invoice)\n * URLs may use PLURAL form (customers, subscriptions, invoices)\n *\n * Strategy: Convert to singular form (most resources are singular in filesystem)\n */\nfunction normalizeResourceName(resource: string): string {\n // Convert to singular form - samples directories use singular\n // Examples:\n // \"customers\" → \"customer\"\n // \"subscriptions\" → \"subscription\"\n // \"invoices\" → \"invoice\"\n // \"customer\" → \"customer\" (already singular, no change)\n return pluralize.singular(resource);\n}\n\n/**\n * Get version path string\n */\nfunction getVersionPath(apiVersion: ApiVersion, pcVersion: PcVersion): string {\n if (apiVersion === \"v1\") {\n return \"v1\";\n }\n return pcVersion === \"v2\" ? \"v2-pcv2\" : \"v2-pcv1\";\n}\n\n/**\n * Trim response to keep samples concise\n * Recursively processes arrays and objects\n */\nfunction trimResponse(response: any): any {\n if (Array.isArray(response) && response.length > 0) {\n const trimmedFirst = trimResponse(response[0]);\n return [trimmedFirst, { d: \"d\" }];\n }\n\n if (typeof response === \"object\" && response !== null) {\n const trimmed: Record<string, any> = {};\n for (const key in response) {\n trimmed[key] = trimResponse(response[key]);\n }\n return trimmed;\n }\n\n return response;\n}\n\n/**\n * Fetch response sample from filesystem or Postman collection\n */\nfunction fetchResponse(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n sampleFileName?: string,\n): any | null {\n try {\n const basePath = getContentBasePath();\n const versionPath = getVersionPath(apiVersion, pcVersion);\n const normalizedResource = normalizeResourceName(resource);\n const normalizedOpId = normalizeOperationId(operation);\n\n // 1. Try exact match with raw operation ID (e.g. \"create_a_pre-cancel_hosted_page\")\n let operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n operation,\n );\n\n // 2. If valid directory doesn't exist, try normalized snake_case (fallback)\n if (!existsSync(operationDir)) {\n operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n normalizedOpId,\n );\n }\n\n // If exact match doesn't exist, return null\n if (!existsSync(operationDir)) {\n return null;\n }\n\n // 1. If sampleFileName is a Postman collection, extract response from it\n if (sampleFileName?.endsWith(POSTMAN_COLLECTION_EXTENSION)) {\n const collectionPath = join(operationDir, sampleFileName);\n if (existsSync(collectionPath)) {\n try {\n const content = readFileSync(collectionPath, \"utf-8\");\n const collection = JSON.parse(content);\n\n // Extract response body from first item's first response\n if (\n collection?.item?.length &&\n collection?.item[0]?.response?.length &&\n collection?.item[0]?.response[0]?.body\n ) {\n const responseBody = collection?.item[0]?.response[0]?.body;\n // Response body is a JSON string, parse it\n return typeof responseBody === \"string\"\n ? JSON.parse(responseBody)\n : responseBody;\n }\n } catch (error) {\n console.warn(\n `Failed to extract response from Postman collection ${sampleFileName}:`,\n error,\n );\n }\n }\n }\n\n // 2. Otherwise, look for response JSON file in response/ subdirectory\n const responseFileName = sampleFileName || DEFAULT_JSON_FILENAME;\n const responsePath = join(operationDir, RESPONSE_SUBDIR, responseFileName);\n\n if (!existsSync(responsePath)) {\n // Fallback to default.json if specific response doesn't exist\n const defaultPath = join(\n operationDir,\n RESPONSE_SUBDIR,\n DEFAULT_JSON_FILENAME,\n );\n if (!existsSync(defaultPath)) {\n return null;\n }\n const content = readFileSync(defaultPath, \"utf-8\");\n return JSON.parse(content);\n }\n\n const content = readFileSync(responsePath, \"utf-8\");\n return JSON.parse(content);\n } catch (error) {\n console.warn(\n `Failed to fetch response for ${resource}/${operation}:`,\n error,\n );\n return null;\n }\n}\n\n/**\n * Fetch from the override file (highest priority — takes precedence over filesystem responses)\n */\nfunction getManuallyAddedOverrideResponse(identifier: string): any | null {\n try {\n const basePath = getContentBasePath();\n const overridePath = join(\n basePath,\n SAMPLES_BASE_DIR,\n MANUAL_RESPONSE_OVERRIDE_FILENAME,\n );\n\n if (existsSync(overridePath)) {\n const content = readFileSync(overridePath, \"utf-8\");\n const data = JSON.parse(content);\n if (data[identifier]) {\n return data[identifier];\n }\n // Try singular form (URLs use plural, overrides may use singular)\n const singular = pluralize.singular(identifier);\n if (singular !== identifier && data[singular]) {\n return data[singular];\n }\n }\n\n return null;\n } catch (error) {\n console.error(`Error reading override response for ${identifier}:`, error);\n return null;\n }\n}\n\n/**\n * Fetch from the standard manual response file (fallback — used when no filesystem response exists)\n */\nfunction getManuallyAddedFallbackResponse(identifier: string): any | null {\n try {\n const basePath = getContentBasePath();\n const manualPath = join(\n basePath,\n SAMPLES_BASE_DIR,\n MANUAL_RESPONSE_FILENAME,\n );\n\n if (!existsSync(manualPath)) {\n return null;\n }\n\n const content = readFileSync(manualPath, \"utf-8\");\n const data = JSON.parse(content);\n\n if (data[identifier]) {\n return data[identifier];\n }\n // Try singular form (URLs use plural, manual entries may use singular)\n const singular = pluralize.singular(identifier);\n if (singular !== identifier && data[singular]) {\n return data[singular];\n }\n\n return null;\n } catch (error) {\n console.error(`Error reading manual response for ${identifier}:`, error);\n return null;\n }\n}\n\n/**\n * Get default operation response with fallbacks\n */\nexport function getDefaultOperationResponse(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n sampleFileName?: string,\n): SampleResponse | null {\n // Check override file first (highest priority) — by operation, then by resource\n let response = getManuallyAddedOverrideResponse(operation);\n if (response == null) {\n response = getManuallyAddedOverrideResponse(resource);\n }\n\n // Try response matching the sample filename (e.g., create_with_card_details.json)\n if (response == null) {\n response = fetchResponse(\n resource,\n operation,\n apiVersion,\n pcVersion,\n sampleFileName,\n );\n }\n\n // Try manual fallback by operation\n if (response == null) {\n response = getManuallyAddedFallbackResponse(operation);\n }\n\n // Try manual fallback by resource\n if (response == null) {\n response = getManuallyAddedFallbackResponse(resource);\n }\n\n if (response) {\n return {\n statusCode: 200,\n body: trimResponse(response),\n };\n }\n\n return null;\n}\n\n/**\n * Get the first available operation's response for a resource\n * Used to display the resource model when no specific operation is requested\n * Mimics the Nuxt app behavior\n */\nexport function getFirstAvailableOperationResponse(\n resource: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n): SampleResponse | null {\n try {\n // Check override file first (highest priority)\n const overrideResponse = getManuallyAddedOverrideResponse(resource);\n if (overrideResponse) {\n return {\n statusCode: 200,\n body: overrideResponse,\n };\n }\n\n const basePath = getContentBasePath();\n const versionPath = getVersionPath(apiVersion, pcVersion);\n const normalizedResource = normalizeResourceName(resource);\n\n const resourceDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n );\n\n // Try to find response in operation directories\n if (existsSync(resourceDir)) {\n // Get all operation directories, filtering out estimate operations\n // Estimate operations return estimate objects, not the resource object\n const operationDirs = readdirSync(resourceDir, { withFileTypes: true })\n .filter((dirent) => dirent.isDirectory())\n .map((dirent) => dirent.name)\n .filter((opId) => !opId.toLowerCase().includes(\"estimate\"));\n\n // Sort operations by priority (retrieve > list > create > others)\n // This is a filesystem fallback, so we use heuristics instead of OpenAPI x-cb-sort-order\n const sortedOps = operationDirs.sort((a, b) => {\n const aLower = a.toLowerCase();\n const bLower = b.toLowerCase();\n const resourceLower = resource.toLowerCase();\n const singularResource = pluralize.singular(resourceLower);\n\n // Priority: retrieve > list > create > others\n const getPriority = (op: string): number => {\n if (op.includes(\"retrieve\") && op.includes(singularResource))\n return 1;\n if (op.startsWith(\"list_\")) return 2;\n if (op.startsWith(\"create_\")) return 3;\n if (op.startsWith(\"update_\")) return 4;\n return 5;\n };\n\n return getPriority(aLower) - getPriority(bLower);\n });\n\n // Try each operation in priority order until we find one with a valid response\n // Since we've filtered out estimate operations by directory name, responses should be valid\n for (const operationId of sortedOps) {\n const responsePath = join(\n resourceDir,\n operationId,\n RESPONSE_SUBDIR,\n DEFAULT_JSON_FILENAME,\n );\n\n if (existsSync(responsePath)) {\n const content = readFileSync(responsePath, \"utf-8\");\n const response = JSON.parse(content);\n\n return {\n statusCode: 200,\n body: response,\n };\n }\n }\n }\n\n // Fallback: Check manually added response files\n const manualResponse = getManuallyAddedFallbackResponse(resource);\n if (manualResponse) {\n return {\n statusCode: 200,\n body: manualResponse,\n };\n }\n\n return null;\n } catch (error) {\n console.error(`Error in getFirstAvailableOperationResponse:`, error);\n return null;\n }\n}\n\n/**\n * Fetch request samples from filesystem\n */\n/**\n * Convert URL operation format (kebab-case) to filesystem format (snake_case)\n * Example: \"create-subscription\" -> \"create_subscription\"\n */\nfunction normalizeOperationId(operation: string): string {\n // Replace slashes with dashes first (for nested paths)\n let normalized = operation.replace(/\\//g, \"-\");\n // Convert kebab-case to snake_case\n normalized = normalized.replace(/-/g, \"_\");\n return normalized;\n}\n\nfunction _fetchRequestSamples(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n): SampleRequest[] {\n try {\n const basePath = getContentBasePath();\n const versionPath = getVersionPath(apiVersion, pcVersion);\n const normalizedResource = normalizeResourceName(resource);\n const operationId = normalizeOperationId(operation);\n\n const requestPath = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n operationId,\n REQUEST_SUBDIR,\n DEFAULT_JSON_FILENAME,\n );\n\n if (!existsSync(requestPath)) {\n return [];\n }\n\n const content = readFileSync(requestPath, \"utf-8\");\n const data = JSON.parse(content);\n\n // Handle both single request and array of requests\n if (Array.isArray(data)) {\n return data;\n }\n\n return [data];\n } catch (error) {\n console.warn(\n `Failed to fetch requests for ${resource}/${operation}:`,\n error,\n );\n return [];\n }\n}\n\nexport function fetchAllRequestSamples(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n): Array<{ filename: string; name: string; sample: ExtendedSampleRequest }> {\n try {\n const basePath = getContentBasePath();\n const versionPath = getVersionPath(apiVersion, pcVersion);\n const normalizedResource = normalizeResourceName(resource);\n const normalizedOpId = normalizeOperationId(operation);\n\n // 1. Try exact match with raw operation ID (e.g. \"create_a_pre-cancel_hosted_page\")\n let operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n operation,\n );\n\n // 2. If valid directory doesn't exist, try normalized snake_case (fallback)\n if (!existsSync(operationDir)) {\n operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n normalizedOpId,\n );\n }\n\n const samples: Array<{\n filename: string;\n name: string;\n sample: ExtendedSampleRequest;\n }> = [];\n\n // If directory exists, load samples from filesystem\n if (existsSync(operationDir)) {\n const requestDir = join(operationDir, REQUEST_SUBDIR);\n\n // 1. Load individual request JSON files from request/ subdirectory\n if (existsSync(requestDir)) {\n const files = readdirSync(requestDir).filter((file) =>\n file.endsWith(JSON_EXTENSION),\n );\n\n for (const filename of files) {\n try {\n const filePath = join(requestDir, filename);\n const content = readFileSync(filePath, \"utf-8\");\n const data = JSON.parse(content);\n\n // Convert filename to display name\n // \"default.json\" → \"Default\"\n // \"pause_with_options.json\" → \"Pause with options\"\n const name = filename\n .replace(JSON_EXTENSION, \"\")\n .replace(/_/g, \" \")\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n\n // Handle both single request and array\n const sampleData = Array.isArray(data) ? data[0] : data;\n\n samples.push({\n filename,\n name,\n sample: sampleData,\n });\n } catch (error) {\n console.warn(`Failed to load ${filename}:`, error);\n }\n }\n }\n\n // 2. Load Postman collections from operation root directory\n if (existsSync(operationDir)) {\n const collectionFiles = readdirSync(operationDir).filter((file) =>\n file.endsWith(POSTMAN_COLLECTION_EXTENSION),\n );\n\n for (const collectionFile of collectionFiles) {\n try {\n const collectionPath = join(operationDir, collectionFile);\n const content = readFileSync(collectionPath, \"utf-8\");\n const collection = JSON.parse(content);\n\n // Parse Postman collection (usually has one item)\n if (collection.item && collection.item.length > 0) {\n const item = collection.item[0];\n const request = item.request;\n\n // Extract URI\n let uri = \"\";\n if (typeof request.url === \"string\") {\n uri = request.url;\n } else if (request.url?.path) {\n uri = `/${request.url.path.join(\"/\")}`;\n }\n\n // Extract parameters from body\n const params: Record<string, any> = {};\n if (\n request.body?.mode === \"urlencoded\" &&\n request.body.urlencoded\n ) {\n for (const param of request.body.urlencoded) {\n params[param.key] = param.value;\n }\n }\n\n // Extract description from response\n let description = item.name;\n if (\n item.response &&\n item.response.length > 0 &&\n item.response[0].originalRequest?.description?.content\n ) {\n description =\n item.response[0].originalRequest.description.content;\n }\n\n // Clean up collection filename for display name\n // \"updating_auto_collection_and_enabling_direct_debit_for_a_customer-update_a_customer-26_09_2025_22_38_41.postman_collection.json\"\n // → \"Updating auto collection and enabling direct debit for a customer\"\n const cleanName = collectionFile\n .replace(POSTMAN_COLLECTION_EXTENSION, \"\")\n .split(\"-\")[0] // Take first part before timestamp\n .replace(/_/g, \" \")\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n\n samples.push({\n filename: collectionFile,\n name: cleanName,\n sample: {\n uri,\n method: request.method || \"POST\",\n params,\n desc: description,\n description: cleanName,\n } as ExtendedSampleRequest,\n });\n }\n } catch (error) {\n console.warn(\n `Failed to load Postman collection ${collectionFile}:`,\n error,\n );\n }\n }\n }\n } // end if (existsSync(operationDir))\n\n // Fallback: Check manually added request file if no samples found\n if (samples.length === 0) {\n try {\n const manualRequestPath = join(\n basePath,\n SAMPLES_BASE_DIR,\n MANUAL_REQUEST_FILENAME,\n );\n\n if (existsSync(manualRequestPath)) {\n const content = readFileSync(manualRequestPath, \"utf-8\");\n const manualData = JSON.parse(content);\n\n // Check if this operation has a manual request\n // The key could be the operation name or resource_operation\n const possibleKeys = [\n normalizedOpId,\n `${normalizedResource}_${normalizedOpId}`,\n `${resource}_${operation}`,\n ];\n\n for (const key of possibleKeys) {\n if (manualData[key]) {\n const sampleData = Array.isArray(manualData[key])\n ? manualData[key][0]\n : manualData[key];\n samples.push({\n filename: \"manual\",\n name: \"Default\",\n sample: sampleData,\n });\n break;\n }\n }\n }\n } catch (error) {\n console.warn(`Failed to load manual request file:`, error);\n }\n }\n\n // Sort to ensure 'default.json' comes first, Postman collections last\n samples.sort((a, b) => {\n if (a.filename === DEFAULT_JSON_FILENAME) return -1;\n if (b.filename === DEFAULT_JSON_FILENAME) return 1;\n if (a.filename.endsWith(POSTMAN_COLLECTION_EXTENSION)) return 1;\n if (b.filename.endsWith(POSTMAN_COLLECTION_EXTENSION)) return -1;\n return a.filename.localeCompare(b.filename);\n });\n\n return samples;\n } catch (error) {\n console.warn(\n `Failed to fetch all requests for ${resource}/${operation}:`,\n error,\n );\n return [];\n }\n}\n\n/**\n * Fetch Postman collection if available\n */\nfunction fetchPostmanCollections(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n): PostmanCollection[] {\n try {\n const basePath = getContentBasePath();\n const versionPath = getVersionPath(apiVersion, pcVersion);\n const normalizedResource = normalizeResourceName(resource);\n // Remove strict normalization - try raw first, then fallback\n // const normalizedOpId = normalizeOperationId(operation);\n\n // 1. Try exact match with raw operation ID (e.g. \"create_a_pre-cancel_hosted_page\")\n let operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n operation,\n );\n\n // 2. If valid directory doesn't exist, try normalized snake_case (fallback)\n if (!existsSync(operationDir)) {\n const normalizedOpId = normalizeOperationId(operation);\n operationDir = join(\n basePath,\n SAMPLES_BASE_DIR,\n versionPath,\n normalizedResource,\n normalizedOpId,\n );\n }\n\n if (!existsSync(operationDir)) {\n return [];\n }\n\n // Find all Postman collection files in the directory\n const files = readdirSync(operationDir);\n const postmanFiles = files.filter((file) =>\n file.endsWith(POSTMAN_COLLECTION_EXTENSION),\n );\n\n const collections: PostmanCollection[] = [];\n\n for (const file of postmanFiles) {\n try {\n const filePath = join(operationDir, file);\n const content = readFileSync(filePath, \"utf-8\");\n collections.push(JSON.parse(content));\n } catch (fileError) {\n console.warn(`Failed to parse Postman collection ${file}:`, fileError);\n }\n }\n\n return collections;\n } catch (error) {\n console.warn(\n `Failed to fetch Postman collections for ${resource}/${operation}:`,\n error,\n );\n return [];\n }\n}\n\n// Legacy function for backward compatibility\nfunction _fetchPostmanCollection(\n resource: string,\n operation: string,\n apiVersion: ApiVersion,\n pcVersion: PcVersion,\n): PostmanCollection | null {\n const collections = fetchPostmanCollections(\n resource,\n operation,\n apiVersion,\n pcVersion,\n );\n return collections.length > 0 ? collections[0] : null;\n}\n\n/**\n * Convert Postman collection to sample requests\n */\nfunction _convertPostmanToRequests(\n collection: PostmanCollection,\n): SampleRequest[] {\n const requests: SampleRequest[] = [];\n\n try {\n for (const item of collection.item) {\n const request = item.request;\n\n // Extract URI from Postman URL structure\n let uri = \"\";\n if (typeof request.url === \"string\") {\n uri = request.url;\n } else if (request.url.path) {\n // Convert path array to string: [\"api\", \"v2\", \"subscriptions\", \"xyz\", \"pause\"] => \"/api/v2/subscriptions/xyz/pause\"\n uri = `/${request.url.path.join(\"/\")}`;\n } else if (request.url.raw) {\n uri = request.url.raw;\n }\n\n const params: Record<string, any> = {};\n\n // Extract URL-encoded body parameters\n if (request.body?.mode === \"urlencoded\" && request.body.urlencoded) {\n for (const param of request.body.urlencoded) {\n params[param.key] = param.value;\n }\n }\n\n // Extract form-data parameters\n if (request.body?.mode === \"formdata\" && request.body.formdata) {\n for (const param of request.body.formdata) {\n params[param.key] = param.value;\n }\n }\n\n // Extract clean display name from collection info name\n // Example: \"pause_on_a_specific_date-pause_a_subscription-16_06_2025_18_06_49.postman_collection.json\"\n // Should become: \"Pause on a specific date\"\n let displayName = item.name; // Default to item name\n\n if (collection.info?.name) {\n // Remove .postman_collection.json extension and timestamp\n const cleanName = collection.info.name\n .replace(/\\.postman_collection\\.json$/, \"\")\n .split(\"-\")[0]; // Take only the first part before the first hyphen\n\n // Convert snake_case to Title Case\n displayName = cleanName\n .split(\"_\")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n }\n\n requests.push({\n uri,\n method: request.method || \"POST\",\n params,\n name: item.name,\n description: displayName,\n } as ExtendedSampleRequest);\n }\n } catch (error) {\n console.warn(\"Failed to convert Postman collection:\", error);\n }\n\n return requests;\n}\n"],"names":["content","a","b"],"mappings":";;;;;;;AAwCO,SAAS,cACd,UAAwC,IACtB;AAClB,QAAM,EAAE,cAAc,IAAA,IAAS;AAE/B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,IAAI,MAAM;AAIR,YAAM,cAAc,OAAO,KAAK,MAAM,EACnC,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,QAAQ,EACtB,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM;AAEvB,WAAK,WAAW,WAAW,IAAI;AAC/B,WAAK,WAAW,wBAAwB,IAAI,YAAY,SAAA;AACxD,WAAK,WAAW,mBAAmB,IAAI;AAGvC,YAAM,gBAAiB,KAAK,WAAW,SAAoB;AAC3D,WAAK,WAAW,QAAQ,GAAG,aAAa,mBAAmB,KAAA;AAE3D,aAAO;AAAA,IACT;AAAA,EAAA;AAEJ;AC9CA,MAAM,mBAAmB;AAKzB,MAAM,iBAAiB;AAKvB,MAAM,kBAAkB;AAKxB,MAAM,wBAAwB;AAK9B,MAAM,iBAAiB;AAKvB,MAAM,+BAA+B;AAKrC,MAAM,oCACJ;AAKF,MAAM,2BAA2B;AAKjC,MAAM,0BAA0B;AAUhC,SAAS,qBAA6B;AACpC,QAAM,WAAW,QAAQ,IAAI;AAE7B,MAAI,CAAC,UAAU;AACb,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAOJ;AAEA,SAAO;AACT;AASA,SAAS,sBAAsB,UAA0B;AAOvD,SAAO,UAAU,SAAS,QAAQ;AACpC;AAKA,SAAS,eAAe,YAAwB,WAA8B;AAC5E,MAAI,eAAe,MAA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