@chargebee/code-sample-generator 0.5.9 → 0.6.1
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/README.md +17 -6
- package/dist/{LanguageSwitcher-B6BOtmjh.js → LanguageSwitcher-CMk0rDv4.js} +201 -113
- package/dist/LanguageSwitcher-CMk0rDv4.js.map +1 -0
- package/dist/browser/index.d.ts +24 -3
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser.js +27 -10
- 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 +126 -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.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-BknGUtaj.js → generate-from-sample-D9B_64qs.js} +4632 -2279
- package/dist/{generate-from-sample-BknGUtaj.js.map → generate-from-sample-D9B_64qs.js.map} +1 -1
- package/dist/generated/ops/operation-ids.d.ts +2 -2
- package/dist/generated/ops/operation-ids.d.ts.map +1 -1
- package/dist/generated/ops/operation-params.d.ts +192 -75
- 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/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/v2-pcv1/list_gateway_payment_method_tokens_for_a_payment_source.d.ts +4 -0
- package/dist/generated/ops/v2-pcv1/list_gateway_payment_method_tokens_for_a_payment_source.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv1/list_grant_blocks.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-pcv2/allocate.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/allocate.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/archive_a_credit_unit.d.ts +4 -0
- 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.map +1 -1
- 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.map +1 -1
- package/dist/generated/ops/v2-pcv2/capture_authorization.d.ts.map +1 -1
- 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_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_gateway_payment_method_tokens_for_a_payment_source.d.ts +4 -0
- package/dist/generated/ops/v2-pcv2/list_gateway_payment_method_tokens_for_a_payment_source.d.ts.map +1 -0
- package/dist/generated/ops/v2-pcv2/list_grant_blocks.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.map +1 -1
- package/dist/generated/ops/v2-pcv2/list_ledger_operations.d.ts.map +1 -1
- 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.map +1 -1
- 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_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 +7 -39
- 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/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -62
- package/dist/index.js.map +1 -1
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node.js +20 -8
- package/dist/node.js.map +1 -1
- package/dist/types.d.ts +12 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/generate-batch.d.ts +6 -1
- package/dist/utils/generate-batch.d.ts.map +1 -1
- package/dist/utils/generate-code-sample.d.ts +13 -1
- 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 +21 -0
- package/dist/utils/resolve-descriptor.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/LanguageSwitcher-B6BOtmjh.js.map +0 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -31,11 +31,14 @@ export { LanguageSwitcher } from "../components/LanguageSwitcher";
|
|
|
31
31
|
export { TryInApiExplorer } from "../components/TryInApiExplorer";
|
|
32
32
|
export { AVAILABLE_LANGUAGE_IDS, AVAILABLE_LANGUAGES, DEFAULT_LANGUAGE, DEFAULT_THEME, LANGUAGE_DISPLAY_NAMES, } from "../constants/languages";
|
|
33
33
|
export { useLanguageSelection, useSampleLoader } from "../hooks";
|
|
34
|
+
export type { MinimalOperationDescriptor, MinimalParamInfo, MinimalReturnInfo, MinimalType, } from "../core/minimal-types";
|
|
34
35
|
export type { Language } from "../core/types";
|
|
35
36
|
export type * from "../types";
|
|
36
37
|
import { type ApiVersion } from "../generated/ops";
|
|
37
38
|
import { type OperationId } from "../generated/ops/operation-ids";
|
|
39
|
+
export type { ApiVersion } from "../generated/ops";
|
|
38
40
|
export type { OperationId } from "../generated/ops/operation-ids";
|
|
41
|
+
import type { MinimalOperationDescriptor } from "../core/minimal-types";
|
|
39
42
|
import type { ParamsForOperation } from "../generated/ops/operation-params";
|
|
40
43
|
import type { SampleRequest } from "../samples/types";
|
|
41
44
|
/**
|
|
@@ -75,6 +78,19 @@ export interface CodeGeneratorOptions {
|
|
|
75
78
|
apiKey: string;
|
|
76
79
|
/** Cache type - only "memory" is supported in browser */
|
|
77
80
|
cache?: "memory" | "none";
|
|
81
|
+
/**
|
|
82
|
+
* OpenAPI document already loaded by the host. Descriptors are extracted once
|
|
83
|
+
* per document and cached. When omitted (and no `descriptors` / per-call
|
|
84
|
+
* `descriptor`), the frozen registry is used.
|
|
85
|
+
*/
|
|
86
|
+
openapi?: unknown;
|
|
87
|
+
/**
|
|
88
|
+
* Pre-extracted descriptors keyed by operation ID. Takes precedence over
|
|
89
|
+
* `openapi`. Prefer this in the browser when shipping one descriptor per page
|
|
90
|
+
* instead of the whole OpenAPI document. Per-call `generate({ descriptor })`
|
|
91
|
+
* overrides this map.
|
|
92
|
+
*/
|
|
93
|
+
descriptors?: Record<string, MinimalOperationDescriptor>;
|
|
78
94
|
}
|
|
79
95
|
/**
|
|
80
96
|
* Code generator instance returned by createCodeGenerator
|
|
@@ -142,6 +158,11 @@ export interface CodeGenerator {
|
|
|
142
158
|
};
|
|
143
159
|
site?: string;
|
|
144
160
|
apiKey?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Descriptor for this operation. Used when its `id` matches `operation`;
|
|
163
|
+
* takes precedence over the factory's `descriptors` / `openapi`.
|
|
164
|
+
*/
|
|
165
|
+
descriptor?: MinimalOperationDescriptor;
|
|
145
166
|
}): Promise<{
|
|
146
167
|
code: string;
|
|
147
168
|
}>;
|
|
@@ -159,10 +180,10 @@ export interface CodeGenerator {
|
|
|
159
180
|
clearCache(): void;
|
|
160
181
|
}
|
|
161
182
|
/**
|
|
162
|
-
* Create a code generator instance for browser environments
|
|
183
|
+
* Create a code generator instance for browser environments.
|
|
163
184
|
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
185
|
+
* Uses memory caching. Operation shape comes from host-supplied OpenAPI or
|
|
186
|
+
* pre-extracted descriptors (`openapi`, `descriptors`, or per-call `descriptor`).
|
|
166
187
|
*
|
|
167
188
|
* **Use Cases:**
|
|
168
189
|
* - API Explorer playground (dynamic code generation as user edits params)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MA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EAAE,MAAM,CAAC;QAChB;;;WAGG;QACH,UAAU,CAAC,EAAE,0BAA0B,CAAC;KACzC,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE9B;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,UAAU,IAAI,IAAI,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,oBAAoB,GAC5B,aAAa,CA+Jf"}
|
package/dist/browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C, a, b, c, G, L, T, u, d } from "./LanguageSwitcher-
|
|
2
|
-
import { g as getOperationIdsForVersion, a as getOperationIds,
|
|
3
|
-
import {
|
|
1
|
+
import { C, a, b, c, G, L, T, u, d } from "./LanguageSwitcher-CMk0rDv4.js";
|
|
2
|
+
import { g as getOperationIdsForVersion, a as getOperationIds, r as resolveDescriptor, b as generateFromSample } from "./generate-from-sample-D9B_64qs.js";
|
|
3
|
+
import { c as c2, A, D, d as d2, L as L2 } from "./generate-from-sample-D9B_64qs.js";
|
|
4
4
|
function validateOperationId(id, version) {
|
|
5
5
|
if (version) {
|
|
6
6
|
const ops = getOperationIdsForVersion(version);
|
|
@@ -14,13 +14,22 @@ function validateOperationId(id, version) {
|
|
|
14
14
|
return allOps.includes(id);
|
|
15
15
|
}
|
|
16
16
|
function createCodeGenerator(options) {
|
|
17
|
-
const {
|
|
17
|
+
const {
|
|
18
|
+
apiVersion,
|
|
19
|
+
pcVersion,
|
|
20
|
+
site,
|
|
21
|
+
apiKey,
|
|
22
|
+
cache = "memory",
|
|
23
|
+
openapi,
|
|
24
|
+
descriptors
|
|
25
|
+
} = options;
|
|
18
26
|
const operationCache = /* @__PURE__ */ new Map();
|
|
19
27
|
const config = {
|
|
20
28
|
apiVersion,
|
|
21
29
|
pcVersion,
|
|
22
30
|
site,
|
|
23
|
-
apiKey
|
|
31
|
+
apiKey,
|
|
32
|
+
openapi
|
|
24
33
|
};
|
|
25
34
|
return {
|
|
26
35
|
async generate(generateOptions) {
|
|
@@ -31,7 +40,8 @@ function createCodeGenerator(options) {
|
|
|
31
40
|
requestSample,
|
|
32
41
|
request: requestParam,
|
|
33
42
|
site: overrideSite,
|
|
34
|
-
apiKey: overrideApiKey
|
|
43
|
+
apiKey: overrideApiKey,
|
|
44
|
+
descriptor: overrideDescriptor
|
|
35
45
|
} = generateOptions;
|
|
36
46
|
const operation = operationParam ?? operationId;
|
|
37
47
|
const request = requestParam ?? requestSample;
|
|
@@ -71,12 +81,14 @@ function createCodeGenerator(options) {
|
|
|
71
81
|
};
|
|
72
82
|
}
|
|
73
83
|
const customFieldMeta = !Array.isArray(request) && !("uri" in request) ? request.customFieldMeta : void 0;
|
|
84
|
+
const descriptor = overrideDescriptor ?? descriptors?.[operation];
|
|
74
85
|
const finalConfig = {
|
|
75
86
|
...config,
|
|
76
87
|
...overrideSite && { site: overrideSite },
|
|
77
88
|
...overrideApiKey && { apiKey: overrideApiKey },
|
|
78
89
|
operation,
|
|
79
|
-
...customFieldMeta && { customFieldMeta }
|
|
90
|
+
...customFieldMeta && { customFieldMeta },
|
|
91
|
+
...descriptor && { descriptor }
|
|
80
92
|
};
|
|
81
93
|
const code = await generateFromSample(sample, finalConfig, language);
|
|
82
94
|
return { code };
|
|
@@ -84,7 +96,12 @@ function createCodeGenerator(options) {
|
|
|
84
96
|
async prefetch(operation) {
|
|
85
97
|
try {
|
|
86
98
|
const combinedVersion = apiVersion === "v1" ? "v1" : pcVersion === "v1" ? "v2-pcv1" : "v2-pcv2";
|
|
87
|
-
const operationDescriptor =
|
|
99
|
+
const operationDescriptor = resolveDescriptor(
|
|
100
|
+
combinedVersion,
|
|
101
|
+
operation,
|
|
102
|
+
config.openapi,
|
|
103
|
+
descriptors?.[operation]
|
|
104
|
+
);
|
|
88
105
|
if (cache === "memory" && operationDescriptor) {
|
|
89
106
|
operationCache.set(operation, operationDescriptor);
|
|
90
107
|
}
|
|
@@ -98,14 +115,14 @@ function createCodeGenerator(options) {
|
|
|
98
115
|
};
|
|
99
116
|
}
|
|
100
117
|
export {
|
|
101
|
-
|
|
118
|
+
c2 as AVAILABLE_LANGUAGES,
|
|
102
119
|
A as AVAILABLE_LANGUAGE_IDS,
|
|
103
120
|
C as Carousel,
|
|
104
121
|
a as CodeBlock,
|
|
105
122
|
b as CodeSampleHeader,
|
|
106
123
|
c as CodeSamples,
|
|
107
124
|
D as DEFAULT_LANGUAGE,
|
|
108
|
-
|
|
125
|
+
d2 as DEFAULT_THEME,
|
|
109
126
|
G as GoToApiExplorer,
|
|
110
127
|
L2 as LANGUAGE_DISPLAY_NAMES,
|
|
111
128
|
L as LanguageSwitcher,
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sources":["../src/browser/index.ts"],"sourcesContent":["/**\n * Browser Export for @chargebee/code-sample-generator\n *\n * This is the **recommended entry point for browser/client-side applications**.\n * It provides all browser-safe exports: React components, constants, hooks,\n * and the browser code generator.\n *\n * The main entry point (`@chargebee/code-sample-generator`) includes server-only code\n * (filesystem operations, OpenAPI parsing) that will fail in browser builds.\n * Always use `@chargebee/code-sample-generator/browser` in browser environments.\n *\n * @example\n * ```typescript\n * import {\n * CodeSamples,\n * AVAILABLE_LANGUAGES,\n * createCodeGenerator,\n * } from '@chargebee/code-sample-generator/browser';\n * ```\n */\n\n// ============================================================================\n// RE-EXPORTED BROWSER-SAFE COMPONENTS\n// ============================================================================\n\nexport type { CarouselProps } from \"../components/Carousel\";\nexport { Carousel } from \"../components/Carousel\";\nexport type { CodeBlockProps } from \"../components/CodeBlock\";\nexport { CodeBlock } from \"../components/CodeBlock\";\nexport type { CodeSampleHeaderProps } from \"../components/CodeSampleHeader\";\nexport { CodeSampleHeader } from \"../components/CodeSampleHeader\";\nexport { CodeSamples } from \"../components/CodeSamples\";\nexport { GoToApiExplorer } from \"../components/GoToApiExplorer\";\nexport type {\n LanguageOption,\n LanguageSwitcherProps,\n} from \"../components/LanguageSwitcher\";\nexport { LanguageSwitcher } from \"../components/LanguageSwitcher\";\nexport { TryInApiExplorer } from \"../components/TryInApiExplorer\";\n\n// ============================================================================\n// RE-EXPORTED BROWSER-SAFE CONSTANTS\n// ============================================================================\n// NOTE: Import from ../constants/languages directly, NOT from ../constants\n// (the barrel re-exports OpenAPIExtensions from @cb-docs-platform/openapi-utils\n// which has Node.js dependencies)\n\nexport {\n AVAILABLE_LANGUAGE_IDS,\n AVAILABLE_LANGUAGES,\n DEFAULT_LANGUAGE,\n DEFAULT_THEME,\n LANGUAGE_DISPLAY_NAMES,\n} from \"../constants/languages\";\n\n// ============================================================================\n// RE-EXPORTED BROWSER-SAFE HOOKS\n// ============================================================================\n\nexport { useLanguageSelection, useSampleLoader } from \"../hooks\";\n\n// ============================================================================\n// RE-EXPORTED BROWSER-SAFE TYPES\n// ============================================================================\n\nexport type { Language } from \"../core/types\";\nexport type * from \"../types\";\n\n// ============================================================================\n// BROWSER CODE GENERATOR\n// ============================================================================\n\nimport {\n type ApiVersion,\n getOperation,\n getOperationIds,\n} from \"../generated/ops\";\nimport {\n getOperationIdsForVersion,\n type OperationId,\n} from \"../generated/ops/operation-ids\";\n\nexport type { OperationId } from \"../generated/ops/operation-ids\";\n\nimport type { ParamsForOperation } from \"../generated/ops/operation-params\";\nimport type { SampleRequest } from \"../samples/types\";\nimport type { GeneratorConfig } from \"../types\";\nimport { generateFromSample } from \"../utils/generate-from-sample\";\n\n/**\n * Runtime validation helper for operation IDs\n *\n * Checks if a string is a valid operation ID at runtime.\n * Useful for validating user input or API parameters.\n *\n * @param id - Operation ID to validate\n * @param version - Optional version to check against (checks all versions if not provided)\n * @returns True if the ID is a valid operation ID\n *\n * @example\n * ```typescript\n * if (validateOperationId(userInput)) {\n * // Safe to use as OperationId\n * generator.generate({ operation: userInput, ... });\n * } else {\n * console.error('Invalid operation ID');\n * }\n * ```\n */\nexport function validateOperationId(\n id: string,\n version?: ApiVersion,\n): id is OperationId {\n if (version) {\n const ops = getOperationIdsForVersion(version);\n return ops.includes(id as OperationId);\n }\n\n // Check all versions\n const allOps = [\n ...getOperationIds(\"v1\"),\n ...getOperationIds(\"v2-pcv1\"),\n ...getOperationIds(\"v2-pcv2\"),\n ];\n return allOps.includes(id as OperationId);\n}\n\n/**\n * Options for creating a code generator\n */\nexport interface CodeGeneratorOptions {\n /** Base URL for OpenAPI specs (e.g., \"https://api.chargebee.com/api/v2\") */\n specsBaseUrl?: string;\n /** API version (e.g., \"v1\", \"v2\") */\n apiVersion: string;\n /** Product Catalog version (e.g., \"v1\", \"v2\") */\n pcVersion: string;\n /** Chargebee site name */\n site: string;\n /** Chargebee API key */\n apiKey: string;\n /** Cache type - only \"memory\" is supported in browser */\n cache?: \"memory\" | \"none\";\n}\n\n/**\n * Code generator instance returned by createCodeGenerator\n */\nexport interface CodeGenerator {\n /**\n * Generate a code sample\n *\n * @template Op - The operation ID. When provided, params type in request is inferred from OperationParamsMap.\n *\n * @param options - Generation options\n * @param options.language - Language/SDK identifier (e.g., \"curl\", \"node-v3\", \"python-v3\")\n * @param options.operation - Operation ID (e.g., \"create_a_customer\")\n * @param options.request - Request parameters and body. When operation is typed, params are type-checked.\n * @param options.site - Optional site override (defaults to config site)\n * @param options.apiKey - Optional API key override (defaults to config apiKey)\n *\n * @deprecated The `operationId` and `requestSample` parameters are deprecated.\n * Use `operation` and `request` instead. Support will be removed in a future version.\n *\n * @example\n * ```typescript\n * // Basic usage (backward compatible)\n * const result = await generator.generate({\n * language: 'curl',\n * operation: 'create_a_customer',\n * request: { params: { first_name: 'John' } }\n * });\n * ```\n *\n * @example\n * ```typescript\n * // With operation-aware types (if OperationParamsMap is extended via module augmentation)\n * const result = await generator.generate<'create_a_customer'>({\n * language: 'curl',\n * operation: 'create_a_customer',\n * request: {\n * params: {\n * first_name: 'John', // ✅ Type-safe\n * fsrtName: 'John', // ❌ TypeScript error\n * }\n * }\n * });\n * ```\n */\n generate<Op extends OperationId = OperationId>(options: {\n language: string;\n /** @deprecated Use `operation` instead */\n operationId?: string;\n operation?: Op | OperationId | string;\n /** @deprecated Use `request` instead */\n requestSample?: {\n params?: Record<string, unknown>;\n body?: Record<string, unknown>;\n };\n request?:\n | SampleRequest<ParamsForOperation<Op>>\n | SampleRequest<ParamsForOperation<Op>>[]\n | {\n params?: Record<string, unknown>;\n body?: Record<string, unknown>;\n /**\n * Map of custom field name -> inferred data type\n * (e.g. `{ cf_amount: \"number\" }`). Lets typed SDKs emit the correct\n * filter API for dynamic `cf_*` fields on list operations.\n */\n customFieldMeta?: Record<string, string>;\n };\n site?: string;\n apiKey?: string;\n }): Promise<{ code: string }>;\n\n /**\n * Prefetch an operation spec to warm up the cache\n *\n * @param operation - Operation ID to prefetch\n *\n * @deprecated The `operationId` parameter is deprecated. Use `operation` instead.\n */\n prefetch(operation: OperationId | string): Promise<void>;\n\n /**\n * Clear the cache\n */\n clearCache(): void;\n}\n\n/**\n * Create a code generator instance for browser environments\n *\n * This factory function creates a code generator optimized for browser/client-side use.\n * The generator uses memory caching and bundled operation descriptors (no external fetching).\n *\n * **Use Cases:**\n * - API Explorer playground (dynamic code generation as user edits params)\n * - Interactive documentation tools\n * - Client-side code sample previews\n *\n * **Performance Tips:**\n * - Use singleton pattern: Create one generator instance and reuse it\n * - Prefetch common operations: Call `prefetch()` for frequently used operations\n * - Enable memory cache: Use `cache: 'memory'` (default) for faster subsequent generations\n *\n * @param options - Generator configuration options\n * @param options.apiVersion - API version (\"v1\" or \"v2\")\n * @param options.pcVersion - Product Catalog version (\"v1\" or \"v2\")\n * @param options.site - Chargebee site name (e.g., \"acme-test\")\n * @param options.apiKey - Chargebee API key\n * @param options.cache - Cache type (\"memory\" or \"none\", default: \"memory\")\n * @returns Code generator instance\n *\n * @example Basic Setup\n * ```typescript\n * const generator = createCodeGenerator({\n * apiVersion: 'v2',\n * pcVersion: 'v2',\n * site: 'acme-test',\n * apiKey: 'test_key',\n * cache: 'memory'\n * });\n * ```\n *\n * @example Generate Code Dynamically\n * ```typescript\n * const result = await generator.generate({\n * language: 'curl',\n * operation: 'create_a_customer',\n * request: { params: { first_name: 'John' } }\n * });\n * console.log(result.code);\n * ```\n *\n * @example React Component Usage\n * ```typescript\n * function CodePlayground({ operation, params }) {\n * const [code, setCode] = useState('');\n * const generator = useMemo(() => createCodeGenerator({\n * apiVersion: 'v2',\n * pcVersion: 'v2',\n * site: 'acme-test',\n * apiKey: 'test_key'\n * }), []);\n *\n * useEffect(() => {\n * generator.generate({ language: 'curl', operation, request: { params } })\n * .then(result => setCode(result.code));\n * }, [operation, params]);\n *\n * return <pre>{code}</pre>;\n * }\n * ```\n *\n * @example Prefetch Common Operations\n * ```typescript\n * const generator = createCodeGenerator({\n * apiVersion: 'v2',\n * pcVersion: 'v2',\n * site: 'acme-test',\n * apiKey: 'test_key'\n * });\n * await generator.prefetch('create_a_customer');\n * await generator.prefetch('list_customers');\n * ```\n */\nexport function createCodeGenerator(\n options: CodeGeneratorOptions,\n): CodeGenerator {\n const { apiVersion, pcVersion, site, apiKey, cache = \"memory\" } = options;\n\n // Memory cache for operation descriptors\n const operationCache = new Map<string, unknown>();\n\n const config: GeneratorConfig = {\n apiVersion,\n pcVersion,\n site,\n apiKey,\n };\n\n return {\n async generate(generateOptions) {\n const {\n language,\n operationId,\n operation: operationParam,\n requestSample,\n request: requestParam,\n site: overrideSite,\n apiKey: overrideApiKey,\n } = generateOptions;\n\n // Support both old and new parameter names (backward compatibility)\n const operation = operationParam ?? operationId;\n const request = requestParam ?? requestSample;\n\n // Emit deprecation warnings for old parameter names\n if (operationId !== undefined) {\n // eslint-disable-next-line no-console\n console.warn(\n \"[@chargebee/code-sample-generator] The 'operationId' parameter is deprecated. Use 'operation' instead.\",\n );\n }\n if (requestSample !== undefined) {\n // eslint-disable-next-line no-console\n console.warn(\n \"[@chargebee/code-sample-generator] The 'requestSample' parameter is deprecated. Use 'request' instead.\",\n );\n }\n\n if (!operation) {\n throw new Error(\n \"Operation is required. Provide either 'operation' or 'operationId' parameter.\",\n );\n }\n\n // Optional: Validate operation ID at runtime (can be disabled for performance)\n // Uncomment if you want strict validation:\n // if (!validateOperationId(operation)) {\n // throw new Error(`Invalid operation ID: ${operation}`);\n // }\n\n if (!request) {\n throw new Error(\n \"Request is required. Provide either 'request' or 'requestSample' parameter.\",\n );\n }\n\n // Normalize request to SampleRequest format\n // Handle different request formats: SampleRequest, array, or simple object\n let sample: SampleRequest;\n\n if (Array.isArray(request)) {\n // If array, use first element\n sample = request[0];\n } else if (\"uri\" in request) {\n // Already a SampleRequest (has uri property)\n sample = request;\n } else {\n // Simple object format { params?, body? }\n // Note: SampleRequest uses 'payload' not 'body', but we accept 'body' for convenience\n const simpleRequest = request as {\n params?: Record<string, unknown>;\n body?: Record<string, unknown>;\n };\n sample = {\n uri: simpleRequest.params\n ? Object.keys(simpleRequest.params)\n .map((key) => `{${key}}`)\n .join(\"/\")\n : \"/\",\n method: \"POST\", // Default, will be determined from operation\n params: simpleRequest.params || {},\n ...(simpleRequest.body && { payload: simpleRequest.body }),\n };\n }\n\n // Custom field type hints (cf_* dynamic fields) — used by typed SDKs to\n // pick the correct filter API. Present only on the simple object format.\n const customFieldMeta =\n !Array.isArray(request) && !(\"uri\" in request)\n ? (\n request as {\n customFieldMeta?: Record<string, string>;\n }\n ).customFieldMeta\n : undefined;\n\n // Use override site/apiKey if provided, otherwise use config defaults\n const finalConfig: GeneratorConfig = {\n ...config,\n ...(overrideSite && { site: overrideSite }),\n ...(overrideApiKey && { apiKey: overrideApiKey }),\n operation: operation,\n ...(customFieldMeta && { customFieldMeta }),\n };\n\n const code = await generateFromSample(sample, finalConfig, language);\n\n return { code };\n },\n\n async prefetch(operation: OperationId | string) {\n // Try to load the operation to warm up the cache\n try {\n // Convert apiVersion + pcVersion to combined version format\n const combinedVersion: ApiVersion =\n apiVersion === \"v1\"\n ? \"v1\"\n : pcVersion === \"v1\"\n ? \"v2-pcv1\"\n : \"v2-pcv2\";\n\n const operationDescriptor = getOperation(combinedVersion, operation);\n if (cache === \"memory\" && operationDescriptor) {\n operationCache.set(operation, operationDescriptor);\n }\n } catch (error) {\n // Silently fail - prefetch is optional\n // eslint-disable-next-line no-console\n console.warn(`Failed to prefetch operation ${operation}:`, error);\n }\n },\n\n clearCache() {\n operationCache.clear();\n },\n };\n}\n"],"names":[],"mappings":";;;AA6GO,SAAS,oBACd,IACA,SACmB;AACnB,MAAI,SAAS;AACX,UAAM,MAAM,0BAA0B,OAAO;AAC7C,WAAO,IAAI,SAAS,EAAiB;AAAA,EACvC;AAGA,QAAM,SAAS;AAAA,IACb,GAAG,gBAAgB,IAAI;AAAA,IACvB,GAAG,gBAAgB,SAAS;AAAA,IAC5B,GAAG,gBAAgB,SAAS;AAAA,EAAA;AAE9B,SAAO,OAAO,SAAS,EAAiB;AAC1C;AAuLO,SAAS,oBACd,SACe;AACf,QAAM,EAAE,YAAY,WAAW,MAAM,QAAQ,QAAQ,aAAa;AAGlE,QAAM,qCAAqB,IAAA;AAE3B,QAAM,SAA0B;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGF,SAAO;AAAA,IACL,MAAM,SAAS,iBAAiB;AAC9B,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA,WAAW;AAAA,QACX;AAAA,QACA,SAAS;AAAA,QACT,MAAM;AAAA,QACN,QAAQ;AAAA,MAAA,IACN;AAGJ,YAAM,YAAY,kBAAkB;AACpC,YAAM,UAAU,gBAAgB;AAGhC,UAAI,gBAAgB,QAAW;AAE7B,gBAAQ;AAAA,UACN;AAAA,QAAA;AAAA,MAEJ;AACA,UAAI,kBAAkB,QAAW;AAE/B,gBAAQ;AAAA,UACN;AAAA,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CAAgC,SAAS,KAAK,KAAK;AAAA,MAClE;AAAA,IACF;AAAA,IAEA,aAAa;AACX,qBAAe,MAAA;AAAA,IACjB;AAAA,EAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"browser.js","sources":["../src/browser/index.ts"],"sourcesContent":["/**\n * Browser Export for @chargebee/code-sample-generator\n *\n * This is the **recommended entry point for browser/client-side applications**.\n * It provides all browser-safe exports: React components, constants, hooks,\n * and the browser code generator.\n *\n * The main entry point (`@chargebee/code-sample-generator`) includes server-only code\n * (filesystem operations, OpenAPI parsing) that will fail in browser builds.\n * Always use `@chargebee/code-sample-generator/browser` in browser environments.\n *\n * @example\n * ```typescript\n * import {\n * CodeSamples,\n * AVAILABLE_LANGUAGES,\n * createCodeGenerator,\n * } from '@chargebee/code-sample-generator/browser';\n * ```\n */\n\n// ============================================================================\n// RE-EXPORTED BROWSER-SAFE COMPONENTS\n// ============================================================================\n\nexport type { CarouselProps } from \"../components/Carousel\";\nexport { Carousel } from \"../components/Carousel\";\nexport type { CodeBlockProps } from \"../components/CodeBlock\";\nexport { CodeBlock } from \"../components/CodeBlock\";\nexport type { CodeSampleHeaderProps } from \"../components/CodeSampleHeader\";\nexport { CodeSampleHeader } from \"../components/CodeSampleHeader\";\nexport { CodeSamples } from \"../components/CodeSamples\";\nexport { GoToApiExplorer } from \"../components/GoToApiExplorer\";\nexport type {\n LanguageOption,\n LanguageSwitcherProps,\n} from \"../components/LanguageSwitcher\";\nexport { LanguageSwitcher } from \"../components/LanguageSwitcher\";\nexport { TryInApiExplorer } from \"../components/TryInApiExplorer\";\n\n// ============================================================================\n// RE-EXPORTED BROWSER-SAFE CONSTANTS\n// ============================================================================\n// NOTE: Import from ../constants/languages directly, NOT from ../constants\n// (the barrel re-exports OpenAPIExtensions from @cb-docs-platform/openapi-utils\n// which has Node.js dependencies)\n\nexport {\n AVAILABLE_LANGUAGE_IDS,\n AVAILABLE_LANGUAGES,\n DEFAULT_LANGUAGE,\n DEFAULT_THEME,\n LANGUAGE_DISPLAY_NAMES,\n} from \"../constants/languages\";\n\n// ============================================================================\n// RE-EXPORTED BROWSER-SAFE HOOKS\n// ============================================================================\n\nexport { useLanguageSelection, useSampleLoader } from \"../hooks\";\n\n// ============================================================================\n// RE-EXPORTED BROWSER-SAFE TYPES\n// ============================================================================\n\nexport type {\n MinimalOperationDescriptor,\n MinimalParamInfo,\n MinimalReturnInfo,\n MinimalType,\n} from \"../core/minimal-types\";\nexport type { Language } from \"../core/types\";\nexport type * from \"../types\";\n\n// ============================================================================\n// BROWSER CODE GENERATOR\n// ============================================================================\n\nimport { type ApiVersion, getOperationIds } from \"../generated/ops\";\nimport {\n getOperationIdsForVersion,\n type OperationId,\n} from \"../generated/ops/operation-ids\";\n\nexport type { ApiVersion } from \"../generated/ops\";\nexport type { OperationId } from \"../generated/ops/operation-ids\";\n\nimport type { MinimalOperationDescriptor } from \"../core/minimal-types\";\nimport type { ParamsForOperation } from \"../generated/ops/operation-params\";\nimport type { SampleRequest } from \"../samples/types\";\nimport type { GeneratorConfig } from \"../types\";\nimport { generateFromSample } from \"../utils/generate-from-sample\";\nimport { resolveDescriptor } from \"../utils/resolve-descriptor\";\n\n/**\n * Runtime validation helper for operation IDs\n *\n * Checks if a string is a valid operation ID at runtime.\n * Useful for validating user input or API parameters.\n *\n * @param id - Operation ID to validate\n * @param version - Optional version to check against (checks all versions if not provided)\n * @returns True if the ID is a valid operation ID\n *\n * @example\n * ```typescript\n * if (validateOperationId(userInput)) {\n * // Safe to use as OperationId\n * generator.generate({ operation: userInput, ... });\n * } else {\n * console.error('Invalid operation ID');\n * }\n * ```\n */\nexport function validateOperationId(\n id: string,\n version?: ApiVersion,\n): id is OperationId {\n if (version) {\n const ops = getOperationIdsForVersion(version);\n return ops.includes(id as OperationId);\n }\n\n // Check all versions\n const allOps = [\n ...getOperationIds(\"v1\"),\n ...getOperationIds(\"v2-pcv1\"),\n ...getOperationIds(\"v2-pcv2\"),\n ];\n return allOps.includes(id as OperationId);\n}\n\n/**\n * Options for creating a code generator\n */\nexport interface CodeGeneratorOptions {\n /** Base URL for OpenAPI specs (e.g., \"https://api.chargebee.com/api/v2\") */\n specsBaseUrl?: string;\n /** API version (e.g., \"v1\", \"v2\") */\n apiVersion: string;\n /** Product Catalog version (e.g., \"v1\", \"v2\") */\n pcVersion: string;\n /** Chargebee site name */\n site: string;\n /** Chargebee API key */\n apiKey: string;\n /** Cache type - only \"memory\" is supported in browser */\n cache?: \"memory\" | \"none\";\n /**\n * OpenAPI document already loaded by the host. Descriptors are extracted once\n * per document and cached. When omitted (and no `descriptors` / per-call\n * `descriptor`), the frozen registry is used.\n */\n openapi?: unknown;\n\n /**\n * Pre-extracted descriptors keyed by operation ID. Takes precedence over\n * `openapi`. Prefer this in the browser when shipping one descriptor per page\n * instead of the whole OpenAPI document. Per-call `generate({ descriptor })`\n * overrides this map.\n */\n descriptors?: Record<string, MinimalOperationDescriptor>;\n}\n\n/**\n * Code generator instance returned by createCodeGenerator\n */\nexport interface CodeGenerator {\n /**\n * Generate a code sample\n *\n * @template Op - The operation ID. When provided, params type in request is inferred from OperationParamsMap.\n *\n * @param options - Generation options\n * @param options.language - Language/SDK identifier (e.g., \"curl\", \"node-v3\", \"python-v3\")\n * @param options.operation - Operation ID (e.g., \"create_a_customer\")\n * @param options.request - Request parameters and body. When operation is typed, params are type-checked.\n * @param options.site - Optional site override (defaults to config site)\n * @param options.apiKey - Optional API key override (defaults to config apiKey)\n *\n * @deprecated The `operationId` and `requestSample` parameters are deprecated.\n * Use `operation` and `request` instead. Support will be removed in a future version.\n *\n * @example\n * ```typescript\n * // Basic usage (backward compatible)\n * const result = await generator.generate({\n * language: 'curl',\n * operation: 'create_a_customer',\n * request: { params: { first_name: 'John' } }\n * });\n * ```\n *\n * @example\n * ```typescript\n * // With operation-aware types (if OperationParamsMap is extended via module augmentation)\n * const result = await generator.generate<'create_a_customer'>({\n * language: 'curl',\n * operation: 'create_a_customer',\n * request: {\n * params: {\n * first_name: 'John', // ✅ Type-safe\n * fsrtName: 'John', // ❌ TypeScript error\n * }\n * }\n * });\n * ```\n */\n generate<Op extends OperationId = OperationId>(options: {\n language: string;\n /** @deprecated Use `operation` instead */\n operationId?: string;\n operation?: Op | OperationId | string;\n /** @deprecated Use `request` instead */\n requestSample?: {\n params?: Record<string, unknown>;\n body?: Record<string, unknown>;\n };\n request?:\n | SampleRequest<ParamsForOperation<Op>>\n | SampleRequest<ParamsForOperation<Op>>[]\n | {\n params?: Record<string, unknown>;\n body?: Record<string, unknown>;\n /**\n * Map of custom field name -> inferred data type\n * (e.g. `{ cf_amount: \"number\" }`). Lets typed SDKs emit the correct\n * filter API for dynamic `cf_*` fields on list operations.\n */\n customFieldMeta?: Record<string, string>;\n };\n site?: string;\n apiKey?: string;\n /**\n * Descriptor for this operation. Used when its `id` matches `operation`;\n * takes precedence over the factory's `descriptors` / `openapi`.\n */\n descriptor?: MinimalOperationDescriptor;\n }): Promise<{ code: string }>;\n\n /**\n * Prefetch an operation spec to warm up the cache\n *\n * @param operation - Operation ID to prefetch\n *\n * @deprecated The `operationId` parameter is deprecated. Use `operation` instead.\n */\n prefetch(operation: OperationId | string): Promise<void>;\n\n /**\n * Clear the cache\n */\n clearCache(): void;\n}\n\n/**\n * Create a code generator instance for browser environments.\n *\n * Uses memory caching. Operation shape comes from host-supplied OpenAPI or\n * pre-extracted descriptors (`openapi`, `descriptors`, or per-call `descriptor`).\n *\n * **Use Cases:**\n * - API Explorer playground (dynamic code generation as user edits params)\n * - Interactive documentation tools\n * - Client-side code sample previews\n *\n * **Performance Tips:**\n * - Use singleton pattern: Create one generator instance and reuse it\n * - Prefetch common operations: Call `prefetch()` for frequently used operations\n * - Enable memory cache: Use `cache: 'memory'` (default) for faster subsequent generations\n *\n * @param options - Generator configuration options\n * @param options.apiVersion - API version (\"v1\" or \"v2\")\n * @param options.pcVersion - Product Catalog version (\"v1\" or \"v2\")\n * @param options.site - Chargebee site name (e.g., \"acme-test\")\n * @param options.apiKey - Chargebee API key\n * @param options.cache - Cache type (\"memory\" or \"none\", default: \"memory\")\n * @returns Code generator instance\n *\n * @example Basic Setup\n * ```typescript\n * const generator = createCodeGenerator({\n * apiVersion: 'v2',\n * pcVersion: 'v2',\n * site: 'acme-test',\n * apiKey: 'test_key',\n * cache: 'memory'\n * });\n * ```\n *\n * @example Generate Code Dynamically\n * ```typescript\n * const result = await generator.generate({\n * language: 'curl',\n * operation: 'create_a_customer',\n * request: { params: { first_name: 'John' } }\n * });\n * console.log(result.code);\n * ```\n *\n * @example React Component Usage\n * ```typescript\n * function CodePlayground({ operation, params }) {\n * const [code, setCode] = useState('');\n * const generator = useMemo(() => createCodeGenerator({\n * apiVersion: 'v2',\n * pcVersion: 'v2',\n * site: 'acme-test',\n * apiKey: 'test_key'\n * }), []);\n *\n * useEffect(() => {\n * generator.generate({ language: 'curl', operation, request: { params } })\n * .then(result => setCode(result.code));\n * }, [operation, params]);\n *\n * return <pre>{code}</pre>;\n * }\n * ```\n *\n * @example Prefetch Common Operations\n * ```typescript\n * const generator = createCodeGenerator({\n * apiVersion: 'v2',\n * pcVersion: 'v2',\n * site: 'acme-test',\n * apiKey: 'test_key'\n * });\n * await generator.prefetch('create_a_customer');\n * await generator.prefetch('list_customers');\n * ```\n */\nexport function createCodeGenerator(\n options: CodeGeneratorOptions,\n): CodeGenerator {\n const {\n apiVersion,\n pcVersion,\n site,\n apiKey,\n cache = \"memory\",\n openapi,\n descriptors,\n } = options;\n\n // Memory cache for operation descriptors\n const operationCache = new Map<string, unknown>();\n\n const config: GeneratorConfig = {\n apiVersion,\n pcVersion,\n site,\n apiKey,\n openapi,\n };\n\n return {\n async generate(generateOptions) {\n const {\n language,\n operationId,\n operation: operationParam,\n requestSample,\n request: requestParam,\n site: overrideSite,\n apiKey: overrideApiKey,\n descriptor: overrideDescriptor,\n } = generateOptions;\n\n // Support both old and new parameter names (backward compatibility)\n const operation = operationParam ?? operationId;\n const request = requestParam ?? requestSample;\n\n // Emit deprecation warnings for old parameter names\n if (operationId !== undefined) {\n // eslint-disable-next-line no-console\n console.warn(\n \"[@chargebee/code-sample-generator] The 'operationId' parameter is deprecated. Use 'operation' instead.\",\n );\n }\n if (requestSample !== undefined) {\n // eslint-disable-next-line no-console\n console.warn(\n \"[@chargebee/code-sample-generator] The 'requestSample' parameter is deprecated. Use 'request' instead.\",\n );\n }\n\n if (!operation) {\n throw new Error(\n \"Operation is required. Provide either 'operation' or 'operationId' parameter.\",\n );\n }\n\n // Optional: Validate operation ID at runtime (can be disabled for performance)\n // Uncomment if you want strict validation:\n // if (!validateOperationId(operation)) {\n // throw new Error(`Invalid operation ID: ${operation}`);\n // }\n\n if (!request) {\n throw new Error(\n \"Request is required. Provide either 'request' or 'requestSample' parameter.\",\n );\n }\n\n // Normalize request to SampleRequest format\n // Handle different request formats: SampleRequest, array, or simple object\n let sample: SampleRequest;\n\n if (Array.isArray(request)) {\n // If array, use first element\n sample = request[0];\n } else if (\"uri\" in request) {\n // Already a SampleRequest (has uri property)\n sample = request;\n } else {\n // Simple object format { params?, body? }\n // Note: SampleRequest uses 'payload' not 'body', but we accept 'body' for convenience\n const simpleRequest = request as {\n params?: Record<string, unknown>;\n body?: Record<string, unknown>;\n };\n sample = {\n uri: simpleRequest.params\n ? Object.keys(simpleRequest.params)\n .map((key) => `{${key}}`)\n .join(\"/\")\n : \"/\",\n method: \"POST\", // Default, will be determined from operation\n params: simpleRequest.params || {},\n ...(simpleRequest.body && { payload: simpleRequest.body }),\n };\n }\n\n // Custom field type hints (cf_* dynamic fields) — used by typed SDKs to\n // pick the correct filter API. Present only on the simple object format.\n const customFieldMeta =\n !Array.isArray(request) && !(\"uri\" in request)\n ? (\n request as {\n customFieldMeta?: Record<string, string>;\n }\n ).customFieldMeta\n : undefined;\n\n const descriptor = overrideDescriptor ?? descriptors?.[operation];\n\n // Use override site/apiKey if provided, otherwise use config defaults\n const finalConfig: GeneratorConfig = {\n ...config,\n ...(overrideSite && { site: overrideSite }),\n ...(overrideApiKey && { apiKey: overrideApiKey }),\n operation: operation,\n ...(customFieldMeta && { customFieldMeta }),\n ...(descriptor && { descriptor }),\n };\n\n const code = await generateFromSample(sample, finalConfig, language);\n\n return { code };\n },\n\n async prefetch(operation: OperationId | string) {\n // Try to load the operation to warm up the cache\n try {\n // Convert apiVersion + pcVersion to combined version format\n const combinedVersion: ApiVersion =\n apiVersion === \"v1\"\n ? \"v1\"\n : pcVersion === \"v1\"\n ? \"v2-pcv1\"\n : \"v2-pcv2\";\n\n const operationDescriptor = resolveDescriptor(\n combinedVersion,\n operation,\n config.openapi,\n descriptors?.[operation],\n );\n if (cache === \"memory\" && operationDescriptor) {\n operationCache.set(operation, operationDescriptor);\n }\n } catch (error) {\n // Silently fail - prefetch is optional\n // eslint-disable-next-line no-console\n console.warn(`Failed to prefetch operation ${operation}:`, error);\n }\n },\n\n clearCache() {\n operationCache.clear();\n },\n };\n}\n"],"names":[],"mappings":";;;AAkHO,SAAS,oBACd,IACA,SACmB;AACnB,MAAI,SAAS;AACX,UAAM,MAAM,0BAA0B,OAAO;AAC7C,WAAO,IAAI,SAAS,EAAiB;AAAA,EACvC;AAGA,QAAM,SAAS;AAAA,IACb,GAAG,gBAAgB,IAAI;AAAA,IACvB,GAAG,gBAAgB,SAAS;AAAA,IAC5B,GAAG,gBAAgB,SAAS;AAAA,EAAA;AAE9B,SAAO,OAAO,SAAS,EAAiB;AAC1C;AA0MO,SAAS,oBACd,SACe;AACf,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,EAAA,IACE;AAGJ,QAAM,qCAAqB,IAAA;AAE3B,QAAM,SAA0B;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGF,SAAO;AAAA,IACL,MAAM,SAAS,iBAAiB;AAC9B,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA,WAAW;AAAA,QACX;AAAA,QACA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AAM,OAAO,MAAM,mBAAmB,QAAQ,aAAa,QAAQ;AAEnE,aAAO,EAAE,KAAA;AAAA,IACX;AAAA,IAEA,MAAM,SAAS,WAAiC;AAE9C,UAAI;AAEF,cAAM,kBACJ,eAAe,OACX,OACA,cAAc,OACZ,YACA;AAER,cAAM,sBAAsB;AAAA,UAC1B;AAAA,UACA;AAAA,UACA,OAAO;AAAA,UACP,cAAc,SAAS;AAAA,QAAA;AAEzB,YAAI,UAAU,YAAY,qBAAqB;AAC7C,yBAAe,IAAI,WAAW,mBAAmB;AAAA,QACnD;AAAA,MACF,SAAS,OAAO;AAGd,gBAAQ,KAAK,gCAAgC,SAAS,KAAK,KAAK;AAAA,MAClE;AAAA,IACF;AAAA,IAEA,aAAa;AACX,qBAAe,MAAA;AAAA,IACjB;AAAA,EAAA;AAEJ;"}
|
|
@@ -1230,6 +1230,25 @@
|
|
|
1230
1230
|
overflow-y: auto; /* Scroll code block if it exceeds remaining height */
|
|
1231
1231
|
min-height: 0; /* Allow flex item to shrink below content size */
|
|
1232
1232
|
}
|
|
1233
|
+
/* ============================================================================
|
|
1234
|
+
CONTENT-FIT REQUEST BODY (operation-page Sample Request)
|
|
1235
|
+
----------------------------------------------------------------------------
|
|
1236
|
+
Unlike .code-samples-body (fixed 800px cap + flex-fill, which stretches short
|
|
1237
|
+
snippets and clips long ones), this sizes to its content. Each code block
|
|
1238
|
+
manages its own collapse via CollapsibleCodeBlock: natural height up to a cap,
|
|
1239
|
+
then an internal scrollbar plus a "See more / See less" toggle.
|
|
1240
|
+
============================================================================ */
|
|
1241
|
+
.code-samples-scroll-body {
|
|
1242
|
+
margin: 0;
|
|
1243
|
+
background-color: var(--code-samples-chrome-bg);
|
|
1244
|
+
display: block;
|
|
1245
|
+
}
|
|
1246
|
+
/* Single-mode description banner stays pinned above the scrolling code */
|
|
1247
|
+
.code-samples-scroll-body > .sample-description {
|
|
1248
|
+
position: sticky;
|
|
1249
|
+
top: 0;
|
|
1250
|
+
z-index: 10;
|
|
1251
|
+
}
|
|
1233
1252
|
/* ============================================================================
|
|
1234
1253
|
CAROUSEL CONTAINER - Flex layout for proper height distribution
|
|
1235
1254
|
============================================================================ */
|
|
@@ -1368,6 +1387,32 @@
|
|
|
1368
1387
|
margin: 0;
|
|
1369
1388
|
display: block;
|
|
1370
1389
|
}
|
|
1390
|
+
/* ============================================================================
|
|
1391
|
+
HEIGHT-ADAPTIVE CAROUSEL (opt-in via heightAdapt prop)
|
|
1392
|
+
----------------------------------------------------------------------------
|
|
1393
|
+
The viewport height is measured from the active slide in JS and applied
|
|
1394
|
+
inline to .carousel-content-wrapper, so short slides no longer stretch to the
|
|
1395
|
+
tallest slide (removes dead space). Slides render at their natural height and
|
|
1396
|
+
the viewport animates between them / as a slide is expanded.
|
|
1397
|
+
============================================================================ */
|
|
1398
|
+
.carousel-container--fit {
|
|
1399
|
+
height: auto;
|
|
1400
|
+
flex: none;
|
|
1401
|
+
}
|
|
1402
|
+
.carousel-container--fit .carousel-content-wrapper {
|
|
1403
|
+
flex: none;
|
|
1404
|
+
/* Clip taller inactive slides; height is set inline from the active slide. */
|
|
1405
|
+
overflow: hidden;
|
|
1406
|
+
transition: height 0.3s ease-in-out;
|
|
1407
|
+
}
|
|
1408
|
+
.carousel-container--fit .carousel-content-slider {
|
|
1409
|
+
align-items: flex-start; /* natural per-slide height, no stretch */
|
|
1410
|
+
flex: none;
|
|
1411
|
+
}
|
|
1412
|
+
.carousel-container--fit .carousel-content-item,
|
|
1413
|
+
.carousel-container--fit .carousel-content-item > div {
|
|
1414
|
+
flex: none; /* size to content instead of filling */
|
|
1415
|
+
}
|
|
1371
1416
|
/* ============================================================================
|
|
1372
1417
|
SAMPLE DESCRIPTION BANNER
|
|
1373
1418
|
============================================================================ */
|
|
@@ -8,10 +8,18 @@ export interface CarouselProps {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
showDots?: boolean;
|
|
10
10
|
onIndexChange?: (index: number) => void;
|
|
11
|
+
/**
|
|
12
|
+
* When true, the carousel viewport sizes itself to the *active* slide's
|
|
13
|
+
* measured height instead of stretching every slide to the tallest one.
|
|
14
|
+
* This removes the dead space that short slides otherwise leave behind, and
|
|
15
|
+
* lets the viewport grow/shrink as a slide's collapsible code block is
|
|
16
|
+
* expanded or collapsed.
|
|
17
|
+
*/
|
|
18
|
+
heightAdapt?: boolean;
|
|
11
19
|
}
|
|
12
20
|
/**
|
|
13
21
|
* Carousel Component
|
|
14
22
|
* Simple carousel matching exact production style
|
|
15
23
|
*/
|
|
16
|
-
export declare function Carousel({ items, className, showDots, onIndexChange, }: CarouselProps): import("react/jsx-runtime").JSX.Element | null;
|
|
24
|
+
export declare function Carousel({ items, className, showDots, onIndexChange, heightAdapt, }: CarouselProps): import("react/jsx-runtime").JSX.Element | null;
|
|
17
25
|
//# sourceMappingURL=Carousel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../src/components/Carousel.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../src/components/Carousel.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,SAAc,EACd,QAAe,EACf,aAAa,EACb,WAAmB,GACpB,EAAE,aAAa,kDA6If"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeSamples.d.ts","sourceRoot":"","sources":["../../src/components/CodeSamples.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAMH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"CodeSamples.d.ts","sourceRoot":"","sources":["../../src/components/CodeSamples.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAMH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AA2Q1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,WAAW,CAAC,EAC1B,UAAU,EACV,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,eAAwB,EACxB,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,iBAAiB,EAChC,WAAW,EACX,QAAa,EACb,SAAc,EACd,KAAK,EACL,gBAAgB,EAChB,MAAM,EAAE,OAAO,EAAE,8DAA8D;AAC/E,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,aAAa,GACd,EAAE,yBAAyB,2CA0f3B"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operation Descriptor Extraction
|
|
3
|
+
*
|
|
4
|
+
* Derives {@link MinimalOperationDescriptor}s from an OpenAPI document.
|
|
5
|
+
*
|
|
6
|
+
* This is the single source of truth for descriptor extraction. It is used by:
|
|
7
|
+
* - `scripts/generate-operation-types.ts` at build time, to emit operation ID /
|
|
8
|
+
* params TypeScript types (not descriptors)
|
|
9
|
+
* - `core/spec-context.ts` at runtime, so callers that hold an OpenAPI document
|
|
10
|
+
* (docs site, CLI, API explorer) get descriptors from that document — no
|
|
11
|
+
* package rebuild required
|
|
12
|
+
* - Host apps that extract descriptors at their own build time and pass them
|
|
13
|
+
* via `GeneratorConfig.descriptor`
|
|
14
|
+
*
|
|
15
|
+
* Must stay browser-safe: no `node:*` imports, no filesystem access. Extension
|
|
16
|
+
* constants are imported from the pure `openapi-extensions` subpath rather than
|
|
17
|
+
* the `@cb-docs-platform/openapi-utils` barrel, which pulls in Node built-ins.
|
|
18
|
+
*/
|
|
19
|
+
import type { MinimalOperationDescriptor } from "./minimal-types";
|
|
20
|
+
interface ResourceSchema {
|
|
21
|
+
"x-cb-resource-id"?: string;
|
|
22
|
+
"x-cb-is-third-party-resource"?: boolean;
|
|
23
|
+
"x-cb-hidden-from-client-sdk"?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface OpenAPISpec {
|
|
26
|
+
openapi?: string;
|
|
27
|
+
paths: Record<string, PathItem>;
|
|
28
|
+
components?: {
|
|
29
|
+
schemas?: Record<string, ResourceSchema>;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
interface PathItem {
|
|
33
|
+
get?: Operation;
|
|
34
|
+
post?: Operation;
|
|
35
|
+
put?: Operation;
|
|
36
|
+
delete?: Operation;
|
|
37
|
+
patch?: Operation;
|
|
38
|
+
}
|
|
39
|
+
interface Operation {
|
|
40
|
+
operationId?: string;
|
|
41
|
+
summary?: string;
|
|
42
|
+
"x-cb-resource-id"?: string;
|
|
43
|
+
"x-cb-operation-method-name"?: string;
|
|
44
|
+
"x-cb-sdk-method-name"?: string;
|
|
45
|
+
"x-cb-operation-is-list"?: boolean;
|
|
46
|
+
"x-cb-is-operation-needs-json-input"?: boolean;
|
|
47
|
+
"x-cb-operation-is-batch"?: boolean;
|
|
48
|
+
"x-cb-idempotency-supported"?: boolean;
|
|
49
|
+
"x-cb-operation-is-idempotent"?: boolean;
|
|
50
|
+
"x-cb-restricted"?: boolean;
|
|
51
|
+
"x-cb-hidden-from-client-sdk"?: boolean;
|
|
52
|
+
"x-cb-internal"?: boolean;
|
|
53
|
+
"x-cb-operation-is-bulk"?: boolean;
|
|
54
|
+
requestBody?: RequestBody;
|
|
55
|
+
parameters?: Parameter[];
|
|
56
|
+
responses?: Record<string, Response>;
|
|
57
|
+
}
|
|
58
|
+
interface RequestBody {
|
|
59
|
+
content?: {
|
|
60
|
+
"application/x-www-form-urlencoded"?: {
|
|
61
|
+
schema?: Schema;
|
|
62
|
+
};
|
|
63
|
+
"application/json"?: {
|
|
64
|
+
schema?: Schema;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
interface Parameter {
|
|
69
|
+
name: string;
|
|
70
|
+
in: "query" | "path" | "header";
|
|
71
|
+
required?: boolean;
|
|
72
|
+
schema?: Schema;
|
|
73
|
+
}
|
|
74
|
+
interface Response {
|
|
75
|
+
content?: {
|
|
76
|
+
"application/json"?: {
|
|
77
|
+
schema?: Schema;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
interface Schema {
|
|
82
|
+
type?: string;
|
|
83
|
+
format?: string;
|
|
84
|
+
enum?: string[];
|
|
85
|
+
items?: Schema;
|
|
86
|
+
properties?: Record<string, Schema>;
|
|
87
|
+
required?: string[];
|
|
88
|
+
additionalProperties?: boolean;
|
|
89
|
+
$ref?: string;
|
|
90
|
+
"x-cb-is-filter-parameter"?: boolean;
|
|
91
|
+
"x-cb-sdk-filter-name"?: string;
|
|
92
|
+
"x-cb-is-global-enum"?: boolean;
|
|
93
|
+
"x-cb-global-enum-reference"?: string;
|
|
94
|
+
"x-cb-is-gen-separate"?: boolean;
|
|
95
|
+
"x-cb-is-external-enum"?: boolean;
|
|
96
|
+
"x-cb-sdk-enum-api-name"?: string;
|
|
97
|
+
"x-cb-is-money-column"?: boolean;
|
|
98
|
+
"x-cb-is-sub-resource"?: boolean;
|
|
99
|
+
"x-cb-meta-model-name"?: string;
|
|
100
|
+
"x-cb-hidden-from-client-sdk"?: boolean;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Reason an operation was left out of the descriptor set. Kept as a union so
|
|
104
|
+
* build-ops can report a per-reason breakdown.
|
|
105
|
+
*/
|
|
106
|
+
export type SkipReason = "hidden_operation" | "internal_operation" | "bulk_operation" | "hidden_resource" | "missing_metadata";
|
|
107
|
+
export interface ExtractionStats {
|
|
108
|
+
totalPaths: number;
|
|
109
|
+
totalOperations: number;
|
|
110
|
+
skippedOperations: number;
|
|
111
|
+
skippedReasons: Partial<Record<SkipReason, number>>;
|
|
112
|
+
}
|
|
113
|
+
export interface ExtractionResult {
|
|
114
|
+
descriptors: MinimalOperationDescriptor[];
|
|
115
|
+
stats: ExtractionStats;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Extracts a descriptor for every SDK-visible operation in the document.
|
|
119
|
+
*
|
|
120
|
+
* Operations hidden from client SDKs, internal operations, bulk operations,
|
|
121
|
+
* operations on hidden resources, and operations missing the metadata code
|
|
122
|
+
* generation needs are all skipped — the same rules the SDK generators apply.
|
|
123
|
+
*/
|
|
124
|
+
export declare function extractDescriptors(spec: OpenAPISpec): ExtractionResult;
|
|
125
|
+
export {};
|
|
126
|
+
//# sourceMappingURL=descriptor-extraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-extraction.d.ts","sourceRoot":"","sources":["../../src/core/descriptor-extraction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EAEV,0BAA0B,EAI3B,MAAM,iBAAiB,CAAC;AAMzB,UAAU,cAAc;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,C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gB,GAChB,iBAAiB,GACjB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,0BAA0B,EAAE,CAAC;IAC1C,KAAK,EAAE,eAAe,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,gBAAgB,CAuEtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expander.d.ts","sourceRoot":"","sources":["../../src/core/expander.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEV,0BAA0B,EAI3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAEV,mBAAmB,EAGpB,MAAM,SAAS,CAAC;AAsDjB;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,0BAA0B,GAClC,mBAAmB,CA0BrB;
|
|
1
|
+
{"version":3,"file":"expander.d.ts","sourceRoot":"","sources":["../../src/core/expander.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEV,0BAA0B,EAI3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAEV,mBAAmB,EAGpB,MAAM,SAAS,CAAC;AAsDjB;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,0BAA0B,GAClC,mBAAmB,CA0BrB;AA0ID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,mBAAmB,GACxB,0BAA0B,CA4C5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ir-builder.d.ts","sourceRo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EAAE,MAAM,CAAC,CAAC;CAC1C;AAcD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CACrB,SAAS,EAAE,mBAAmB,EAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,GAAE,SAAc,GACtB,EAAE,CA4EJ;AAklBD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,CAoCvE"}
|
|
@@ -50,6 +50,35 @@ export interface MinimalParamInfo {
|
|
|
50
50
|
r?: true;
|
|
51
51
|
/** Is sub-resource (only present if true) */
|
|
52
52
|
s?: true;
|
|
53
|
+
/**
|
|
54
|
+
* Top-level-resource enum (only present if true). Set when some resource declares
|
|
55
|
+
* this array-sub-object enum's attribute. Go v4 and .NET use it to keep the enum on
|
|
56
|
+
* its own class (`FilterCondition.Field`). Java v3 / Go v3 / Python v3 also look at
|
|
57
|
+
* `opsr` / `grr` / `dep` / `x` to decide nesting.
|
|
58
|
+
*/
|
|
59
|
+
tlr?: true;
|
|
60
|
+
/**
|
|
61
|
+
* Operation sub-resource (only present if true). The operation resource declares the
|
|
62
|
+
* enum's container with `x-cb-is-sub-resource` (e.g. `alert.filter_conditions`).
|
|
63
|
+
*/
|
|
64
|
+
opsr?: true;
|
|
65
|
+
/**
|
|
66
|
+
* Global resource reference (only present if true). The container has
|
|
67
|
+
* `x-cb-is-global-resource-reference` (e.g. `metered_feature.column_definitions`).
|
|
68
|
+
*/
|
|
69
|
+
grr?: true;
|
|
70
|
+
/**
|
|
71
|
+
* Dependent attribute (only present if true). The container has
|
|
72
|
+
* `x-cb-is-dependent-attribute`.
|
|
73
|
+
*/
|
|
74
|
+
dep?: true;
|
|
75
|
+
/**
|
|
76
|
+
* Resource-owned enum (only present if true) — the single-object form of `tlr`
|
|
77
|
+
* (e.g. `contract_term` in `import_contract_term`). Only Go v4 uses it, writing
|
|
78
|
+
* the enum with the owning resource's type (`ContractTermActionAtTermEnd`);
|
|
79
|
+
* other generators nest it under the operation and ignore this flag.
|
|
80
|
+
*/
|
|
81
|
+
ro?: true;
|
|
53
82
|
/** Format from OpenAPI (e.g. "unix-time" for timestamp operator schemas) */
|
|
54
83
|
fm?: string;
|
|
55
84
|
/** Meta model name — owning resource in plural snake_case (e.g. "credit_notes") */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minimal-types.d.ts","sourceRoot":"","sources":["../../src/core/minimal-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB,KAAK,GACL,KAAK,GACL,MAAM,GACN,KAAK,GACL,MAAM,GACN,KAAK,GACL,KAAK,CAAC;AAEV;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAC;AAMR;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2BAA2B;IAC3B,CAAC,EAAE,WAAW,CAAC;IAEf,uBAAuB;IACvB,CAAC,CAAC,EAAE,UAAU,CAAC;IAEf,0DAA0D;IAC1D,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,kBAAkB;IAClB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;IAEb,4CAA4C;IAC5C,CAAC,CAAC,EAAE,IAAI,CAAC;IAET,8CAA8C;IAC9C,CAAC,CAAC,EAAE,IAAI,CAAC;IAET,kDAAkD;IAClD,CAAC,CAAC,EAAE,MAAM,CAAC;IAEX,6CAA6C;IAC7C,CAAC,CAAC,EAAE,IAAI,CAAC;IAET,yCAAyC;IACzC,CAAC,CAAC,EAAE,IAAI,CAAC;IAET,6CAA6C;IAC7C,CAAC,CAAC,EAAE,IAAI,CAAC;IAET,4EAA4E;IAC5E,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,mFAAmF;IACnF,EAAE,CAAC,EAAE,MAAM,CA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IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAE1C,kCAAkC;IAClC,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,CAAC,EAAE,MAAM,CAAC;IAEV,qBAAqB;IACrB,CAAC,EAAE,MAAM,CAAC;IAEV,sCAAsC;IACtC,CAAC,CAAC,EAAE,IAAI,CAAC;IAET,8CAA8C;IAC9C,CAAC,CAAC,EAAE,IAAI,CAAC;CACV"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-spec descriptor cache.
|
|
3
|
+
*
|
|
4
|
+
* Extracting descriptors walks every path and every schema in the document, so
|
|
5
|
+
* it runs once per OpenAPI object and the result is reused for all subsequent
|
|
6
|
+
* lookups. Keyed by object identity in a `WeakMap`: callers (the docs loader,
|
|
7
|
+
* the CLI, the API explorer) hold one cached spec object per API version, and
|
|
8
|
+
* the entry is released when they drop it.
|
|
9
|
+
*/
|
|
10
|
+
import type { OpenAPISpec } from "./descriptor-extraction";
|
|
11
|
+
import type { MinimalOperationDescriptor } from "./minimal-types";
|
|
12
|
+
/**
|
|
13
|
+
* Returns every descriptor in the document, indexed by operation ID.
|
|
14
|
+
* The first call for a given spec object pays the extraction cost.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getSpecDescriptors(spec: OpenAPISpec): Map<string, MinimalOperationDescriptor>;
|
|
17
|
+
//# sourceMappingURL=spec-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-context.d.ts","sourceRoot":"","sources":["../../src/core/spec-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAOlE;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,WAAW,GAChB,GAAG,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAUzC"}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -57,6 +57,33 @@ export interface ParamSchema {
|
|
|
57
57
|
isMoneyColumn?: boolean;
|
|
58
58
|
/** Whether this is a sub-resource (x-cb-is-sub-resource) */
|
|
59
59
|
isSubResource?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* From IR `tlr`: true when some resource declares this array-sub-object enum's
|
|
62
|
+
* attribute. Go v4 and .NET use this to keep the enum on its own class. Java v3 /
|
|
63
|
+
* Go v3 / Python v3 also use `isOperationSubResource` /
|
|
64
|
+
* `isGlobalResourceReference` / `isDependentAttribute` / `isExternalEnum`.
|
|
65
|
+
*/
|
|
66
|
+
isTopLevelResourceEnum?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* From IR `opsr`: the operation resource declares the enum's container with
|
|
69
|
+
* `x-cb-is-sub-resource` (e.g. `alert.filter_conditions`).
|
|
70
|
+
*/
|
|
71
|
+
isOperationSubResource?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* From IR `grr`: the container has `x-cb-is-global-resource-reference`
|
|
74
|
+
* (e.g. `metered_feature.column_definitions`).
|
|
75
|
+
*/
|
|
76
|
+
isGlobalResourceReference?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* From IR `dep`: the container has `x-cb-is-dependent-attribute`.
|
|
79
|
+
*/
|
|
80
|
+
isDependentAttribute?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* From IR `ro`: the single-object form of `isTopLevelResourceEnum` (e.g.
|
|
83
|
+
* `contract_term` in `import_contract_term`). Only Go v4 uses it, writing the
|
|
84
|
+
* enum with the owning resource's type (`ContractTermActionAtTermEnd`).
|
|
85
|
+
*/
|
|
86
|
+
isResourceOwnedEnum?: boolean;
|
|
60
87
|
/** Owning resource name in plural snake_case (x-cb-meta-model-name), e.g., "credit_notes" */
|
|
61
88
|
metaModelName?: string;
|
|
62
89
|
}
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,SAAS,GACT,SAAS,GACT,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,CAAC;AAEb,eAAO,MAAM,SAAS,EAAE,QAAQ,EAc/B,CAAC;AAMF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AACrC,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAAC;AAM9D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,WAAW;IAE1B,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IACvE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC5E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAI/B,oEAAoE;IACpE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CA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