@portone/mcp-server 0.13.0 → 0.15.0-alpha.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/README.md +62 -47
- package/assets/docs/_components/ko/docs-for-llms.md +21 -0
- package/assets/docs/_components/ko/llms-txt-support.md +15 -0
- package/assets/docs/_components/ko/using-mcp-server.md +60 -0
- package/assets/docs/api/rest-v1/_components/v1auth.md +103 -0
- package/assets/docs/help/admin-console/analytics/content32.md +4 -4
- package/assets/docs/help/admin-console/payment-service/content29.md +223 -110
- package/assets/docs/help/admin-console/pg-settlement/content30.md +103 -208
- package/assets/docs/help/admin-console/pg-settlement-history/content35.md +167 -0
- package/assets/docs/help/admin-console/platform-settlement/partner_settlement_service_guide.md +268 -0
- package/assets/docs/help/api-sdk-2025-05-14.md +71 -0
- package/assets/docs/help/applepay.md +1 -1
- package/assets/docs/help/content100002.md +1 -1
- package/assets/docs/help/content100029.md +1 -1
- package/assets/docs/help/content100060.md +2 -2
- package/assets/docs/help/content200015.md +1 -1
- package/assets/docs/help/content200019.md +1 -1
- package/assets/docs/help/content200023.md +2 -2
- package/assets/docs/help/content200050.md +1 -1
- package/assets/docs/help/core-service/channel-setting/danal.md +6 -8
- package/assets/docs/help/core-service/channel-setting/eximbay.md +9 -3
- package/assets/docs/help/core-service/channel-setting/kcp_channel.md +80 -13
- package/assets/docs/help/core-service/channel-setting/naverpay.md +6 -8
- package/assets/docs/help/core-service/channel-setting/nice.md +49 -47
- package/assets/docs/help/core-service/channel-setting/payletter.md +91 -0
- package/assets/docs/help/core-service/channel-setting/paymentwall.md +4 -1
- package/assets/docs/help/core-service/how-to-use/additional-nice.md +19 -19
- package/assets/docs/help/core-service/how-to-use/cancel-reversal.md +2 -2
- package/assets/docs/help/core-service/how-to-use/content200009.md +2 -2
- package/assets/docs/help/core-service/how-to-use/danal-contract.md +2 -2
- package/assets/docs/help/core-service/how-to-use/daou-contract.md +2 -2
- package/assets/docs/help/core-service/how-to-use/high-risk-industry.md +9 -9
- package/assets/docs/help/core-service/how-to-use/identity-verification-age-restriction.md +29 -0
- package/assets/docs/help/core-service/how-to-use/information-pg.md +4 -4
- package/assets/docs/help/core-service/how-to-use/ksnet-contract.md +1 -1
- package/assets/docs/help/core-service/how-to-use/nice-contract.md +15 -15
- package/assets/docs/help/core-service/how-to-use/open-immediately.md +1 -1
- package/assets/docs/help/core-service/how-to-use/point-service.md +7 -7
- package/assets/docs/help/core-service/how-to-use/settle-contract.md +2 -2
- package/assets/docs/help/core-service/how-to-use/shopify-available-list.md +4 -4
- package/assets/docs/help/core-service/how-to-use/test-mode-cancel.md +3 -3
- package/assets/docs/help/core-service/how-to-use/tosspayments-contract.md +4 -4
- package/assets/docs/help/core-service/payment-type/content200007.md +8 -7
- package/assets/docs/help/core-service/payment-type/content200036.md +17 -18
- package/assets/docs/help/core-service/payment-type/content200042.md +3 -3
- package/assets/docs/help/core-service/payment-type/content200052.md +2 -2
- package/assets/docs/help/core-service/payment-type/content200053.md +7 -3
- package/assets/docs/help/core-service/payment-type/hub-service-fee.md +19 -17
- package/assets/docs/help/core-service/payment-type/inicis-easypay-hub-fee.md +5 -6
- package/assets/docs/help/core-service/payment-type/inicis-international.md +10 -10
- package/assets/docs/help/core-service/payment-type/internationl-pg.md +7 -3
- package/assets/docs/help/core-service/payment-type/kcp-easypay-hub-apply.md +4 -5
- package/assets/docs/help/core-service/payment-type/kcp-international.md +2 -3
- package/assets/docs/help/core-service/payment-type/nice-easypay-hub-fee.md +8 -8
- package/assets/docs/help/core-service/payment-type/nice-international.md +14 -14
- package/assets/docs/help/core-service/payment-type/payletter-international.md +104 -0
- package/assets/docs/help/core-service/payment-type/schedule-requirement.md +2 -2
- package/assets/docs/help/core-service/payment-type/tosspayments-easypay-hub-fee.md +6 -6
- package/assets/docs/help/faq/general-inquiry/confirm-process.md +16 -16
- package/assets/docs/help/faq/general-inquiry/identity-verification-suspended-ip.md +35 -0
- package/assets/docs/help/faq/general-inquiry/kcp-business-number-error.md +29 -0
- package/assets/docs/help/faq/general-inquiry/platform-contract-method.md +4 -5
- package/assets/docs/help/faq/general-inquiry/platform-contract-pg.md +2 -2
- package/assets/docs/help/faq/general-inquiry/real-channel-info.md +1 -1
- package/assets/docs/help/faq/payment-faq/cash-receipt-guide.md +2 -2
- package/assets/docs/help/faq/payment-faq/kcp-cash-receipt.md +34 -0
- package/assets/docs/help/faq/payment-faq/payment-failure-danal-insufficient-funds.md +29 -0
- package/assets/docs/help/faq/payment-faq/payment-failure-kcp-insufficient-funds.md +35 -0
- package/assets/docs/help/faq/payment-faq/payment-failure-kiwoompay-insufficient-funds.md +25 -0
- package/assets/docs/help/faq/payment-faq/payment-failure-nice-insufficient-funds.md +28 -0
- package/assets/docs/help/faq/payment-faq/pg-max-min-amount.md +3 -3
- package/assets/docs/help/faq/payment-faq/vbank-service-detail.md +10 -10
- package/assets/docs/help/faq/payment-faq/wordpress-woocommerce-taxation.md +67 -0
- package/assets/docs/help/faq/platform-faq/platform_additional_fee_setting.md +28 -0
- package/assets/docs/help/faq/platform-faq/platform_api_docs.md +24 -0
- package/assets/docs/help/faq/platform-faq/platform_definition_partner.md +34 -0
- package/assets/docs/help/faq/platform-faq/platform_definition_payout_agency.md +23 -0
- package/assets/docs/help/faq/platform-faq/platform_definition_platform.md +17 -0
- package/assets/docs/help/faq/platform-faq/platform_definition_settlement.md +29 -0
- package/assets/docs/help/faq/platform-faq/platform_difference_settlement_payout.md +29 -0
- package/assets/docs/help/faq/platform-faq/platform_ecommerce_discount_policy.md +19 -0
- package/assets/docs/help/faq/platform-faq/platform_introduction.md +15 -0
- package/assets/docs/help/faq/platform-faq/platform_introduction_conditions.md +16 -0
- package/assets/docs/help/faq/platform-faq/platform_nocode_guide.md +5 -5
- package/assets/docs/help/faq/platform-faq/platform_nocode_hosting.md +20 -0
- package/assets/docs/help/faq/platform-faq/platform_nocode_use.md +28 -0
- package/assets/docs/help/faq/platform-faq/platform_partner_bulk_registration.md +31 -0
- package/assets/docs/help/faq/platform-faq/platform_partner_info_guide.md +49 -0
- package/assets/docs/help/faq/platform-faq/platform_partner_management_tags.md +14 -0
- package/assets/docs/help/faq/platform-faq/platform_partner_tax_type.md +18 -0
- package/assets/docs/help/faq/platform-faq/platform_partnerships.md +16 -0
- package/assets/docs/help/faq/platform-faq/platform_payment_formula_setting.md +20 -0
- package/assets/docs/help/faq/platform-faq/platform_paymentdetails_definition.md +11 -0
- package/assets/docs/help/faq/platform-faq/platform_paymentdetails_view_features.md +18 -0
- package/assets/docs/help/faq/platform-faq/platform_payoutagency_realtime_payment.md +22 -0
- package/assets/docs/help/faq/platform-faq/platform_payoutagency_safety_legality.md +22 -0
- package/assets/docs/help/faq/platform-faq/platform_payoutagency_scheduled_payment.md +18 -0
- package/assets/docs/help/faq/platform-faq/platform_pg_fee_handling.md +18 -0
- package/assets/docs/help/faq/platform-faq/platform_policymanagement_calculator.md +1 -1
- package/assets/docs/help/faq/platform-faq/platform_privacypolicy_creation_guide.md +24 -0
- package/assets/docs/help/faq/platform-faq/platform_privacypolicy_definition.md +19 -0
- package/assets/docs/help/faq/platform-faq/platform_privacypolicy_service_compliance.md +28 -0
- package/assets/docs/help/faq/platform-faq/platform_settlement_auto_calculation_setting.md +39 -0
- package/assets/docs/help/faq/platform-faq/platform_settlement_cancellation_data.md +21 -0
- package/assets/docs/help/faq/platform-faq/platform_settlement_custom_attributes.md +18 -0
- package/assets/docs/help/faq/platform-faq/platform_settlement_custom_formula_request.md +20 -0
- package/assets/docs/help/faq/platform-faq/platform_settlement_cycle_setting.md +42 -0
- package/assets/docs/help/faq/platform-faq/platform_settlement_decimal_rounding.md +23 -0
- package/assets/docs/help/faq/platform-faq/platform_settlement_hold_date_setting.md +35 -0
- package/assets/docs/help/faq/platform-faq/platform_settlement_holidays.md +9 -0
- package/assets/docs/help/faq/platform-faq/platform_settlement_manual_registration.md +32 -0
- package/assets/docs/help/faq/platform-faq/platform_settlementdetails_view_features.md +26 -0
- package/assets/docs/help/faq/platform-faq/platform_settlmentandpayout_guide.md +4 -4
- package/assets/docs/help/faq/platform-faq/platform_supported_bank_codes.md +85 -0
- package/assets/docs/help/faq/platform-faq/platform_supported_currencies.md +33 -0
- package/assets/docs/help/faq/platform-faq/platform_tax_calculation.md +17 -0
- package/assets/docs/help/faq/platform-faq/platform_tax_setting_guide.md +1 -1
- package/assets/docs/help/faq/platform-faq/platform_tax_withholding_tax_definition.md +14 -0
- package/assets/docs/help/faq/platform-faq/platform_virtual_account_withdrawal.md +16 -0
- package/assets/docs/help/faq/platform-faq/platform_webhook_definition.md +24 -0
- package/assets/docs/help/faq/platform-faq/recommended_withdrawal.md +16 -0
- package/assets/docs/help/faq/platform-faq/system_test_environment.md +13 -0
- package/assets/docs/help/faq/platform-faq/taxinvoice_bulk_issuance.md +25 -0
- package/assets/docs/help/faq/platform-faq/taxinvoice_cancel.md +12 -0
- package/assets/docs/help/faq/platform-faq/taxinvoice_delayed.md +18 -0
- package/assets/docs/help/faq/platform-faq/taxinvoice_forward_issuance.md +23 -0
- package/assets/docs/help/faq/platform-faq/taxinvoice_guide_atoz.md +202 -0
- package/assets/docs/help/faq/platform-faq/taxinvoice_partner_peristalsis.md +60 -0
- package/assets/docs/help/faq/platform-faq/taxinvoice_reverse_issuance_buyer_process.md +52 -0
- package/assets/docs/help/faq/platform-faq/taxinvoice_reverse_issuance_definition.md +46 -0
- package/assets/docs/help/faq/platform-faq/taxinvoice_reverse_issuance_partner_signup.md +23 -0
- package/assets/docs/help/faq/platform-faq/taxinvoice_reverse_issuance_supplier_process.md +47 -0
- package/assets/docs/help/notice-payletter-2025-10-21.md +29 -0
- package/assets/docs/help/notice-payletter-2025-10-24.md +46 -0
- package/assets/docs/help/platform-2025-07-02.md +73 -0
- package/assets/docs/help/platform-2025-07-07.md +56 -0
- package/assets/docs/help/pricing/pg/domestic-and-oversea-fees.md +2 -2
- package/assets/docs/help/procedure/payment-integration/test-integration.md +2 -2
- package/assets/docs/help/procedure/pg-application/content59.md +1 -1
- package/assets/docs/help/procedure/pg-application/start.md +1 -1
- package/assets/docs/help/procedure/recommendation/package.md +5 -5
- package/assets/docs/help/service/identity-verification/identity-verification.md +6 -6
- package/assets/docs/help/service/paymethod/paymethod.md +2 -2
- package/assets/docs/help/service/pg/pg-service-list.md +25 -13
- package/assets/docs/help/service/version/portone-version.md +1 -1
- package/assets/docs/opi/ko/console/guide/billing-payments.md +1 -1
- package/assets/docs/opi/ko/console/guide/reg.md +1 -1
- package/assets/docs/opi/ko/console/guide/smartrouting.md +0 -2
- package/assets/docs/opi/ko/console/pg.md +7 -7
- package/assets/docs/opi/ko/etc/recon.md +1 -1
- package/assets/docs/opi/ko/extra/confirm-process/readme-v1.md +2 -2
- package/assets/docs/opi/ko/extra/confirm-process/readme-v2.md +11 -4
- package/assets/docs/opi/ko/extra/identity-verification/readme-v2.md +2 -2
- package/assets/docs/opi/ko/extra/identity-verification/v1/all/3.md +3 -3
- package/assets/docs/opi/ko/extra/identity-verification/v1/all/readme.md +1 -1
- package/assets/docs/opi/ko/extra/identity-verification/v1/credit-auth/4.md +3 -3
- package/assets/docs/opi/ko/extra/identity-verification/v1/phone/4.md +3 -3
- package/assets/docs/opi/ko/extra/manual-confirm/readme-v2.md +74 -0
- package/assets/docs/opi/ko/extra/plugins/wordpress/button.md +1 -1
- package/assets/docs/opi/ko/extra/plugins/wordpress/edd.md +1 -1
- package/assets/docs/opi/ko/extra/plugins/wordpress/woocommerce/subscription.md +1 -1
- package/assets/docs/opi/ko/extra/promotion/intro.md +1 -1
- package/assets/docs/opi/ko/extra/smart-routing/console-guide.md +1 -1
- package/assets/docs/opi/ko/extra/smart-routing/integration.md +2 -2
- package/assets/docs/opi/ko/extra/smart-routing/intro.md +9 -9
- package/assets/docs/opi/ko/integration/pg/v1/danal.md +5 -0
- package/assets/docs/opi/ko/integration/pg/v1/daou/readme.md +9 -0
- package/assets/docs/opi/ko/integration/pg/v1/daou/undefined.md +8 -0
- package/assets/docs/opi/ko/integration/pg/v1/eximbay.md +0 -14
- package/assets/docs/opi/ko/integration/pg/v1/inicis.md +58 -0
- package/assets/docs/opi/ko/integration/pg/v1/kakaopay.md +12 -1
- package/assets/docs/opi/ko/integration/pg/v1/kicc.md +3 -1
- package/assets/docs/opi/ko/integration/pg/v1/nhn-kcp/kcp-quickpay.md +710 -0
- package/assets/docs/opi/ko/integration/pg/v1/nhn-kcp/readme.md +661 -0
- package/assets/docs/opi/ko/integration/pg/v1/nhn-kcp.md +10 -71
- package/assets/docs/opi/ko/integration/pg/v1/nice-v2/billing-api-caution.md +11 -11
- package/assets/docs/opi/ko/integration/pg/v1/nice-v2/payment-caution.md +16 -16
- package/assets/docs/opi/ko/integration/pg/v1/nice-v2/readme.md +10 -8
- package/assets/docs/opi/ko/integration/pg/v1/nice.md +6 -6
- package/assets/docs/opi/ko/integration/pg/v1/payletter-global.md +86 -0
- package/assets/docs/opi/ko/integration/pg/v1/paypal.md +1 -1
- package/assets/docs/opi/ko/integration/pg/v1/readme.md +5 -3
- package/assets/docs/opi/ko/integration/pg/v1/settle/readme.md +80 -0
- package/assets/docs/opi/ko/integration/pg/v1/spb/readme.md +10 -9
- package/assets/docs/opi/ko/integration/pg/v1/welcome/readme.md +10 -7
- package/assets/docs/opi/ko/integration/pg/v2/eximbay-v2.md +138 -22
- package/assets/docs/opi/ko/integration/pg/v2/inicis-unified-identity-verification.md +0 -1
- package/assets/docs/opi/ko/integration/pg/v2/inicis-v2.md +13 -1
- package/assets/docs/opi/ko/integration/pg/v2/kcp-v2.md +4 -2
- package/assets/docs/opi/ko/integration/pg/v2/naverpay.md +1 -1
- package/assets/docs/opi/ko/integration/pg/v2/nice-v2.md +40 -40
- package/assets/docs/opi/ko/integration/pg/v2/payletter-global.md +9 -2
- package/assets/docs/opi/ko/integration/pg/v2/paypal-v2.md +13 -12
- package/assets/docs/opi/ko/integration/pg/v2/readme.md +1 -1
- package/assets/docs/opi/ko/integration/pg/v2/smartro-v2.md +1 -1
- package/assets/docs/opi/ko/integration/pg/v2/welcome.md +8 -7
- package/assets/docs/opi/ko/integration/ready/_components/integration-guide/hyphen.md +27 -0
- package/assets/docs/opi/ko/integration/ready/_components/integration-guide/inicis.md +64 -0
- package/assets/docs/opi/ko/integration/ready/_components/integration-guide/kcp-v2.md +70 -0
- package/assets/docs/opi/ko/integration/ready/_components/integration-guide/paypal-v2.md +25 -0
- package/assets/docs/opi/ko/integration/ready/_components/integration-guide/tosspayments.md +15 -0
- package/assets/docs/opi/ko/integration/ready/readme.md +26 -10
- package/assets/docs/opi/ko/integration/start/_components/sdk-installation.md +71 -0
- package/assets/docs/opi/ko/integration/start/v1/non-auth.md +2 -4
- package/assets/docs/opi/ko/integration/start/v2/billing/issue.md +1 -1
- package/assets/docs/opi/ko/integration/start/v2/checkout.md +4 -2
- package/assets/docs/opi/ko/integration/start/v2/readme.md +2 -2
- package/assets/docs/opi/ko/integration/using-ai-tools.md +33 -57
- package/assets/docs/opi/ko/integration/virtual-account/readme.md +9 -9
- package/assets/docs/opi/ko/integration/webhook/readme-v1.md +2 -4
- package/assets/docs/opi/ko/integration/webhook/readme-v2.md +1 -3
- package/assets/docs/opi/ko/quick-guide/payment.md +16 -16
- package/assets/docs/opi/ko/support/code-info/pg-1.md +1 -1
- package/assets/docs/opi/ko/support/code-info/pg-2.md +2 -2
- package/assets/docs/opi/ko/support/code-info/pg.md +2 -2
- package/assets/docs/opi/ko/support/contact.md +1 -13
- package/assets/docs/opi/ko/support/pg-terms.md +233 -0
- package/assets/docs/platform/ko/guides/dictionary.md +136 -16
- package/assets/docs/platform/ko/guides/process.md +1 -1
- package/assets/docs/platform/ko/guides/webhook.md +1 -1
- package/assets/docs/platform/ko/using-ai-tools.md +33 -57
- package/assets/docs/release-notes/api-sdk/2023-07-10.md +7 -7
- package/assets/docs/release-notes/api-sdk/2023-07-31.md +1 -1
- package/assets/docs/release-notes/api-sdk/2023-08-31.md +2 -2
- package/assets/docs/release-notes/api-sdk/2024-01-08.md +4 -4
- package/assets/docs/release-notes/api-sdk/2024-06-03.md +1 -1
- package/assets/docs/release-notes/api-sdk/2024-09-05.md +0 -1
- package/assets/docs/release-notes/api-sdk/2024-09-27.md +1 -1
- package/assets/docs/release-notes/console/2025-10-17.md +47 -0
- package/assets/docs/release-notes/platform/2025-03-17.md +1 -1
- package/assets/docs/release-notes/platform/2025-07-07.md +1 -1
- package/assets/docs/release-notes/platform/2025-07-23.md +85 -0
- package/assets/docs/release-notes/platform/2025-08-13.md +95 -0
- package/assets/docs/release-notes/platform/2025-08-21.md +53 -0
- package/assets/docs/release-notes/platform/2025-08-28.md +53 -0
- package/assets/docs/release-notes/platform/2025-10-02.md +152 -0
- package/assets/docs/schema/browser-sdk.yml +196 -69
- package/assets/docs/schema/v1.openapi.json +164 -217
- package/assets/docs/schema/v1.openapi.yml +148 -213
- package/assets/docs/schema/v2.openapi.json +18056 -11790
- package/assets/docs/schema/v2.openapi.yml +4801 -191
- package/assets/docs/sdk/ko/v1-sdk/javascript-sdk/payrq.md +3 -3
- package/assets/docs/sdk/ko/v1-sdk/javascript-sdk/payrt.md +3 -3
- package/assets/docs/sdk/ko/v2-sdk/_components/sdk-installation.md +71 -0
- package/assets/docs/sdk/ko/v2-server-sdk/jvm.md +12 -5
- package/assets/docs/sdk/ko/v2-server-sdk/python.md +12 -3
- package/assets/docs/v1-docs-full.md +2298 -1026
- package/assets/docs/v2-docs-full.md +1412 -362
- package/assets/docs/website-links.md +23 -13
- package/assets/instructions.md +4 -2
- package/manifest.json +3 -14
- package/package.json +20 -19
- package/server/index.js +1783 -739
- package/assets/docs/help/admin-console/platform-settlement/content33-1.md +0 -201
- package/assets/docs/help/core-service/payment-type/schedule-logic-guide.md +0 -49
- package/assets/docs/help/faq/platform-faq/taxinvoice_guide.md +0 -107
- package/assets/docs/help/faq/platform-faq/taxinvoice_signupemail.md +0 -67
package/server/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __export = (target, all) => {
|
|
4
|
-
for (var
|
|
5
|
-
__defProp(target,
|
|
4
|
+
for (var name14 in all)
|
|
5
|
+
__defProp(target, name14, { get: all[name14], enumerable: true });
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
@@ -10,11 +10,12 @@ import { dirname, join as join4 } from "path";
|
|
|
10
10
|
import { fileURLToPath } from "url";
|
|
11
11
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
12
12
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
13
|
+
import { GraphQLClient } from "graphql-request";
|
|
13
14
|
|
|
14
15
|
// package.json
|
|
15
16
|
var package_default = {
|
|
16
17
|
name: "@portone/mcp-server",
|
|
17
|
-
version: "0.
|
|
18
|
+
version: "0.15.0-alpha.0",
|
|
18
19
|
description: "\uD3EC\uD2B8\uC6D0 \uC0AC\uC6A9\uC790\uB97C \uC704\uD55C MCP (Model Context Protocol) \uC11C\uBC84\uC785\uB2C8\uB2E4. \uD3EC\uD2B8\uC6D0 \uAC1C\uBC1C\uC790\uC13C\uD130, \uD5EC\uD504\uC13C\uD130 \uB4F1 \uACF5\uC2DD \uBB38\uC11C \uB0B4\uC6A9\uC744 LLM(Large Language Model)\uC5D0 \uC81C\uACF5\uD574 \uC815\uD655\uD55C \uC815\uBCF4\uB97C \uBC14\uD0D5\uC73C\uB85C \uC0AC\uC6A9\uC790\uC758 \uC5F0\uB3D9 \uBC0F \uC9C8\uC758\uB97C \uB3D5\uB3C4\uB85D \uD569\uB2C8\uB2E4.",
|
|
19
20
|
main: "server/index.js",
|
|
20
21
|
type: "module",
|
|
@@ -23,10 +24,10 @@ var package_default = {
|
|
|
23
24
|
},
|
|
24
25
|
scripts: {
|
|
25
26
|
test: "vitest",
|
|
26
|
-
"update-docs": "node
|
|
27
|
+
"update-docs": "node update-docs.ts",
|
|
27
28
|
build: "tsup src/index.ts --outDir server --format esm",
|
|
28
|
-
"build:dxt": "node
|
|
29
|
-
dev: "node
|
|
29
|
+
"build:dxt": "node scripts/build-dxt.ts",
|
|
30
|
+
dev: "node src/index.ts",
|
|
30
31
|
start: "node server/index.js",
|
|
31
32
|
lint: "biome check .",
|
|
32
33
|
format: "biome format --write .",
|
|
@@ -44,27 +45,31 @@ var package_default = {
|
|
|
44
45
|
},
|
|
45
46
|
license: "MIT OR Apache-2.0",
|
|
46
47
|
dependencies: {
|
|
47
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
48
|
-
"@portone/server-sdk": "^0.
|
|
49
|
-
axios: "^1.
|
|
48
|
+
"@modelcontextprotocol/sdk": "^1.20.0",
|
|
49
|
+
"@portone/server-sdk": "^0.17.0",
|
|
50
|
+
axios: "^1.12.2",
|
|
51
|
+
graphql: "^16.11.0",
|
|
52
|
+
"graphql-request": "^7.2.0",
|
|
50
53
|
"gray-matter": "^4.0.3",
|
|
54
|
+
h3: "2.0.1-rc.2",
|
|
51
55
|
"js-yaml": "^4.1.0",
|
|
52
|
-
|
|
56
|
+
open: "^10.2.0",
|
|
57
|
+
"ts-pattern": "^5.8.0",
|
|
53
58
|
zod: "^3.25.75"
|
|
54
59
|
},
|
|
55
|
-
packageManager: "pnpm@10.
|
|
60
|
+
packageManager: "pnpm@10.20.0+sha512.cf9998222162dd85864d0a8102e7892e7ba4ceadebbf5a31f9c2fce48dfce317a9c53b9f6464d1ef9042cba2e02ae02a9f7c143a2b438cd93c91840f0192b9dd",
|
|
56
61
|
devDependencies: {
|
|
57
|
-
"@biomejs/biome": "2.
|
|
58
|
-
"@changesets/cli": "^2.29.
|
|
62
|
+
"@biomejs/biome": "2.2.6",
|
|
63
|
+
"@changesets/cli": "^2.29.7",
|
|
59
64
|
"@types/js-yaml": "^4.0.9",
|
|
60
|
-
"@types/node": "^
|
|
65
|
+
"@types/node": "^22.18.10",
|
|
61
66
|
tsup: "^8.5.0",
|
|
62
|
-
"type-fest": "^
|
|
63
|
-
typescript: "^5.
|
|
64
|
-
vitest: "^
|
|
67
|
+
"type-fest": "^5.1.0",
|
|
68
|
+
typescript: "^5.9.3",
|
|
69
|
+
vitest: "^3.2.4"
|
|
65
70
|
},
|
|
66
71
|
engines: {
|
|
67
|
-
node: ">=22.
|
|
72
|
+
node: ">=22.18.0"
|
|
68
73
|
},
|
|
69
74
|
files: [
|
|
70
75
|
"server",
|
|
@@ -74,10 +79,7 @@ var package_default = {
|
|
|
74
79
|
"LICENSE-MIT",
|
|
75
80
|
"README.md"
|
|
76
81
|
],
|
|
77
|
-
repository:
|
|
78
|
-
type: "git",
|
|
79
|
-
url: "https://github.com/portone-io/portone-mcp-server.git"
|
|
80
|
-
}
|
|
82
|
+
repository: "github:portone-io/mcp-server"
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
// src/loader/index.ts
|
|
@@ -198,590 +200,1504 @@ async function loadInstructions(path) {
|
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
202
|
|
|
201
|
-
// src/tools/
|
|
202
|
-
var
|
|
203
|
-
__export(
|
|
203
|
+
// src/tools/addTestChannel.ts
|
|
204
|
+
var addTestChannel_exports = {};
|
|
205
|
+
__export(addTestChannel_exports, {
|
|
204
206
|
config: () => config,
|
|
205
207
|
init: () => init,
|
|
206
208
|
name: () => name
|
|
207
209
|
});
|
|
208
|
-
import
|
|
210
|
+
import z5 from "zod";
|
|
209
211
|
|
|
210
|
-
// src/tools/
|
|
212
|
+
// src/tools/request/addChannel.ts
|
|
213
|
+
import { match, P } from "ts-pattern";
|
|
211
214
|
import z from "zod";
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
"
|
|
237
|
-
"
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
"cancellations.reason",
|
|
313
|
-
"cancellations.cancelledAt",
|
|
314
|
-
"cancellations.requestedAt",
|
|
315
|
-
"cancellations.trigger",
|
|
316
|
-
"disputes.status",
|
|
317
|
-
"disputes.reason",
|
|
318
|
-
"disputes.createdAt",
|
|
319
|
-
"disputes.resolvedAt",
|
|
320
|
-
"channelGroup.name",
|
|
321
|
-
"channelGroup.isForTest"
|
|
322
|
-
];
|
|
323
|
-
var PaymentField = z.enum(PAYMENT_FIELDS);
|
|
324
|
-
var IDENTITY_VERIFICATION_FIELDS = [
|
|
325
|
-
"status",
|
|
326
|
-
"id",
|
|
327
|
-
"requestedAt",
|
|
328
|
-
"updatedAt",
|
|
329
|
-
"statusChangedAt",
|
|
330
|
-
"failure",
|
|
331
|
-
"version",
|
|
332
|
-
"channel.type",
|
|
333
|
-
"channel.name",
|
|
334
|
-
"channel.pgProvider"
|
|
335
|
-
];
|
|
336
|
-
var IdentityVerificationField = z.enum(IDENTITY_VERIFICATION_FIELDS);
|
|
337
|
-
var JsonLiteral = z.string().or(z.number()).or(z.boolean());
|
|
338
|
-
var JsonValue = z.lazy(
|
|
339
|
-
() => JsonLiteral.or(z.array(JsonValue)).or(z.record(JsonValue))
|
|
340
|
-
);
|
|
341
|
-
function filterFields(fields, data) {
|
|
342
|
-
const withPrefixes = new Set(fields);
|
|
343
|
-
for (const field of fields) {
|
|
344
|
-
let searchPos = 0;
|
|
345
|
-
while (true) {
|
|
346
|
-
const dot = field.indexOf(".", searchPos);
|
|
347
|
-
if (dot === -1) break;
|
|
348
|
-
withPrefixes.add(field.slice(0, dot));
|
|
349
|
-
searchPos = dot + 1;
|
|
215
|
+
|
|
216
|
+
// src/url.ts
|
|
217
|
+
var DEVELOPERS_URL = "https://developers.portone.io";
|
|
218
|
+
var CONSOLE_URL = "https://admin.portone.io";
|
|
219
|
+
var MERCHANT_SERVICE_URL = "https://merchant-service.prod.iamport.co";
|
|
220
|
+
var CHANNEL_SERVICE_URL = "https://channel-service.prod.iamport.co";
|
|
221
|
+
var GRAPHQL_URL = "https://api.portone.io/graphql";
|
|
222
|
+
var HELP_CENTER_URL = "https://help.portone.io";
|
|
223
|
+
|
|
224
|
+
// src/tools/utils/userAgent.ts
|
|
225
|
+
var USER_AGENT = `${package_default.name} ${package_default.version}`;
|
|
226
|
+
|
|
227
|
+
// src/tools/request/addChannel.ts
|
|
228
|
+
var StatusResponse = z.object({
|
|
229
|
+
code: z.unknown(),
|
|
230
|
+
message: z.string(),
|
|
231
|
+
details: z.unknown()
|
|
232
|
+
}).partial();
|
|
233
|
+
var AddChannelResponse = z.object({
|
|
234
|
+
channel: z.object({
|
|
235
|
+
channelKey: z.string()
|
|
236
|
+
})
|
|
237
|
+
});
|
|
238
|
+
var channelTypeMapper = {
|
|
239
|
+
LIVE: "CHANNEL_TYPE_REQUEST_LIVE",
|
|
240
|
+
TEST: "CHANNEL_TYPE_REQUEST_MERCHANT_TEST"
|
|
241
|
+
};
|
|
242
|
+
async function addChannel({
|
|
243
|
+
channelType,
|
|
244
|
+
pgpCredential,
|
|
245
|
+
channelName,
|
|
246
|
+
pgMerchantId,
|
|
247
|
+
storeId,
|
|
248
|
+
taxType,
|
|
249
|
+
manualConfirm,
|
|
250
|
+
isForPayment,
|
|
251
|
+
isForIdentityCertification,
|
|
252
|
+
authorization
|
|
253
|
+
}) {
|
|
254
|
+
const request = {
|
|
255
|
+
channelType: channelTypeMapper[channelType],
|
|
256
|
+
pgpCredential,
|
|
257
|
+
channelName,
|
|
258
|
+
pgMerchantId,
|
|
259
|
+
isForPayment,
|
|
260
|
+
isForIdentityCertification,
|
|
261
|
+
storeId,
|
|
262
|
+
taxType,
|
|
263
|
+
manualConfirm
|
|
264
|
+
};
|
|
265
|
+
try {
|
|
266
|
+
const response = await fetch(new URL("/v2/channels", CHANNEL_SERVICE_URL), {
|
|
267
|
+
method: "POST",
|
|
268
|
+
headers: {
|
|
269
|
+
Authorization: authorization,
|
|
270
|
+
"Content-Type": "application/json",
|
|
271
|
+
"User-Agent": USER_AGENT
|
|
272
|
+
},
|
|
273
|
+
body: JSON.stringify(request)
|
|
274
|
+
});
|
|
275
|
+
const text = await response.text();
|
|
276
|
+
try {
|
|
277
|
+
const parsed = await AddChannelResponse.or(StatusResponse).parseAsync(
|
|
278
|
+
JSON.parse(text)
|
|
279
|
+
);
|
|
280
|
+
return match(parsed).returnType().with({ channel: P.nonNullable }, (success) => ({
|
|
281
|
+
type: "success",
|
|
282
|
+
data: success
|
|
283
|
+
})).otherwise(({ code, message, details }) => ({
|
|
284
|
+
type: "error",
|
|
285
|
+
data: {
|
|
286
|
+
message: message ?? "\uCC44\uB110\uC744 \uC62C\uBC14\uB974\uAC8C \uCD94\uAC00\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.",
|
|
287
|
+
code,
|
|
288
|
+
details,
|
|
289
|
+
status: response.status
|
|
290
|
+
}
|
|
291
|
+
}));
|
|
292
|
+
} catch (parseError) {
|
|
293
|
+
return {
|
|
294
|
+
type: "error",
|
|
295
|
+
data: {
|
|
296
|
+
message: "\uC62C\uBC14\uB974\uC9C0 \uC54A\uC740 \uD615\uC2DD\uC758 \uC11C\uBC84 \uC751\uB2F5",
|
|
297
|
+
cause: parseError
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
} catch (error) {
|
|
302
|
+
if (error instanceof Error) {
|
|
303
|
+
return {
|
|
304
|
+
type: "error",
|
|
305
|
+
data: error
|
|
306
|
+
};
|
|
307
|
+
} else {
|
|
308
|
+
return {
|
|
309
|
+
type: "error",
|
|
310
|
+
data: {
|
|
311
|
+
message: `\uC54C \uC218 \uC5C6\uB294 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.`,
|
|
312
|
+
cause: error
|
|
313
|
+
}
|
|
314
|
+
};
|
|
350
315
|
}
|
|
351
316
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// src/tools/request/listStores.ts
|
|
320
|
+
import { parse } from "graphql";
|
|
321
|
+
import { gql } from "graphql-request";
|
|
322
|
+
import { match as match2, P as P2 } from "ts-pattern";
|
|
323
|
+
import z2 from "zod";
|
|
324
|
+
var ErrorResponse = z2.object({
|
|
325
|
+
__typename: z2.string(),
|
|
326
|
+
message: z2.string().nullable()
|
|
327
|
+
});
|
|
328
|
+
var StoreResponse = z2.object({
|
|
329
|
+
id: z2.string(),
|
|
330
|
+
plainId: z2.string(),
|
|
331
|
+
name: z2.string(),
|
|
332
|
+
isRepresentative: z2.boolean(),
|
|
333
|
+
v1Info: z2.object({
|
|
334
|
+
v1UserId: z2.number(),
|
|
335
|
+
userCode: z2.string(),
|
|
336
|
+
tierCode: z2.string().nullable()
|
|
337
|
+
}).or(ErrorResponse)
|
|
338
|
+
}).transform(({ v1Info, ...store }) => ({
|
|
339
|
+
...match2(v1Info).with({ __typename: P2.nonNullable }, () => ({})).otherwise(({ v1UserId, tierCode, ...rest }) => ({
|
|
340
|
+
userId: v1UserId,
|
|
341
|
+
tierCode: tierCode ?? void 0,
|
|
342
|
+
...rest
|
|
343
|
+
})),
|
|
344
|
+
...store
|
|
345
|
+
}));
|
|
346
|
+
var MerchantResponse = z2.object({
|
|
347
|
+
stores: z2.object({
|
|
348
|
+
items: z2.array(StoreResponse)
|
|
349
|
+
}).or(ErrorResponse)
|
|
350
|
+
});
|
|
351
|
+
var ListStoresResponse = z2.object({
|
|
352
|
+
merchant: MerchantResponse.transform(({ stores }) => stores).or(
|
|
353
|
+
ErrorResponse
|
|
354
|
+
)
|
|
355
|
+
}).transform(
|
|
356
|
+
({ merchant }) => match2(merchant).with({ __typename: P2.nonNullable }, (error) => error).otherwise(({ items }) => {
|
|
357
|
+
const main = items.find(({ isRepresentative }) => isRepresentative);
|
|
358
|
+
return {
|
|
359
|
+
main,
|
|
360
|
+
items: items.filter(({ isRepresentative }) => !isRepresentative)
|
|
361
|
+
};
|
|
362
|
+
})
|
|
363
|
+
);
|
|
364
|
+
var listStoresQuery = parse(gql`
|
|
365
|
+
query ListStores {
|
|
366
|
+
merchant {
|
|
367
|
+
...ErrorFragment
|
|
368
|
+
... on Merchant {
|
|
369
|
+
stores {
|
|
370
|
+
...ErrorFragment
|
|
371
|
+
... on StoresPayload {
|
|
372
|
+
items {
|
|
373
|
+
... on Store {
|
|
374
|
+
id
|
|
375
|
+
plainId
|
|
376
|
+
name
|
|
377
|
+
isRepresentative
|
|
378
|
+
v1Info {
|
|
379
|
+
...ErrorFragment
|
|
380
|
+
... on StoreV1Info {
|
|
381
|
+
v1UserId
|
|
382
|
+
userCode
|
|
383
|
+
tierCode
|
|
384
|
+
}
|
|
385
|
+
}
|
|
370
386
|
}
|
|
371
|
-
}
|
|
372
|
-
|
|
387
|
+
}
|
|
388
|
+
}
|
|
373
389
|
}
|
|
374
|
-
} else {
|
|
375
|
-
return data2;
|
|
376
390
|
}
|
|
377
391
|
}
|
|
378
392
|
}
|
|
379
393
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
394
|
+
fragment ErrorFragment on Error {
|
|
395
|
+
__typename
|
|
396
|
+
message
|
|
397
|
+
}
|
|
398
|
+
`);
|
|
399
|
+
async function listStores({
|
|
400
|
+
client,
|
|
401
|
+
authorization
|
|
402
|
+
}) {
|
|
403
|
+
try {
|
|
404
|
+
const response = await client.request({
|
|
405
|
+
document: listStoresQuery,
|
|
406
|
+
requestHeaders: {
|
|
407
|
+
authorization
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
const parsed = await ListStoresResponse.parseAsync(response);
|
|
411
|
+
return match2(parsed).returnType().with({ __typename: P2.nonNullable }, ({ __typename, message }) => ({
|
|
412
|
+
type: "error",
|
|
413
|
+
data: {
|
|
414
|
+
message,
|
|
415
|
+
type: __typename
|
|
416
|
+
}
|
|
417
|
+
})).otherwise((stores) => ({
|
|
418
|
+
type: "success",
|
|
419
|
+
data: stores
|
|
420
|
+
}));
|
|
421
|
+
} catch (error) {
|
|
422
|
+
if (error instanceof Error) {
|
|
423
|
+
return {
|
|
424
|
+
type: "error",
|
|
425
|
+
data: {
|
|
426
|
+
...error
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
} else {
|
|
430
|
+
return {
|
|
431
|
+
type: "error",
|
|
432
|
+
data: {
|
|
433
|
+
message: "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.",
|
|
434
|
+
cause: error
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
386
440
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
441
|
+
// src/tools/request/listV2SharedTestChannel.ts
|
|
442
|
+
import { match as match3, P as P3 } from "ts-pattern";
|
|
443
|
+
import z3 from "zod";
|
|
444
|
+
var StatusResponse2 = z3.object({
|
|
445
|
+
code: z3.unknown(),
|
|
446
|
+
message: z3.string(),
|
|
447
|
+
details: z3.unknown()
|
|
448
|
+
}).partial();
|
|
449
|
+
var SharedTestChannelResponse = z3.object({
|
|
450
|
+
pgProvider: z3.string(),
|
|
451
|
+
pgMerchantId: z3.string(),
|
|
452
|
+
pgpCredential: z3.object({}).passthrough(),
|
|
453
|
+
channelName: z3.string(),
|
|
454
|
+
isForPayment: z3.boolean(),
|
|
455
|
+
isForIdentityCertification: z3.boolean()
|
|
456
|
+
});
|
|
457
|
+
var ListV2SharedTestChannelResponse = z3.object({
|
|
458
|
+
channels: z3.array(SharedTestChannelResponse)
|
|
459
|
+
});
|
|
460
|
+
async function listV2SharedTestChannel({
|
|
461
|
+
authorization
|
|
462
|
+
}) {
|
|
463
|
+
try {
|
|
464
|
+
const response = await fetch(
|
|
465
|
+
new URL("/v2/shared-test-channels", CHANNEL_SERVICE_URL),
|
|
466
|
+
{
|
|
467
|
+
method: "GET",
|
|
468
|
+
headers: {
|
|
469
|
+
Authorization: authorization,
|
|
470
|
+
"User-Agent": USER_AGENT
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
);
|
|
474
|
+
const text = await response.text();
|
|
475
|
+
try {
|
|
476
|
+
const parsed = await ListV2SharedTestChannelResponse.or(
|
|
477
|
+
StatusResponse2
|
|
478
|
+
).parseAsync(JSON.parse(text));
|
|
479
|
+
return match3(parsed).returnType().with({ channels: P3.nonNullable }, (success) => ({
|
|
480
|
+
type: "success",
|
|
481
|
+
data: success
|
|
482
|
+
})).otherwise(({ code, message, details }) => ({
|
|
483
|
+
type: "error",
|
|
484
|
+
data: {
|
|
485
|
+
message: message ?? "\uD14C\uC2A4\uD2B8 \uCC44\uB110 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.",
|
|
486
|
+
code,
|
|
487
|
+
details,
|
|
488
|
+
status: response.status
|
|
489
|
+
}
|
|
490
|
+
}));
|
|
491
|
+
} catch (parseError) {
|
|
492
|
+
return {
|
|
493
|
+
type: "error",
|
|
494
|
+
data: {
|
|
495
|
+
message: "\uC62C\uBC14\uB974\uC9C0 \uC54A\uC740 \uD615\uC2DD\uC758 \uC11C\uBC84 \uC751\uB2F5",
|
|
496
|
+
cause: parseError
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
} catch (error) {
|
|
501
|
+
if (error instanceof Error) {
|
|
502
|
+
return {
|
|
503
|
+
type: "error",
|
|
504
|
+
data: error
|
|
505
|
+
};
|
|
506
|
+
} else {
|
|
507
|
+
return {
|
|
508
|
+
type: "error",
|
|
509
|
+
data: {
|
|
510
|
+
message: `\uC54C \uC218 \uC5C6\uB294 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.`,
|
|
511
|
+
cause: error
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
}
|
|
399
515
|
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// src/tools/utils/key.ts
|
|
519
|
+
import { getQuery, H3, serve } from "h3";
|
|
520
|
+
import open from "open";
|
|
521
|
+
import { match as match4 } from "ts-pattern";
|
|
522
|
+
import { z as z4 } from "zod";
|
|
523
|
+
var OAUTH_CLIENT_ID = "MCP";
|
|
524
|
+
var OAUTH_TIMEOUT_MILLIS = 5 * 60 * 1e3;
|
|
525
|
+
var OAuthTokenResponse = z4.object({
|
|
526
|
+
access_token: z4.string(),
|
|
527
|
+
token_type: z4.string(),
|
|
528
|
+
expires_in: z4.number(),
|
|
529
|
+
scope: z4.array(z4.string()),
|
|
530
|
+
refresh_token: z4.string()
|
|
531
|
+
});
|
|
532
|
+
var OAuthError = class extends Error {
|
|
400
533
|
};
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
534
|
+
var TokenProvider = class {
|
|
535
|
+
app = new H3().get("/oauth/mcp", async (event) => {
|
|
536
|
+
const query = getQuery(event);
|
|
537
|
+
const { code, error, error_description: errorDescription } = query;
|
|
538
|
+
if (code == null) {
|
|
539
|
+
const message = errorDescription == null ? error : errorDescription;
|
|
540
|
+
return `OAuth Error: ${message}`;
|
|
406
541
|
}
|
|
407
|
-
const url = `/identity-verifications/${identityVerificationId}${params.toString() ? `?${params.toString()}` : ""}`;
|
|
408
542
|
try {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
543
|
+
this.token = await this.exchangeAuthorizationCode(code);
|
|
544
|
+
} catch (error2) {
|
|
545
|
+
const message = error2 instanceof Error ? error2.message : "Internal Server Error";
|
|
546
|
+
return new Response(message, {
|
|
547
|
+
status: 500
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
return `<!DOCTYPE html>
|
|
551
|
+
<html lang="en">
|
|
552
|
+
<head><meta charset='utf-8'><script>window.close()</script></head>
|
|
553
|
+
<body>Authorization complete. You may close this window.</body>
|
|
554
|
+
</html>
|
|
555
|
+
`;
|
|
556
|
+
});
|
|
557
|
+
serverController = null;
|
|
558
|
+
token = null;
|
|
559
|
+
codeVerifier = null;
|
|
560
|
+
launchRefresher() {
|
|
561
|
+
setInterval(async () => {
|
|
562
|
+
if (this.token !== null && Date.now() >= this.token.refreshAt) {
|
|
563
|
+
try {
|
|
564
|
+
this.token = await this.refresh(this.token.refresh);
|
|
565
|
+
} catch (e) {
|
|
566
|
+
console.error(e);
|
|
567
|
+
this.token = null;
|
|
568
|
+
}
|
|
421
569
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
570
|
+
}, 10 * 1e3);
|
|
571
|
+
}
|
|
572
|
+
async exchangeAuthorizationCode(code) {
|
|
573
|
+
const res = await fetch(new URL("/oauth/token", MERCHANT_SERVICE_URL), {
|
|
574
|
+
method: "POST",
|
|
575
|
+
headers: {
|
|
576
|
+
"Content-Type": "application/json"
|
|
577
|
+
},
|
|
578
|
+
body: JSON.stringify({
|
|
579
|
+
client_id: OAUTH_CLIENT_ID,
|
|
580
|
+
grant_type: "authorization_code",
|
|
581
|
+
code,
|
|
582
|
+
code_verifier: this.codeVerifier
|
|
583
|
+
})
|
|
584
|
+
});
|
|
585
|
+
if (!res.ok) {
|
|
586
|
+
throw new OAuthError(
|
|
587
|
+
`server returned status: ${res.status} ${await res.text()}`
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
try {
|
|
591
|
+
const text = await res.text();
|
|
592
|
+
const response = await OAuthTokenResponse.parseAsync(JSON.parse(text));
|
|
593
|
+
const now = Date.now();
|
|
594
|
+
this.serverController?.abort();
|
|
595
|
+
this.serverController = null;
|
|
596
|
+
return {
|
|
597
|
+
access: response.access_token,
|
|
598
|
+
refresh: response.refresh_token,
|
|
599
|
+
refreshAt: now + 6e4,
|
|
600
|
+
expiresAt: now + response.expires_in * 1e3,
|
|
601
|
+
tokenType: response.token_type
|
|
426
602
|
};
|
|
603
|
+
} catch (error) {
|
|
604
|
+
throw new OAuthError("Invalid server response", { cause: error });
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
async refresh(refreshToken) {
|
|
608
|
+
const res = await fetch(new URL("/oauth/token", MERCHANT_SERVICE_URL), {
|
|
609
|
+
method: "POST",
|
|
610
|
+
headers: {
|
|
611
|
+
"Content-Type": "application/json"
|
|
612
|
+
},
|
|
613
|
+
body: JSON.stringify({
|
|
614
|
+
client_id: OAUTH_CLIENT_ID,
|
|
615
|
+
grant_type: "refresh_token",
|
|
616
|
+
refresh_token: refreshToken
|
|
617
|
+
})
|
|
618
|
+
});
|
|
619
|
+
if (!res.ok) {
|
|
620
|
+
throw new OAuthError(`server returned status: ${res.status}`);
|
|
621
|
+
}
|
|
622
|
+
try {
|
|
623
|
+
const text = await res.text();
|
|
624
|
+
const response = await OAuthTokenResponse.parseAsync(JSON.parse(text));
|
|
625
|
+
const now = Date.now();
|
|
626
|
+
return {
|
|
627
|
+
access: response.access_token,
|
|
628
|
+
refresh: response.refresh_token,
|
|
629
|
+
refreshAt: now + 6e4,
|
|
630
|
+
expiresAt: now + response.expires_in * 1e3,
|
|
631
|
+
tokenType: response.token_type
|
|
632
|
+
};
|
|
633
|
+
} catch (error) {
|
|
634
|
+
throw new OAuthError("Invalid server response", { cause: error });
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
async getToken() {
|
|
638
|
+
if (this.token === null || Date.now() >= this.token.expiresAt) {
|
|
639
|
+
this.serverController?.abort();
|
|
640
|
+
this.serverController = new AbortController();
|
|
641
|
+
const serverTimeout = setTimeout(() => {
|
|
642
|
+
this.serverController?.abort();
|
|
643
|
+
this.serverController = null;
|
|
644
|
+
}, OAUTH_TIMEOUT_MILLIS);
|
|
645
|
+
this.serverController.signal.addEventListener("abort", () => {
|
|
646
|
+
clearTimeout(serverTimeout);
|
|
647
|
+
});
|
|
648
|
+
serve(this.app, {
|
|
649
|
+
port: 1270,
|
|
650
|
+
silent: true,
|
|
651
|
+
node: {
|
|
652
|
+
signal: this.serverController.signal
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
this.codeVerifier = crypto.getRandomValues(Buffer.alloc(32)).toString("base64url");
|
|
656
|
+
const codeChallenge = Buffer.from(
|
|
657
|
+
await crypto.subtle.digest(
|
|
658
|
+
"SHA-256",
|
|
659
|
+
Buffer.from(this.codeVerifier, "ascii")
|
|
660
|
+
)
|
|
661
|
+
).toString("base64url");
|
|
662
|
+
const url = new URL("/oauth/authorize", CONSOLE_URL);
|
|
663
|
+
url.searchParams.set("client_id", OAUTH_CLIENT_ID);
|
|
664
|
+
url.searchParams.set("redirect_uri", "http://127.0.0.1:1270/oauth/mcp");
|
|
665
|
+
url.searchParams.set("response_type", "code");
|
|
666
|
+
url.searchParams.set(
|
|
667
|
+
"scope",
|
|
668
|
+
[
|
|
669
|
+
"HOME_AND_REPORT",
|
|
670
|
+
"CHANNEL_READ",
|
|
671
|
+
"CHANNEL_UPDATE",
|
|
672
|
+
"STORE_READ",
|
|
673
|
+
"MERCHANT_READ"
|
|
674
|
+
].join(" ")
|
|
675
|
+
);
|
|
676
|
+
url.searchParams.set("code_challenge", codeChallenge);
|
|
677
|
+
url.searchParams.set("code_challenge_method", "S256");
|
|
678
|
+
await open(url.toString());
|
|
679
|
+
return {
|
|
680
|
+
state: "loginRequired",
|
|
681
|
+
url
|
|
682
|
+
};
|
|
683
|
+
} else {
|
|
684
|
+
return {
|
|
685
|
+
state: "authorized",
|
|
686
|
+
authorization: `${this.token.tokenType} ${this.token.access}`
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
async function getToken(tokenProvider) {
|
|
692
|
+
const state = await tokenProvider.getToken();
|
|
693
|
+
return match4(state).returnType().with(
|
|
694
|
+
{
|
|
695
|
+
state: "loginRequired"
|
|
696
|
+
},
|
|
697
|
+
({ url }) => ({
|
|
698
|
+
type: "error",
|
|
699
|
+
data: {
|
|
700
|
+
message: `\uB85C\uADF8\uC778\uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \uBE0C\uB77C\uC6B0\uC800\uC5D0\uC11C \uB85C\uADF8\uC778\uC744 \uC9C4\uD589\uD574\uC8FC\uC138\uC694. \uBE0C\uB77C\uC6B0\uC800\uAC00 \uC5F4\uB9AC\uC9C0 \uC54A\uC73C\uBA74 ${url} \uC5D0 \uC9C1\uC811 \uC811\uC18D\uD574\uC11C \uB85C\uADF8\uC778\uC744 \uC9C4\uD589\uD574\uC8FC\uC138\uC694.`
|
|
701
|
+
}
|
|
702
|
+
})
|
|
703
|
+
).with(
|
|
704
|
+
{
|
|
705
|
+
state: "authorized"
|
|
706
|
+
},
|
|
707
|
+
({ authorization }) => ({
|
|
708
|
+
type: "success",
|
|
709
|
+
data: authorization
|
|
710
|
+
})
|
|
711
|
+
).exhaustive();
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// src/tools/utils/result.ts
|
|
715
|
+
function toolErrorResult(error) {
|
|
716
|
+
return {
|
|
717
|
+
content: [
|
|
718
|
+
{
|
|
719
|
+
type: "text",
|
|
720
|
+
text: JSON.stringify(error.data, null, 2)
|
|
721
|
+
}
|
|
722
|
+
],
|
|
723
|
+
isError: true
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// src/tools/addTestChannel.ts
|
|
728
|
+
var name = "addTestChannel";
|
|
729
|
+
var InputSchema = z5.object({
|
|
730
|
+
mid: z5.string().describe("\uD14C\uC2A4\uD2B8 \uCC44\uB110\uC758 PG\uC0AC MID"),
|
|
731
|
+
manualConfirm: z5.boolean().optional().default(false).describe("\uC218\uB3D9 \uC2B9\uC778 \uC0AC\uC6A9 \uC5EC\uBD80")
|
|
732
|
+
});
|
|
733
|
+
var OutputSchema = z5.object({
|
|
734
|
+
channelKey: z5.string().describe("\uCD94\uAC00\uB41C \uCC44\uB110\uC758 \uCC44\uB110\uD0A4")
|
|
735
|
+
});
|
|
736
|
+
var config = {
|
|
737
|
+
title: "\uD3EC\uD2B8\uC6D0 \uD14C\uC2A4\uD2B8 \uCC44\uB110 \uCD94\uAC00",
|
|
738
|
+
description: `\uACE0\uAC1D\uC0AC\uC758 \uB300\uD45C\uC0C1\uC810\uC5D0 \uACF5\uC6A9 \uD14C\uC2A4\uD2B8 \uCC44\uB110\uC744 \uCD94\uAC00\uD569\uB2C8\uB2E4.
|
|
739
|
+
|
|
740
|
+
NOTE:
|
|
741
|
+
\uBC18\uB4DC\uC2DC listSharedTestChannels\uB97C \uD1B5\uD574 \uC5BB\uC740 MID\uB97C \uC0AC\uC6A9\uD558\uC138\uC694.`,
|
|
742
|
+
inputSchema: InputSchema.shape,
|
|
743
|
+
outputSchema: OutputSchema.shape
|
|
744
|
+
};
|
|
745
|
+
function init(tokenProvider, client) {
|
|
746
|
+
return async ({ mid, manualConfirm }) => {
|
|
747
|
+
const token = await getToken(tokenProvider);
|
|
748
|
+
if (token.type === "error") {
|
|
749
|
+
return toolErrorResult(token);
|
|
750
|
+
}
|
|
751
|
+
const authorization = token.data;
|
|
752
|
+
const stores = await listStores({
|
|
753
|
+
client,
|
|
754
|
+
authorization
|
|
755
|
+
});
|
|
756
|
+
if (stores.type === "error") {
|
|
757
|
+
return toolErrorResult(stores);
|
|
758
|
+
}
|
|
759
|
+
const storeId = stores.data.main?.plainId;
|
|
760
|
+
if (storeId == null) {
|
|
427
761
|
return {
|
|
428
762
|
content: [
|
|
429
763
|
{
|
|
430
764
|
type: "text",
|
|
431
|
-
text:
|
|
765
|
+
text: "\uB300\uD45C\uC0C1\uC810 \uC815\uBCF4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
432
766
|
}
|
|
433
767
|
],
|
|
434
|
-
|
|
768
|
+
isError: true
|
|
435
769
|
};
|
|
436
|
-
}
|
|
770
|
+
}
|
|
771
|
+
const list = await listV2SharedTestChannel({
|
|
772
|
+
authorization
|
|
773
|
+
});
|
|
774
|
+
if (list.type === "error") {
|
|
775
|
+
return toolErrorResult(list);
|
|
776
|
+
}
|
|
777
|
+
const channelToAdd = list.data.channels.find(
|
|
778
|
+
({ pgMerchantId }) => pgMerchantId === mid
|
|
779
|
+
);
|
|
780
|
+
if (channelToAdd == null) {
|
|
437
781
|
return {
|
|
438
782
|
content: [
|
|
439
783
|
{
|
|
440
784
|
type: "text",
|
|
441
|
-
text:
|
|
785
|
+
text: `${mid}\uC5D0 \uD574\uB2F9\uD558\uB294 \uD14C\uC2A4\uD2B8 \uCC44\uB110 \uC815\uBCF4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.`
|
|
442
786
|
}
|
|
443
787
|
],
|
|
444
788
|
isError: true
|
|
445
789
|
};
|
|
446
790
|
}
|
|
791
|
+
const add = await addChannel({
|
|
792
|
+
authorization,
|
|
793
|
+
channelType: "TEST",
|
|
794
|
+
manualConfirm,
|
|
795
|
+
...channelToAdd,
|
|
796
|
+
storeId
|
|
797
|
+
});
|
|
798
|
+
if (add.type === "error") {
|
|
799
|
+
return toolErrorResult(add);
|
|
800
|
+
}
|
|
801
|
+
const structuredContent = add.data.channel;
|
|
802
|
+
return {
|
|
803
|
+
content: [
|
|
804
|
+
{
|
|
805
|
+
type: "text",
|
|
806
|
+
text: JSON.stringify(structuredContent, null, 2)
|
|
807
|
+
}
|
|
808
|
+
],
|
|
809
|
+
structuredContent
|
|
810
|
+
};
|
|
447
811
|
};
|
|
448
812
|
}
|
|
449
813
|
|
|
450
|
-
// src/tools/
|
|
451
|
-
var
|
|
452
|
-
__export(
|
|
814
|
+
// src/tools/getChannelsOfStore.ts
|
|
815
|
+
var getChannelsOfStore_exports = {};
|
|
816
|
+
__export(getChannelsOfStore_exports, {
|
|
453
817
|
config: () => config2,
|
|
454
818
|
init: () => init2,
|
|
455
819
|
name: () => name2
|
|
456
820
|
});
|
|
457
|
-
import
|
|
821
|
+
import z7 from "zod";
|
|
458
822
|
|
|
459
|
-
// src/tools/
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
)
|
|
823
|
+
// src/tools/request/listChannels.ts
|
|
824
|
+
import { match as match5, P as P4 } from "ts-pattern";
|
|
825
|
+
import z6 from "zod";
|
|
826
|
+
var StatusResponse3 = z6.object({
|
|
827
|
+
code: z6.unknown(),
|
|
828
|
+
message: z6.string(),
|
|
829
|
+
details: z6.unknown()
|
|
830
|
+
}).partial();
|
|
831
|
+
var ChannelResponse = z6.object({
|
|
832
|
+
channelId: z6.string(),
|
|
833
|
+
pgProvider: z6.string(),
|
|
834
|
+
channelType: z6.string(),
|
|
835
|
+
liveChannel: z6.object({
|
|
836
|
+
merchantId: z6.string(),
|
|
837
|
+
storeIds: z6.array(z6.string())
|
|
838
|
+
}).optional(),
|
|
839
|
+
merchantTestChannel: z6.object({
|
|
840
|
+
merchantId: z6.string()
|
|
841
|
+
}).optional(),
|
|
842
|
+
channelName: z6.string(),
|
|
843
|
+
pgMerchantId: z6.string(),
|
|
844
|
+
isForPayment: z6.boolean(),
|
|
845
|
+
isForIdentityCertification: z6.boolean(),
|
|
846
|
+
isFromV1UserPgs: z6.boolean(),
|
|
847
|
+
isFromV1SbcrUsers: z6.boolean(),
|
|
848
|
+
deleted: z6.boolean(),
|
|
849
|
+
boundAt: z6.string(),
|
|
850
|
+
modifiedAt: z6.string(),
|
|
851
|
+
taxType: z6.string().optional(),
|
|
852
|
+
channelKey: z6.string(),
|
|
853
|
+
pgCompany: z6.string(),
|
|
854
|
+
isSupportingV2: z6.boolean(),
|
|
855
|
+
manualConfirm: z6.boolean()
|
|
856
|
+
});
|
|
857
|
+
var ListChannelsResponse = z6.object({
|
|
858
|
+
channels: z6.array(ChannelResponse)
|
|
859
|
+
});
|
|
860
|
+
async function listChannels({
|
|
861
|
+
storeId,
|
|
862
|
+
authorization
|
|
863
|
+
}) {
|
|
864
|
+
try {
|
|
865
|
+
const url = new URL("/v2/channels", CHANNEL_SERVICE_URL);
|
|
866
|
+
url.searchParams.set("storeId", storeId);
|
|
867
|
+
const response = await fetch(url, {
|
|
868
|
+
method: "GET",
|
|
869
|
+
headers: {
|
|
870
|
+
Authorization: authorization,
|
|
871
|
+
"User-Agent": USER_AGENT
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
const text = await response.text();
|
|
875
|
+
try {
|
|
876
|
+
const parsed = await ListChannelsResponse.or(StatusResponse3).parseAsync(
|
|
877
|
+
JSON.parse(text)
|
|
878
|
+
);
|
|
879
|
+
return match5(parsed).returnType().with({ channels: P4.nonNullable }, (success) => ({
|
|
880
|
+
type: "success",
|
|
881
|
+
data: success
|
|
882
|
+
})).otherwise(({ code, message, details }) => ({
|
|
883
|
+
type: "error",
|
|
884
|
+
data: {
|
|
885
|
+
message: message ?? "\uC0C1\uC810\uC758 \uCC44\uB110 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.",
|
|
886
|
+
code,
|
|
887
|
+
details,
|
|
888
|
+
status: response.status
|
|
889
|
+
}
|
|
890
|
+
}));
|
|
891
|
+
} catch (parseError) {
|
|
892
|
+
return {
|
|
893
|
+
type: "error",
|
|
894
|
+
data: {
|
|
895
|
+
message: "\uC62C\uBC14\uB974\uC9C0 \uC54A\uC740 \uD615\uC2DD\uC758 \uC11C\uBC84 \uC751\uB2F5",
|
|
896
|
+
cause: parseError
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
} catch (error) {
|
|
901
|
+
if (error instanceof Error) {
|
|
902
|
+
return {
|
|
903
|
+
type: "error",
|
|
904
|
+
data: error
|
|
905
|
+
};
|
|
906
|
+
} else {
|
|
907
|
+
return {
|
|
908
|
+
type: "error",
|
|
909
|
+
data: {
|
|
910
|
+
message: "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.",
|
|
911
|
+
cause: error
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
}
|
|
464
916
|
}
|
|
465
917
|
|
|
466
|
-
// src/tools/
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
918
|
+
// src/tools/utils/filterFields.ts
|
|
919
|
+
function filterFields(fields, data) {
|
|
920
|
+
const withPrefixes = new Set(fields);
|
|
921
|
+
for (const field of fields) {
|
|
922
|
+
let searchPos = 0;
|
|
923
|
+
while (true) {
|
|
924
|
+
const dot = field.indexOf(".", searchPos);
|
|
925
|
+
if (dot === -1) break;
|
|
926
|
+
withPrefixes.add(field.slice(0, dot));
|
|
927
|
+
searchPos = dot + 1;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
return filterFieldsPath(data, "");
|
|
931
|
+
function filterFieldsPath(data2, currentPath) {
|
|
932
|
+
return Object.fromEntries(
|
|
933
|
+
Object.entries(data2).flatMap(([key, value]) => {
|
|
934
|
+
const childPath = currentPath === "" ? key : `${currentPath}.${key}`;
|
|
935
|
+
if (withPrefixes.has(childPath)) {
|
|
936
|
+
if (Array.isArray(value)) {
|
|
937
|
+
return [
|
|
938
|
+
[
|
|
939
|
+
key,
|
|
940
|
+
value.map(
|
|
941
|
+
(item) => typeof item === "object" ? filterFieldsPath(item, childPath) : item
|
|
942
|
+
)
|
|
943
|
+
]
|
|
944
|
+
];
|
|
945
|
+
} else if (typeof value === "object") {
|
|
946
|
+
return [[key, filterFieldsPath(value, childPath)]];
|
|
947
|
+
} else {
|
|
948
|
+
return [[key, value]];
|
|
949
|
+
}
|
|
950
|
+
} else {
|
|
951
|
+
return [];
|
|
952
|
+
}
|
|
953
|
+
})
|
|
954
|
+
);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// src/tools/getChannelsOfStore.ts
|
|
959
|
+
var name2 = "getChannelsOfStore";
|
|
960
|
+
var Channel = z7.object({
|
|
961
|
+
id: z7.string().describe(
|
|
962
|
+
"\uCC44\uB110 ID\uB85C \uCC44\uB110 \uC218\uC815 \uC2DC\uB9C8\uB2E4 \uBCC0\uACBD\uB429\uB2C8\uB2E4. \uBAA8\uB4E0 \uACB0\uC81C\uAC74\uC740 \uCC44\uB110 ID\uC640 \uD5A0\uAED8 \uC800\uC7A5\uB418\uC5B4 \uCC44\uB110 \uC218\uC815 \uD6C4\uC5D0\uB3C4 \uC774\uC804 ID\uB97C \uC720\uC9C0\uD569\uB2C8\uB2E4."
|
|
963
|
+
),
|
|
964
|
+
pg: z7.string().describe(
|
|
965
|
+
"PG\uC0AC \uACB0\uC81C \uBAA8\uB4C8\uC758 \uC2DD\uBCC4\uC790\uB85C, PG\uC0AC\uBCC4\uB85C \uC5EC\uB7EC \uBAA8\uB4C8\uC774 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4."
|
|
966
|
+
),
|
|
967
|
+
mid: z7.string().describe("PG\uC0AC\uC5D0\uC11C \uACE0\uAC1D\uC0AC\uB97C \uAD6C\uBD84\uD558\uAE30 \uC704\uD55C ID"),
|
|
968
|
+
name: z7.string().describe("\uCC44\uB110\uBA85"),
|
|
969
|
+
usage: z7.array(z7.enum(["PAYMENT", "IDENTITY"])).describe("\uCC44\uB110\uC744 \uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uC6A9\uB3C4"),
|
|
970
|
+
createdAt: z7.string().describe("\uC0DD\uC131 \uC2DC\uAC01"),
|
|
971
|
+
modifiedAt: z7.string().describe("\uB9C8\uC9C0\uB9C9 \uC218\uC815 \uC2DC\uAC01"),
|
|
972
|
+
taxType: z7.string().describe("\uC815\uC0B0 \uC2DC\uC5D0\uB9CC \uCC38\uACE0\uD558\uB294, MID\uC758 \uACFC\uC138 \uC815\uBCF4"),
|
|
973
|
+
key: z7.string().describe("\uCC44\uB110 \uD0A4"),
|
|
974
|
+
canV2: z7.boolean().describe("V2 \uC0AC\uC6A9 \uAC00\uB2A5 \uC5EC\uBD80"),
|
|
975
|
+
manualConfirm: z7.boolean().describe("\uC218\uB3D9 \uC2B9\uC778 (2-transaction) \uC0AC\uC6A9 \uC5EC\uBD80")
|
|
976
|
+
}).partial();
|
|
977
|
+
var InputSchema2 = z7.object({
|
|
978
|
+
store: z7.string().describe("\uCC44\uB110\uC744 \uAC80\uC0C9\uD560 \uC0C1\uC810\uC544\uC774\uB514"),
|
|
979
|
+
fields: Channel.keyof().array().describe("\uACB0\uACFC\uB85C \uBC1B\uC744 \uCC44\uB110 \uC815\uBCF4 \uBAA9\uB85D")
|
|
980
|
+
});
|
|
981
|
+
var OutputSchema2 = z7.object({
|
|
982
|
+
items: Channel.array().describe("\uC870\uD68C\uB41C \uCC44\uB110 \uBAA9\uB85D")
|
|
983
|
+
});
|
|
476
984
|
var config2 = {
|
|
477
|
-
title: "\uD3EC\uD2B8\uC6D0 \
|
|
478
|
-
description:
|
|
985
|
+
title: "\uD3EC\uD2B8\uC6D0 \uC0C1\uC810 \uB0B4 \uCC44\uB110 \uBAA9\uB85D \uC870\uD68C",
|
|
986
|
+
description: "\uACE0\uAC1D\uC0AC\uC758 \uC0C1\uC810\uC5D0 \uC874\uC7AC\uD558\uB294 \uBAA8\uB4E0 \uCC44\uB110 \uC815\uBCF4\uB97C \uAC00\uC838\uC635\uB2C8\uB2E4.",
|
|
987
|
+
inputSchema: InputSchema2.shape,
|
|
988
|
+
outputSchema: OutputSchema2.shape
|
|
989
|
+
};
|
|
990
|
+
function init2(tokenProvider) {
|
|
991
|
+
return async ({ store, fields }) => {
|
|
992
|
+
const token = await getToken(tokenProvider);
|
|
993
|
+
if (token.type === "error") {
|
|
994
|
+
return toolErrorResult(token);
|
|
995
|
+
}
|
|
996
|
+
const list = await listChannels({
|
|
997
|
+
storeId: store,
|
|
998
|
+
authorization: token.data
|
|
999
|
+
});
|
|
1000
|
+
if (list.type === "error") {
|
|
1001
|
+
return toolErrorResult(list);
|
|
1002
|
+
}
|
|
1003
|
+
const channels = list.data.channels.filter(({ deleted }) => !deleted).map(
|
|
1004
|
+
({
|
|
1005
|
+
channelId,
|
|
1006
|
+
pgProvider,
|
|
1007
|
+
pgMerchantId,
|
|
1008
|
+
channelName,
|
|
1009
|
+
isForPayment,
|
|
1010
|
+
isForIdentityCertification,
|
|
1011
|
+
boundAt,
|
|
1012
|
+
modifiedAt,
|
|
1013
|
+
taxType,
|
|
1014
|
+
channelKey,
|
|
1015
|
+
isSupportingV2,
|
|
1016
|
+
manualConfirm
|
|
1017
|
+
}) => {
|
|
1018
|
+
const usage = [];
|
|
1019
|
+
if (isForPayment) usage.push("PAYMENT");
|
|
1020
|
+
if (isForIdentityCertification) usage.push("IDENTITY");
|
|
1021
|
+
return {
|
|
1022
|
+
id: channelId,
|
|
1023
|
+
pg: pgProvider,
|
|
1024
|
+
mid: pgMerchantId,
|
|
1025
|
+
name: channelName,
|
|
1026
|
+
usage,
|
|
1027
|
+
createdAt: boundAt,
|
|
1028
|
+
modifiedAt,
|
|
1029
|
+
taxType,
|
|
1030
|
+
key: channelKey,
|
|
1031
|
+
canV2: isSupportingV2,
|
|
1032
|
+
manualConfirm
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
);
|
|
1036
|
+
const structuredContent = {
|
|
1037
|
+
items: channels.map((item) => filterFields(fields, item))
|
|
1038
|
+
};
|
|
1039
|
+
return {
|
|
1040
|
+
content: [
|
|
1041
|
+
{
|
|
1042
|
+
type: "text",
|
|
1043
|
+
text: JSON.stringify(structuredContent, null, 2)
|
|
1044
|
+
}
|
|
1045
|
+
],
|
|
1046
|
+
structuredContent
|
|
1047
|
+
};
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
// src/tools/getDocsUrl.ts
|
|
1052
|
+
var getDocsUrl_exports = {};
|
|
1053
|
+
__export(getDocsUrl_exports, {
|
|
1054
|
+
config: () => config3,
|
|
1055
|
+
init: () => init3,
|
|
1056
|
+
name: () => name3
|
|
1057
|
+
});
|
|
1058
|
+
import z8 from "zod";
|
|
1059
|
+
|
|
1060
|
+
// src/tools/utils/docPathToUrl.ts
|
|
1061
|
+
function docPathToUrl(path) {
|
|
1062
|
+
if (path.startsWith("help/")) {
|
|
1063
|
+
return `${HELP_CENTER_URL}/category/${path.slice(5)}`;
|
|
1064
|
+
}
|
|
1065
|
+
return `${DEVELOPERS_URL}/${path}`;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
// src/tools/getDocsUrl.ts
|
|
1069
|
+
var name3 = "getPortoneDocsUrl";
|
|
1070
|
+
var OutputSchema3 = z8.object({
|
|
1071
|
+
url: z8.string().array().describe(
|
|
1072
|
+
"\uBB38\uC11C\uB97C \uC6F9\uC73C\uB85C \uC811\uADFC \uAC00\uB2A5\uD55C \uB9C1\uD06C\uAC00 \uC785\uB825\uD55C \uBB38\uC11C \uC21C\uC11C\uB300\uB85C \uC8FC\uC5B4\uC9D1\uB2C8\uB2E4."
|
|
1073
|
+
)
|
|
1074
|
+
});
|
|
1075
|
+
var config3 = {
|
|
1076
|
+
title: "\uD3EC\uD2B8\uC6D0 \uBB38\uC11C \uC6F9 \uB9C1\uD06C \uC870\uD68C",
|
|
1077
|
+
description: `\uD3EC\uD2B8\uC6D0 \uAC1C\uBCC4 \uBB38\uC11C\uB4E4\uC758 \uACBD\uB85C\uB97C \uD1B5\uD574 \uD574\uB2F9 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uC758 \uC6F9\uC73C\uB85C \uC811\uADFC \uAC00\uB2A5\uD55C \uB9C1\uD06C\uB97C \uAC00\uC838\uC635\uB2C8\uB2E4.
|
|
479
1078
|
|
|
480
1079
|
Note:
|
|
481
|
-
\
|
|
482
|
-
|
|
483
|
-
\uB0A0\uC9DC \uBC0F \uC2DC\uAC04 \uC815\uBCF4 \uC785\uCD9C\uB825 \uC2DC\uC5D0\uB294 \uBC18\uB4DC\uC2DC \uD0C0\uC784\uC874\uC744 \uBA85\uC2DC\uD569\uB2C8\uB2E4.`,
|
|
1080
|
+
\uBB38\uC11C\uAC00 1\uAC1C\uBFD0\uC778 \uACBD\uC6B0\uC5D0\uB294 readPortoneDoc\uC744 \uC0AC\uC6A9\uD558\uBA74 \uBB38\uC11C \uB0B4\uC6A9\uACFC \uBA54\uD0C0 \uC815\uBCF4\uB3C4 \uD68D\uB4DD\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.
|
|
1081
|
+
getPortoneDocsUrl\uC740 \uC5EC\uB7EC \uBB38\uC11C\uC758 \uB9C1\uD06C\uB97C \uAC00\uC838\uC62C \uC218 \uC788\uC2B5\uB2C8\uB2E4.`,
|
|
484
1082
|
inputSchema: {
|
|
485
|
-
|
|
486
|
-
untilTime: z3.string().datetime({ offset: true }).describe("\uC870\uD68C \uC885\uB8CC \uC2DC\uAC04 (ISO 8601 \uD615\uC2DD)"),
|
|
487
|
-
pageIndex: z3.number().min(0).describe("\uAC80\uC0C9\uD560 \uD398\uC774\uC9C0 \uC704\uCE58\uC785\uB2C8\uB2E4. 0\uBD80\uD130 \uC2DC\uC791\uD569\uB2C8\uB2E4."),
|
|
488
|
-
pageSize: z3.number().min(1).default(10).describe("\uD55C \uD398\uC774\uC9C0\uC5D0 \uBC18\uD658\uD560 \uACB0\uACFC\uC758 \uC218\uC785\uB2C8\uB2E4."),
|
|
489
|
-
fields: z3.array(IdentityVerificationField).describe("\uAC80\uC0C9 \uACB0\uACFC\uB85C \uBC1B\uC744 \uD544\uB4DC \uBAA9\uB85D\uC785\uB2C8\uB2E4."),
|
|
490
|
-
timestampType: IdentityVerificationTimeStamp.default(
|
|
491
|
-
"STATUS_UPDATED_AT"
|
|
492
|
-
).describe(`\uC870\uD68C \uBC94\uC704\uC758 \uAE30\uC900\uC774 \uBCF8\uC778\uC778\uC99D\uC744 \uCC98\uC74C \uC2DC\uB3C4\uD55C \uC2DC\uAC01\uC774\uBA74 "REQUESTED_AT",
|
|
493
|
-
\uBCF8\uC778\uC778\uC99D\uC774 \uC644\uB8CC\uB41C \uC2DC\uAC01\uC774\uBA74 "VERIFIED_AT", \uC2E4\uD328\uD55C \uC2DC\uAC01\uC774\uBA74 "FAILED_AT",
|
|
494
|
-
\uB9C8\uC9C0\uB9C9\uC73C\uB85C \uC0C1\uD0DC\uAC00 \uBCC0\uACBD\uB41C \uC2DC\uAC01\uC774\uBA74 "STATUS_UPDATED_AT"\uC785\uB2C8\uB2E4.`),
|
|
495
|
-
storeId: z3.string().optional().describe(
|
|
496
|
-
"\uD558\uC704 \uC0C1\uC810\uC744 \uD3EC\uD568\uD55C \uD2B9\uC815 \uC0C1\uC810\uC758 \uC778\uC99D \uAC74\uB9CC\uC744 \uC870\uD68C\uD560 \uACBD\uC6B0\uC5D0\uB9CC \uC785\uB825\uD569\uB2C8\uB2E4. `store-id-{uuid}` \uD615\uC2DD\uC785\uB2C8\uB2E4."
|
|
497
|
-
),
|
|
498
|
-
status: z3.array(IdentityVerificationStatus).optional().describe("\uD3EC\uD568\uD560 \uBCF8\uC778\uC778\uC99D \uC0C1\uD0DC \uBAA9\uB85D\uC785\uB2C8\uB2E4."),
|
|
499
|
-
pgProvider: z3.array(PgProviderSchema).optional().describe("\uBCF8\uC778\uC778\uC99D\uC774 \uC77C\uC5B4\uB09C \uACB0\uC81C\uB300\uD589\uC0AC \uBAA9\uB85D\uC785\uB2C8\uB2E4."),
|
|
500
|
-
version: z3.enum(["V1", "V2"]).optional().describe("\uD3EC\uD568\uD560 \uD3EC\uD2B8\uC6D0 \uBC84\uC804\uC785\uB2C8\uB2E4. \uBBF8\uC785\uB825 \uC2DC \uBAA8\uB450 \uAC80\uC0C9\uB429\uB2C8\uB2E4."),
|
|
501
|
-
carrier: z3.array(Carrier).optional().describe("\uD3EC\uD568\uD560 \uD1B5\uC2E0\uC0AC \uBAA9\uB85D\uC785\uB2C8\uB2E4. MVNO\uB294 \uC54C\uB730\uD3F0\uC744 \uB73B\uD569\uB2C8\uB2E4."),
|
|
502
|
-
customerName: z3.string().optional().describe("\uBC1C\uAE09\uC790\uC758 \uC131\uBA85 \uC77C\uBD80\uBD84\uC785\uB2C8\uB2E4."),
|
|
503
|
-
pgMerchantId: z3.string().optional().describe("\uACB0\uC81C\uB300\uD589\uC0AC\uC5D0\uC11C \uC81C\uACF5\uD55C \uC0C1\uC810\uC544\uC774\uB514 (MID) \uC77C\uBD80\uBD84\uC785\uB2C8\uB2E4."),
|
|
504
|
-
isTest: z3.boolean().default(true).describe(
|
|
505
|
-
"\uD14C\uC2A4\uD2B8 \uC778\uC99D \uAC74\uC744 \uD3EC\uD568\uD560\uC9C0 \uC5EC\uBD80\uC785\uB2C8\uB2E4. \uBBF8\uC785\uB825 \uC2DC `true`\uC785\uB2C8\uB2E4."
|
|
506
|
-
)
|
|
1083
|
+
path: z8.string().array().describe("\uC77D\uC744 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uB4E4\uC758 \uACBD\uB85C \uBAA9\uB85D")
|
|
507
1084
|
},
|
|
508
|
-
outputSchema:
|
|
509
|
-
items: z3.array(z3.object({}).passthrough()).describe("\uC870\uD68C\uB41C \uBCF8\uC778\uC778\uC99D \uAC74\uC758 \uBAA9\uB85D"),
|
|
510
|
-
totalCount: z3.number().describe("\uC870\uAC74\uC5D0 \uB9DE\uB294 \uBCF8\uC778\uC778\uC99D \uAC74\uC758 \uCD1D \uAC1C\uC218")
|
|
511
|
-
}
|
|
1085
|
+
outputSchema: OutputSchema3.shape
|
|
512
1086
|
};
|
|
513
|
-
function
|
|
514
|
-
return
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
carrier,
|
|
525
|
-
customerName,
|
|
526
|
-
version,
|
|
527
|
-
pgMerchantId,
|
|
528
|
-
isTest
|
|
529
|
-
}) => {
|
|
530
|
-
const searchFilter = filterOutNone({
|
|
531
|
-
from: fromTime,
|
|
532
|
-
until: untilTime,
|
|
533
|
-
timeRangeField: timestampType,
|
|
534
|
-
storeId,
|
|
535
|
-
statuses: status,
|
|
536
|
-
pgProviders: pgProvider,
|
|
537
|
-
version,
|
|
538
|
-
carriers: carrier,
|
|
539
|
-
pgMerchantId,
|
|
540
|
-
isTest,
|
|
541
|
-
customer: filterOutNone({
|
|
542
|
-
name: customerName
|
|
543
|
-
})
|
|
544
|
-
});
|
|
545
|
-
const response = await httpClient.get(
|
|
546
|
-
`/identity-verifications?requestBody=${encodeURIComponent(
|
|
547
|
-
JSON.stringify({
|
|
548
|
-
filter: searchFilter,
|
|
549
|
-
page: {
|
|
550
|
-
number: pageIndex,
|
|
551
|
-
size: pageSize
|
|
552
|
-
}
|
|
553
|
-
})
|
|
554
|
-
)}`
|
|
555
|
-
);
|
|
556
|
-
if (!response.ok) {
|
|
557
|
-
const text = await response.text();
|
|
558
|
-
return { content: [{ type: "text", text }], isError: true };
|
|
1087
|
+
function init3(documents) {
|
|
1088
|
+
return ({ path: paths }) => {
|
|
1089
|
+
const { markdownDocs } = documents;
|
|
1090
|
+
const found = [];
|
|
1091
|
+
const notFound = [];
|
|
1092
|
+
for (const path of paths) {
|
|
1093
|
+
if (path in markdownDocs) {
|
|
1094
|
+
found.push(docPathToUrl(markdownDocs[path].path));
|
|
1095
|
+
} else {
|
|
1096
|
+
notFound.push(path);
|
|
1097
|
+
}
|
|
559
1098
|
}
|
|
560
|
-
|
|
561
|
-
const data = await response.json();
|
|
562
|
-
const maskedItems = filterFields(fields, data.items);
|
|
563
|
-
const structuredContent = {
|
|
564
|
-
items: maskedItems,
|
|
565
|
-
totalCount: data.page.totalCount
|
|
566
|
-
};
|
|
1099
|
+
if (notFound.length > 0) {
|
|
567
1100
|
return {
|
|
568
1101
|
content: [
|
|
569
1102
|
{
|
|
570
1103
|
type: "text",
|
|
571
|
-
text:
|
|
1104
|
+
text: `Document not found at paths: ${notFound}`
|
|
572
1105
|
}
|
|
573
1106
|
],
|
|
574
|
-
structuredContent
|
|
575
|
-
};
|
|
576
|
-
} catch {
|
|
577
|
-
return {
|
|
578
|
-
content: [{ type: "text", text: "\uC11C\uBC84\uB85C\uBD80\uD130 \uC798\uBABB\uB41C \uC751\uB2F5 \uC218\uC2E0" }],
|
|
579
1107
|
isError: true
|
|
580
1108
|
};
|
|
581
1109
|
}
|
|
1110
|
+
const structuredContent = {
|
|
1111
|
+
url: found
|
|
1112
|
+
};
|
|
1113
|
+
return {
|
|
1114
|
+
content: [
|
|
1115
|
+
{
|
|
1116
|
+
type: "text",
|
|
1117
|
+
text: JSON.stringify(structuredContent, null, 2)
|
|
1118
|
+
}
|
|
1119
|
+
],
|
|
1120
|
+
structuredContent
|
|
1121
|
+
};
|
|
582
1122
|
};
|
|
583
1123
|
}
|
|
584
1124
|
|
|
585
|
-
// src/tools/
|
|
586
|
-
var
|
|
587
|
-
__export(
|
|
588
|
-
config: () =>
|
|
589
|
-
init: () =>
|
|
590
|
-
name: () =>
|
|
1125
|
+
// src/tools/getPaymentsByFilter.ts
|
|
1126
|
+
var getPaymentsByFilter_exports = {};
|
|
1127
|
+
__export(getPaymentsByFilter_exports, {
|
|
1128
|
+
config: () => config4,
|
|
1129
|
+
init: () => init4,
|
|
1130
|
+
name: () => name4
|
|
591
1131
|
});
|
|
592
|
-
import
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
1132
|
+
import z10 from "zod";
|
|
1133
|
+
|
|
1134
|
+
// src/tools/request/getPaymentsByFilter.ts
|
|
1135
|
+
import { parse as parse2 } from "graphql";
|
|
1136
|
+
import { gql as gql2 } from "graphql-request";
|
|
1137
|
+
import { match as match6, P as P5 } from "ts-pattern";
|
|
1138
|
+
import z9 from "zod";
|
|
1139
|
+
|
|
1140
|
+
// src/tools/utils/nullableObject.ts
|
|
1141
|
+
function nullableObject(shape) {
|
|
1142
|
+
return Object.fromEntries(
|
|
1143
|
+
Object.entries(shape).map(([key, value]) => [key, value.nullable()])
|
|
1144
|
+
);
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
// src/tools/request/getPaymentsByFilter.ts
|
|
1148
|
+
var ErrorResponse2 = z9.object({
|
|
1149
|
+
__typename: z9.string(),
|
|
1150
|
+
message: z9.string().nullable()
|
|
1151
|
+
});
|
|
1152
|
+
var PageResponse = z9.object({
|
|
1153
|
+
totalCount: z9.number()
|
|
1154
|
+
});
|
|
1155
|
+
var PaymentResponse = z9.object(
|
|
1156
|
+
nullableObject({
|
|
1157
|
+
amount: z9.object(
|
|
1158
|
+
nullableObject({
|
|
1159
|
+
total: z9.number(),
|
|
1160
|
+
taxFree: z9.number(),
|
|
1161
|
+
vat: z9.number(),
|
|
1162
|
+
supply: z9.number(),
|
|
1163
|
+
discount: z9.number(),
|
|
1164
|
+
paid: z9.number(),
|
|
1165
|
+
cancelled: z9.number(),
|
|
1166
|
+
cancelledTaxFree: z9.number(),
|
|
1167
|
+
cardDiscount: z9.number(),
|
|
1168
|
+
easyPayDiscount: z9.number(),
|
|
1169
|
+
promotionDiscount: z9.number(),
|
|
1170
|
+
currentDiscount: z9.number(),
|
|
1171
|
+
cancellable: z9.number()
|
|
1172
|
+
})
|
|
1173
|
+
),
|
|
1174
|
+
billingKey: z9.string(),
|
|
1175
|
+
channel: z9.object(
|
|
1176
|
+
nullableObject({
|
|
1177
|
+
type: z9.string(),
|
|
1178
|
+
id: z9.string(),
|
|
1179
|
+
key: z9.string(),
|
|
1180
|
+
name: z9.string(),
|
|
1181
|
+
pgProvider: z9.string(),
|
|
1182
|
+
pgMerchantId: z9.string()
|
|
1183
|
+
})
|
|
1184
|
+
),
|
|
1185
|
+
channelGroup: z9.object(
|
|
1186
|
+
nullableObject({
|
|
1187
|
+
plainId: z9.string(),
|
|
1188
|
+
name: z9.string(),
|
|
1189
|
+
isForTest: z9.boolean()
|
|
1190
|
+
})
|
|
1191
|
+
),
|
|
1192
|
+
currency: z9.string(),
|
|
1193
|
+
customer: z9.object(
|
|
1194
|
+
nullableObject({
|
|
1195
|
+
id: z9.string()
|
|
1196
|
+
})
|
|
1197
|
+
),
|
|
1198
|
+
histories: z9.array(
|
|
1199
|
+
z9.object(
|
|
1200
|
+
nullableObject({
|
|
1201
|
+
status: z9.string(),
|
|
1202
|
+
statusChangedAt: z9.string(),
|
|
1203
|
+
paid: z9.number(),
|
|
1204
|
+
cancelled: z9.number(),
|
|
1205
|
+
partialCancelled: z9.number()
|
|
1206
|
+
})
|
|
1207
|
+
)
|
|
1208
|
+
),
|
|
1209
|
+
lastWebhookStatus: z9.string(),
|
|
1210
|
+
orderName: z9.string(),
|
|
1211
|
+
transactionId: z9.string(),
|
|
1212
|
+
scheduleId: z9.string(),
|
|
1213
|
+
requestedAt: z9.string(),
|
|
1214
|
+
plainId: z9.string(),
|
|
1215
|
+
methodTypes: z9.array(z9.string()),
|
|
1216
|
+
storeId: z9.string()
|
|
1217
|
+
})
|
|
1218
|
+
);
|
|
1219
|
+
var PaymentsResponse = z9.object({
|
|
1220
|
+
items: z9.array(PaymentResponse),
|
|
1221
|
+
page: PageResponse
|
|
1222
|
+
}).or(ErrorResponse2);
|
|
1223
|
+
var GetPaymentsByFilterResponse = z9.object({
|
|
1224
|
+
merchant: z9.object({
|
|
1225
|
+
store: z9.object({
|
|
1226
|
+
payments: PaymentsResponse
|
|
1227
|
+
}).or(ErrorResponse2)
|
|
1228
|
+
}).or(
|
|
1229
|
+
z9.object({
|
|
1230
|
+
payments: PaymentsResponse
|
|
1231
|
+
})
|
|
1232
|
+
).or(ErrorResponse2)
|
|
1233
|
+
}).transform(({ merchant }) => {
|
|
1234
|
+
if ("__typename" in merchant) return merchant;
|
|
1235
|
+
if ("store" in merchant) {
|
|
1236
|
+
if ("__typename" in merchant.store) return merchant.store;
|
|
1237
|
+
return merchant.store.payments;
|
|
1238
|
+
} else {
|
|
1239
|
+
return merchant.payments;
|
|
605
1240
|
}
|
|
606
|
-
};
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
1241
|
+
});
|
|
1242
|
+
var getPaymentsByFilterQuery = parse2(gql2`
|
|
1243
|
+
query GetPaymentsByFilter(
|
|
1244
|
+
$storeId: ID
|
|
1245
|
+
$page: PageInput
|
|
1246
|
+
$sort: PaymentSortInput
|
|
1247
|
+
$filter: PaymentFilterInputV2Input
|
|
1248
|
+
$includeMerchantPayment: Boolean!
|
|
1249
|
+
$includeStorePayment: Boolean!
|
|
1250
|
+
) {
|
|
1251
|
+
merchant {
|
|
1252
|
+
...ErrorFragment
|
|
1253
|
+
... on Merchant {
|
|
1254
|
+
payments(page: $page, sort: $sort, filter: $filter) @include(if: $includeMerchantPayment) {
|
|
1255
|
+
...ErrorFragment
|
|
1256
|
+
...PaymentFragment
|
|
1257
|
+
}
|
|
1258
|
+
store(id: $storeId) {
|
|
1259
|
+
...ErrorFragment
|
|
1260
|
+
... on Store {
|
|
1261
|
+
payments(page: $page, sort: $sort, filter: $filter) @include(if: $includeStorePayment) {
|
|
1262
|
+
...ErrorFragment
|
|
1263
|
+
...PaymentFragment
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
612
1267
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
fragment ErrorFragment on Error {
|
|
1272
|
+
__typename
|
|
1273
|
+
message
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
fragment PaymentFragment on PaymentsPayload {
|
|
1277
|
+
items {
|
|
1278
|
+
amount {
|
|
1279
|
+
total
|
|
1280
|
+
taxFree
|
|
1281
|
+
vat
|
|
1282
|
+
supply
|
|
1283
|
+
discount
|
|
1284
|
+
paid
|
|
1285
|
+
cancelled
|
|
1286
|
+
cancelledTaxFree
|
|
1287
|
+
cardDiscount
|
|
1288
|
+
easyPayDiscount
|
|
1289
|
+
promotionDiscount
|
|
1290
|
+
currentDiscount
|
|
1291
|
+
cancellable
|
|
1292
|
+
}
|
|
1293
|
+
billingKey
|
|
1294
|
+
channel {
|
|
1295
|
+
type
|
|
1296
|
+
id
|
|
1297
|
+
key
|
|
1298
|
+
name
|
|
1299
|
+
pgProvider
|
|
1300
|
+
pgMerchantId
|
|
1301
|
+
}
|
|
1302
|
+
channelGroup {
|
|
1303
|
+
plainId
|
|
1304
|
+
name
|
|
1305
|
+
isForTest
|
|
1306
|
+
}
|
|
1307
|
+
currency
|
|
1308
|
+
customer {
|
|
1309
|
+
id
|
|
1310
|
+
}
|
|
1311
|
+
histories {
|
|
1312
|
+
status
|
|
1313
|
+
statusChangedAt
|
|
1314
|
+
paid
|
|
1315
|
+
cancelled
|
|
1316
|
+
partialCancelled
|
|
1317
|
+
}
|
|
1318
|
+
lastWebhookStatus
|
|
1319
|
+
orderName
|
|
1320
|
+
transactionId
|
|
1321
|
+
storeId
|
|
1322
|
+
scheduleId
|
|
1323
|
+
requestedAt
|
|
1324
|
+
plainId
|
|
1325
|
+
methodTypes
|
|
1326
|
+
}
|
|
1327
|
+
page {
|
|
1328
|
+
totalCount
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
`);
|
|
1332
|
+
var PaymentSortBy = z9.enum(["REQUESTED_AT", "STATUS_CHANGED_AT"]);
|
|
1333
|
+
var PaymentStatus = z9.enum([
|
|
1334
|
+
"READY",
|
|
1335
|
+
"PENDING",
|
|
1336
|
+
"VIRTUAL_ACCOUNT_ISSUED",
|
|
1337
|
+
"PAID",
|
|
1338
|
+
"FAILED",
|
|
1339
|
+
"PARTIAL_CANCELLED",
|
|
1340
|
+
"CANCELLED"
|
|
1341
|
+
]);
|
|
1342
|
+
var PaymentType = z9.enum(["NORMAL", "SCHEDULE"]);
|
|
1343
|
+
var PaymentMethodDetailType = z9.enum([
|
|
1344
|
+
"CARD",
|
|
1345
|
+
"TRANSFER",
|
|
1346
|
+
"VIRTUAL_ACCOUNT",
|
|
1347
|
+
"GIFT_CERTIFICATE",
|
|
1348
|
+
"MOBILE",
|
|
1349
|
+
"EASY_PAY",
|
|
1350
|
+
"CONVENIENCE_STORE",
|
|
1351
|
+
"POINT"
|
|
1352
|
+
]);
|
|
1353
|
+
var PgProvider = z9.enum([
|
|
1354
|
+
"HTML5_INICIS",
|
|
1355
|
+
"PAYPAL",
|
|
1356
|
+
"PAYPAL_V2",
|
|
1357
|
+
"INICIS",
|
|
1358
|
+
"DANAL",
|
|
1359
|
+
"NICE",
|
|
1360
|
+
"DANAL_TPAY",
|
|
1361
|
+
"JTNET",
|
|
1362
|
+
"UPLUS",
|
|
1363
|
+
"NAVERPAY",
|
|
1364
|
+
"KAKAO",
|
|
1365
|
+
"SETTLE",
|
|
1366
|
+
"KCP",
|
|
1367
|
+
"MOBILIANS",
|
|
1368
|
+
"KAKAOPAY",
|
|
1369
|
+
"NAVERCO",
|
|
1370
|
+
"SYRUP",
|
|
1371
|
+
"KICC",
|
|
1372
|
+
"EXIMBAY",
|
|
1373
|
+
"SMILEPAY",
|
|
1374
|
+
"PAYCO",
|
|
1375
|
+
"KCP_BILLING",
|
|
1376
|
+
"ALIPAY",
|
|
1377
|
+
"PAYPLE",
|
|
1378
|
+
"CHAI",
|
|
1379
|
+
"BLUEWALNUT",
|
|
1380
|
+
"SMARTRO",
|
|
1381
|
+
"SMARTRO_V2",
|
|
1382
|
+
"PAYMENTWALL",
|
|
1383
|
+
"TOSSPAYMENTS",
|
|
1384
|
+
"KCP_QUICK",
|
|
1385
|
+
"DAOU",
|
|
1386
|
+
"GALAXIA",
|
|
1387
|
+
"TOSSPAY",
|
|
1388
|
+
"KCP_DIRECT",
|
|
1389
|
+
"SETTLE_ACC",
|
|
1390
|
+
"SETTLE_FIRM",
|
|
1391
|
+
"INICIS_UNIFIED",
|
|
1392
|
+
"KSNET",
|
|
1393
|
+
"PINPAY",
|
|
1394
|
+
"NICE_V2",
|
|
1395
|
+
"TOSS_BRANDPAY",
|
|
1396
|
+
"WELCOME",
|
|
1397
|
+
"TOSSPAY_V2",
|
|
1398
|
+
"INICIS_V2",
|
|
1399
|
+
"KPN",
|
|
1400
|
+
"KCP_V2",
|
|
1401
|
+
"HYPHEN",
|
|
1402
|
+
"EXIMBAY_V2",
|
|
1403
|
+
"INICIS_JP",
|
|
1404
|
+
"PAYLETTER_GLOBAL"
|
|
1405
|
+
]);
|
|
1406
|
+
var SelectedChannelType = z9.enum(["LIVE", "TEST"]);
|
|
1407
|
+
var PaymentWebhookStatus = z9.enum([
|
|
1408
|
+
"SUCCEEDED",
|
|
1409
|
+
"FAILED_NOT_OK_RESPONSE",
|
|
1410
|
+
"FAILED_UNEXPECTED_ERROR"
|
|
1411
|
+
]);
|
|
1412
|
+
var TimestampType = z9.enum(["CREATED_AT", "STATUS_CHANGED_AT"]);
|
|
1413
|
+
var PaymentFilter = z9.object({
|
|
1414
|
+
timestampType: TimestampType.optional(),
|
|
1415
|
+
from: z9.string(),
|
|
1416
|
+
until: z9.string(),
|
|
1417
|
+
statuses: z9.array(PaymentStatus).optional(),
|
|
1418
|
+
types: z9.array(PaymentType).optional(),
|
|
1419
|
+
methods: z9.array(PaymentMethodDetailType).optional(),
|
|
1420
|
+
pgProviders: z9.array(PgProvider).optional(),
|
|
1421
|
+
channelTypes: z9.array(SelectedChannelType).optional(),
|
|
1422
|
+
currencies: z9.array(z9.string()).optional(),
|
|
1423
|
+
lastWebhookStatuses: z9.array(PaymentWebhookStatus).optional(),
|
|
1424
|
+
textSearch: z9.object({
|
|
1425
|
+
id: z9.string(),
|
|
1426
|
+
orderName: z9.string()
|
|
1427
|
+
}).partial()
|
|
1428
|
+
});
|
|
1429
|
+
async function getPaymentsByFilter({
|
|
1430
|
+
client,
|
|
1431
|
+
authorization,
|
|
1432
|
+
id,
|
|
1433
|
+
page,
|
|
1434
|
+
pageSize,
|
|
1435
|
+
sortBy,
|
|
1436
|
+
isDescending,
|
|
1437
|
+
filter
|
|
1438
|
+
}) {
|
|
1439
|
+
try {
|
|
1440
|
+
const response = await client.request({
|
|
1441
|
+
document: getPaymentsByFilterQuery,
|
|
1442
|
+
requestHeaders: {
|
|
1443
|
+
authorization
|
|
1444
|
+
},
|
|
1445
|
+
variables: {
|
|
1446
|
+
storeId: id,
|
|
1447
|
+
page: {
|
|
1448
|
+
number: page,
|
|
1449
|
+
size: pageSize
|
|
1450
|
+
},
|
|
1451
|
+
sort: {
|
|
1452
|
+
by: sortBy,
|
|
1453
|
+
order: isDescending === true ? "DESC" : "ASC"
|
|
1454
|
+
},
|
|
1455
|
+
filter,
|
|
1456
|
+
includeMerchantPayment: id == null,
|
|
1457
|
+
includeStorePayment: id != null
|
|
627
1458
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
1459
|
+
});
|
|
1460
|
+
const parsed = await GetPaymentsByFilterResponse.parseAsync(response);
|
|
1461
|
+
return match6(parsed).returnType().with({ __typename: P5.nonNullable }, ({ __typename, message }) => ({
|
|
1462
|
+
type: "error",
|
|
1463
|
+
data: {
|
|
1464
|
+
message,
|
|
1465
|
+
type: __typename
|
|
1466
|
+
}
|
|
1467
|
+
})).otherwise((stores) => ({
|
|
1468
|
+
type: "success",
|
|
1469
|
+
data: stores
|
|
1470
|
+
}));
|
|
1471
|
+
} catch (error) {
|
|
1472
|
+
if (error instanceof Error) {
|
|
633
1473
|
return {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
type: "text",
|
|
637
|
-
text: JSON.stringify(structuredContent, null, 2)
|
|
638
|
-
}
|
|
639
|
-
],
|
|
640
|
-
structuredContent
|
|
1474
|
+
type: "error",
|
|
1475
|
+
data: error
|
|
641
1476
|
};
|
|
642
|
-
}
|
|
1477
|
+
} else {
|
|
643
1478
|
return {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
],
|
|
650
|
-
isError: true
|
|
1479
|
+
type: "error",
|
|
1480
|
+
data: {
|
|
1481
|
+
message: `\uC54C \uC218 \uC5C6\uB294 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.`,
|
|
1482
|
+
cause: error
|
|
1483
|
+
}
|
|
651
1484
|
};
|
|
652
1485
|
}
|
|
653
|
-
}
|
|
1486
|
+
}
|
|
654
1487
|
}
|
|
655
1488
|
|
|
656
1489
|
// src/tools/getPaymentsByFilter.ts
|
|
657
|
-
var getPaymentsByFilter_exports = {};
|
|
658
|
-
__export(getPaymentsByFilter_exports, {
|
|
659
|
-
config: () => config4,
|
|
660
|
-
init: () => init4,
|
|
661
|
-
name: () => name4
|
|
662
|
-
});
|
|
663
|
-
import z5 from "zod";
|
|
664
|
-
var PaymentTimeRangeField = z5.enum(["CREATED_AT", "STATUS_CHANGED_AT"]);
|
|
665
|
-
var PaymentStatus = z5.enum([
|
|
666
|
-
"READY",
|
|
667
|
-
"PENDING",
|
|
668
|
-
"VIRTUAL_ACCOUNT_ISSUED",
|
|
669
|
-
"PAID",
|
|
670
|
-
"FAILED",
|
|
671
|
-
"PARTIAL_CANCELLED",
|
|
672
|
-
"CANCELLED"
|
|
673
|
-
]);
|
|
674
|
-
var PaymentMethodType = z5.enum([
|
|
675
|
-
"CARD",
|
|
676
|
-
"TRANSFER",
|
|
677
|
-
"VIRTUAL_ACCOUNT",
|
|
678
|
-
"GIFT_CERTIFICATE",
|
|
679
|
-
"MOBILE",
|
|
680
|
-
"EASY_PAY",
|
|
681
|
-
"CONVENIENCE_STORE"
|
|
682
|
-
]);
|
|
683
1490
|
var name4 = "getPaymentsByFilter";
|
|
1491
|
+
var Amount = z10.object({
|
|
1492
|
+
total: z10.number().describe("\uCD1D \uAE08\uC561"),
|
|
1493
|
+
taxFree: z10.number().describe("\uBA74\uC138 \uAE08\uC561"),
|
|
1494
|
+
vat: z10.number().describe("\uBD80\uAC00\uC138"),
|
|
1495
|
+
supply: z10.number().describe("\uACF5\uAE09\uAC00\uC561"),
|
|
1496
|
+
dc: z10.number().describe("\uD560\uC778\uC561"),
|
|
1497
|
+
cancel: z10.number().describe("\uCD1D \uCDE8\uC18C\uC561"),
|
|
1498
|
+
taxFreeCancel: z10.number().describe("\uBA74\uC138 \uCDE8\uC18C\uC561"),
|
|
1499
|
+
cardDc: z10.number().describe("\uCE74\uB4DC\uC0AC \uD560\uC778\uC561"),
|
|
1500
|
+
easyDc: z10.number().describe("\uAC04\uD3B8\uACB0\uC81C \uD560\uC778\uC561"),
|
|
1501
|
+
promotionDc: z10.number().describe("\uD504\uB85C\uBAA8\uC158 \uD560\uC778\uC561"),
|
|
1502
|
+
balance: z10.number().describe("\uCDE8\uC18C \uAC00\uB2A5 \uC794\uC561")
|
|
1503
|
+
}).partial();
|
|
1504
|
+
var AmountFields = Object.keys(Amount.shape);
|
|
1505
|
+
var Channel2 = z10.object({
|
|
1506
|
+
type: z10.string().describe("\uCC44\uB110 \uC2E4\uC5F0\uB3D9 \uC885\uB958"),
|
|
1507
|
+
id: z10.string().describe("\uCC44\uB110 ID. \uCC44\uB110\uC744 \uC218\uC815\uD558\uBA74 \uCC44\uB110 ID\uAC00 \uBCC0\uACBD\uB418\uBA70 \uCC44\uB110\uD0A4\uB294 \uC720\uC9C0\uB428."),
|
|
1508
|
+
key: z10.string().describe("\uCC44\uB110\uD0A4"),
|
|
1509
|
+
name: z10.string().describe("\uCC44\uB110\uBA85"),
|
|
1510
|
+
pg: z10.string().describe("PG\uC0AC \uBAA8\uB4C8"),
|
|
1511
|
+
mid: z10.string().describe("PG\uC0AC MID")
|
|
1512
|
+
}).partial();
|
|
1513
|
+
var ChannelFields = Object.keys(Channel2.shape);
|
|
1514
|
+
var ChannelGroup = z10.object({
|
|
1515
|
+
id: z10.string().describe("\uCC44\uB110 \uADF8\uB8F9 ID"),
|
|
1516
|
+
name: z10.string().describe("\uADF8\uB8F9\uBA85"),
|
|
1517
|
+
test: z10.boolean().describe("\uD14C\uC2A4\uD2B8 \uC5EC\uBD80")
|
|
1518
|
+
}).partial();
|
|
1519
|
+
var ChannelGroupFields = Object.keys(ChannelGroup.shape);
|
|
1520
|
+
var History = z10.object({
|
|
1521
|
+
status: z10.string().describe("\uAC70\uB798 \uC0C1\uD0DC"),
|
|
1522
|
+
changedAt: z10.string().describe("\uC0C1\uD0DC \uBCC0\uACBD \uC2DC\uAC01"),
|
|
1523
|
+
paid: z10.number().describe("\uACB0\uC81C\uC561"),
|
|
1524
|
+
cancel: z10.number().describe("\uCDE8\uC18C\uC561")
|
|
1525
|
+
}).partial();
|
|
1526
|
+
var HistoryFields = Object.keys(History.shape);
|
|
1527
|
+
var Payment = z10.object({
|
|
1528
|
+
amount: Amount.describe("\uAE08\uC561 \uC815\uBCF4"),
|
|
1529
|
+
billKey: z10.string().describe("\uC0AC\uC6A9\uB41C \uBE4C\uB9C1\uD0A4"),
|
|
1530
|
+
channel: Channel2.describe("\uACB0\uC81C \uB2F9\uC2DC \uC120\uD0DD\uB41C \uCC44\uB110 \uC815\uBCF4"),
|
|
1531
|
+
group: ChannelGroup.describe("\uCC44\uB110 \uADF8\uB8F9 \uC815\uBCF4"),
|
|
1532
|
+
currency: z10.string().describe("\uACB0\uC81C \uD1B5\uD654"),
|
|
1533
|
+
customer: z10.string().describe("\uACE0\uAC1D ID"),
|
|
1534
|
+
history: History.array().describe("\uACB0\uC81C \uC0C1\uD0DC \uBCC0\uACBD \uAE30\uB85D"),
|
|
1535
|
+
webhook: z10.string().describe("\uB9C8\uC9C0\uB9C9 \uC6F9\uD6C5 \uC218\uC2E0 \uACB0\uACFC"),
|
|
1536
|
+
order: z10.string().describe("\uC8FC\uBB38\uBA85"),
|
|
1537
|
+
txId: z10.string().describe("\uD3EC\uD2B8\uC6D0 \uAC70\uB798\uBC88\uD638 (V1\uC5D0\uC11C\uB294 imp_uid)"),
|
|
1538
|
+
storeId: z10.string().describe("\uAC70\uB798 \uBC1C\uC0DD \uC0C1\uC810\uC544\uC774\uB514"),
|
|
1539
|
+
schedule: z10.string().describe("\uACB0\uC81C \uC608\uC57D ID"),
|
|
1540
|
+
requestAt: z10.string().describe("\uACB0\uC81C \uC694\uCCAD \uC2DC\uAC01"),
|
|
1541
|
+
paymentId: z10.string().describe("\uACE0\uAC1D\uC0AC \uAC70\uB798\uBC88\uD638 (V1\uC5D0\uC11C\uB294 merchant_uid)"),
|
|
1542
|
+
method: z10.string().array().describe("\uC0AC\uC6A9\uB41C \uACB0\uC81C\uC218\uB2E8 \uBAA9\uB85D")
|
|
1543
|
+
}).partial();
|
|
1544
|
+
var PaymentFields = Object.keys(Payment.shape).concat(AmountFields.map((key) => `amount.${key}`)).concat(ChannelFields.map((key) => `channel.${key}`)).concat(ChannelGroupFields.map((key) => `group.${key}`)).concat(HistoryFields.map((key) => `history.${key}`));
|
|
1545
|
+
var OutputSchema4 = z10.object({
|
|
1546
|
+
items: Payment.array().describe("\uC870\uD68C\uB41C \uACB0\uC81C \uBAA9\uB85D"),
|
|
1547
|
+
count: z10.number().describe("\uD398\uC774\uC9C0\uC640 \uAD00\uACC4\uC5C6\uC774 \uC870\uAC74\uC5D0 \uB9DE\uB294 \uACB0\uC81C \uCD1D \uAC1C\uC218")
|
|
1548
|
+
});
|
|
1549
|
+
var InputSchema3 = z10.object({
|
|
1550
|
+
from: z10.string().datetime({ offset: true }).describe("\uC870\uD68C \uC2DC\uC791 \uC2DC\uAC04 (ISO 8601 \uD615\uC2DD)"),
|
|
1551
|
+
to: z10.string().datetime({ offset: true }).describe("\uC870\uD68C \uC885\uB8CC \uC2DC\uAC04 (ISO 8601 \uD615\uC2DD)"),
|
|
1552
|
+
timeType: TimestampType.describe("from, to\uB85C \uC81C\uC57D\uD560 \uACB0\uC81C\uAC74\uC758 \uAE30\uC900 \uC2DC\uAC01 \uC870\uAC74"),
|
|
1553
|
+
page: z10.number().min(0).describe("\uAC80\uC0C9\uD560 \uD398\uC774\uC9C0 \uC704\uCE58\uC785\uB2C8\uB2E4. 0\uBD80\uD130 \uC2DC\uC791\uD569\uB2C8\uB2E4."),
|
|
1554
|
+
pageSize: z10.number().min(1).default(10).describe("\uD55C \uD398\uC774\uC9C0\uC5D0 \uBC18\uD658\uD560 \uACB0\uACFC\uC758 \uC218"),
|
|
1555
|
+
status: z10.array(PaymentStatus).optional().describe("\uD3EC\uD568\uD560 \uACB0\uC81C \uC0C1\uD0DC \uBAA9\uB85D"),
|
|
1556
|
+
types: PaymentType.array().optional().describe("\uC77C\uBC18 / \uC815\uAE30\uACB0\uC81C \uC5EC\uBD80"),
|
|
1557
|
+
method: PaymentMethodDetailType.array().optional().describe("\uD3EC\uD568\uD560 \uACB0\uC81C\uC218\uB2E8 \uBAA9\uB85D"),
|
|
1558
|
+
pg: PgProvider.array().optional().describe("\uD3EC\uD568\uD560 PG\uC0AC \uBAA8\uB4C8 \uBAA9\uB85D"),
|
|
1559
|
+
channel: SelectedChannelType.array().optional().describe("\uC2E4\uC5F0\uB3D9 \uBC0F \uD14C\uC2A4\uD2B8 \uD3EC\uD568 \uBAA9\uB85D"),
|
|
1560
|
+
currency: z10.string().length(3).toUpperCase().array().optional().describe("\uD3EC\uD568\uD560 \uD1B5\uD654 \uBAA9\uB85D, \uC138 \uC790\uB9AC \uD1B5\uD654 \uCF54\uB4DC"),
|
|
1561
|
+
webhook: PaymentWebhookStatus.array().optional().describe("\uD3EC\uD568\uD560 \uACB0\uC81C\uAC74\uC758 \uC6F9\uD6C5 \uC0C1\uD0DC \uBAA9\uB85D"),
|
|
1562
|
+
id: z10.string().optional().describe("paymentId / txId / imp_uid / merchant_uid \uAC80\uC0C9 \uD544\uB4DC"),
|
|
1563
|
+
order: z10.string().optional().describe("\uACB0\uC81C\uAC74\uC758 \uC8FC\uBB38\uBA85"),
|
|
1564
|
+
fields: z10.enum(PaymentFields).array().describe("\uAC80\uC0C9 \uACB0\uACFC\uB85C \uBC1B\uC744 \uD544\uB4DC \uBAA9\uB85D\uC785\uB2C8\uB2E4.")
|
|
1565
|
+
});
|
|
684
1566
|
var config4 = {
|
|
685
1567
|
title: "\uD3EC\uD2B8\uC6D0 \uACB0\uC81C \uB0B4\uC5ED \uAC80\uC0C9",
|
|
686
|
-
description: `\uD3EC\uD2B8\uC6D0 \uC11C\uBC84\uC5D0\uC11C \uC8FC\uC5B4\uC9C4 \uC870\uAC74\uC744 \uBAA8\uB450 \uB9CC\uC871\uD558\uB294 \uACB0\uC81C \uB0B4\uC5ED\uC744 \
|
|
1568
|
+
description: `\uD3EC\uD2B8\uC6D0 \uC11C\uBC84\uC5D0\uC11C \uC8FC\uC5B4\uC9C4 \uC870\uAC74\uC744 \uBAA8\uB450 \uB9CC\uC871\uD558\uB294 \uACB0\uC81C \uB0B4\uC5ED\uC744 \uAC80\uC0C9\uD569\uB2C8\uB2E4.
|
|
687
1569
|
|
|
688
1570
|
Note:
|
|
689
|
-
UNAUTHORIZED \uC5D0\uB7EC\uC758 \uACBD\uC6B0 MCP \uC11C\uBC84\uC758 API_SECRET \uD658\uACBD\uBCC0\uC218 \uC124\uC815\uC774 \uC798\uBABB\uB418\uC5C8\uC744 \uAC00\uB2A5\uC131\uC774 \uC788\uC2B5\uB2C8\uB2E4.
|
|
690
1571
|
\uC18C\uBB38\uC790 imp_ \uD639\uC740 imps_ \uB85C \uC2DC\uC791\uD558\uB294 \uAC70\uB798\uBC88\uD638\uB294 \uACE0\uAC1D\uC0AC \uAC70\uB798\uBC88\uD638\uAC00 \uC544\uB2CC V1 \uD3EC\uD2B8\uC6D0 \uAC70\uB798\uBC88\uD638(imp_uid)\uC77C \uAC00\uB2A5\uC131\uC774 \uC788\uC2B5\uB2C8\uB2E4.
|
|
691
1572
|
\uB0A0\uC9DC \uBC0F \uC2DC\uAC04 \uC815\uBCF4 \uC785\uCD9C\uB825 \uC2DC\uC5D0\uB294 \uBC18\uB4DC\uC2DC \uD0C0\uC784\uC874\uC744 \uBA85\uC2DC\uD569\uB2C8\uB2E4.`,
|
|
692
|
-
inputSchema:
|
|
693
|
-
|
|
694
|
-
untilTime: z5.string().datetime({ offset: true }).describe("\uC870\uD68C \uC885\uB8CC \uC2DC\uAC04 (ISO 8601 \uD615\uC2DD)"),
|
|
695
|
-
pageIndex: z5.number().min(0).describe("\uAC80\uC0C9\uD560 \uD398\uC774\uC9C0 \uC704\uCE58\uC785\uB2C8\uB2E4. 0\uBD80\uD130 \uC2DC\uC791\uD569\uB2C8\uB2E4."),
|
|
696
|
-
pageSize: z5.number().min(1).default(10).describe("\uD55C \uD398\uC774\uC9C0\uC5D0 \uBC18\uD658\uD560 \uACB0\uACFC\uC758 \uC218\uC785\uB2C8\uB2E4."),
|
|
697
|
-
fields: z5.array(PaymentField).describe("\uAC80\uC0C9 \uACB0\uACFC\uB85C \uBC1B\uC744 \uD544\uB4DC \uBAA9\uB85D\uC785\uB2C8\uB2E4."),
|
|
698
|
-
timestampType: PaymentTimeRangeField.optional().default("STATUS_CHANGED_AT").describe(`\uC870\uD68C \uBC94\uC704\uAC00 \uACB0\uC81C\uB97C \uCC98\uC74C \uC2DC\uB3C4\uD55C \uC2DC\uAC01 \uAE30\uC900\uC774\uBA74 "CREATED_AT",
|
|
699
|
-
\uB9C8\uC9C0\uB9C9\uC73C\uB85C \uACB0\uC81C \uC0C1\uD0DC\uAC00 \uBCC0\uACBD\uB41C \uC2DC\uAC01 \uAE30\uC900\uC774\uBA74 "STATUS_CHANGED_AT"\uC785\uB2C8\uB2E4.
|
|
700
|
-
\uBBF8\uC785\uB825 \uC2DC "STATUS_CHANGED_AT"\uC785\uB2C8\uB2E4.`),
|
|
701
|
-
storeId: z5.string().optional().describe(
|
|
702
|
-
"\uD558\uC704 \uC0C1\uC810\uC744 \uD3EC\uD568\uD55C \uD2B9\uC815 \uC0C1\uC810\uC758 \uACB0\uC81C \uAC74\uB9CC\uC744 \uC870\uD68C\uD560 \uACBD\uC6B0\uC5D0\uB9CC \uC785\uB825\uD569\uB2C8\uB2E4. `store-id-{uuid}` \uD615\uC2DD\uC785\uB2C8\uB2E4."
|
|
703
|
-
),
|
|
704
|
-
status: z5.array(PaymentStatus).optional().describe("\uD3EC\uD568\uD560 \uACB0\uC81C \uC0C1\uD0DC \uBAA9\uB85D\uC785\uB2C8\uB2E4."),
|
|
705
|
-
methods: z5.array(PaymentMethodType).optional().describe("\uD3EC\uD568\uD560 \uACB0\uC81C \uC218\uB2E8 \uBAA9\uB85D\uC785\uB2C8\uB2E4."),
|
|
706
|
-
pgProvider: z5.array(PgProviderSchema).optional().describe("\uD3EC\uD568\uD560 \uACB0\uC81C\uAC00 \uC77C\uC5B4\uB09C \uACB0\uC81C\uB300\uD589\uC0AC \uBAA9\uB85D\uC785\uB2C8\uB2E4."),
|
|
707
|
-
isTest: z5.boolean().optional().default(true).describe("\uD14C\uC2A4\uD2B8 \uACB0\uC81C\uB97C \uD3EC\uD568\uD560\uC9C0 \uC5EC\uBD80\uC785\uB2C8\uB2E4. \uBBF8\uC785\uB825 \uC2DC `true`\uC785\uB2C8\uB2E4."),
|
|
708
|
-
version: z5.enum(["V1", "V2"]).optional().describe("\uD3EC\uD568\uD560 \uD3EC\uD2B8\uC6D0 \uBC84\uC804\uC785\uB2C8\uB2E4. \uBBF8\uC785\uB825 \uC2DC \uBAA8\uB450 \uAC80\uC0C9\uB429\uB2C8\uB2E4."),
|
|
709
|
-
currency: z5.string().optional().describe("\uD3EC\uD568\uD560 \uACB0\uC81C \uD1B5\uD654\uB97C \uB098\uD0C0\uB0B4\uB294 \uC138 \uC790\uB9AC \uD1B5\uD654 \uCF54\uB4DC\uC785\uB2C8\uB2E4."),
|
|
710
|
-
paymentId: z5.string().optional().describe(
|
|
711
|
-
"\uACE0\uAC1D\uC0AC\uC5D0\uC11C \uBC1C\uAE09\uD55C \uAC70\uB798\uBC88\uD638 \uC77C\uBD80\uBD84\uC785\uB2C8\uB2E4. V2\uC5D0\uC11C\uB294 paymentId, V1\uC5D0\uC11C\uB294 merchant_uid\uC5D0 \uB300\uC751\uB429\uB2C8\uB2E4."
|
|
712
|
-
),
|
|
713
|
-
orderName: z5.string().optional().describe("\uACB0\uC81C \uC8FC\uBB38\uBA85 \uC77C\uBD80\uBD84\uC785\uB2C8\uB2E4."),
|
|
714
|
-
customerName: z5.string().optional().describe("\uAD6C\uB9E4\uC790\uC758 \uC131\uBA85 \uC77C\uBD80\uBD84\uC785\uB2C8\uB2E4."),
|
|
715
|
-
customerEmail: z5.string().optional().describe("\uAD6C\uB9E4\uC790\uC758 \uC774\uBA54\uC77C \uC77C\uBD80\uBD84\uC785\uB2C8\uB2E4."),
|
|
716
|
-
pgMerchantId: z5.string().optional().describe("\uACB0\uC81C\uB300\uD589\uC0AC\uC5D0\uC11C \uC81C\uACF5\uD55C \uC0C1\uC810\uC544\uC774\uB514 (MID) \uC77C\uBD80\uBD84\uC785\uB2C8\uB2E4.")
|
|
717
|
-
},
|
|
718
|
-
outputSchema: {
|
|
719
|
-
items: z5.array(z5.object({}).passthrough()).describe("\uC870\uD68C\uB41C \uACB0\uC81C \uAC74\uC758 \uBAA9\uB85D"),
|
|
720
|
-
totalCount: z5.number().describe("\uC870\uAC74\uC5D0 \uB9DE\uB294 \uBCF8\uC778\uC778\uC99D \uAC74\uC758 \uCD1D \uAC1C\uC218")
|
|
721
|
-
}
|
|
1573
|
+
inputSchema: InputSchema3.shape,
|
|
1574
|
+
outputSchema: OutputSchema4.shape
|
|
722
1575
|
};
|
|
723
|
-
function init4(
|
|
1576
|
+
function init4(tokenProvider, client) {
|
|
724
1577
|
return async ({
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
1578
|
+
from,
|
|
1579
|
+
to,
|
|
1580
|
+
timeType,
|
|
1581
|
+
page,
|
|
728
1582
|
pageSize,
|
|
729
1583
|
fields,
|
|
730
|
-
timestampType,
|
|
731
|
-
storeId,
|
|
732
1584
|
status,
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
version,
|
|
1585
|
+
order,
|
|
1586
|
+
id,
|
|
1587
|
+
webhook,
|
|
737
1588
|
currency,
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
pgMerchantId
|
|
1589
|
+
channel,
|
|
1590
|
+
pg,
|
|
1591
|
+
method,
|
|
1592
|
+
types
|
|
743
1593
|
}) => {
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
1594
|
+
const token = await getToken(tokenProvider);
|
|
1595
|
+
if (token.type === "error") {
|
|
1596
|
+
return toolErrorResult(token);
|
|
1597
|
+
}
|
|
1598
|
+
const payments = await getPaymentsByFilter({
|
|
1599
|
+
client,
|
|
1600
|
+
authorization: token.data,
|
|
1601
|
+
filter: {
|
|
1602
|
+
from,
|
|
1603
|
+
until: to,
|
|
1604
|
+
timestampType: timeType,
|
|
1605
|
+
statuses: status,
|
|
1606
|
+
lastWebhookStatuses: webhook,
|
|
1607
|
+
channelTypes: channel,
|
|
1608
|
+
pgProviders: pg,
|
|
1609
|
+
methods: method,
|
|
1610
|
+
currencies: currency,
|
|
1611
|
+
types,
|
|
1612
|
+
textSearch: {
|
|
1613
|
+
orderName: order,
|
|
1614
|
+
id
|
|
1615
|
+
}
|
|
1616
|
+
},
|
|
1617
|
+
page,
|
|
1618
|
+
pageSize
|
|
763
1619
|
});
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
JSON.stringify({
|
|
767
|
-
filter: searchFilter,
|
|
768
|
-
page: {
|
|
769
|
-
number: pageIndex,
|
|
770
|
-
size: pageSize
|
|
771
|
-
}
|
|
772
|
-
})
|
|
773
|
-
)}`
|
|
774
|
-
);
|
|
775
|
-
if (!response.ok) {
|
|
776
|
-
const text = await response.text();
|
|
777
|
-
return { content: [{ type: "text", text }], isError: true };
|
|
1620
|
+
if (payments.type === "error") {
|
|
1621
|
+
return toolErrorResult(payments);
|
|
778
1622
|
}
|
|
1623
|
+
const renamed = payments.data.items.map(
|
|
1624
|
+
({
|
|
1625
|
+
amount,
|
|
1626
|
+
billingKey,
|
|
1627
|
+
channel: channel2,
|
|
1628
|
+
channelGroup,
|
|
1629
|
+
currency: currency2,
|
|
1630
|
+
customer,
|
|
1631
|
+
histories,
|
|
1632
|
+
lastWebhookStatus,
|
|
1633
|
+
orderName,
|
|
1634
|
+
transactionId,
|
|
1635
|
+
storeId,
|
|
1636
|
+
scheduleId,
|
|
1637
|
+
requestedAt,
|
|
1638
|
+
plainId,
|
|
1639
|
+
methodTypes
|
|
1640
|
+
}) => {
|
|
1641
|
+
return {
|
|
1642
|
+
amount: {
|
|
1643
|
+
total: amount?.total ?? void 0,
|
|
1644
|
+
taxFree: amount?.taxFree ?? void 0,
|
|
1645
|
+
vat: amount?.vat ?? void 0,
|
|
1646
|
+
supply: amount?.supply ?? void 0,
|
|
1647
|
+
dc: amount?.discount ?? void 0,
|
|
1648
|
+
cancel: amount?.cancelled ?? void 0,
|
|
1649
|
+
taxFreeCancel: amount?.cancelledTaxFree ?? void 0,
|
|
1650
|
+
cardDc: amount?.cardDiscount ?? void 0,
|
|
1651
|
+
easyDc: amount?.easyPayDiscount ?? void 0,
|
|
1652
|
+
promotionDc: amount?.promotionDiscount ?? void 0,
|
|
1653
|
+
balance: amount?.cancellable ?? void 0
|
|
1654
|
+
},
|
|
1655
|
+
billKey: billingKey ?? void 0,
|
|
1656
|
+
channel: {
|
|
1657
|
+
type: channel2?.type ?? void 0,
|
|
1658
|
+
id: channel2?.id ?? void 0,
|
|
1659
|
+
key: channel2?.key ?? void 0,
|
|
1660
|
+
name: channel2?.name ?? void 0,
|
|
1661
|
+
pg: channel2?.pgProvider ?? void 0,
|
|
1662
|
+
mid: channel2?.pgMerchantId ?? void 0
|
|
1663
|
+
},
|
|
1664
|
+
group: {
|
|
1665
|
+
id: channelGroup?.plainId ?? void 0,
|
|
1666
|
+
name: channelGroup?.name ?? void 0,
|
|
1667
|
+
test: channelGroup?.isForTest ?? void 0
|
|
1668
|
+
},
|
|
1669
|
+
currency: currency2 ?? void 0,
|
|
1670
|
+
customer: customer?.id ?? void 0,
|
|
1671
|
+
history: histories?.map(
|
|
1672
|
+
({
|
|
1673
|
+
status: status2,
|
|
1674
|
+
paid,
|
|
1675
|
+
cancelled,
|
|
1676
|
+
statusChangedAt,
|
|
1677
|
+
partialCancelled
|
|
1678
|
+
}) => ({
|
|
1679
|
+
status: status2 ?? void 0,
|
|
1680
|
+
changedAt: statusChangedAt ?? void 0,
|
|
1681
|
+
paid: paid ?? void 0,
|
|
1682
|
+
cancel: cancelled ?? partialCancelled ?? void 0
|
|
1683
|
+
})
|
|
1684
|
+
) ?? void 0,
|
|
1685
|
+
webhook: lastWebhookStatus ?? void 0,
|
|
1686
|
+
order: orderName ?? void 0,
|
|
1687
|
+
txId: transactionId ?? void 0,
|
|
1688
|
+
storeId: storeId ?? void 0,
|
|
1689
|
+
schedule: scheduleId ?? void 0,
|
|
1690
|
+
requestAt: requestedAt ?? void 0,
|
|
1691
|
+
paymentId: plainId ?? void 0,
|
|
1692
|
+
method: methodTypes ?? void 0
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
);
|
|
779
1696
|
try {
|
|
780
|
-
const
|
|
781
|
-
const maskedPayments = filterFields(fields, data.items);
|
|
1697
|
+
const maskedPayments = renamed.map((item) => filterFields(fields, item));
|
|
782
1698
|
const structuredContent = {
|
|
783
1699
|
items: maskedPayments,
|
|
784
|
-
|
|
1700
|
+
count: payments.data.page.totalCount
|
|
785
1701
|
};
|
|
786
1702
|
return {
|
|
787
1703
|
content: [
|
|
@@ -808,12 +1724,11 @@ __export(listDocs_exports, {
|
|
|
808
1724
|
init: () => init5,
|
|
809
1725
|
name: () => name5
|
|
810
1726
|
});
|
|
811
|
-
import
|
|
1727
|
+
import z11 from "zod";
|
|
812
1728
|
|
|
813
1729
|
// src/tools/utils/markdown.ts
|
|
814
1730
|
function formatDocumentMetadata(doc) {
|
|
815
1731
|
const lines = [];
|
|
816
|
-
lines.push(`\uD30C\uC77C: ${doc.path}`);
|
|
817
1732
|
if (doc.frontmatter) {
|
|
818
1733
|
if (doc.frontmatter.title) {
|
|
819
1734
|
lines.push(`\uC81C\uBAA9: ${doc.frontmatter.title}`);
|
|
@@ -829,42 +1744,47 @@ function formatDocumentMetadata(doc) {
|
|
|
829
1744
|
}
|
|
830
1745
|
|
|
831
1746
|
// src/tools/listDocs.ts
|
|
832
|
-
var name5 = "
|
|
1747
|
+
var name5 = "listPortoneDocs";
|
|
833
1748
|
var config5 = {
|
|
834
1749
|
title: "\uD3EC\uD2B8\uC6D0 \uBB38\uC11C \uBAA9\uB85D \uC870\uD68C",
|
|
835
|
-
description: `\
|
|
1750
|
+
description: `\uD2B9\uC815 \uACBD\uB85C \uD558\uC704\uC5D0 \uC788\uB294 \uBAA8\uB4E0 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C \uBAA9\uB85D\uC744 \uD2B8\uB9AC \uD615\uD0DC\uB85C \uC870\uD68C\uD569\uB2C8\uB2E4.
|
|
1751
|
+
\uBAA9\uB85D\uC5D0\uB294 \uBB38\uC11C \uACBD\uB85C, \uC81C\uBAA9, \uC124\uBA85, \uB300\uC0C1 \uBC84\uC804 \uB4F1 \uCD95\uC57D\uB41C \uBB38\uC11C \uC815\uBCF4\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.
|
|
1752
|
+
|
|
1753
|
+
Returns:
|
|
1754
|
+
\uD544\uD130\uB9C1\uB41C \uBB38\uC11C \uBAA9\uB85D (\uAC01 \uBB38\uC11C\uC758 \uD30C\uC77C\uBA85, \uAE38\uC774, \uC81C\uBAA9, \uC124\uBA85, \uB300\uC0C1 \uBC84\uC804 \uB4F1)
|
|
1755
|
+
|
|
1756
|
+
Note:
|
|
1757
|
+
\uBB38\uC11C \uBAA9\uB85D\uC740 \uB300\uB7C9\uC758 \uB370\uC774\uD130\uC774\uBBC0\uB85C \uC0C1\uC704 \uB514\uB809\uD1A0\uB9AC\uB97C \uC870\uD68C\uD560 \uACBD\uC6B0 omitFiles\uB97C true\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.`,
|
|
836
1758
|
inputSchema: {
|
|
837
|
-
|
|
838
|
-
"\
|
|
1759
|
+
paths: z11.string().array().default([]).describe(
|
|
1760
|
+
"\uD558\uC704 \uBAA9\uB85D\uC744 \uC870\uD68C\uD560 \uACBD\uB85C\uB4E4\uC785\uB2C8\uB2E4. \uBBF8\uC785\uB825 \uC2DC \uC804\uCCB4 \uBAA9\uB85D\uC744 \uC870\uD68C\uD569\uB2C8\uB2E4."
|
|
839
1761
|
),
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
help_docs: z6.boolean().default(true).describe(
|
|
843
|
-
"\uAC1C\uBC1C\uACFC \uBB34\uAD00\uD558\uAC8C \uC11C\uBE44\uC2A4 \uAD00\uB828 \uB0B4\uC6A9\uC744 \uC77C\uBC18\uC801\uC73C\uB85C \uB2F4\uB294 \uD5EC\uD504\uC13C\uD130 \uBB38\uC11C (help/) \uD3EC\uD568 \uC5EC\uBD80"
|
|
1762
|
+
onlyPaths: z11.boolean().default(false).describe(
|
|
1763
|
+
"true\uC778 \uACBD\uC6B0 \uBB38\uC11C\uB97C \uC81C\uC678\uD55C \uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D\uB9CC \uD45C\uC2DC\uD558\uACE0, \uB514\uB809\uD1A0\uB9AC \uD558\uC704\uC5D0 readme.md\uAC00 \uC788\uB294 \uACBD\uC6B0 \uD574\uB2F9 \uD30C\uC77C\uC758 \uC124\uBA85\uC744 \uD45C\uC2DC\uD569\uB2C8\uB2E4."
|
|
844
1764
|
)
|
|
845
|
-
},
|
|
846
|
-
outputSchema: {
|
|
847
|
-
result: z6.string().describe("\uD544\uD130\uB9C1\uB41C \uBB38\uC11C \uBAA9\uB85D")
|
|
848
1765
|
}
|
|
849
1766
|
};
|
|
850
1767
|
function init5(documents) {
|
|
851
|
-
return ({
|
|
1768
|
+
return ({ paths, onlyPaths }) => {
|
|
852
1769
|
const { markdownDocs } = documents;
|
|
853
1770
|
const filteredDocs = [];
|
|
1771
|
+
const docTree = /* @__PURE__ */ new Map();
|
|
854
1772
|
for (const [path, doc] of Object.entries(markdownDocs)) {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1773
|
+
const isSubpath = paths.length === 0 || paths.some((searchPath) => path.startsWith(searchPath));
|
|
1774
|
+
if (!isSubpath) continue;
|
|
1775
|
+
filteredDocs.push(doc);
|
|
1776
|
+
let treeNode = docTree;
|
|
1777
|
+
const components = path.split("/");
|
|
1778
|
+
if (onlyPaths) components.pop();
|
|
1779
|
+
for (const pathComp of components) {
|
|
1780
|
+
const child = treeNode.get(pathComp);
|
|
1781
|
+
if (child) {
|
|
1782
|
+
treeNode = child;
|
|
1783
|
+
} else {
|
|
1784
|
+
const newChild = /* @__PURE__ */ new Map();
|
|
1785
|
+
treeNode.set(pathComp, newChild);
|
|
1786
|
+
treeNode = newChild;
|
|
1787
|
+
}
|
|
868
1788
|
}
|
|
869
1789
|
}
|
|
870
1790
|
if (filteredDocs.length === 0) {
|
|
@@ -874,100 +1794,217 @@ function init5(documents) {
|
|
|
874
1794
|
type: "text",
|
|
875
1795
|
text: "No documents found with the specified filters."
|
|
876
1796
|
}
|
|
877
|
-
]
|
|
878
|
-
isError: true
|
|
1797
|
+
]
|
|
879
1798
|
};
|
|
880
1799
|
}
|
|
881
|
-
const
|
|
882
|
-
const
|
|
883
|
-
|
|
884
|
-
|
|
1800
|
+
const treeLines = [];
|
|
1801
|
+
for (const rootPath of Array.from(docTree.keys()).sort()) {
|
|
1802
|
+
const rootNode = docTree.get(rootPath);
|
|
1803
|
+
if (rootNode) formatTree(0, rootPath, rootPath, rootNode);
|
|
1804
|
+
}
|
|
1805
|
+
function formatTree(level, path, filename, node) {
|
|
1806
|
+
const indent = " ".repeat(level);
|
|
1807
|
+
treeLines.push(`${indent}${filename}`);
|
|
1808
|
+
const docs = markdownDocs[path];
|
|
1809
|
+
if (docs) {
|
|
1810
|
+
const metadata = formatDocumentMetadata(docs).trim();
|
|
1811
|
+
if (metadata.length > 0) {
|
|
1812
|
+
treeLines.push(metadata);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
if (onlyPaths) {
|
|
1816
|
+
const readme = markdownDocs[`${path}/readme.md`];
|
|
1817
|
+
if (readme) {
|
|
1818
|
+
const metadata = formatDocumentMetadata(readme).trim();
|
|
1819
|
+
if (metadata.length > 0) {
|
|
1820
|
+
treeLines.push(metadata);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
for (const child of Array.from(node.keys()).sort()) {
|
|
1825
|
+
const childNode = node.get(child);
|
|
1826
|
+
if (childNode)
|
|
1827
|
+
formatTree(level + 1, `${path}/${child}`, child, childNode);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
885
1830
|
return {
|
|
886
1831
|
content: [
|
|
887
1832
|
{
|
|
888
1833
|
type: "text",
|
|
889
|
-
text:
|
|
1834
|
+
text: treeLines.join("\n")
|
|
890
1835
|
}
|
|
891
|
-
]
|
|
892
|
-
structuredContent
|
|
1836
|
+
]
|
|
893
1837
|
};
|
|
894
1838
|
};
|
|
895
1839
|
}
|
|
896
1840
|
|
|
897
|
-
// src/tools/
|
|
898
|
-
var
|
|
899
|
-
__export(
|
|
1841
|
+
// src/tools/listSharedTestChannels.ts
|
|
1842
|
+
var listSharedTestChannels_exports = {};
|
|
1843
|
+
__export(listSharedTestChannels_exports, {
|
|
900
1844
|
config: () => config6,
|
|
901
1845
|
init: () => init6,
|
|
902
1846
|
name: () => name6
|
|
903
1847
|
});
|
|
904
|
-
import
|
|
905
|
-
var name6 = "
|
|
1848
|
+
import z12 from "zod";
|
|
1849
|
+
var name6 = "listSharedTestChannels";
|
|
1850
|
+
var SharedTestChannel = z12.object({
|
|
1851
|
+
pg: z12.string().describe(
|
|
1852
|
+
"PG\uC0AC \uACB0\uC81C \uBAA8\uB4C8\uC758 \uC2DD\uBCC4\uC790\uB85C, PG\uC0AC\uBCC4\uB85C \uC5EC\uB7EC \uBAA8\uB4C8\uC774 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4."
|
|
1853
|
+
),
|
|
1854
|
+
mid: z12.string().describe("PG\uC0AC\uC5D0\uC11C \uACE0\uAC1D\uC0AC\uB97C \uAD6C\uBD84\uD558\uAE30 \uC704\uD55C ID"),
|
|
1855
|
+
name: z12.string().describe("\uD3EC\uD2B8\uC6D0\uC5D0\uC11C \uC9C0\uC815\uD55C \uCC44\uB110\uC758 \uC774\uB984"),
|
|
1856
|
+
usage: z12.array(z12.enum(["PAYMENT", "IDENTITY"])).describe("\uCC44\uB110\uC744 \uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uC6A9\uB3C4")
|
|
1857
|
+
});
|
|
1858
|
+
var OutputSchema5 = z12.object({
|
|
1859
|
+
items: z12.array(SharedTestChannel).describe("\uC870\uD68C\uB41C \uCC44\uB110 \uBAA9\uB85D\uC73C\uB85C, MID\uAC00 \uD3EC\uD568\uB429\uB2C8\uB2E4.")
|
|
1860
|
+
});
|
|
906
1861
|
var config6 = {
|
|
907
|
-
title: "\uD3EC\uD2B8\uC6D0 \
|
|
908
|
-
description:
|
|
909
|
-
|
|
910
|
-
Note:
|
|
911
|
-
\uBA3C\uC800 list_portone_docs\uC744 \uC0AC\uC6A9\uD574 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C \uBAA9\uB85D\uC744 \uD655\uC778\uD558\uACE0,
|
|
912
|
-
\uADF8 \uC911 \uC6D0\uD558\uB294 \uBB38\uC11C\uC758 path\uB97C read_portone_doc\uC5D0 \uC804\uB2EC\uD558\uC5EC \uB0B4\uC6A9\uC744 \uD655\uC778\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`,
|
|
1862
|
+
title: "\uD3EC\uD2B8\uC6D0 \uACF5\uC6A9 \uD14C\uC2A4\uD2B8 \uCC44\uB110 \uBAA9\uB85D \uC870\uD68C",
|
|
1863
|
+
description: "\uD3EC\uD2B8\uC6D0\uC5D0\uC11C \uD14C\uC2A4\uD2B8 \uC6A9\uB3C4\uB85C \uC81C\uACF5\uD558\uB294 \uCC44\uB110\uC758 \uBAA9\uB85D\uC744 \uAC00\uC838\uC635\uB2C8\uB2E4.",
|
|
913
1864
|
inputSchema: {
|
|
914
|
-
|
|
1865
|
+
pgProviders: z12.array(PgProvider).optional().describe("\uBAA9\uB85D\uC5D0 \uC788\uB294 PG\uC0AC(\uBBF8\uC124\uC815 \uC2DC \uBAA8\uB4E0 PG\uC0AC)\uB9CC \uBCF4\uC5EC\uC90D\uB2C8\uB2E4.")
|
|
915
1866
|
},
|
|
916
|
-
outputSchema:
|
|
917
|
-
result: z7.string().describe("\uCC3E\uC740 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uC758 \uB0B4\uC6A9")
|
|
918
|
-
}
|
|
1867
|
+
outputSchema: OutputSchema5.shape
|
|
919
1868
|
};
|
|
920
|
-
function init6(
|
|
921
|
-
return (
|
|
922
|
-
const
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
],
|
|
932
|
-
isError: true
|
|
933
|
-
};
|
|
1869
|
+
function init6(tokenProvider) {
|
|
1870
|
+
return async () => {
|
|
1871
|
+
const token = await getToken(tokenProvider);
|
|
1872
|
+
if (token.type === "error") {
|
|
1873
|
+
return toolErrorResult(token);
|
|
1874
|
+
}
|
|
1875
|
+
const list = await listV2SharedTestChannel({
|
|
1876
|
+
authorization: token.data
|
|
1877
|
+
});
|
|
1878
|
+
if (list.type === "error") {
|
|
1879
|
+
return toolErrorResult(list);
|
|
934
1880
|
}
|
|
935
1881
|
const structuredContent = {
|
|
936
|
-
|
|
1882
|
+
items: list.data.channels.map(
|
|
1883
|
+
({
|
|
1884
|
+
pgProvider,
|
|
1885
|
+
pgMerchantId,
|
|
1886
|
+
channelName,
|
|
1887
|
+
isForPayment,
|
|
1888
|
+
isForIdentityCertification
|
|
1889
|
+
}) => {
|
|
1890
|
+
const usage = [];
|
|
1891
|
+
if (isForPayment) usage.push("PAYMENT");
|
|
1892
|
+
if (isForIdentityCertification) usage.push("IDENTITY");
|
|
1893
|
+
return {
|
|
1894
|
+
pg: pgProvider,
|
|
1895
|
+
mid: pgMerchantId,
|
|
1896
|
+
name: channelName,
|
|
1897
|
+
usage
|
|
1898
|
+
};
|
|
1899
|
+
}
|
|
1900
|
+
)
|
|
937
1901
|
};
|
|
938
1902
|
return {
|
|
1903
|
+
structuredContent,
|
|
939
1904
|
content: [
|
|
940
1905
|
{
|
|
941
1906
|
type: "text",
|
|
942
1907
|
text: JSON.stringify(structuredContent, null, 2)
|
|
943
1908
|
}
|
|
944
|
-
]
|
|
945
|
-
structuredContent
|
|
1909
|
+
]
|
|
946
1910
|
};
|
|
947
1911
|
};
|
|
948
1912
|
}
|
|
949
1913
|
|
|
950
|
-
// src/tools/
|
|
951
|
-
var
|
|
952
|
-
__export(
|
|
1914
|
+
// src/tools/listStores.ts
|
|
1915
|
+
var listStores_exports = {};
|
|
1916
|
+
__export(listStores_exports, {
|
|
953
1917
|
config: () => config7,
|
|
954
1918
|
init: () => init7,
|
|
955
1919
|
name: () => name7
|
|
956
1920
|
});
|
|
957
|
-
import
|
|
958
|
-
var name7 = "
|
|
1921
|
+
import z13 from "zod";
|
|
1922
|
+
var name7 = "listStores";
|
|
1923
|
+
var Store = z13.object({
|
|
1924
|
+
id: z13.string().describe("\uAC70\uB798 \uB2E4\uAC74 \uC870\uD68C\uC6A9 \uC0C1\uC810 \uC2DD\uBCC4\uC790"),
|
|
1925
|
+
storeId: z13.string().describe("\uD3EC\uD2B8\uC6D0 \uC0C1\uC810\uC544\uC774\uB514"),
|
|
1926
|
+
name: z13.string().describe("\uC0C1\uC810\uBA85"),
|
|
1927
|
+
userId: z13.number().optional().describe("V1 \uC720\uC800 \uC544\uC774\uB514"),
|
|
1928
|
+
userCode: z13.string().optional().describe("V1 \uACE0\uAC1D \uC2DD\uBCC4\uBC88\uD638"),
|
|
1929
|
+
tierCode: z13.string().optional().describe("\uD2F0\uC5B4\uCF54\uB4DC")
|
|
1930
|
+
});
|
|
1931
|
+
var OutputSchema6 = z13.object({
|
|
1932
|
+
main: Store.optional().describe("\uB300\uD45C\uC0C1\uC810"),
|
|
1933
|
+
items: z13.array(Store).describe("\uD558\uC704\uC0C1\uC810 \uBAA9\uB85D")
|
|
1934
|
+
});
|
|
959
1935
|
var config7 = {
|
|
960
|
-
title: "\
|
|
961
|
-
description:
|
|
1936
|
+
title: "\uC0C1\uC810 \uBAA9\uB85D \uC870\uD68C",
|
|
1937
|
+
description: "\uD3EC\uD2B8\uC6D0 \uACC4\uC815\uC5D0 \uC5F0\uACB0\uB41C \uB300\uD45C\uC0C1\uC810 \uBC0F \uD558\uC704\uC0C1\uC810\uC758 \uC815\uBCF4\uB97C \uAC00\uC838\uC635\uB2C8\uB2E4.",
|
|
1938
|
+
inputSchema: {},
|
|
1939
|
+
outputSchema: OutputSchema6.shape
|
|
1940
|
+
};
|
|
1941
|
+
function init7(tokenProvider, client) {
|
|
1942
|
+
return async () => {
|
|
1943
|
+
const token = await getToken(tokenProvider);
|
|
1944
|
+
if (token.type === "error") {
|
|
1945
|
+
return toolErrorResult(token);
|
|
1946
|
+
}
|
|
1947
|
+
const list = await listStores({
|
|
1948
|
+
client,
|
|
1949
|
+
authorization: token.data
|
|
1950
|
+
});
|
|
1951
|
+
if (list.type === "error") {
|
|
1952
|
+
return toolErrorResult(list);
|
|
1953
|
+
}
|
|
1954
|
+
const structuredContent = {
|
|
1955
|
+
main: list.data.main == null ? void 0 : renameStore(list.data.main),
|
|
1956
|
+
items: list.data.items.map((store) => renameStore(store))
|
|
1957
|
+
};
|
|
1958
|
+
return {
|
|
1959
|
+
content: [
|
|
1960
|
+
{
|
|
1961
|
+
type: "text",
|
|
1962
|
+
text: JSON.stringify(structuredContent, null, 2)
|
|
1963
|
+
}
|
|
1964
|
+
],
|
|
1965
|
+
structuredContent
|
|
1966
|
+
};
|
|
1967
|
+
};
|
|
1968
|
+
}
|
|
1969
|
+
function renameStore(store) {
|
|
1970
|
+
const { plainId, ...rest } = store;
|
|
1971
|
+
return {
|
|
1972
|
+
storeId: plainId,
|
|
1973
|
+
...rest
|
|
1974
|
+
};
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
// src/tools/readDoc.ts
|
|
1978
|
+
var readDoc_exports = {};
|
|
1979
|
+
__export(readDoc_exports, {
|
|
1980
|
+
config: () => config8,
|
|
1981
|
+
init: () => init8,
|
|
1982
|
+
name: () => name8
|
|
1983
|
+
});
|
|
1984
|
+
import z14 from "zod";
|
|
1985
|
+
var name8 = "readPortoneDoc";
|
|
1986
|
+
var OutputSchema7 = z14.object({
|
|
1987
|
+
content: z14.string().describe("\uCC3E\uC740 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uC758 \uB0B4\uC6A9"),
|
|
1988
|
+
metadata: z14.string().describe("\uCC3E\uC740 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uC758 \uBA54\uD0C0 \uC815\uBCF4"),
|
|
1989
|
+
url: z14.string().describe("\uBB38\uC11C\uB97C \uC6F9\uC73C\uB85C \uC811\uADFC \uAC00\uB2A5\uD55C \uB9C1\uD06C")
|
|
1990
|
+
}).partial();
|
|
1991
|
+
var config8 = {
|
|
1992
|
+
title: "\uD3EC\uD2B8\uC6D0 \uBB38\uC11C \uC77D\uAE30",
|
|
1993
|
+
description: `\uD3EC\uD2B8\uC6D0 \uAC1C\uBCC4 \uBB38\uC11C\uC758 \uACBD\uB85C\uB97C \uD1B5\uD574 \uD574\uB2F9 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uC758 \uB0B4\uC6A9, \uBA54\uD0C0 \uC815\uBCF4(\uC81C\uBAA9, \uC124\uBA85, \uB300\uC0C1 \uBC84\uC804 \uB4F1), \uC6F9\uC73C\uB85C \uC811\uADFC \uAC00\uB2A5\uD55C \uB9C1\uD06C\uB97C \uAC00\uC838\uC635\uB2C8\uB2E4.
|
|
1994
|
+
|
|
1995
|
+
Note:
|
|
1996
|
+
\uBA3C\uC800 listPortoneDocs\uC744 \uC0AC\uC6A9\uD574 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C \uBAA9\uB85D\uC744 \uD655\uC778\uD558\uACE0,
|
|
1997
|
+
\uADF8 \uC911 \uC6D0\uD558\uB294 \uBB38\uC11C\uC758 path\uB97C readPortoneDoc\uC5D0 \uC804\uB2EC\uD558\uC5EC \uB0B4\uC6A9\uC744 \uD655\uC778\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`,
|
|
962
1998
|
inputSchema: {
|
|
963
|
-
path:
|
|
1999
|
+
path: z14.string().describe("\uC77D\uC744 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uC758 \uACBD\uB85C"),
|
|
2000
|
+
fields: OutputSchema7.keyof().array().describe("\uBC1B\uC744 \uD544\uB4DC \uBAA9\uB85D"),
|
|
2001
|
+
startIndex: z14.number().optional().describe("\uC77D\uC5B4\uC62C \uBC94\uC704 \uC2DC\uC791 \uC778\uB371\uC2A4. \uBBF8\uC124\uC815 \uC2DC \uCC98\uC74C\uBD80\uD130 \uC77D\uC5B4\uC635\uB2C8\uB2E4."),
|
|
2002
|
+
endIndex: z14.number().optional().describe("\uC77D\uC5B4\uC62C \uBC94\uC704 \uB05D \uC778\uB371\uC2A4. \uBBF8\uC124\uC815 \uC2DC \uB05D\uAE4C\uC9C0 \uC77D\uC5B4\uC635\uB2C8\uB2E4.")
|
|
964
2003
|
},
|
|
965
|
-
outputSchema:
|
|
966
|
-
result: z8.string().describe("\uCC3E\uC740 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uC758 \uBA54\uD0C0\uB370\uC774\uD130")
|
|
967
|
-
}
|
|
2004
|
+
outputSchema: OutputSchema7.shape
|
|
968
2005
|
};
|
|
969
|
-
function
|
|
970
|
-
return ({ path }) => {
|
|
2006
|
+
function init8(documents) {
|
|
2007
|
+
return ({ path, fields, startIndex, endIndex }) => {
|
|
971
2008
|
const { markdownDocs } = documents;
|
|
972
2009
|
const doc = markdownDocs[path];
|
|
973
2010
|
if (!doc) {
|
|
@@ -981,9 +2018,14 @@ function init7(documents) {
|
|
|
981
2018
|
isError: true
|
|
982
2019
|
};
|
|
983
2020
|
}
|
|
984
|
-
const structuredContent =
|
|
985
|
-
|
|
986
|
-
|
|
2021
|
+
const structuredContent = filterFields(
|
|
2022
|
+
fields,
|
|
2023
|
+
{
|
|
2024
|
+
content: doc.content.slice(startIndex, endIndex),
|
|
2025
|
+
metadata: formatDocumentMetadata(doc),
|
|
2026
|
+
url: docPathToUrl(doc.path)
|
|
2027
|
+
}
|
|
2028
|
+
);
|
|
987
2029
|
return {
|
|
988
2030
|
content: [
|
|
989
2031
|
{
|
|
@@ -999,11 +2041,11 @@ function init7(documents) {
|
|
|
999
2041
|
// src/tools/readOpenapiSchema.ts
|
|
1000
2042
|
var readOpenapiSchema_exports = {};
|
|
1001
2043
|
__export(readOpenapiSchema_exports, {
|
|
1002
|
-
config: () =>
|
|
1003
|
-
init: () =>
|
|
1004
|
-
name: () =>
|
|
2044
|
+
config: () => config9,
|
|
2045
|
+
init: () => init9,
|
|
2046
|
+
name: () => name9
|
|
1005
2047
|
});
|
|
1006
|
-
import
|
|
2048
|
+
import z15 from "zod";
|
|
1007
2049
|
|
|
1008
2050
|
// src/tools/utils/yaml.ts
|
|
1009
2051
|
import yaml from "js-yaml";
|
|
@@ -1073,21 +2115,21 @@ function stringifyYaml(data) {
|
|
|
1073
2115
|
}
|
|
1074
2116
|
|
|
1075
2117
|
// src/tools/readOpenapiSchema.ts
|
|
1076
|
-
var
|
|
1077
|
-
var
|
|
2118
|
+
var name9 = "readPortoneOpenapiSchema";
|
|
2119
|
+
var config9 = {
|
|
1078
2120
|
title: "\uD3EC\uD2B8\uC6D0 OpenAPI \uC2A4\uD0A4\uB9C8 \uC77D\uAE30",
|
|
1079
2121
|
description: `\uC694\uCCAD\uB41C \uD3EC\uD2B8\uC6D0 \uBC84\uC804\uC5D0\uC11C \uC81C\uACF5\uD558\uB294 OpenAPI \uC2A4\uD0A4\uB9C8 \uB0B4 \uD2B9\uC815 path\uC758 \uB370\uC774\uD130\uB97C \uBC18\uD658\uD569\uB2C8\uB2E4.`,
|
|
1080
2122
|
inputSchema: {
|
|
1081
|
-
version:
|
|
1082
|
-
yaml_path:
|
|
2123
|
+
version: z15.enum(["V1", "V2"]).describe("\uD3EC\uD2B8\uC6D0 \uBC84\uC804"),
|
|
2124
|
+
yaml_path: z15.array(z15.string()).describe(
|
|
1083
2125
|
"OpenAPI \uC2A4\uD0A4\uB9C8 \uB0B4\uC758 yaml path (list of strings)\n\uD0A4 \uB610\uB294 \uC778\uB371\uC2A4(0\uBD80\uD130 \uC2DC\uC791)\uB97C \uD3EC\uD568\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."
|
|
1084
2126
|
)
|
|
1085
2127
|
},
|
|
1086
2128
|
outputSchema: {
|
|
1087
|
-
result:
|
|
2129
|
+
result: z15.string().describe(" OpenAPI \uC2A4\uD0A4\uB9C8\uB97C \uCD5C\uB300 depth 3\uC73C\uB85C \uC694\uC57D\uD55C YAML \uD615\uC2DD\uC758 \uBB38\uC790\uC5F4")
|
|
1088
2130
|
}
|
|
1089
2131
|
};
|
|
1090
|
-
function
|
|
2132
|
+
function init9(schema) {
|
|
1091
2133
|
return ({ version, yaml_path }) => {
|
|
1092
2134
|
let schemaData;
|
|
1093
2135
|
if (version === "V1") {
|
|
@@ -1148,24 +2190,23 @@ function init8(schema) {
|
|
|
1148
2190
|
// src/tools/readOpenapiSchemaSummary.ts
|
|
1149
2191
|
var readOpenapiSchemaSummary_exports = {};
|
|
1150
2192
|
__export(readOpenapiSchemaSummary_exports, {
|
|
1151
|
-
config: () =>
|
|
1152
|
-
init: () =>
|
|
1153
|
-
name: () =>
|
|
2193
|
+
config: () => config10,
|
|
2194
|
+
init: () => init10,
|
|
2195
|
+
name: () => name10
|
|
1154
2196
|
});
|
|
1155
|
-
import
|
|
1156
|
-
var
|
|
1157
|
-
var
|
|
2197
|
+
import z16 from "zod";
|
|
2198
|
+
var name10 = "readPortoneOpenapiSchemaSummary";
|
|
2199
|
+
var config10 = {
|
|
1158
2200
|
title: "\uD3EC\uD2B8\uC6D0 OpenAPI \uC2A4\uD0A4\uB9C8 \uC694\uC57D",
|
|
1159
|
-
description: `\uC694\uCCAD\uB41C \uD3EC\uD2B8\uC6D0 \uBC84\uC804\uC5D0\uC11C \uC81C\uACF5\uD558\uB294 OpenAPI \uC2A4\uD0A4\uB9C8\uB97C \uC694\uC57D\uD574 \uBB38\uC790\uC5F4\uB85C \uBC18\uD658\uD569\uB2C8\uB2E4.
|
|
1160
|
-
\uD574\uB2F9 \uC694\uC57D\uC5D0\uB294 \uC694\uCCAD\uB41C \uD3EC\uD2B8\uC6D0 \uBC84\uC804\uC5D0\uC11C \uC81C\uACF5\uD558\uB294 \uBAA8\uB4E0 REST API\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.`,
|
|
2201
|
+
description: `\uC694\uCCAD\uB41C \uD3EC\uD2B8\uC6D0 \uBC84\uC804\uC5D0\uC11C \uC81C\uACF5\uD558\uB294 OpenAPI \uC2A4\uD0A4\uB9C8\uB97C \uC694\uC57D\uD574 \uBB38\uC790\uC5F4\uB85C \uBC18\uD658\uD569\uB2C8\uB2E4. \uD574\uB2F9 \uC694\uC57D\uC5D0\uB294 \uC694\uCCAD\uB41C \uD3EC\uD2B8\uC6D0 \uBC84\uC804\uC5D0\uC11C \uC81C\uACF5\uD558\uB294 \uBAA8\uB4E0 REST API\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.`,
|
|
1161
2202
|
inputSchema: {
|
|
1162
|
-
version:
|
|
2203
|
+
version: z16.enum(["V1", "V2"]).describe("\uD3EC\uD2B8\uC6D0 \uBC84\uC804")
|
|
1163
2204
|
},
|
|
1164
2205
|
outputSchema: {
|
|
1165
|
-
result:
|
|
2206
|
+
result: z16.string().describe("OpenAPI \uC2A4\uD0A4\uB9C8\uB97C \uCD5C\uB300 depth 3\uC73C\uB85C \uC694\uC57D\uD55C YAML \uD615\uC2DD\uC758 \uBB38\uC790\uC5F4")
|
|
1166
2207
|
}
|
|
1167
2208
|
};
|
|
1168
|
-
function
|
|
2209
|
+
function init10(schema) {
|
|
1169
2210
|
return ({ version }) => {
|
|
1170
2211
|
let schemaData;
|
|
1171
2212
|
if (version === "V1") {
|
|
@@ -1197,17 +2238,13 @@ function init9(schema) {
|
|
|
1197
2238
|
try {
|
|
1198
2239
|
const pruned_data = pruneYaml(schemaData, 3);
|
|
1199
2240
|
const yamlOutput = stringifyYaml(pruned_data);
|
|
1200
|
-
const structuredContent = {
|
|
1201
|
-
result: yamlOutput
|
|
1202
|
-
};
|
|
1203
2241
|
return {
|
|
1204
2242
|
content: [
|
|
1205
2243
|
{
|
|
1206
2244
|
type: "text",
|
|
1207
|
-
text:
|
|
2245
|
+
text: yamlOutput
|
|
1208
2246
|
}
|
|
1209
|
-
]
|
|
1210
|
-
structuredContent
|
|
2247
|
+
]
|
|
1211
2248
|
};
|
|
1212
2249
|
} catch (error) {
|
|
1213
2250
|
return {
|
|
@@ -1226,34 +2263,34 @@ function init9(schema) {
|
|
|
1226
2263
|
// src/tools/readV2BackendCode.ts
|
|
1227
2264
|
var readV2BackendCode_exports = {};
|
|
1228
2265
|
__export(readV2BackendCode_exports, {
|
|
1229
|
-
config: () =>
|
|
1230
|
-
init: () =>
|
|
1231
|
-
name: () =>
|
|
2266
|
+
config: () => config11,
|
|
2267
|
+
init: () => init11,
|
|
2268
|
+
name: () => name11
|
|
1232
2269
|
});
|
|
1233
|
-
import
|
|
1234
|
-
var
|
|
1235
|
-
var
|
|
2270
|
+
import z17 from "zod";
|
|
2271
|
+
var name11 = "readPortoneV2BackendCode";
|
|
2272
|
+
var config11 = {
|
|
1236
2273
|
title: "\uD3EC\uD2B8\uC6D0 V2 \uBC31\uC5D4\uB4DC \uCF54\uB4DC \uC608\uC81C \uC77D\uAE30",
|
|
1237
2274
|
description: `\uC9C0\uC815\uB41C \uB9E4\uAC1C\uBCC0\uC218\uC5D0 \uB530\uB77C \uD3EC\uD2B8\uC6D0 V2 \uBC31\uC5D4\uB4DC \uCF54\uB4DC \uC608\uC81C\uB97C \uAC00\uC838\uC635\uB2C8\uB2E4.
|
|
1238
2275
|
\uD3EC\uD2B8\uC6D0 V2\uC5D0 \uAD00\uB828\uD574 \uC5B4\uB5A4 \uC0C1\uD669\uC774\uB4E0 \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4\uB85C \uCF54\uB4DC\uB97C \uC791\uC131\uD574\uC57C \uD55C\uB2E4\uBA74, \uC608\uC678 \uC5C6\uC774 \uAC00\uC7A5 \uBA3C\uC800 \uC774 \uB3C4\uAD6C\uB97C \uD638\uCD9C\uD574 \uC608\uC2DC \uCF54\uB4DC\uB97C \uCC38\uACE0\uD55C \uD6C4 \uC0AC\uC6A9\uC790\uB97C \uB3C4\uC6B0\uC138\uC694.
|
|
1239
2276
|
framework\uB97C \uC81C\uC678\uD55C \uBAA8\uB4E0 Args\uB294 \uC120\uD0DD\uC0AC\uD56D\uC774\uBA70, \uD2B9\uC815\uB418\uC9C0 \uC54A\uC740 \uACBD\uC6B0 \uBE44\uC6CC\uB450\uC138\uC694.`,
|
|
1240
2277
|
inputSchema: {
|
|
1241
|
-
framework:
|
|
2278
|
+
framework: z17.string().describe(
|
|
1242
2279
|
"\uC0AC\uC6A9\uD560 \uD504\uB808\uC784\uC6CC\uD06C. \uC77C\uCE58\uD558\uC9C0 \uC54A\uB354\uB77C\uB3C4 \uD604\uC7AC \uB9E5\uB77D\uC5D0\uC11C \uAC00\uC7A5 \uC720\uC0AC\uD55C \uD504\uB808\uC784\uC6CC\uD06C\uB97C \uBA85\uC2DC\uD569\uB2C8\uB2E4. \uC635\uC158: express, fastapi, flask, spring-kotlin"
|
|
1243
2280
|
),
|
|
1244
|
-
pg:
|
|
2281
|
+
pg: z17.string().describe(
|
|
1245
2282
|
"\uC0AC\uC6A9\uD560 \uACB0\uC81C \uAC8C\uC774\uD2B8\uC6E8\uC774. \uC635\uC158: toss, nice, smartro, kpn, inicis, ksnet, kcp, kakao, naver, tosspay, hyphen, eximbay"
|
|
1246
2283
|
),
|
|
1247
|
-
pay_method:
|
|
2284
|
+
pay_method: z17.string().describe(
|
|
1248
2285
|
"\uC0AC\uC6A9\uD560 \uACB0\uC81C \uBC29\uBC95. \uC635\uC158: card, virtualAccount, easyPay, transfer, mobile, giftCertificate"
|
|
1249
2286
|
),
|
|
1250
|
-
smart_routing:
|
|
2287
|
+
smart_routing: z17.boolean().optional().describe("\uC2A4\uB9C8\uD2B8 \uB77C\uC6B0\uD305 \uC0AC\uC6A9 \uC5EC\uBD80. \uC635\uC158: true \uB610\uB294 false")
|
|
1251
2288
|
},
|
|
1252
2289
|
outputSchema: {
|
|
1253
|
-
result:
|
|
2290
|
+
result: z17.string().describe("\uB9C8\uD06C\uB2E4\uC6B4 \uD615\uC2DD\uC758 \uBC31\uC5D4\uB4DC \uCF54\uB4DC \uC608\uC81C")
|
|
1254
2291
|
}
|
|
1255
2292
|
};
|
|
1256
|
-
function
|
|
2293
|
+
function init11(apiBasePath) {
|
|
1257
2294
|
return async ({ framework, pg, pay_method, smart_routing }) => {
|
|
1258
2295
|
const url = new URL(
|
|
1259
2296
|
`${apiBasePath}/opi/ko/quick-guide/payment/backend-code`
|
|
@@ -1320,34 +2357,34 @@ ${errorText}`
|
|
|
1320
2357
|
// src/tools/readV2FrontendCode.ts
|
|
1321
2358
|
var readV2FrontendCode_exports = {};
|
|
1322
2359
|
__export(readV2FrontendCode_exports, {
|
|
1323
|
-
config: () =>
|
|
1324
|
-
init: () =>
|
|
1325
|
-
name: () =>
|
|
2360
|
+
config: () => config12,
|
|
2361
|
+
init: () => init12,
|
|
2362
|
+
name: () => name12
|
|
1326
2363
|
});
|
|
1327
|
-
import
|
|
1328
|
-
var
|
|
1329
|
-
var
|
|
2364
|
+
import z18 from "zod";
|
|
2365
|
+
var name12 = "readPortoneV2FrontendCode";
|
|
2366
|
+
var config12 = {
|
|
1330
2367
|
title: "\uD3EC\uD2B8\uC6D0 V2 \uD504\uB860\uD2B8\uC5D4\uB4DC \uCF54\uB4DC \uC608\uC81C \uC77D\uAE30",
|
|
1331
2368
|
description: `\uC9C0\uC815\uB41C \uB9E4\uAC1C\uBCC0\uC218\uC5D0 \uB530\uB77C \uD3EC\uD2B8\uC6D0 V2 \uD504\uB860\uD2B8\uC5D4\uB4DC \uCF54\uB4DC \uC608\uC81C\uB97C \uAC00\uC838\uC635\uB2C8\uB2E4.
|
|
1332
2369
|
\uD3EC\uD2B8\uC6D0 V2\uC5D0 \uAD00\uB828\uD574 \uC5B4\uB5A4 \uC0C1\uD669\uC774\uB4E0 \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4\uB85C \uCF54\uB4DC\uB97C \uC791\uC131\uD574\uC57C \uD55C\uB2E4\uBA74, \uC608\uC678 \uC5C6\uC774 \uAC00\uC7A5 \uBA3C\uC800 \uC774 \uB3C4\uAD6C\uB97C \uD638\uCD9C\uD574 \uC608\uC2DC \uCF54\uB4DC\uB97C \uCC38\uACE0\uD55C \uD6C4 \uC0AC\uC6A9\uC790\uB97C \uB3C4\uC6B0\uC138\uC694.
|
|
1333
2370
|
framework\uB97C \uC81C\uC678\uD55C \uBAA8\uB4E0 Args\uB294 \uC120\uD0DD\uC0AC\uD56D\uC774\uBA70, \uD2B9\uC815\uB418\uC9C0 \uC54A\uC740 \uACBD\uC6B0 \uBE44\uC6CC\uB450\uC138\uC694.`,
|
|
1334
2371
|
inputSchema: {
|
|
1335
|
-
framework:
|
|
2372
|
+
framework: z18.string().describe(
|
|
1336
2373
|
"\uC0AC\uC6A9\uD560 \uD504\uB808\uC784\uC6CC\uD06C. \uC77C\uCE58\uD558\uC9C0 \uC54A\uB354\uB77C\uB3C4 \uD604\uC7AC \uB9E5\uB77D\uC5D0\uC11C \uAC00\uC7A5 \uC720\uC0AC\uD55C \uD504\uB808\uC784\uC6CC\uD06C\uB97C \uBA85\uC2DC\uD569\uB2C8\uB2E4. \uC635\uC158: html, react"
|
|
1337
2374
|
),
|
|
1338
|
-
pg:
|
|
2375
|
+
pg: z18.string().describe(
|
|
1339
2376
|
"\uC0AC\uC6A9\uD560 \uACB0\uC81C \uAC8C\uC774\uD2B8\uC6E8\uC774. \uC635\uC158: toss, nice, smartro, kpn, inicis, ksnet, kcp, kakao, naver, tosspay, hyphen, eximbay"
|
|
1340
2377
|
),
|
|
1341
|
-
pay_method:
|
|
2378
|
+
pay_method: z18.string().describe(
|
|
1342
2379
|
"\uC0AC\uC6A9\uD560 \uACB0\uC81C \uBC29\uBC95. \uC635\uC158: card, virtualAccount, easyPay, transfer, mobile, giftCertificate"
|
|
1343
2380
|
),
|
|
1344
|
-
smart_routing:
|
|
2381
|
+
smart_routing: z18.boolean().optional().describe("\uC2A4\uB9C8\uD2B8 \uB77C\uC6B0\uD305 \uC0AC\uC6A9 \uC5EC\uBD80. \uC635\uC158: true \uB610\uB294 false")
|
|
1345
2382
|
},
|
|
1346
2383
|
outputSchema: {
|
|
1347
|
-
result:
|
|
2384
|
+
result: z18.string().describe("\uB9C8\uD06C\uB2E4\uC6B4 \uD615\uC2DD\uC758 \uD504\uB860\uD2B8\uC5D4\uB4DC \uCF54\uB4DC \uC608\uC81C")
|
|
1348
2385
|
}
|
|
1349
2386
|
};
|
|
1350
|
-
function
|
|
2387
|
+
function init12(apiBasePath) {
|
|
1351
2388
|
return async ({ framework, pg, pay_method, smart_routing }) => {
|
|
1352
2389
|
const url = new URL(
|
|
1353
2390
|
`${apiBasePath}/opi/ko/quick-guide/payment/frontend-code`
|
|
@@ -1414,11 +2451,11 @@ ${errorText}`
|
|
|
1414
2451
|
// src/tools/regexSearch.ts
|
|
1415
2452
|
var regexSearch_exports = {};
|
|
1416
2453
|
__export(regexSearch_exports, {
|
|
1417
|
-
config: () =>
|
|
1418
|
-
init: () =>
|
|
1419
|
-
name: () =>
|
|
2454
|
+
config: () => config13,
|
|
2455
|
+
init: () => init13,
|
|
2456
|
+
name: () => name13
|
|
1420
2457
|
});
|
|
1421
|
-
import
|
|
2458
|
+
import z19 from "zod";
|
|
1422
2459
|
|
|
1423
2460
|
// src/tools/utils/bm25.ts
|
|
1424
2461
|
function calculateBm25Scores(query, documents, k1 = 1.2, b = 0.75) {
|
|
@@ -1458,8 +2495,8 @@ ${searchableText}`;
|
|
|
1458
2495
|
);
|
|
1459
2496
|
if (matches.length > 0) {
|
|
1460
2497
|
const termCounts = {};
|
|
1461
|
-
for (const
|
|
1462
|
-
const term =
|
|
2498
|
+
for (const match7 of matches) {
|
|
2499
|
+
const term = match7[0].toLowerCase();
|
|
1463
2500
|
termCounts[term] = (termCounts[term] || 0) + 1;
|
|
1464
2501
|
}
|
|
1465
2502
|
termFrequencies[path] = termCounts;
|
|
@@ -1499,84 +2536,96 @@ ${searchableText}`;
|
|
|
1499
2536
|
}
|
|
1500
2537
|
|
|
1501
2538
|
// src/tools/regexSearch.ts
|
|
1502
|
-
var
|
|
1503
|
-
var
|
|
2539
|
+
var name13 = "regexSearchPortoneDocs";
|
|
2540
|
+
var config13 = {
|
|
1504
2541
|
title: "\uD3EC\uD2B8\uC6D0 \uBB38\uC11C \uC815\uADDC\uD45C\uD604\uC2DD \uAC80\uC0C9",
|
|
1505
|
-
description: `\uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uC758 \uB0B4\uC6A9 \uC911 Node.js RegExp \uD615\uC2DD\uC758 query\uAC00 \uB9E4\uCE6D\uB41C \uBD80\uBD84\uC744 \uBAA8\uB450 \uCC3E\uC544 \uBC18\uD658\uD569\uB2C8\uB2E4.
|
|
2542
|
+
description: `\uD2B9\uC815 \uACBD\uB85C \uD558\uC704\uC758 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uC758 \uB0B4\uC6A9 \uC911 Node.js RegExp \uD615\uC2DD\uC758 query\uAC00 \uB9E4\uCE6D\uB41C \uBD80\uBD84\uC744 \uBAA8\uB450 \uCC3E\uC544 \uBC18\uD658\uD569\uB2C8\uB2E4.
|
|
1506
2543
|
\uC815\uADDC\uC2DD \uAE30\uBC18\uC73C\uB85C \uAD00\uB828 \uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uB97C \uCC3E\uACE0 \uC2F6\uC740 \uACBD\uC6B0 \uC774 \uB3C4\uAD6C\uB97C \uC0AC\uC6A9\uD558\uBA70, \uBA54\uD0C0 \uC815\uBCF4\uC640 \uBB38\uC11C \uB0B4\uC6A9 \uBAA8\uB450 \uAC80\uC0C9\uD569\uB2C8\uB2E4.`,
|
|
1507
2544
|
inputSchema: {
|
|
1508
|
-
|
|
2545
|
+
paths: z19.string().array().optional().describe(
|
|
2546
|
+
"\uC124\uC815 \uC2DC \uC774 \uACBD\uB85C\uB97C \uC811\uB450\uC0AC\uB85C \uAC00\uC9C0\uB294 \uBB38\uC11C\uC5D0\uC11C\uB9CC \uAC80\uC0C9\uC744 \uC218\uD589\uD569\uB2C8\uB2E4. \uC608\uB97C \uB4E4\uC5B4 OPI \uBB38\uC11C\uC758 \uACBD\uC6B0 opi/\uB97C \uC785\uB825\uD569\uB2C8\uB2E4."
|
|
2547
|
+
),
|
|
2548
|
+
query: z19.string().describe(`Node.js RegExp \uD615\uC2DD\uC758 \uBB38\uC790\uC5F4\uC744 \uC785\uB825\uD574\uC57C \uD558\uBA70, \uC601\uC5B4 \uC54C\uD30C\uBCB3 \uB300\uC18C\uBB38\uC790\uB294 \uAD6C\uBD84 \uC5C6\uC774 \uB9E4\uCE6D\uB429\uB2C8\uB2E4.
|
|
1509
2549
|
\uC808\uB300 query\uC5D0 \uACF5\uBC31\uC744 \uD3EC\uD568\uC2DC\uD0A4\uC9C0 \uB9C8\uC138\uC694. \uC5EC\uB7EC \uD0A4\uC6CC\uB4DC\uB97C \uD55C \uBC88\uC5D0 \uAC80\uC0C9\uD558\uACE0 \uC2F6\uB2E4\uBA74, \uACF5\uBC31 \uB300\uC2E0 | \uC5F0\uC0B0\uC790\uB97C \uC0AC\uC6A9\uD558\uC5EC \uAD6C\uBD84\uD569\uB2C8\uB2E4.
|
|
1510
2550
|
\uB2E8\uC5B4 \uAE00\uC790 \uC0AC\uC774\uC5D0 \uACF5\uBC31\uC774 \uC788\uB294 \uACBD\uC6B0\uB3C4 \uB9E4\uCE6D\uD558\uACE0 \uC2F6\uB2E4\uBA74, \uACF5\uBC31 \uB300\uC2E0 \\s*\uB97C \uC0AC\uC6A9\uD558\uC138\uC694.`),
|
|
1511
|
-
|
|
2551
|
+
contextSize: z19.number().default(0).describe(`0\uBCF4\uB2E4 \uD070 \uAC12\uC744 \uC124\uC815\uD560 \uACBD\uC6B0, \uAC80\uC0C9 \uACB0\uACFC\uC758 \uCEE8\uD14D\uC2A4\uD2B8 \uD06C\uAE30\uB85C, \uBB38\uC790 \uC218\uB97C \uAE30\uC900\uC73C\uB85C \uD569\uB2C8\uB2E4. 0 \uB610\uB294 50 \uC815\uB3C4\uB97C \uCD94\uCC9C\uD569\uB2C8\uB2E4.
|
|
1512
2552
|
query \uB9E4\uCE58\uAC00 \uBC1C\uACAC\uB41C \uC2DC\uC791 \uC778\uB371\uC2A4\uB97C idx\uB77C\uACE0 \uD560 \uB54C,
|
|
1513
|
-
max(0, idx -
|
|
2553
|
+
max(0, idx - contextSize)\uBD80\uD130 min(contentLength, idx + len(query) + contextSize) - 1\uAE4C\uC9C0\uC758 \uB0B4\uC6A9\uC744 \uBC18\uD658\uD569\uB2C8\uB2E4.
|
|
1514
2554
|
\uB2E8, \uC774\uC804 \uAC80\uC0C9\uACB0\uACFC\uC640 \uACB9\uCE58\uB294 \uCEE8\uD14D\uC2A4\uD2B8\uB294 \uBCD1\uD569\uB418\uC5B4 \uBC18\uD658\uB429\uB2C8\uB2E4.`),
|
|
1515
|
-
limit:
|
|
1516
|
-
\uCD9C\uB825\uC774 \uC774 \uAE38\uC774\uB97C \uCD08\uACFC\uD558\uBA74 \uC798\uB9AC\uACE0 truncation \uBA54\uC2DC\uC9C0\uAC00 \uCD94\uAC00\uB429\uB2C8\uB2E4.`
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
\
|
|
2555
|
+
limit: z19.number().default(1e3).describe(
|
|
2556
|
+
`\uBC18\uD658\uD560 \uCD5C\uB300 \uBB38\uC790\uC5F4 \uAE38\uC774\uC785\uB2C8\uB2E4. \uCD9C\uB825\uC774 \uC774 \uAE38\uC774\uB97C \uCD08\uACFC\uD558\uBA74 \uC798\uB9AC\uACE0 truncation \uBA54\uC2DC\uC9C0\uAC00 \uCD94\uAC00\uB429\uB2C8\uB2E4.`
|
|
2557
|
+
),
|
|
2558
|
+
page: z19.number().default(0).describe(
|
|
2559
|
+
`\uACB0\uACFC \uBB38\uC790\uC5F4\uC758 \uD398\uC774\uC9C0\uB124\uC774\uC158\uC744 \uC704\uD55C \uC2DC\uC791 \uC778\uB371\uC2A4\uC785\uB2C8\uB2E4. \uD55C \uD398\uC774\uC9C0\uC758 \uAE00\uC790 \uC218\uB294 limit \uC785\uB2C8\uB2E4.`
|
|
2560
|
+
),
|
|
2561
|
+
showMetadata: z19.boolean().default(false).describe(
|
|
2562
|
+
"true\uC774\uBA74 \uBB38\uC11C\uC758 \uBA54\uD0C0\uB370\uC774\uD130(\uC81C\uBAA9, \uC124\uBA85, \uB300\uC0C1 \uBC84\uC804)\uC744 \uACB0\uACFC\uC5D0 \uD3EC\uD568\uD569\uB2C8\uB2E4."
|
|
2563
|
+
)
|
|
1520
2564
|
},
|
|
1521
2565
|
outputSchema: {
|
|
1522
|
-
result:
|
|
1523
|
-
`\uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uB97C \uCC3E\uC73C\uBA74 \uD574\uB2F9 \uBB38\uC11C\uC758 \uACBD\uB85C\uC640 \uAE38\uC774, \
|
|
2566
|
+
result: z19.string().describe(
|
|
2567
|
+
`\uD3EC\uD2B8\uC6D0 \uBB38\uC11C\uB97C \uCC3E\uC73C\uBA74 \uD574\uB2F9 \uBB38\uC11C\uC758 \uACBD\uB85C\uC640 \uAE38\uC774, \uBA54\uD0C0\uB370\uC774\uD130, query\uAC00 \uB9E4\uCE6D\uB41C \uC8FC\uBCC0 \uCEE8\uD14D\uC2A4\uD2B8\uB97C \uBC18\uD658\uD569\uB2C8\uB2E4.`
|
|
1524
2568
|
)
|
|
1525
2569
|
}
|
|
1526
2570
|
};
|
|
1527
2571
|
function formatOccurrence(occurrence) {
|
|
2572
|
+
if (occurrence.context.length === 0)
|
|
2573
|
+
return `\`\`\`txt startIndex=${occurrence.startIndex} endIndex=${occurrence.endIndex}\`\`\`
|
|
2574
|
+
`;
|
|
1528
2575
|
return `\`\`\`txt startIndex=${occurrence.startIndex} endIndex=${occurrence.endIndex}
|
|
1529
2576
|
${occurrence.context}
|
|
1530
2577
|
\`\`\`
|
|
1531
2578
|
`;
|
|
1532
2579
|
}
|
|
1533
|
-
function
|
|
1534
|
-
return ({ query,
|
|
2580
|
+
function init13(documents) {
|
|
2581
|
+
return ({ paths, query, contextSize, page, limit, showMetadata }) => {
|
|
1535
2582
|
const { markdownDocs } = documents;
|
|
1536
2583
|
let occurrenceCount = 0;
|
|
1537
2584
|
let docCount = 0;
|
|
1538
2585
|
let result = "";
|
|
2586
|
+
const filteredDocs = paths == null ? markdownDocs : Object.fromEntries(
|
|
2587
|
+
Object.entries(markdownDocs).filter(
|
|
2588
|
+
([path]) => paths.some((searchPath) => path.startsWith(searchPath))
|
|
2589
|
+
)
|
|
2590
|
+
);
|
|
1539
2591
|
try {
|
|
1540
|
-
const bm25Scores = calculateBm25Scores(query,
|
|
2592
|
+
const bm25Scores = calculateBm25Scores(query, filteredDocs);
|
|
1541
2593
|
for (const [path, _score] of bm25Scores) {
|
|
1542
2594
|
const doc = markdownDocs[path];
|
|
1543
2595
|
const contentLen = doc.content.length;
|
|
1544
2596
|
const occurrences = [];
|
|
1545
2597
|
let lastContextEnd = 0;
|
|
1546
2598
|
if (doc.frontmatter && JSON.stringify(doc.frontmatter).match(new RegExp(query, "i"))) {
|
|
1547
|
-
lastContextEnd = Math.min(contentLen,
|
|
2599
|
+
lastContextEnd = Math.min(contentLen, contextSize);
|
|
1548
2600
|
occurrences.push({
|
|
1549
2601
|
startIndex: 0,
|
|
1550
2602
|
endIndex: lastContextEnd,
|
|
1551
|
-
context: doc.content.substring(0, lastContextEnd)
|
|
2603
|
+
context: contextSize === 0 ? "" : doc.content.substring(0, lastContextEnd)
|
|
1552
2604
|
});
|
|
1553
2605
|
}
|
|
1554
2606
|
const regex = new RegExp(query, "gi");
|
|
1555
|
-
let
|
|
1556
|
-
while (
|
|
1557
|
-
|
|
1558
|
-
if (
|
|
2607
|
+
let match7 = regex.exec(doc.content);
|
|
2608
|
+
while (match7 !== null) {
|
|
2609
|
+
match7 = regex.exec(doc.content);
|
|
2610
|
+
if (match7 === null) {
|
|
1559
2611
|
break;
|
|
1560
2612
|
}
|
|
1561
|
-
const idx =
|
|
1562
|
-
const matchLen =
|
|
1563
|
-
const contextStart = Math.max(0, idx -
|
|
1564
|
-
const contextEnd = Math.min(
|
|
1565
|
-
contentLen,
|
|
1566
|
-
idx + matchLen + context_size
|
|
1567
|
-
);
|
|
2613
|
+
const idx = match7.index;
|
|
2614
|
+
const matchLen = match7[0].length;
|
|
2615
|
+
const contextStart = Math.max(0, idx - contextSize);
|
|
2616
|
+
const contextEnd = Math.min(contentLen, idx + matchLen + contextSize);
|
|
1568
2617
|
if (contextStart < lastContextEnd) {
|
|
1569
2618
|
const newOccurrence = {
|
|
1570
2619
|
startIndex: occurrences[occurrences.length - 1].startIndex,
|
|
1571
2620
|
endIndex: contextEnd,
|
|
1572
|
-
context: doc.content.substring(
|
|
2621
|
+
context: contextSize === 0 ? "" : doc.content.substring(
|
|
1573
2622
|
occurrences[occurrences.length - 1].startIndex,
|
|
1574
2623
|
contextEnd
|
|
1575
2624
|
)
|
|
1576
2625
|
};
|
|
1577
2626
|
occurrences[occurrences.length - 1] = newOccurrence;
|
|
1578
2627
|
} else {
|
|
1579
|
-
const context = doc.content.substring(contextStart, contextEnd);
|
|
2628
|
+
const context = contextSize === 0 ? "" : doc.content.substring(contextStart, contextEnd);
|
|
1580
2629
|
occurrences.push({
|
|
1581
2630
|
startIndex: contextStart,
|
|
1582
2631
|
endIndex: contextEnd,
|
|
@@ -1588,9 +2637,11 @@ function init12(documents) {
|
|
|
1588
2637
|
if (occurrences.length > 0) {
|
|
1589
2638
|
docCount++;
|
|
1590
2639
|
occurrenceCount += occurrences.length;
|
|
1591
|
-
result +=
|
|
1592
|
-
result +=
|
|
1593
|
-
|
|
2640
|
+
result += doc.path;
|
|
2641
|
+
result += "\n";
|
|
2642
|
+
if (showMetadata) {
|
|
2643
|
+
result += formatDocumentMetadata(doc);
|
|
2644
|
+
}
|
|
1594
2645
|
for (const occurrence of occurrences) {
|
|
1595
2646
|
result += formatOccurrence(occurrence);
|
|
1596
2647
|
}
|
|
@@ -1611,48 +2662,45 @@ function init12(documents) {
|
|
|
1611
2662
|
let fullResult = `${docCount} documents and ${occurrenceCount} occurrences found with query '${query}'
|
|
1612
2663
|
|
|
1613
2664
|
${result}`;
|
|
1614
|
-
if (
|
|
1615
|
-
|
|
2665
|
+
if (page > 0) {
|
|
2666
|
+
const offset = page * limit;
|
|
2667
|
+
if (offset >= fullResult.length) {
|
|
1616
2668
|
return {
|
|
1617
2669
|
content: [
|
|
1618
2670
|
{
|
|
1619
2671
|
type: "text",
|
|
1620
|
-
text: `No more results. Total
|
|
2672
|
+
text: `No more results. Total page count: ${Math.ceil(fullResult.length / limit)}`
|
|
1621
2673
|
}
|
|
1622
2674
|
],
|
|
1623
2675
|
isError: true
|
|
1624
2676
|
};
|
|
1625
2677
|
}
|
|
1626
|
-
fullResult = fullResult.substring(
|
|
2678
|
+
fullResult = fullResult.substring(offset);
|
|
1627
2679
|
}
|
|
1628
2680
|
if (fullResult.length > limit) {
|
|
1629
2681
|
const truncationMsg = `
|
|
1630
2682
|
|
|
1631
|
-
... (output truncated due to length limit. Use
|
|
1632
|
-
const
|
|
2683
|
+
... (output truncated due to length limit. Use page: ${page + 1} for next page)`;
|
|
2684
|
+
const structuredContent = {
|
|
1633
2685
|
result: fullResult.substring(0, limit) + truncationMsg
|
|
1634
2686
|
};
|
|
1635
2687
|
return {
|
|
1636
2688
|
content: [
|
|
1637
2689
|
{
|
|
1638
2690
|
type: "text",
|
|
1639
|
-
text: JSON.stringify(
|
|
2691
|
+
text: JSON.stringify(structuredContent, null, 2)
|
|
1640
2692
|
}
|
|
1641
2693
|
],
|
|
1642
|
-
structuredContent
|
|
2694
|
+
structuredContent
|
|
1643
2695
|
};
|
|
1644
2696
|
}
|
|
1645
|
-
const structuredContent = {
|
|
1646
|
-
result: fullResult
|
|
1647
|
-
};
|
|
1648
2697
|
return {
|
|
1649
2698
|
content: [
|
|
1650
2699
|
{
|
|
1651
2700
|
type: "text",
|
|
1652
|
-
text:
|
|
2701
|
+
text: fullResult
|
|
1653
2702
|
}
|
|
1654
|
-
]
|
|
1655
|
-
structuredContent
|
|
2703
|
+
]
|
|
1656
2704
|
};
|
|
1657
2705
|
}
|
|
1658
2706
|
} catch (error) {
|
|
@@ -1688,16 +2736,16 @@ ${documents.readme}`
|
|
|
1688
2736
|
);
|
|
1689
2737
|
mcp.registerTool(listDocs_exports.name, listDocs_exports.config, listDocs_exports.init(documents));
|
|
1690
2738
|
mcp.registerTool(readDoc_exports.name, readDoc_exports.config, readDoc_exports.init(documents));
|
|
1691
|
-
mcp.registerTool(
|
|
1692
|
-
readDocMetadata_exports.name,
|
|
1693
|
-
readDocMetadata_exports.config,
|
|
1694
|
-
readDocMetadata_exports.init(documents)
|
|
1695
|
-
);
|
|
1696
2739
|
mcp.registerTool(
|
|
1697
2740
|
regexSearch_exports.name,
|
|
1698
2741
|
regexSearch_exports.config,
|
|
1699
2742
|
regexSearch_exports.init(documents)
|
|
1700
2743
|
);
|
|
2744
|
+
mcp.registerTool(
|
|
2745
|
+
getDocsUrl_exports.name,
|
|
2746
|
+
getDocsUrl_exports.config,
|
|
2747
|
+
getDocsUrl_exports.init(documents)
|
|
2748
|
+
);
|
|
1701
2749
|
mcp.registerTool(
|
|
1702
2750
|
readOpenapiSchema_exports.name,
|
|
1703
2751
|
readOpenapiSchema_exports.config,
|
|
@@ -1708,50 +2756,46 @@ ${documents.readme}`
|
|
|
1708
2756
|
readOpenapiSchemaSummary_exports.config,
|
|
1709
2757
|
readOpenapiSchemaSummary_exports.init(documents.schema)
|
|
1710
2758
|
);
|
|
1711
|
-
const apiBaseUrl = "https://developers.portone.io";
|
|
1712
2759
|
mcp.registerTool(
|
|
1713
2760
|
readV2BackendCode_exports.name,
|
|
1714
2761
|
readV2BackendCode_exports.config,
|
|
1715
|
-
readV2BackendCode_exports.init(
|
|
2762
|
+
readV2BackendCode_exports.init(DEVELOPERS_URL)
|
|
1716
2763
|
);
|
|
1717
2764
|
mcp.registerTool(
|
|
1718
2765
|
readV2FrontendCode_exports.name,
|
|
1719
2766
|
readV2FrontendCode_exports.config,
|
|
1720
|
-
readV2FrontendCode_exports.init(
|
|
2767
|
+
readV2FrontendCode_exports.init(DEVELOPERS_URL)
|
|
2768
|
+
);
|
|
2769
|
+
const graphClient = new GraphQLClient(GRAPHQL_URL, {
|
|
2770
|
+
headers: { "User-Agent": USER_AGENT }
|
|
2771
|
+
});
|
|
2772
|
+
const tokenProvider = new TokenProvider();
|
|
2773
|
+
tokenProvider.launchRefresher();
|
|
2774
|
+
mcp.registerTool(
|
|
2775
|
+
listStores_exports.name,
|
|
2776
|
+
listStores_exports.config,
|
|
2777
|
+
listStores_exports.init(tokenProvider, graphClient)
|
|
2778
|
+
);
|
|
2779
|
+
mcp.registerTool(
|
|
2780
|
+
listSharedTestChannels_exports.name,
|
|
2781
|
+
listSharedTestChannels_exports.config,
|
|
2782
|
+
listSharedTestChannels_exports.init(tokenProvider)
|
|
2783
|
+
);
|
|
2784
|
+
mcp.registerTool(
|
|
2785
|
+
getChannelsOfStore_exports.name,
|
|
2786
|
+
getChannelsOfStore_exports.config,
|
|
2787
|
+
getChannelsOfStore_exports.init(tokenProvider)
|
|
2788
|
+
);
|
|
2789
|
+
mcp.registerTool(
|
|
2790
|
+
addTestChannel_exports.name,
|
|
2791
|
+
addTestChannel_exports.config,
|
|
2792
|
+
addTestChannel_exports.init(tokenProvider, graphClient)
|
|
2793
|
+
);
|
|
2794
|
+
mcp.registerTool(
|
|
2795
|
+
getPaymentsByFilter_exports.name,
|
|
2796
|
+
getPaymentsByFilter_exports.config,
|
|
2797
|
+
getPaymentsByFilter_exports.init(tokenProvider, graphClient)
|
|
1721
2798
|
);
|
|
1722
|
-
const apiSecret = process.env.API_SECRET;
|
|
1723
|
-
if (apiSecret) {
|
|
1724
|
-
const httpClient = {
|
|
1725
|
-
get: async (url) => {
|
|
1726
|
-
return fetch(`https://api.portone.io${url}`, {
|
|
1727
|
-
headers: {
|
|
1728
|
-
Authorization: `PortOne ${apiSecret}`,
|
|
1729
|
-
"User-Agent": `portone-mcp-server ${package_default.version}`
|
|
1730
|
-
}
|
|
1731
|
-
});
|
|
1732
|
-
}
|
|
1733
|
-
};
|
|
1734
|
-
mcp.registerTool(
|
|
1735
|
-
getPayment_exports.name,
|
|
1736
|
-
getPayment_exports.config,
|
|
1737
|
-
getPayment_exports.init(httpClient)
|
|
1738
|
-
);
|
|
1739
|
-
mcp.registerTool(
|
|
1740
|
-
getPaymentsByFilter_exports.name,
|
|
1741
|
-
getPaymentsByFilter_exports.config,
|
|
1742
|
-
getPaymentsByFilter_exports.init(httpClient)
|
|
1743
|
-
);
|
|
1744
|
-
mcp.registerTool(
|
|
1745
|
-
getIdentityVerification_exports.name,
|
|
1746
|
-
getIdentityVerification_exports.config,
|
|
1747
|
-
getIdentityVerification_exports.init(httpClient)
|
|
1748
|
-
);
|
|
1749
|
-
mcp.registerTool(
|
|
1750
|
-
getIdentityVerificationsByFilter_exports.name,
|
|
1751
|
-
getIdentityVerificationsByFilter_exports.config,
|
|
1752
|
-
getIdentityVerificationsByFilter_exports.init(httpClient)
|
|
1753
|
-
);
|
|
1754
|
-
}
|
|
1755
2799
|
const transport = new StdioServerTransport();
|
|
1756
2800
|
await mcp.connect(transport);
|
|
1757
2801
|
}
|