trustbase-seller-backend 0.1.5
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/.agents/skills/wechatpay-payment-integration/SKILL.md +165 -0
- package/.agents/skills/wechatpay-payment-integration/references/APIv3/346/216/245/345/217/243/345/212/250/346/200/201/346/216/222/351/232/234.md +234 -0
- package/.agents/skills/wechatpay-payment-integration/references/wechatpay-dev-cli/344/275/277/347/224/250/350/257/264/346/230/216.md +74 -0
- package/.agents/skills/wechatpay-payment-integration/references//345/237/272/347/241/200/346/246/202/345/277/265/345/217/212/344/270/232/345/212/241/344/273/213/347/273/215.md +109 -0
- package/.agents/skills/wechatpay-payment-integration/references//345/246/202/344/275/225/347/220/206/350/247/243/347/224/250/346/210/267/351/227/256/351/242/230.md +55 -0
- package/.agents/skills/wechatpay-payment-integration/references//346/216/245/345/205/245/350/264/250/351/207/217/346/243/200/346/237/245/346/270/205/345/215/225.md +70 -0
- package/.agents/skills/wechatpay-payment-integration/references//346/226/207/346/241/243/346/243/200/347/264/242/344/270/216/351/227/256/347/255/224.md +99 -0
- package/.agents/skills/wechatpay-payment-integration/scripts/bash/extract_and_sign.sh +231 -0
- package/.agents/skills/wechatpay-payment-integration/scripts/powershell/extract_and_sign.ps1 +199 -0
- package/.agents/skills/wechatpay-payment-integration/scripts/wechatpay-resource-sync.py +646 -0
- package/.env.example +70 -0
- package/MERCHANT-EDITION.md +56 -0
- package/README.md +99 -0
- package/api/__tests__/test-utils.d.ts +33 -0
- package/api/__tests__/test-utils.d.ts.map +1 -0
- package/api/__tests__/test-utils.js +90 -0
- package/api/__tests__/test-utils.js.map +1 -0
- package/api/db/case-library-types.d.ts +47 -0
- package/api/db/case-library-types.d.ts.map +1 -0
- package/api/db/case-library-types.js +105 -0
- package/api/db/case-library-types.js.map +1 -0
- package/api/db/case-library.db.d.ts +5 -0
- package/api/db/case-library.db.d.ts.map +1 -0
- package/api/db/case-library.db.js +127 -0
- package/api/db/case-library.db.js.map +1 -0
- package/api/email.d.ts +56 -0
- package/api/email.d.ts.map +1 -0
- package/api/email.js +307 -0
- package/api/email.js.map +1 -0
- package/api/index.d.ts +22 -0
- package/api/index.d.ts.map +1 -0
- package/api/index.js +41 -0
- package/api/index.js.map +1 -0
- package/api/integration-helpers.d.ts +153 -0
- package/api/integration-helpers.d.ts.map +1 -0
- package/api/integration-helpers.js +361 -0
- package/api/integration-helpers.js.map +1 -0
- package/api/lib/case-summary.d.ts +10 -0
- package/api/lib/case-summary.d.ts.map +1 -0
- package/api/lib/case-summary.js +30 -0
- package/api/lib/case-summary.js.map +1 -0
- package/api/middleware/p2p-auth.d.ts +140 -0
- package/api/middleware/p2p-auth.d.ts.map +1 -0
- package/api/middleware/p2p-auth.js +510 -0
- package/api/middleware/p2p-auth.js.map +1 -0
- package/api/middleware/tool-policy.d.ts +47 -0
- package/api/middleware/tool-policy.d.ts.map +1 -0
- package/api/middleware/tool-policy.js +156 -0
- package/api/middleware/tool-policy.js.map +1 -0
- package/api/oauth-adapters.d.ts +192 -0
- package/api/oauth-adapters.d.ts.map +1 -0
- package/api/oauth-adapters.js +456 -0
- package/api/oauth-adapters.js.map +1 -0
- package/api/oauth-bridge.d.ts +56 -0
- package/api/oauth-bridge.d.ts.map +1 -0
- package/api/oauth-bridge.js +624 -0
- package/api/oauth-bridge.js.map +1 -0
- package/api/oauth-router.d.ts +36 -0
- package/api/oauth-router.d.ts.map +1 -0
- package/api/oauth-router.js +54 -0
- package/api/oauth-router.js.map +1 -0
- package/api/p2p-mcp.d.ts +69 -0
- package/api/p2p-mcp.d.ts.map +1 -0
- package/api/p2p-mcp.js +286 -0
- package/api/p2p-mcp.js.map +1 -0
- package/api/payment-store.d.ts +56 -0
- package/api/payment-store.d.ts.map +1 -0
- package/api/payment-store.js +163 -0
- package/api/payment-store.js.map +1 -0
- package/api/payment.d.ts +14 -0
- package/api/payment.d.ts.map +1 -0
- package/api/payment.js +216 -0
- package/api/payment.js.map +1 -0
- package/api/pwa-stats.d.ts +67 -0
- package/api/pwa-stats.d.ts.map +1 -0
- package/api/pwa-stats.js +269 -0
- package/api/pwa-stats.js.map +1 -0
- package/api/riskcontrol-adapters.d.ts +114 -0
- package/api/riskcontrol-adapters.d.ts.map +1 -0
- package/api/riskcontrol-adapters.js +210 -0
- package/api/riskcontrol-adapters.js.map +1 -0
- package/api/riskcontrol-event-whitelist.d.ts +81 -0
- package/api/riskcontrol-event-whitelist.d.ts.map +1 -0
- package/api/riskcontrol-event-whitelist.js +181 -0
- package/api/riskcontrol-event-whitelist.js.map +1 -0
- package/api/riskcontrol-rules.d.ts +105 -0
- package/api/riskcontrol-rules.d.ts.map +1 -0
- package/api/riskcontrol-rules.js +399 -0
- package/api/riskcontrol-rules.js.map +1 -0
- package/api/riskcontrol-scoring.d.ts +72 -0
- package/api/riskcontrol-scoring.d.ts.map +1 -0
- package/api/riskcontrol-scoring.js +335 -0
- package/api/riskcontrol-scoring.js.map +1 -0
- package/api/riskcontrol-service.d.ts +60 -0
- package/api/riskcontrol-service.d.ts.map +1 -0
- package/api/riskcontrol-service.js +206 -0
- package/api/riskcontrol-service.js.map +1 -0
- package/api/riskcontrol-stream.d.ts +112 -0
- package/api/riskcontrol-stream.d.ts.map +1 -0
- package/api/riskcontrol-stream.js +230 -0
- package/api/riskcontrol-stream.js.map +1 -0
- package/api/riskcontrol-v5-e2e-test.d.ts +15 -0
- package/api/riskcontrol-v5-e2e-test.d.ts.map +1 -0
- package/api/riskcontrol-v5-e2e-test.js +204 -0
- package/api/riskcontrol-v5-e2e-test.js.map +1 -0
- package/api/riskcontrol-v5-router.d.ts +48 -0
- package/api/riskcontrol-v5-router.d.ts.map +1 -0
- package/api/riskcontrol-v5-router.js +226 -0
- package/api/riskcontrol-v5-router.js.map +1 -0
- package/api/riskcontrol-webhook.d.ts +88 -0
- package/api/riskcontrol-webhook.d.ts.map +1 -0
- package/api/riskcontrol-webhook.js +326 -0
- package/api/riskcontrol-webhook.js.map +1 -0
- package/api/routes/case-library.d.ts +4 -0
- package/api/routes/case-library.d.ts.map +1 -0
- package/api/routes/case-library.js +91 -0
- package/api/routes/case-library.js.map +1 -0
- package/api/seller-earnings.d.ts +23 -0
- package/api/seller-earnings.d.ts.map +1 -0
- package/api/seller-earnings.js +258 -0
- package/api/seller-earnings.js.map +1 -0
- package/api/seller-orders.d.ts +25 -0
- package/api/seller-orders.d.ts.map +1 -0
- package/api/seller-orders.js +398 -0
- package/api/seller-orders.js.map +1 -0
- package/api/seller-products-chain.d.ts +31 -0
- package/api/seller-products-chain.d.ts.map +1 -0
- package/api/seller-products-chain.js +308 -0
- package/api/seller-products-chain.js.map +1 -0
- package/api/seller-products.d.ts +30 -0
- package/api/seller-products.d.ts.map +1 -0
- package/api/seller-products.js +453 -0
- package/api/seller-products.js.map +1 -0
- package/api/seller-reputation.d.ts +21 -0
- package/api/seller-reputation.d.ts.map +1 -0
- package/api/seller-reputation.js +204 -0
- package/api/seller-reputation.js.map +1 -0
- package/api/seller-router.d.ts +33 -0
- package/api/seller-router.d.ts.map +1 -0
- package/api/seller-router.js +53 -0
- package/api/seller-router.js.map +1 -0
- package/api/seller-settings.d.ts +23 -0
- package/api/seller-settings.d.ts.map +1 -0
- package/api/seller-settings.js +279 -0
- package/api/seller-settings.js.map +1 -0
- package/api/shipping-store.d.ts +44 -0
- package/api/shipping-store.d.ts.map +1 -0
- package/api/shipping-store.js +154 -0
- package/api/shipping-store.js.map +1 -0
- package/api/shipping.d.ts +16 -0
- package/api/shipping.d.ts.map +1 -0
- package/api/shipping.js +239 -0
- package/api/shipping.js.map +1 -0
- package/api/social-endpoint-verify.d.ts +8 -0
- package/api/social-endpoint-verify.d.ts.map +1 -0
- package/api/social-endpoint-verify.js +152 -0
- package/api/social-endpoint-verify.js.map +1 -0
- package/api/social-posts.d.ts +65 -0
- package/api/social-posts.d.ts.map +1 -0
- package/api/social-posts.js +534 -0
- package/api/social-posts.js.map +1 -0
- package/api/social-router.d.ts +36 -0
- package/api/social-router.d.ts.map +1 -0
- package/api/social-router.js +56 -0
- package/api/social-router.js.map +1 -0
- package/api/social-shares.d.ts +40 -0
- package/api/social-shares.d.ts.map +1 -0
- package/api/social-shares.js +379 -0
- package/api/social-shares.js.map +1 -0
- package/api/social-whitelist.d.ts +41 -0
- package/api/social-whitelist.d.ts.map +1 -0
- package/api/social-whitelist.js +261 -0
- package/api/social-whitelist.js.map +1 -0
- package/api/storefront-orders.d.ts +23 -0
- package/api/storefront-orders.d.ts.map +1 -0
- package/api/storefront-orders.js +349 -0
- package/api/storefront-orders.js.map +1 -0
- package/api/storefront-products.d.ts +21 -0
- package/api/storefront-products.d.ts.map +1 -0
- package/api/storefront-products.js +181 -0
- package/api/storefront-products.js.map +1 -0
- package/api/storefront-router.d.ts +33 -0
- package/api/storefront-router.d.ts.map +1 -0
- package/api/storefront-router.js +47 -0
- package/api/storefront-router.js.map +1 -0
- package/api/storefront-user.d.ts +23 -0
- package/api/storefront-user.d.ts.map +1 -0
- package/api/storefront-user.js +336 -0
- package/api/storefront-user.js.map +1 -0
- package/api/test-db-helper.d.ts +29 -0
- package/api/test-db-helper.d.ts.map +1 -0
- package/api/test-db-helper.js +107 -0
- package/api/test-db-helper.js.map +1 -0
- package/api/traffic.d.ts +22 -0
- package/api/traffic.d.ts.map +1 -0
- package/api/traffic.js +112 -0
- package/api/traffic.js.map +1 -0
- package/api/wc-credentials.d.ts +34 -0
- package/api/wc-credentials.d.ts.map +1 -0
- package/api/wc-credentials.js +296 -0
- package/api/wc-credentials.js.map +1 -0
- package/api/wc-tracker-receiver.d.ts +47 -0
- package/api/wc-tracker-receiver.d.ts.map +1 -0
- package/api/wc-tracker-receiver.js +264 -0
- package/api/wc-tracker-receiver.js.map +1 -0
- package/api/wc-v3.d.ts +40 -0
- package/api/wc-v3.d.ts.map +1 -0
- package/api/wc-v3.js +694 -0
- package/api/wc-v3.js.map +1 -0
- package/bin/tb-doctor.js +32 -0
- package/bin/tb-seller-backend.js +42 -0
- package/check.d.ts +2 -0
- package/check.d.ts.map +1 -0
- package/check.js +19 -0
- package/check.js.map +1 -0
- package/config/export-import.d.ts +108 -0
- package/config/export-import.d.ts.map +1 -0
- package/config/export-import.js +234 -0
- package/config/export-import.js.map +1 -0
- package/config/manager.d.ts +73 -0
- package/config/manager.d.ts.map +1 -0
- package/config/manager.js +246 -0
- package/config/manager.js.map +1 -0
- package/config/profile.d.ts +42 -0
- package/config/profile.d.ts.map +1 -0
- package/config/profile.js +111 -0
- package/config/profile.js.map +1 -0
- package/core/address.js +23 -0
- package/core/advanced-performance.d.ts +149 -0
- package/core/advanced-performance.d.ts.map +1 -0
- package/core/advanced-performance.js +374 -0
- package/core/advanced-performance.js.map +1 -0
- package/core/alerting.d.ts +91 -0
- package/core/alerting.d.ts.map +1 -0
- package/core/alerting.js +379 -0
- package/core/alerting.js.map +1 -0
- package/core/app-store.d.ts +77 -0
- package/core/app-store.d.ts.map +1 -0
- package/core/app-store.js +207 -0
- package/core/app-store.js.map +1 -0
- package/core/boot-env.js +39 -0
- package/core/business-scope-schema.d.ts +60 -0
- package/core/business-scope-schema.d.ts.map +1 -0
- package/core/business-scope-schema.js +165 -0
- package/core/business-scope-schema.js.map +1 -0
- package/core/cache.d.ts +53 -0
- package/core/cache.d.ts.map +1 -0
- package/core/cache.js +130 -0
- package/core/cache.js.map +1 -0
- package/core/chain-listener.d.ts +47 -0
- package/core/chain-listener.d.ts.map +1 -0
- package/core/chain-listener.js +254 -0
- package/core/chain-listener.js.map +1 -0
- package/core/chain-reject.js +107 -0
- package/core/chain-signer.js +258 -0
- package/core/cleanup.d.ts +42 -0
- package/core/cleanup.d.ts.map +1 -0
- package/core/cleanup.js +144 -0
- package/core/cleanup.js.map +1 -0
- package/core/cluster.d.ts +78 -0
- package/core/cluster.d.ts.map +1 -0
- package/core/cluster.js +215 -0
- package/core/cluster.js.map +1 -0
- package/core/community-review.d.ts +82 -0
- package/core/community-review.d.ts.map +1 -0
- package/core/community-review.js +201 -0
- package/core/community-review.js.map +1 -0
- package/core/connection-pool.d.ts +72 -0
- package/core/connection-pool.d.ts.map +1 -0
- package/core/connection-pool.js +173 -0
- package/core/connection-pool.js.map +1 -0
- package/core/consistency.d.ts +130 -0
- package/core/consistency.d.ts.map +1 -0
- package/core/consistency.js +340 -0
- package/core/consistency.js.map +1 -0
- package/core/content-ai.d.ts +303 -0
- package/core/content-ai.d.ts.map +1 -0
- package/core/content-ai.js +344 -0
- package/core/content-ai.js.map +1 -0
- package/core/content-backfill.d.ts +55 -0
- package/core/content-backfill.d.ts.map +1 -0
- package/core/content-backfill.js +174 -0
- package/core/content-backfill.js.map +1 -0
- package/core/conversion-rate-sync.d.ts +97 -0
- package/core/conversion-rate-sync.d.ts.map +1 -0
- package/core/conversion-rate-sync.js +195 -0
- package/core/conversion-rate-sync.js.map +1 -0
- package/core/coverage-backup.d.ts +87 -0
- package/core/coverage-backup.d.ts.map +1 -0
- package/core/coverage-backup.js +265 -0
- package/core/coverage-backup.js.map +1 -0
- package/core/db-installer.d.ts +108 -0
- package/core/db-installer.d.ts.map +1 -0
- package/core/db-installer.js +414 -0
- package/core/db-installer.js.map +1 -0
- package/core/device-analyzer.d.ts +96 -0
- package/core/device-analyzer.d.ts.map +1 -0
- package/core/device-analyzer.js +235 -0
- package/core/device-analyzer.js.map +1 -0
- package/core/discovery.d.ts +165 -0
- package/core/discovery.d.ts.map +1 -0
- package/core/discovery.js +363 -0
- package/core/discovery.js.map +1 -0
- package/core/distributed.d.ts +172 -0
- package/core/distributed.d.ts.map +1 -0
- package/core/distributed.js +422 -0
- package/core/distributed.js.map +1 -0
- package/core/doctor.js +249 -0
- package/core/enforcement.d.ts +57 -0
- package/core/enforcement.d.ts.map +1 -0
- package/core/enforcement.js +115 -0
- package/core/enforcement.js.map +1 -0
- package/core/error-handler.d.ts +131 -0
- package/core/error-handler.d.ts.map +1 -0
- package/core/error-handler.js +291 -0
- package/core/error-handler.js.map +1 -0
- package/core/federated-learning.d.ts +124 -0
- package/core/federated-learning.d.ts.map +1 -0
- package/core/federated-learning.js +338 -0
- package/core/federated-learning.js.map +1 -0
- package/core/fingerprint.d.ts +95 -0
- package/core/fingerprint.d.ts.map +1 -0
- package/core/fingerprint.js +313 -0
- package/core/fingerprint.js.map +1 -0
- package/core/geoip.d.ts +67 -0
- package/core/geoip.d.ts.map +1 -0
- package/core/geoip.js +174 -0
- package/core/geoip.js.map +1 -0
- package/core/gossip.d.ts +141 -0
- package/core/gossip.d.ts.map +1 -0
- package/core/gossip.js +372 -0
- package/core/gossip.js.map +1 -0
- package/core/governance.d.ts +147 -0
- package/core/governance.d.ts.map +1 -0
- package/core/governance.js +351 -0
- package/core/governance.js.map +1 -0
- package/core/indexer-enhancements.d.ts +164 -0
- package/core/indexer-enhancements.d.ts.map +1 -0
- package/core/indexer-enhancements.js +429 -0
- package/core/indexer-enhancements.js.map +1 -0
- package/core/intrusion-detection.d.ts +79 -0
- package/core/intrusion-detection.d.ts.map +1 -0
- package/core/intrusion-detection.js +322 -0
- package/core/intrusion-detection.js.map +1 -0
- package/core/lifecycle.d.ts +118 -0
- package/core/lifecycle.d.ts.map +1 -0
- package/core/lifecycle.js +310 -0
- package/core/lifecycle.js.map +1 -0
- package/core/location.d.ts +99 -0
- package/core/location.d.ts.map +1 -0
- package/core/location.js +219 -0
- package/core/location.js.map +1 -0
- package/core/maxmind-integration.d.ts +68 -0
- package/core/maxmind-integration.d.ts.map +1 -0
- package/core/maxmind-integration.js +245 -0
- package/core/maxmind-integration.js.map +1 -0
- package/core/migration.d.ts +58 -0
- package/core/migration.d.ts.map +1 -0
- package/core/migration.js +223 -0
- package/core/migration.js.map +1 -0
- package/core/monitoring.d.ts +153 -0
- package/core/monitoring.d.ts.map +1 -0
- package/core/monitoring.js +406 -0
- package/core/monitoring.js.map +1 -0
- package/core/offsite-backup.d.ts +71 -0
- package/core/offsite-backup.d.ts.map +1 -0
- package/core/offsite-backup.js +341 -0
- package/core/offsite-backup.js.map +1 -0
- package/core/order-intent-store.js +83 -0
- package/core/order-intent.js +273 -0
- package/core/paths.js +116 -0
- package/core/performance.d.ts +173 -0
- package/core/performance.d.ts.map +1 -0
- package/core/performance.js +386 -0
- package/core/performance.js.map +1 -0
- package/core/product-flag.d.ts +364 -0
- package/core/product-flag.d.ts.map +1 -0
- package/core/product-flag.js +465 -0
- package/core/product-flag.js.map +1 -0
- package/core/protection.d.ts +139 -0
- package/core/protection.d.ts.map +1 -0
- package/core/protection.js +327 -0
- package/core/protection.js.map +1 -0
- package/core/region-adapter.d.ts +152 -0
- package/core/region-adapter.d.ts.map +1 -0
- package/core/region-adapter.js +505 -0
- package/core/region-adapter.js.map +1 -0
- package/core/region-configs.d.ts +12 -0
- package/core/region-configs.d.ts.map +1 -0
- package/core/region-configs.js +907 -0
- package/core/region-configs.js.map +1 -0
- package/core/review-antifraud.d.ts +80 -0
- package/core/review-antifraud.d.ts.map +1 -0
- package/core/review-antifraud.js +193 -0
- package/core/review-antifraud.js.map +1 -0
- package/core/rules-updater.d.ts +89 -0
- package/core/rules-updater.d.ts.map +1 -0
- package/core/rules-updater.js +261 -0
- package/core/rules-updater.js.map +1 -0
- package/core/runtime-data.js +203 -0
- package/core/security.d.ts +144 -0
- package/core/security.d.ts.map +1 -0
- package/core/security.js +390 -0
- package/core/security.js.map +1 -0
- package/core/seller-identity.js +78 -0
- package/core/session-manager.d.ts +93 -0
- package/core/session-manager.d.ts.map +1 -0
- package/core/session-manager.js +262 -0
- package/core/session-manager.js.map +1 -0
- package/core/state-sync.d.ts +121 -0
- package/core/state-sync.d.ts.map +1 -0
- package/core/state-sync.js +287 -0
- package/core/state-sync.js.map +1 -0
- package/core/testing.d.ts +97 -0
- package/core/testing.d.ts.map +1 -0
- package/core/testing.js +361 -0
- package/core/testing.js.map +1 -0
- package/core/trust-score.d.ts +51 -0
- package/core/trust-score.d.ts.map +1 -0
- package/core/trust-score.js +188 -0
- package/core/trust-score.js.map +1 -0
- package/core/trustworthiness.d.ts +140 -0
- package/core/trustworthiness.d.ts.map +1 -0
- package/core/trustworthiness.js +375 -0
- package/core/trustworthiness.js.map +1 -0
- package/core/types.d.ts +258 -0
- package/core/types.d.ts.map +1 -0
- package/core/types.js +9 -0
- package/core/types.js.map +1 -0
- package/core/upgrade-manager.d.ts +114 -0
- package/core/upgrade-manager.d.ts.map +1 -0
- package/core/upgrade-manager.js +264 -0
- package/core/upgrade-manager.js.map +1 -0
- package/core/upgrader.d.ts +107 -0
- package/core/upgrader.d.ts.map +1 -0
- package/core/upgrader.js +389 -0
- package/core/upgrader.js.map +1 -0
- package/core/websocket.d.ts +78 -0
- package/core/websocket.d.ts.map +1 -0
- package/core/websocket.js +292 -0
- package/core/websocket.js.map +1 -0
- package/council/hidden-weight.d.ts +45 -0
- package/council/hidden-weight.d.ts.map +1 -0
- package/council/hidden-weight.js +135 -0
- package/council/hidden-weight.js.map +1 -0
- package/db/email-migrations.sql +31 -0
- package/db/oauth-migrate.d.ts +39 -0
- package/db/oauth-migrate.d.ts.map +1 -0
- package/db/oauth-migrate.js +201 -0
- package/db/oauth-migrate.js.map +1 -0
- package/db/oauth-migrations.sql +92 -0
- package/db/social-migrate.d.ts +12 -0
- package/db/social-migrate.d.ts.map +1 -0
- package/db/social-migrate.js +102 -0
- package/db/social-migrate.js.map +1 -0
- package/db/social-migrations.sql +94 -0
- package/db/store-migrate.d.ts +33 -0
- package/db/store-migrate.d.ts.map +1 -0
- package/db/store-migrate.js +149 -0
- package/db/store-migrate.js.map +1 -0
- package/db/store-migrations.sql +242 -0
- package/debug.d.ts +2 -0
- package/debug.d.ts.map +1 -0
- package/debug.js +18 -0
- package/debug.js.map +1 -0
- package/event-listener.d.ts +93 -0
- package/event-listener.d.ts.map +1 -0
- package/event-listener.js +321 -0
- package/event-listener.js.map +1 -0
- package/event-whitelist.d.ts +79 -0
- package/event-whitelist.d.ts.map +1 -0
- package/event-whitelist.js +533 -0
- package/event-whitelist.js.map +1 -0
- package/index.d.ts +45 -0
- package/index.d.ts.map +1 -0
- package/index.js +361 -0
- package/index.js.map +1 -0
- package/init-node.d.ts +9 -0
- package/init-node.d.ts.map +1 -0
- package/init-node.js +230 -0
- package/init-node.js.map +1 -0
- package/mcp/ai-tools.d.ts +2 -0
- package/mcp/ai-tools.d.ts.map +1 -0
- package/mcp/ai-tools.js +266 -0
- package/mcp/ai-tools.js.map +1 -0
- package/mcp/auto-dispatch-tools.d.ts +2 -0
- package/mcp/auto-dispatch-tools.d.ts.map +1 -0
- package/mcp/auto-dispatch-tools.js +348 -0
- package/mcp/auto-dispatch-tools.js.map +1 -0
- package/mcp/business-scope-tools.d.ts +11 -0
- package/mcp/business-scope-tools.d.ts.map +1 -0
- package/mcp/business-scope-tools.js +179 -0
- package/mcp/business-scope-tools.js.map +1 -0
- package/mcp/buyer-tools.d.ts +67 -0
- package/mcp/buyer-tools.d.ts.map +1 -0
- package/mcp/buyer-tools.js +445 -0
- package/mcp/buyer-tools.js.map +1 -0
- package/mcp/interfaces.d.ts +1058 -0
- package/mcp/interfaces.d.ts.map +1 -0
- package/mcp/interfaces.js +13 -0
- package/mcp/interfaces.js.map +1 -0
- package/mcp/m2m-chat-tool.d.ts +50 -0
- package/mcp/m2m-chat-tool.d.ts.map +1 -0
- package/mcp/m2m-chat-tool.js +432 -0
- package/mcp/m2m-chat-tool.js.map +1 -0
- package/mcp/migrations.d.ts +30 -0
- package/mcp/migrations.d.ts.map +1 -0
- package/mcp/migrations.js +391 -0
- package/mcp/migrations.js.map +1 -0
- package/mcp/peer-tools.d.ts +163 -0
- package/mcp/peer-tools.d.ts.map +1 -0
- package/mcp/peer-tools.js +532 -0
- package/mcp/peer-tools.js.map +1 -0
- package/mcp/plugin-management-tools.d.ts +2 -0
- package/mcp/plugin-management-tools.d.ts.map +1 -0
- package/mcp/plugin-management-tools.js +327 -0
- package/mcp/plugin-management-tools.js.map +1 -0
- package/mcp/product-type-tools.d.ts +2 -0
- package/mcp/product-type-tools.d.ts.map +1 -0
- package/mcp/product-type-tools.js +470 -0
- package/mcp/product-type-tools.js.map +1 -0
- package/mcp/security-tools.d.ts +2 -0
- package/mcp/security-tools.d.ts.map +1 -0
- package/mcp/security-tools.js +313 -0
- package/mcp/security-tools.js.map +1 -0
- package/mcp/seller-query-tools.d.ts +2 -0
- package/mcp/seller-query-tools.d.ts.map +1 -0
- package/mcp/seller-query-tools.js +179 -0
- package/mcp/seller-query-tools.js.map +1 -0
- package/mcp/server.d.ts +11 -0
- package/mcp/server.d.ts.map +1 -0
- package/mcp/server.js +68 -0
- package/mcp/server.js.map +1 -0
- package/mcp/standalone-server.d.ts +34 -0
- package/mcp/standalone-server.d.ts.map +1 -0
- package/mcp/standalone-server.js +261 -0
- package/mcp/standalone-server.js.map +1 -0
- package/mcp/tools-integration.d.ts +31 -0
- package/mcp/tools-integration.d.ts.map +1 -0
- package/mcp/tools-integration.js +288 -0
- package/mcp/tools-integration.js.map +1 -0
- package/mcp/web-panel.d.ts +18 -0
- package/mcp/web-panel.d.ts.map +1 -0
- package/mcp/web-panel.js +1657 -0
- package/mcp/web-panel.js.map +1 -0
- package/middleware/api-key-auth.d.ts +64 -0
- package/middleware/api-key-auth.d.ts.map +1 -0
- package/middleware/api-key-auth.js +255 -0
- package/middleware/api-key-auth.js.map +1 -0
- package/middleware/scope-auth.d.ts +54 -0
- package/middleware/scope-auth.d.ts.map +1 -0
- package/middleware/scope-auth.js +153 -0
- package/middleware/scope-auth.js.map +1 -0
- package/middleware/security.d.ts +48 -0
- package/middleware/security.d.ts.map +1 -0
- package/middleware/security.js +217 -0
- package/middleware/security.js.map +1 -0
- package/middleware/wallet-auth.d.ts +54 -0
- package/middleware/wallet-auth.d.ts.map +1 -0
- package/middleware/wallet-auth.js +158 -0
- package/middleware/wallet-auth.js.map +1 -0
- package/oauth/chain-revocation-sink.d.ts +24 -0
- package/oauth/chain-revocation-sink.d.ts.map +1 -0
- package/oauth/chain-revocation-sink.js +47 -0
- package/oauth/chain-revocation-sink.js.map +1 -0
- package/oauth/gossip-sync.d.ts +25 -0
- package/oauth/gossip-sync.d.ts.map +1 -0
- package/oauth/gossip-sync.js +62 -0
- package/oauth/gossip-sync.js.map +1 -0
- package/oauth/issuer-keys.d.ts +31 -0
- package/oauth/issuer-keys.d.ts.map +1 -0
- package/oauth/issuer-keys.js +117 -0
- package/oauth/issuer-keys.js.map +1 -0
- package/oauth/peer-resolver.d.ts +25 -0
- package/oauth/peer-resolver.d.ts.map +1 -0
- package/oauth/peer-resolver.js +81 -0
- package/oauth/peer-resolver.js.map +1 -0
- package/oauth/revocation-store.d.ts +58 -0
- package/oauth/revocation-store.d.ts.map +1 -0
- package/oauth/revocation-store.js +86 -0
- package/oauth/revocation-store.js.map +1 -0
- package/oauth/token-v2.d.ts +101 -0
- package/oauth/token-v2.d.ts.map +1 -0
- package/oauth/token-v2.js +167 -0
- package/oauth/token-v2.js.map +1 -0
- package/oracle/c5-glue.js +603 -0
- package/oracle/ops-console.js +623 -0
- package/oracle/oracle-sync.d.ts +29 -0
- package/oracle/oracle-sync.d.ts.map +1 -0
- package/oracle/oracle-sync.js +445 -0
- package/oracle/oracle-sync.js.map +1 -0
- package/oracle/registry.d.ts +30 -0
- package/oracle/registry.d.ts.map +1 -0
- package/oracle/registry.js +62 -0
- package/oracle/registry.js.map +1 -0
- package/p2p/availability.d.ts +188 -0
- package/p2p/availability.d.ts.map +1 -0
- package/p2p/availability.js +574 -0
- package/p2p/availability.js.map +1 -0
- package/p2p/bootstrap.d.ts +42 -0
- package/p2p/bootstrap.d.ts.map +1 -0
- package/p2p/bootstrap.js +146 -0
- package/p2p/bootstrap.js.map +1 -0
- package/p2p/buyer-client.d.ts +98 -0
- package/p2p/buyer-client.d.ts.map +1 -0
- package/p2p/buyer-client.js +199 -0
- package/p2p/buyer-client.js.map +1 -0
- package/p2p/cdn-ddns.d.ts +208 -0
- package/p2p/cdn-ddns.d.ts.map +1 -0
- package/p2p/cdn-ddns.js +500 -0
- package/p2p/cdn-ddns.js.map +1 -0
- package/p2p/cluster-sync.d.ts +115 -0
- package/p2p/cluster-sync.d.ts.map +1 -0
- package/p2p/cluster-sync.js +330 -0
- package/p2p/cluster-sync.js.map +1 -0
- package/p2p/consistency-check.d.ts +30 -0
- package/p2p/consistency-check.d.ts.map +1 -0
- package/p2p/consistency-check.js +168 -0
- package/p2p/consistency-check.js.map +1 -0
- package/p2p/endpoint-registry.d.ts +41 -0
- package/p2p/endpoint-registry.d.ts.map +1 -0
- package/p2p/endpoint-registry.js +128 -0
- package/p2p/endpoint-registry.js.map +1 -0
- package/p2p/ipv6.d.ts +120 -0
- package/p2p/ipv6.d.ts.map +1 -0
- package/p2p/ipv6.js +425 -0
- package/p2p/ipv6.js.map +1 -0
- package/p2p/protocol.d.ts +100 -0
- package/p2p/protocol.d.ts.map +1 -0
- package/p2p/protocol.js +330 -0
- package/p2p/protocol.js.map +1 -0
- package/p2p/reliability.d.ts +56 -0
- package/p2p/reliability.d.ts.map +1 -0
- package/p2p/reliability.js +240 -0
- package/p2p/reliability.js.map +1 -0
- package/p2p/seller-service.d.ts +53 -0
- package/p2p/seller-service.d.ts.map +1 -0
- package/p2p/seller-service.js +276 -0
- package/p2p/seller-service.js.map +1 -0
- package/p2p/signing.d.ts +31 -0
- package/p2p/signing.d.ts.map +1 -0
- package/p2p/signing.js +95 -0
- package/p2p/signing.js.map +1 -0
- package/package.json +73 -0
- package/payment/api.d.ts +9 -0
- package/payment/api.d.ts.map +1 -0
- package/payment/api.js +141 -0
- package/payment/api.js.map +1 -0
- package/payment/gateway.d.ts +114 -0
- package/payment/gateway.d.ts.map +1 -0
- package/payment/gateway.js +231 -0
- package/payment/gateway.js.map +1 -0
- package/payments/alipay/index.d.ts +18 -0
- package/payments/alipay/index.d.ts.map +1 -0
- package/payments/alipay/index.js +55 -0
- package/payments/alipay/index.js.map +1 -0
- package/payments/base.d.ts +13 -0
- package/payments/base.d.ts.map +1 -0
- package/payments/base.js +28 -0
- package/payments/base.js.map +1 -0
- package/payments/index.d.ts +18 -0
- package/payments/index.d.ts.map +1 -0
- package/payments/index.js +66 -0
- package/payments/index.js.map +1 -0
- package/payments/template/index.d.ts +18 -0
- package/payments/template/index.d.ts.map +1 -0
- package/payments/template/index.js +57 -0
- package/payments/template/index.js.map +1 -0
- package/payments/types.d.ts +42 -0
- package/payments/types.d.ts.map +1 -0
- package/payments/types.js +3 -0
- package/payments/types.js.map +1 -0
- package/payments/wechat/index.d.ts +18 -0
- package/payments/wechat/index.d.ts.map +1 -0
- package/payments/wechat/index.js +54 -0
- package/payments/wechat/index.js.map +1 -0
- package/peer/chain-signer.d.ts +74 -0
- package/peer/chain-signer.d.ts.map +1 -0
- package/peer/chain-signer.js +149 -0
- package/peer/chain-signer.js.map +1 -0
- package/peer/config.d.ts +71 -0
- package/peer/config.d.ts.map +1 -0
- package/peer/config.js +61 -0
- package/peer/config.js.map +1 -0
- package/peer/index.d.ts +12 -0
- package/peer/index.d.ts.map +1 -0
- package/peer/index.js +46 -0
- package/peer/index.js.map +1 -0
- package/peer/key-store.d.ts +66 -0
- package/peer/key-store.d.ts.map +1 -0
- package/peer/key-store.js +163 -0
- package/peer/key-store.js.map +1 -0
- package/peer/proto-codec.d.ts +103 -0
- package/peer/proto-codec.d.ts.map +1 -0
- package/peer/proto-codec.js +423 -0
- package/peer/proto-codec.js.map +1 -0
- package/peer/registrar.d.ts +88 -0
- package/peer/registrar.d.ts.map +1 -0
- package/peer/registrar.js +271 -0
- package/peer/registrar.js.map +1 -0
- package/peer/registry.d.ts +31 -0
- package/peer/registry.d.ts.map +1 -0
- package/peer/registry.js +143 -0
- package/peer/registry.js.map +1 -0
- package/plugins/auth.d.ts +193 -0
- package/plugins/auth.d.ts.map +1 -0
- package/plugins/auth.js +923 -0
- package/plugins/auth.js.map +1 -0
- package/plugins/manager.d.ts +37 -0
- package/plugins/manager.d.ts.map +1 -0
- package/plugins/manager.js +83 -0
- package/plugins/manager.js.map +1 -0
- package/plugins/oauth.d.ts +249 -0
- package/plugins/oauth.d.ts.map +1 -0
- package/plugins/oauth.js +979 -0
- package/plugins/oauth.js.map +1 -0
- package/plugins/p2p-message.d.ts +133 -0
- package/plugins/p2p-message.d.ts.map +1 -0
- package/plugins/p2p-message.js +443 -0
- package/plugins/p2p-message.js.map +1 -0
- package/plugins/postgresql.d.ts +54 -0
- package/plugins/postgresql.d.ts.map +1 -0
- package/plugins/postgresql.js +743 -0
- package/plugins/postgresql.js.map +1 -0
- package/plugins/relationship.d.ts +141 -0
- package/plugins/relationship.d.ts.map +1 -0
- package/plugins/relationship.js +395 -0
- package/plugins/relationship.js.map +1 -0
- package/plugins/sqlite.d.ts +200 -0
- package/plugins/sqlite.d.ts.map +1 -0
- package/plugins/sqlite.js +2412 -0
- package/plugins/sqlite.js.map +1 -0
- package/port-manager/disguise/ssh.d.ts +19 -0
- package/port-manager/disguise/ssh.d.ts.map +1 -0
- package/port-manager/disguise/ssh.js +104 -0
- package/port-manager/disguise/ssh.js.map +1 -0
- package/port-manager/port-manager.d.ts +65 -0
- package/port-manager/port-manager.d.ts.map +1 -0
- package/port-manager/port-manager.js +164 -0
- package/port-manager/port-manager.js.map +1 -0
- package/port-manager/port-scanner.d.ts +22 -0
- package/port-manager/port-scanner.d.ts.map +1 -0
- package/port-manager/port-scanner.js +187 -0
- package/port-manager/port-scanner.js.map +1 -0
- package/port-manager/types.d.ts +51 -0
- package/port-manager/types.d.ts.map +1 -0
- package/port-manager/types.js +6 -0
- package/port-manager/types.js.map +1 -0
- package/proto/amino/amino.proto +84 -0
- package/proto/cosmos/base/v1beta1/coin.proto +61 -0
- package/proto/cosmos/msg/v1/msg.proto +30 -0
- package/proto/cosmos_proto/cosmos.proto +112 -0
- package/proto/gogoproto/gogo.proto +145 -0
- package/proto/google/protobuf/descriptor.proto +1218 -0
- package/proto/trustchain/economy/v1/params.proto +133 -0
- package/proto/trustchain/economy/v1/tx.proto +162 -0
- package/proto/trustchain/marketplace/v1/params.proto +64 -0
- package/proto/trustchain/marketplace/v1/product.proto +21 -0
- package/proto/trustchain/marketplace/v1/tx.proto +131 -0
- package/proto/trustchain/order/v1/params.proto +94 -0
- package/proto/trustchain/order/v1/tx.proto +156 -0
- package/proto/trustchain/serviceprovider/v1/paymentfact.proto +32 -0
- package/proto/trustchain/serviceprovider/v1/serviceprovider.proto +38 -0
- package/proto/trustchain/serviceprovider/v1/tx.proto +106 -0
- package/proto/trustchain/subchain/v1/params.proto +26 -0
- package/proto/trustchain/subchain/v1/pool.proto +53 -0
- package/proto/trustchain/subchain/v1/tx.proto +159 -0
- package/proto/trustchain/trustcoin/v1/business_scope.proto +126 -0
- package/proto/trustchain/trustcoin/v1/genesis.proto +33 -0
- package/proto/trustchain/trustcoin/v1/params.proto +86 -0
- package/proto/trustchain/trustcoin/v1/query.proto +95 -0
- package/proto/trustchain/trustcoin/v1/tx.proto +160 -0
- package/proto/trustchain/verification/v1/params.proto +46 -0
- package/proto/trustchain/verification/v1/tx.proto +126 -0
- package/proto/trustchain/verification/v1/verification.proto +105 -0
- package/relationship-chain-api.d.ts +13 -0
- package/relationship-chain-api.d.ts.map +1 -0
- package/relationship-chain-api.js +139 -0
- package/relationship-chain-api.js.map +1 -0
- package/relationship-chain.d.ts +90 -0
- package/relationship-chain.d.ts.map +1 -0
- package/relationship-chain.js +201 -0
- package/relationship-chain.js.map +1 -0
- package/routes/agent-pay.js +419 -0
- package/routes/agent-serviceprovider.js +183 -0
- package/routes/ai.d.ts +54 -0
- package/routes/ai.d.ts.map +1 -0
- package/routes/ai.js +293 -0
- package/routes/ai.js.map +1 -0
- package/routes/api-keys.d.ts +12 -0
- package/routes/api-keys.d.ts.map +1 -0
- package/routes/api-keys.js +163 -0
- package/routes/api-keys.js.map +1 -0
- package/routes/app-store.d.ts +12 -0
- package/routes/app-store.d.ts.map +1 -0
- package/routes/app-store.js +207 -0
- package/routes/app-store.js.map +1 -0
- package/routes/auth-management.d.ts +17 -0
- package/routes/auth-management.d.ts.map +1 -0
- package/routes/auth-management.js +257 -0
- package/routes/auth-management.js.map +1 -0
- package/routes/auth.d.ts +9 -0
- package/routes/auth.d.ts.map +1 -0
- package/routes/auth.js +846 -0
- package/routes/auth.js.map +1 -0
- package/routes/brand.d.ts +3 -0
- package/routes/brand.d.ts.map +1 -0
- package/routes/brand.js +109 -0
- package/routes/brand.js.map +1 -0
- package/routes/chain-registry.d.ts +11 -0
- package/routes/chain-registry.d.ts.map +1 -0
- package/routes/chain-registry.js +51 -0
- package/routes/chain-registry.js.map +1 -0
- package/routes/chain-writes-insurance.d.ts +17 -0
- package/routes/chain-writes-insurance.d.ts.map +1 -0
- package/routes/chain-writes-insurance.js +69 -0
- package/routes/chain-writes-insurance.js.map +1 -0
- package/routes/chain-writes-pledge.d.ts +34 -0
- package/routes/chain-writes-pledge.d.ts.map +1 -0
- package/routes/chain-writes-pledge.js +206 -0
- package/routes/chain-writes-pledge.js.map +1 -0
- package/routes/chain-writes-products.d.ts +66 -0
- package/routes/chain-writes-products.d.ts.map +1 -0
- package/routes/chain-writes-products.js +394 -0
- package/routes/chain-writes-products.js.map +1 -0
- package/routes/chain-writes.d.ts +78 -0
- package/routes/chain-writes.d.ts.map +1 -0
- package/routes/chain-writes.js +658 -0
- package/routes/chain-writes.js.map +1 -0
- package/routes/chain.d.ts +10 -0
- package/routes/chain.d.ts.map +1 -0
- package/routes/chain.js +45 -0
- package/routes/chain.js.map +1 -0
- package/routes/compliance.d.ts +3 -0
- package/routes/compliance.d.ts.map +1 -0
- package/routes/compliance.js +53 -0
- package/routes/compliance.js.map +1 -0
- package/routes/council.d.ts +3 -0
- package/routes/council.d.ts.map +1 -0
- package/routes/council.js +477 -0
- package/routes/council.js.map +1 -0
- package/routes/crosschain.d.ts +11 -0
- package/routes/crosschain.d.ts.map +1 -0
- package/routes/crosschain.js +39 -0
- package/routes/crosschain.js.map +1 -0
- package/routes/device.d.ts +3 -0
- package/routes/device.d.ts.map +1 -0
- package/routes/device.js +73 -0
- package/routes/device.js.map +1 -0
- package/routes/devreward.d.ts +54 -0
- package/routes/devreward.d.ts.map +1 -0
- package/routes/devreward.js +129 -0
- package/routes/devreward.js.map +1 -0
- package/routes/economy.d.ts +50 -0
- package/routes/economy.d.ts.map +1 -0
- package/routes/economy.js +273 -0
- package/routes/economy.js.map +1 -0
- package/routes/flowback.d.ts +32 -0
- package/routes/flowback.d.ts.map +1 -0
- package/routes/flowback.js +97 -0
- package/routes/flowback.js.map +1 -0
- package/routes/insurance.d.ts +10 -0
- package/routes/insurance.d.ts.map +1 -0
- package/routes/insurance.js +70 -0
- package/routes/insurance.js.map +1 -0
- package/routes/m2m-viewer.js +195 -0
- package/routes/m2m.d.ts +10 -0
- package/routes/m2m.d.ts.map +1 -0
- package/routes/m2m.js +31 -0
- package/routes/m2m.js.map +1 -0
- package/routes/marketplace.d.ts +15 -0
- package/routes/marketplace.d.ts.map +1 -0
- package/routes/marketplace.js +396 -0
- package/routes/marketplace.js.map +1 -0
- package/routes/node-config.d.ts +6 -0
- package/routes/node-config.d.ts.map +1 -0
- package/routes/node-config.js +500 -0
- package/routes/node-config.js.map +1 -0
- package/routes/oauth-revocation.d.ts +42 -0
- package/routes/oauth-revocation.d.ts.map +1 -0
- package/routes/oauth-revocation.js +99 -0
- package/routes/oauth-revocation.js.map +1 -0
- package/routes/oauth.d.ts +17 -0
- package/routes/oauth.d.ts.map +1 -0
- package/routes/oauth.js +700 -0
- package/routes/oauth.js.map +1 -0
- package/routes/onboard.html +352 -0
- package/routes/onboard.js +435 -0
- package/routes/order.d.ts +8 -0
- package/routes/order.d.ts.map +1 -0
- package/routes/order.js +607 -0
- package/routes/order.js.map +1 -0
- package/routes/p2p-api.d.ts +33 -0
- package/routes/p2p-api.d.ts.map +1 -0
- package/routes/p2p-api.js +274 -0
- package/routes/p2p-api.js.map +1 -0
- package/routes/p2p-message.d.ts +20 -0
- package/routes/p2p-message.d.ts.map +1 -0
- package/routes/p2p-message.js +237 -0
- package/routes/p2p-message.js.map +1 -0
- package/routes/peer.d.ts +22 -0
- package/routes/peer.d.ts.map +1 -0
- package/routes/peer.js +220 -0
- package/routes/peer.js.map +1 -0
- package/routes/plugins.d.ts +4 -0
- package/routes/plugins.d.ts.map +1 -0
- package/routes/plugins.js +138 -0
- package/routes/plugins.js.map +1 -0
- package/routes/port-manager.d.ts +6 -0
- package/routes/port-manager.d.ts.map +1 -0
- package/routes/port-manager.js +212 -0
- package/routes/port-manager.js.map +1 -0
- package/routes/relationship.d.ts +7 -0
- package/routes/relationship.d.ts.map +1 -0
- package/routes/relationship.js +314 -0
- package/routes/relationship.js.map +1 -0
- package/routes/relay.d.ts +3 -0
- package/routes/relay.d.ts.map +1 -0
- package/routes/relay.js +182 -0
- package/routes/relay.js.map +1 -0
- package/routes/reputation.d.ts +10 -0
- package/routes/reputation.d.ts.map +1 -0
- package/routes/reputation.js +141 -0
- package/routes/reputation.js.map +1 -0
- package/routes/reward.d.ts +3 -0
- package/routes/reward.d.ts.map +1 -0
- package/routes/reward.js +130 -0
- package/routes/reward.js.map +1 -0
- package/routes/security-monitoring.d.ts +12 -0
- package/routes/security-monitoring.d.ts.map +1 -0
- package/routes/security-monitoring.js +373 -0
- package/routes/security-monitoring.js.map +1 -0
- package/routes/shop.d.ts +8 -0
- package/routes/shop.d.ts.map +1 -0
- package/routes/shop.js +164 -0
- package/routes/shop.js.map +1 -0
- package/routes/social.d.ts +22 -0
- package/routes/social.d.ts.map +1 -0
- package/routes/social.js +95 -0
- package/routes/social.js.map +1 -0
- package/routes/subchain.d.ts +18 -0
- package/routes/subchain.d.ts.map +1 -0
- package/routes/subchain.js +106 -0
- package/routes/subchain.js.map +1 -0
- package/routes/trustcoin.d.ts +17 -0
- package/routes/trustcoin.d.ts.map +1 -0
- package/routes/trustcoin.js +149 -0
- package/routes/trustcoin.js.map +1 -0
- package/routes/twofa.d.ts +7 -0
- package/routes/twofa.d.ts.map +1 -0
- package/routes/twofa.js +105 -0
- package/routes/twofa.js.map +1 -0
- package/routes/verification.d.ts +8 -0
- package/routes/verification.d.ts.map +1 -0
- package/routes/verification.js +234 -0
- package/routes/verification.js.map +1 -0
- package/routes/wallet.d.ts +4 -0
- package/routes/wallet.d.ts.map +1 -0
- package/routes/wallet.js +770 -0
- package/routes/wallet.js.map +1 -0
- package/run-auth.d.ts +8 -0
- package/run-auth.d.ts.map +1 -0
- package/run-auth.js +82 -0
- package/run-auth.js.map +1 -0
- package/run-p2p-message.d.ts +8 -0
- package/run-p2p-message.d.ts.map +1 -0
- package/run-p2p-message.js +82 -0
- package/run-p2p-message.js.map +1 -0
- package/run-relationship.d.ts +12 -0
- package/run-relationship.d.ts.map +1 -0
- package/run-relationship.js +182 -0
- package/run-relationship.js.map +1 -0
- package/run-unified.d.ts +13 -0
- package/run-unified.d.ts.map +1 -0
- package/run-unified.js +1067 -0
- package/run-unified.js.map +1 -0
- package/run.d.ts +12 -0
- package/run.d.ts.map +1 -0
- package/run.js +889 -0
- package/run.js.map +1 -0
- package/search/ranking.d.ts +55 -0
- package/search/ranking.d.ts.map +1 -0
- package/search/ranking.js +67 -0
- package/search/ranking.js.map +1 -0
- package/shipping/base.d.ts +15 -0
- package/shipping/base.d.ts.map +1 -0
- package/shipping/base.js +39 -0
- package/shipping/base.js.map +1 -0
- package/shipping/index.d.ts +19 -0
- package/shipping/index.d.ts.map +1 -0
- package/shipping/index.js +72 -0
- package/shipping/index.js.map +1 -0
- package/shipping/sf-express/index.d.ts +23 -0
- package/shipping/sf-express/index.d.ts.map +1 -0
- package/shipping/sf-express/index.js +71 -0
- package/shipping/sf-express/index.js.map +1 -0
- package/shipping/template/index.d.ts +20 -0
- package/shipping/template/index.d.ts.map +1 -0
- package/shipping/template/index.js +74 -0
- package/shipping/template/index.js.map +1 -0
- package/shipping/types.d.ts +71 -0
- package/shipping/types.d.ts.map +1 -0
- package/shipping/types.js +6 -0
- package/shipping/types.js.map +1 -0
- package/shipping/virtual/index.d.ts +19 -0
- package/shipping/virtual/index.d.ts.map +1 -0
- package/shipping/virtual/index.js +54 -0
- package/shipping/virtual/index.js.map +1 -0
- package/shipping/yto/index.d.ts +18 -0
- package/shipping/yto/index.d.ts.map +1 -0
- package/shipping/yto/index.js +59 -0
- package/shipping/yto/index.js.map +1 -0
- package/shipping/zto/index.d.ts +18 -0
- package/shipping/zto/index.d.ts.map +1 -0
- package/shipping/zto/index.js +59 -0
- package/shipping/zto/index.js.map +1 -0
- package/skills-lock.json +11 -0
- package/src/db/email-migrations.sql +31 -0
- package/src/db/oauth-migrations.sql +92 -0
- package/src/db/social-migrations.sql +94 -0
- package/src/db/store-migrations.sql +242 -0
- package/test-api-key-revoke.js +167 -0
- package/test-auth-register-ratelimit.js +132 -0
- package/test-auth-tv2.d.ts +2 -0
- package/test-auth-tv2.d.ts.map +1 -0
- package/test-auth-tv2.js +174 -0
- package/test-auth-tv2.js.map +1 -0
- package/test-canonsign-cross.d.ts +2 -0
- package/test-canonsign-cross.d.ts.map +1 -0
- package/test-canonsign-cross.js +32 -0
- package/test-canonsign-cross.js.map +1 -0
- package/test-chain-signer.js +127 -0
- package/test-env-truthy.js +50 -0
- package/test-onboard-contract.js +94 -0
- package/test-ops-console-boundary.js +147 -0
- package/test-oracle-glue.js +232 -0
- package/test-order-create-v394.js +358 -0
- package/test-order-intent.js +245 -0
- package/test-order-lifecycle-v394.js +528 -0
- package/test-p2p-message.d.ts +13 -0
- package/test-p2p-message.d.ts.map +1 -0
- package/test-p2p-message.js +106 -0
- package/test-p2p-message.js.map +1 -0
- package/test-relationship-chain.d.ts +13 -0
- package/test-relationship-chain.d.ts.map +1 -0
- package/test-relationship-chain.js +103 -0
- package/test-relationship-chain.js.map +1 -0
- package/test-runtime-data-path.js +217 -0
- package/test-seller-identity.js +74 -0
- package/test-signing-paths.js +104 -0
- package/test-token-v2.d.ts +2 -0
- package/test-token-v2.d.ts.map +1 -0
- package/test-token-v2.js +172 -0
- package/test-token-v2.js.map +1 -0
- package/test-wallet-auth-nonce.d.ts +12 -0
- package/test-wallet-auth-nonce.d.ts.map +1 -0
- package/test-wallet-auth-nonce.js +126 -0
- package/test-wallet-auth-nonce.js.map +1 -0
- package/test-wallet-submatch.d.ts +13 -0
- package/test-wallet-submatch.d.ts.map +1 -0
- package/test-wallet-submatch.js +86 -0
- package/test-wallet-submatch.js.map +1 -0
- package/tls/self-signed.d.ts +12 -0
- package/tls/self-signed.d.ts.map +1 -0
- package/tls/self-signed.js +63 -0
- package/tls/self-signed.js.map +1 -0
- package/tools/brand.d.ts +11 -0
- package/tools/brand.d.ts.map +1 -0
- package/tools/brand.js +75 -0
- package/tools/brand.js.map +1 -0
- package/tools/chainregistry.d.ts +18 -0
- package/tools/chainregistry.d.ts.map +1 -0
- package/tools/chainregistry.js +175 -0
- package/tools/chainregistry.js.map +1 -0
- package/tools/compliance.d.ts +14 -0
- package/tools/compliance.d.ts.map +1 -0
- package/tools/compliance.js +45 -0
- package/tools/compliance.js.map +1 -0
- package/tools/council.d.ts +17 -0
- package/tools/council.d.ts.map +1 -0
- package/tools/council.js +75 -0
- package/tools/council.js.map +1 -0
- package/tools/device.d.ts +13 -0
- package/tools/device.d.ts.map +1 -0
- package/tools/device.js +45 -0
- package/tools/device.js.map +1 -0
- package/tools/devreward.d.ts +15 -0
- package/tools/devreward.d.ts.map +1 -0
- package/tools/devreward.js +190 -0
- package/tools/devreward.js.map +1 -0
- package/tools/economy.d.ts +14 -0
- package/tools/economy.d.ts.map +1 -0
- package/tools/economy.js +172 -0
- package/tools/economy.js.map +1 -0
- package/tools/flowback.d.ts +14 -0
- package/tools/flowback.d.ts.map +1 -0
- package/tools/flowback.js +146 -0
- package/tools/flowback.js.map +1 -0
- package/tools/insurance.d.ts +13 -0
- package/tools/insurance.d.ts.map +1 -0
- package/tools/insurance.js +45 -0
- package/tools/insurance.js.map +1 -0
- package/tools/marketplace.d.ts +12 -0
- package/tools/marketplace.d.ts.map +1 -0
- package/tools/marketplace.js +124 -0
- package/tools/marketplace.js.map +1 -0
- package/tools/order.d.ts +12 -0
- package/tools/order.d.ts.map +1 -0
- package/tools/order.js +94 -0
- package/tools/order.js.map +1 -0
- package/tools/recovery.d.ts +14 -0
- package/tools/recovery.d.ts.map +1 -0
- package/tools/recovery.js +158 -0
- package/tools/recovery.js.map +1 -0
- package/tools/relay.d.ts +15 -0
- package/tools/relay.d.ts.map +1 -0
- package/tools/relay.js +152 -0
- package/tools/relay.js.map +1 -0
- package/tools/reputation.d.ts +20 -0
- package/tools/reputation.d.ts.map +1 -0
- package/tools/reputation.js +50 -0
- package/tools/reputation.js.map +1 -0
- package/tools/reputation_seller_credit.d.ts +16 -0
- package/tools/reputation_seller_credit.d.ts.map +1 -0
- package/tools/reputation_seller_credit.js +106 -0
- package/tools/reputation_seller_credit.js.map +1 -0
- package/tools/reward.d.ts +14 -0
- package/tools/reward.d.ts.map +1 -0
- package/tools/reward.js +76 -0
- package/tools/reward.js.map +1 -0
- package/tools/shop.d.ts +14 -0
- package/tools/shop.d.ts.map +1 -0
- package/tools/shop.js +95 -0
- package/tools/shop.js.map +1 -0
- package/tools/verification.d.ts +12 -0
- package/tools/verification.d.ts.map +1 -0
- package/tools/verification.js +89 -0
- package/tools/verification.js.map +1 -0
- package/types/store.d.ts +255 -0
- package/types/store.d.ts.map +1 -0
- package/types/store.js +19 -0
- package/types/store.js.map +1 -0
- package/utils/aes-gcm.d.ts +63 -0
- package/utils/aes-gcm.d.ts.map +1 -0
- package/utils/aes-gcm.js +179 -0
- package/utils/aes-gcm.js.map +1 -0
- package/utils/api-response.d.ts +51 -0
- package/utils/api-response.d.ts.map +1 -0
- package/utils/api-response.js +65 -0
- package/utils/api-response.js.map +1 -0
- package/utils/base32.d.ts +5 -0
- package/utils/base32.d.ts.map +1 -0
- package/utils/base32.js +20 -0
- package/utils/base32.js.map +1 -0
- package/utils/crypto.d.ts +77 -0
- package/utils/crypto.d.ts.map +1 -0
- package/utils/crypto.js +164 -0
- package/utils/crypto.js.map +1 -0
- package/utils/encryption.d.ts +81 -0
- package/utils/encryption.d.ts.map +1 -0
- package/utils/encryption.js +247 -0
- package/utils/encryption.js.map +1 -0
- package/utils/env.js +20 -0
- package/utils/jwt.d.ts +110 -0
- package/utils/jwt.d.ts.map +1 -0
- package/utils/jwt.js +275 -0
- package/utils/jwt.js.map +1 -0
- package/utils/qrcode-reader.d.ts +22 -0
- package/utils/qrcode-reader.d.ts.map +1 -0
- package/utils/qrcode-reader.js +90 -0
- package/utils/qrcode-reader.js.map +1 -0
- package/utils/qrcode.d.ts +26 -0
- package/utils/qrcode.d.ts.map +1 -0
- package/utils/qrcode.js +92 -0
- package/utils/qrcode.js.map +1 -0
- package/utils/totp.d.ts +3 -0
- package/utils/totp.d.ts.map +1 -0
- package/utils/totp.js +58 -0
- package/utils/totp.js.map +1 -0
- package/utils/two-factor-auth.d.ts +16 -0
- package/utils/two-factor-auth.d.ts.map +1 -0
- package/utils/two-factor-auth.js +150 -0
- package/utils/two-factor-auth.js.map +1 -0
- package/verifyer/hsm.d.ts +70 -0
- package/verifyer/hsm.d.ts.map +1 -0
- package/verifyer/hsm.js +482 -0
- package/verifyer/hsm.js.map +1 -0
- package/verifyer/index.d.ts +81 -0
- package/verifyer/index.d.ts.map +1 -0
- package/verifyer/index.js +372 -0
- package/verifyer/index.js.map +1 -0
- package/ws/peer-monitor-broadcaster.d.ts +24 -0
- package/ws/peer-monitor-broadcaster.d.ts.map +1 -0
- package/ws/peer-monitor-broadcaster.js +56 -0
- package/ws/peer-monitor-broadcaster.js.map +1 -0
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
"""
|
|
2
|
+
wechatpay-resource-sync.py — 微信支付 Skill 及知识库远程同步工具
|
|
3
|
+
|
|
4
|
+
用法:
|
|
5
|
+
python3 wechatpay-resource-sync.py update # 检查远程并同步 Skill 和知识库(含首次安装)
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
import shutil
|
|
11
|
+
import stat
|
|
12
|
+
import sys
|
|
13
|
+
import tarfile
|
|
14
|
+
import tempfile
|
|
15
|
+
import zipfile
|
|
16
|
+
from datetime import datetime, timedelta, timezone
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from urllib.error import HTTPError, URLError
|
|
19
|
+
from urllib.request import Request, urlopen
|
|
20
|
+
|
|
21
|
+
VERSION = "1.2"
|
|
22
|
+
|
|
23
|
+
# ==== 脚本配置 ====
|
|
24
|
+
|
|
25
|
+
SCRIPT_DIR = Path(__file__).resolve().parent # scripts directory/
|
|
26
|
+
SKILL_DIR = SCRIPT_DIR.parent # skill directory/
|
|
27
|
+
|
|
28
|
+
DOCS_URL = "https://wx.gtimg.com/resource/wechatpay_api/wechatpay-docs.zip"
|
|
29
|
+
SKILL_URL = "https://wx.gtimg.com/resource/wechatpay_api/skill/wechatpay-payment-integration/bundle.zip"
|
|
30
|
+
DOCS_TARGET_DIR = SKILL_DIR / "assets"
|
|
31
|
+
STATE_FILE = SCRIPT_DIR / ".wechatpay-resource-sync-state.json"
|
|
32
|
+
CHECK_INTERVAL_HOURS = 12
|
|
33
|
+
|
|
34
|
+
_TZ = timezone(timedelta(hours=8))
|
|
35
|
+
|
|
36
|
+
# ==== HTTP header(统一小写) ====
|
|
37
|
+
|
|
38
|
+
# 代理/网关可能会改写 Header 字段名大小写;字段名本身大小写不敏感。
|
|
39
|
+
# 这里统一将"字段名"转为大写进行匹配,避免因大小写变化导致取值失败。
|
|
40
|
+
H_LAST_MODIFIED = "LAST-MODIFIED"
|
|
41
|
+
H_ETAG = "ETAG"
|
|
42
|
+
H_CONTENT_LENGTH = "CONTENT-LENGTH"
|
|
43
|
+
|
|
44
|
+
# ==== 状态文件 key ====
|
|
45
|
+
|
|
46
|
+
# 检查/更新时间由 Skill 与知识库共用;远程版本标记各自独立。
|
|
47
|
+
S_LAST_CHECK = "LAST_CHECK_TIME"
|
|
48
|
+
S_LAST_UPDATE = "LAST_UPDATE_TIME"
|
|
49
|
+
S_DOCS_REMOTE_MODIFIED = "DOCS_REMOTE_LAST_MODIFIED"
|
|
50
|
+
S_DOCS_REMOTE_ETAG = "DOCS_REMOTE_ETAG"
|
|
51
|
+
S_SKILL_REMOTE_MODIFIED = "SKILL_REMOTE_LAST_MODIFIED"
|
|
52
|
+
S_SKILL_REMOTE_ETAG = "SKILL_REMOTE_ETAG"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
USER_AGENT = f"{Path(__file__).stem}/{VERSION}"
|
|
56
|
+
IGNORED_FILES = {".DS_Store", "Thumbs.db", "__MACOSX"}
|
|
57
|
+
DOCS_FILE_GLOB = "*.md"
|
|
58
|
+
ZIP_FALLBACK_ENCODING = "cp437"
|
|
59
|
+
|
|
60
|
+
# Skill 更新时需要保留的顶层目录(由文档同步独立管理)
|
|
61
|
+
SKILL_PRESERVE_DIRS = {DOCS_TARGET_DIR.name}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# ==== 状态管理 ====
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _now_iso() -> str:
|
|
68
|
+
"""返回当前时间的 ISO 8601 字符串(东八区)。"""
|
|
69
|
+
return datetime.now(_TZ).isoformat(timespec="seconds")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _load_state() -> dict:
|
|
73
|
+
"""从 STATE_FILE 读取同步状态,文件不存在则返回空 dict。"""
|
|
74
|
+
if STATE_FILE.exists():
|
|
75
|
+
state = json.loads(STATE_FILE.read_text(encoding="utf-8"))
|
|
76
|
+
# 兼容:部分环境可能会改写 header value 的大小写;本地 state 统一按小写存取。
|
|
77
|
+
for key in (
|
|
78
|
+
S_DOCS_REMOTE_ETAG,
|
|
79
|
+
S_DOCS_REMOTE_MODIFIED,
|
|
80
|
+
S_SKILL_REMOTE_ETAG,
|
|
81
|
+
S_SKILL_REMOTE_MODIFIED,
|
|
82
|
+
):
|
|
83
|
+
if isinstance(state.get(key), str):
|
|
84
|
+
state[key] = state[key].lower()
|
|
85
|
+
return state
|
|
86
|
+
return {}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _save_state(state: dict) -> None:
|
|
90
|
+
"""将同步状态写入 STATE_FILE。"""
|
|
91
|
+
STATE_FILE.parent.mkdir(parents=True, exist_ok=True)
|
|
92
|
+
STATE_FILE.write_text(
|
|
93
|
+
json.dumps(state, ensure_ascii=False, indent=2) + "\n", encoding="utf-8"
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# ==== 远程资源 ====
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _within_interval(state: dict) -> bool:
|
|
101
|
+
"""判断距上次检查是否不足 CHECK_INTERVAL_HOURS 小时。"""
|
|
102
|
+
ts = state.get(S_LAST_CHECK)
|
|
103
|
+
if not ts:
|
|
104
|
+
return False
|
|
105
|
+
elapsed = datetime.now(_TZ) - datetime.fromisoformat(ts)
|
|
106
|
+
return elapsed.total_seconds() < CHECK_INTERVAL_HOURS * 3600
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _remote_changed(
|
|
110
|
+
state: dict, remote: dict, etag_state_key: str, modified_state_key: str
|
|
111
|
+
) -> bool:
|
|
112
|
+
"""比较远程 ETag / Last-Modified 与本地记录,判断是否有变化。"""
|
|
113
|
+
r_etag = remote.get(H_ETAG)
|
|
114
|
+
if r_etag and state.get(etag_state_key):
|
|
115
|
+
return str(r_etag).lower() != str(state[etag_state_key]).lower()
|
|
116
|
+
r_lm = remote.get(H_LAST_MODIFIED)
|
|
117
|
+
if r_lm and state.get(modified_state_key):
|
|
118
|
+
return str(r_lm).lower() != str(state[modified_state_key]).lower()
|
|
119
|
+
return True # 无法判断时视为有变化
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def _head_url(url: str) -> dict:
|
|
123
|
+
"""HEAD 请求指定 URL,返回 last_modified / etag / content_length 或 error。"""
|
|
124
|
+
req = Request(url, method="HEAD")
|
|
125
|
+
req.add_header("User-Agent", USER_AGENT)
|
|
126
|
+
try:
|
|
127
|
+
with urlopen(req, timeout=15) as resp:
|
|
128
|
+
headers = {k.upper(): v for k, v in resp.headers.items()}
|
|
129
|
+
lm = headers.get(H_LAST_MODIFIED)
|
|
130
|
+
etag = headers.get(H_ETAG)
|
|
131
|
+
return {
|
|
132
|
+
H_LAST_MODIFIED: lm.lower() if isinstance(lm, str) else lm,
|
|
133
|
+
H_ETAG: etag.lower() if isinstance(etag, str) else etag,
|
|
134
|
+
H_CONTENT_LENGTH: headers.get(H_CONTENT_LENGTH),
|
|
135
|
+
}
|
|
136
|
+
except (URLError, HTTPError) as exc:
|
|
137
|
+
return {"error": str(exc)}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
# ==== 下载与解压 ====
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def _download_url(url: str, dest: Path, label: str = "下载") -> None:
|
|
144
|
+
"""从指定 URL 下载文件到 dest,显示下载进度。"""
|
|
145
|
+
req = Request(url)
|
|
146
|
+
req.add_header("User-Agent", USER_AGENT)
|
|
147
|
+
with urlopen(req, timeout=300) as resp:
|
|
148
|
+
headers = {k.upper(): v for k, v in resp.headers.items()}
|
|
149
|
+
total = headers.get(H_CONTENT_LENGTH)
|
|
150
|
+
total = int(total) if total else None
|
|
151
|
+
done = 0
|
|
152
|
+
last_pct = -1
|
|
153
|
+
last_mb = -1
|
|
154
|
+
is_tty = sys.stdout.isatty()
|
|
155
|
+
with open(dest, "wb") as fp:
|
|
156
|
+
while True:
|
|
157
|
+
chunk = resp.read(65536)
|
|
158
|
+
if not chunk:
|
|
159
|
+
break
|
|
160
|
+
fp.write(chunk)
|
|
161
|
+
done += len(chunk)
|
|
162
|
+
if total:
|
|
163
|
+
pct = done * 100 // total
|
|
164
|
+
if pct == last_pct:
|
|
165
|
+
continue
|
|
166
|
+
last_pct = pct
|
|
167
|
+
if not is_tty and pct % 10 != 0 and pct < 100:
|
|
168
|
+
continue
|
|
169
|
+
msg = (
|
|
170
|
+
f" {label}: {done / 1048576:.1f} MB / "
|
|
171
|
+
f"{total / 1048576:.1f} MB ({pct}%)"
|
|
172
|
+
)
|
|
173
|
+
if is_tty:
|
|
174
|
+
print(f"\r{msg}", end="", flush=True)
|
|
175
|
+
else:
|
|
176
|
+
print(msg, flush=True)
|
|
177
|
+
else:
|
|
178
|
+
mb = int(done / 1048576)
|
|
179
|
+
if is_tty:
|
|
180
|
+
print(
|
|
181
|
+
f"\r {label}: {done / 1048576:.1f} MB",
|
|
182
|
+
end="",
|
|
183
|
+
flush=True,
|
|
184
|
+
)
|
|
185
|
+
elif mb > last_mb:
|
|
186
|
+
last_mb = mb
|
|
187
|
+
print(f" {label}: {done / 1048576:.1f} MB", flush=True)
|
|
188
|
+
print()
|
|
189
|
+
if total is not None and done != total:
|
|
190
|
+
raise RuntimeError(f"下载不完整({done}/{total} 字节),请重试。")
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def _fix_zip_name(name: str) -> str:
|
|
194
|
+
"""未置 UTF-8 标志位的 zip 成员名,按 cp437 还原后依次尝试 utf-8、gbk。"""
|
|
195
|
+
try:
|
|
196
|
+
raw = name.encode(ZIP_FALLBACK_ENCODING)
|
|
197
|
+
except UnicodeEncodeError:
|
|
198
|
+
return name
|
|
199
|
+
for encoding in ("utf-8", "gbk"):
|
|
200
|
+
try:
|
|
201
|
+
return raw.decode(encoding)
|
|
202
|
+
except UnicodeDecodeError:
|
|
203
|
+
continue
|
|
204
|
+
return name # 两种编码都不成立时保留原名,不要中断解压
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def _extract(archive: Path, dest: Path) -> None:
|
|
208
|
+
"""解压 zip 或 tar.gz 到 dest。若 zip 未标记 UTF-8 标志位,做编码修正。"""
|
|
209
|
+
dest.mkdir(parents=True, exist_ok=True)
|
|
210
|
+
if zipfile.is_zipfile(archive):
|
|
211
|
+
with zipfile.ZipFile(archive) as zf:
|
|
212
|
+
for info in zf.infolist():
|
|
213
|
+
if not (info.flag_bits & 0x800):
|
|
214
|
+
info.filename = _fix_zip_name(info.filename)
|
|
215
|
+
zf.extract(info, dest)
|
|
216
|
+
return
|
|
217
|
+
try:
|
|
218
|
+
with tarfile.open(archive) as tf:
|
|
219
|
+
try:
|
|
220
|
+
tf.extractall(dest, filter="data")
|
|
221
|
+
except TypeError:
|
|
222
|
+
# filter 参数需 Python 3.11.4+;低版本自行校验成员路径再解压
|
|
223
|
+
root = dest.resolve()
|
|
224
|
+
for member in tf.getmembers():
|
|
225
|
+
# 链接的目标不受成员路径校验约束,且后续复制会跟随链接读到
|
|
226
|
+
# 链接目标的内容,因此一律拒绝
|
|
227
|
+
if member.issym() or member.islnk():
|
|
228
|
+
raise RuntimeError(
|
|
229
|
+
f"归档包含链接文件,已中止: {member.name}"
|
|
230
|
+
)
|
|
231
|
+
if not (dest / member.name).resolve().is_relative_to(root):
|
|
232
|
+
raise RuntimeError(
|
|
233
|
+
f"归档包含非法路径,已中止: {member.name}"
|
|
234
|
+
)
|
|
235
|
+
tf.extractall(dest)
|
|
236
|
+
return
|
|
237
|
+
except tarfile.ReadError:
|
|
238
|
+
# 仅「读不出 tar 结构」才说明格式不对;filter 拦截等错误照原样抛出
|
|
239
|
+
pass
|
|
240
|
+
raise RuntimeError(
|
|
241
|
+
f"无法识别压缩格式,请确认下载链接是否为 zip 或 tar.gz 文件: {archive.name}"
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def _find_content_root(extract_dir: Path) -> Path:
|
|
246
|
+
"""若解压后只有单一顶层目录,则进入该目录作为实际内容根。"""
|
|
247
|
+
items = [p for p in extract_dir.iterdir() if p.name not in IGNORED_FILES]
|
|
248
|
+
if len(items) == 1 and items[0].is_dir():
|
|
249
|
+
return items[0]
|
|
250
|
+
return extract_dir
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def _win_long_path(path: Path) -> str:
|
|
254
|
+
"""Windows 长路径前缀,绕过 MAX_PATH(260) 限制。"""
|
|
255
|
+
resolved = str(path.resolve())
|
|
256
|
+
if resolved.startswith("\\\\?\\"):
|
|
257
|
+
return resolved
|
|
258
|
+
if resolved.startswith("\\\\"):
|
|
259
|
+
return "\\\\?\\UNC\\" + resolved[2:]
|
|
260
|
+
return "\\\\?\\" + resolved
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def _chmod_writable(path: Path) -> None:
|
|
264
|
+
"""在原有权限位上追加写权限;符号链接跳过,避免改动链接目标。"""
|
|
265
|
+
if path.is_symlink():
|
|
266
|
+
return
|
|
267
|
+
try:
|
|
268
|
+
os.chmod(path, os.stat(path).st_mode | stat.S_IWUSR)
|
|
269
|
+
except OSError:
|
|
270
|
+
pass
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def _on_rm_error(func, path, _exc_info) -> None:
|
|
274
|
+
"""只读文件/目录删除失败时,先改权限再重试。"""
|
|
275
|
+
# POSIX 下能否删除取决于父目录是否可写,父目录也要一并补权限
|
|
276
|
+
_chmod_writable(Path(path).parent)
|
|
277
|
+
_chmod_writable(Path(path))
|
|
278
|
+
func(path)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def _unlink(path: Path) -> None:
|
|
282
|
+
"""删除单个文件或符号链接。"""
|
|
283
|
+
_chmod_writable(path)
|
|
284
|
+
try:
|
|
285
|
+
path.unlink()
|
|
286
|
+
return
|
|
287
|
+
except OSError:
|
|
288
|
+
if sys.platform != "win32":
|
|
289
|
+
raise
|
|
290
|
+
os.remove(_win_long_path(path))
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def _rmdir(path: Path) -> None:
|
|
294
|
+
"""删除空目录。"""
|
|
295
|
+
_chmod_writable(path)
|
|
296
|
+
try:
|
|
297
|
+
path.rmdir()
|
|
298
|
+
return
|
|
299
|
+
except OSError:
|
|
300
|
+
if sys.platform != "win32":
|
|
301
|
+
raise
|
|
302
|
+
os.rmdir(_win_long_path(path))
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def _remove_tree(root: Path) -> None:
|
|
306
|
+
"""删除目录树;Windows 下自底向上并使用长路径,避免 rmtree 在深层目录失败。"""
|
|
307
|
+
if not root.exists():
|
|
308
|
+
return
|
|
309
|
+
if sys.platform == "win32":
|
|
310
|
+
walk_root = _win_long_path(root.resolve())
|
|
311
|
+
for dirpath, dirnames, filenames in os.walk(walk_root, topdown=False):
|
|
312
|
+
for name in filenames:
|
|
313
|
+
fp = os.path.join(dirpath, name)
|
|
314
|
+
try:
|
|
315
|
+
_chmod_writable(Path(fp))
|
|
316
|
+
os.remove(fp)
|
|
317
|
+
except OSError:
|
|
318
|
+
try:
|
|
319
|
+
os.remove(_win_long_path(Path(fp)))
|
|
320
|
+
except OSError as exc:
|
|
321
|
+
raise OSError(f"无法删除文件: {fp}") from exc
|
|
322
|
+
for name in dirnames:
|
|
323
|
+
dp = os.path.join(dirpath, name)
|
|
324
|
+
try:
|
|
325
|
+
_chmod_writable(Path(dp))
|
|
326
|
+
os.rmdir(dp)
|
|
327
|
+
except OSError:
|
|
328
|
+
try:
|
|
329
|
+
os.rmdir(_win_long_path(Path(dp)))
|
|
330
|
+
except OSError as exc:
|
|
331
|
+
raise OSError(f"无法删除目录: {dp}") from exc
|
|
332
|
+
try:
|
|
333
|
+
_rmdir(root)
|
|
334
|
+
except OSError as exc:
|
|
335
|
+
raise OSError(f"无法删除目录: {root}") from exc
|
|
336
|
+
return
|
|
337
|
+
shutil.rmtree(root, onerror=_on_rm_error)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def _mkdir(path: Path) -> None:
|
|
341
|
+
"""创建目录;Windows 下失败时使用长路径重试。"""
|
|
342
|
+
try:
|
|
343
|
+
path.mkdir(parents=True, exist_ok=True)
|
|
344
|
+
return
|
|
345
|
+
except OSError:
|
|
346
|
+
if sys.platform != "win32":
|
|
347
|
+
raise
|
|
348
|
+
os.makedirs(_win_long_path(path), exist_ok=True)
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
def _copy_file(src: Path, dst: Path) -> None:
|
|
352
|
+
"""复制单个文件;Windows 下自动尝试长路径。"""
|
|
353
|
+
_mkdir(dst.parent)
|
|
354
|
+
try:
|
|
355
|
+
shutil.copy2(src, dst)
|
|
356
|
+
return
|
|
357
|
+
except OSError:
|
|
358
|
+
if sys.platform != "win32":
|
|
359
|
+
raise
|
|
360
|
+
shutil.copy2(_win_long_path(src), _win_long_path(dst))
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
def _copy_tree(
|
|
364
|
+
src: Path, dst: Path, preserve_top_level=None
|
|
365
|
+
) -> list[tuple[Path, str]]:
|
|
366
|
+
"""逐文件复制目录树,可跳过指定顶层目录,返回复制错误列表。"""
|
|
367
|
+
preserve_top_level = preserve_top_level or set()
|
|
368
|
+
_mkdir(dst)
|
|
369
|
+
errors: list[tuple[Path, str]] = []
|
|
370
|
+
for item in sorted(src.rglob("*")):
|
|
371
|
+
rel = item.relative_to(src)
|
|
372
|
+
if any(part in IGNORED_FILES for part in rel.parts):
|
|
373
|
+
continue
|
|
374
|
+
if rel.parts and rel.parts[0] in preserve_top_level:
|
|
375
|
+
continue
|
|
376
|
+
target = dst / rel
|
|
377
|
+
if item.is_dir():
|
|
378
|
+
try:
|
|
379
|
+
_mkdir(target)
|
|
380
|
+
except OSError as exc:
|
|
381
|
+
errors.append((rel, str(exc)))
|
|
382
|
+
continue
|
|
383
|
+
try:
|
|
384
|
+
_copy_file(item, target)
|
|
385
|
+
except OSError as exc:
|
|
386
|
+
errors.append((rel, str(exc)))
|
|
387
|
+
return errors
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def _clear_docs_dir() -> None:
|
|
391
|
+
"""删除 DOCS_TARGET_DIR 下的所有文件与子目录(保留 assets 目录本身)。"""
|
|
392
|
+
if not DOCS_TARGET_DIR.exists():
|
|
393
|
+
return
|
|
394
|
+
resolved = DOCS_TARGET_DIR.resolve()
|
|
395
|
+
skill_root = SKILL_DIR.resolve()
|
|
396
|
+
if not resolved.is_relative_to(skill_root):
|
|
397
|
+
raise RuntimeError(f"目标目录不在 skill 范围内,拒绝清空: {DOCS_TARGET_DIR}")
|
|
398
|
+
for child in DOCS_TARGET_DIR.iterdir():
|
|
399
|
+
if child.is_symlink():
|
|
400
|
+
_unlink(child)
|
|
401
|
+
elif child.is_dir():
|
|
402
|
+
_remove_tree(child)
|
|
403
|
+
else:
|
|
404
|
+
_unlink(child)
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
# ==== Skill 目录管理 ====
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
def _clear_skill_dir() -> None:
|
|
411
|
+
"""清空 SKILL_DIR 下的内容,保留 assets 目录和状态文件。"""
|
|
412
|
+
if not SKILL_DIR.exists():
|
|
413
|
+
return
|
|
414
|
+
state_resolved = STATE_FILE.resolve()
|
|
415
|
+
assets_resolved = DOCS_TARGET_DIR.resolve()
|
|
416
|
+
|
|
417
|
+
for child in list(SKILL_DIR.iterdir()):
|
|
418
|
+
child_resolved = child.resolve()
|
|
419
|
+
if child_resolved == assets_resolved:
|
|
420
|
+
continue
|
|
421
|
+
if not child.is_dir():
|
|
422
|
+
if child_resolved != state_resolved:
|
|
423
|
+
_unlink(child)
|
|
424
|
+
continue
|
|
425
|
+
# 检查状态文件是否在此目录下
|
|
426
|
+
_state_inside = False
|
|
427
|
+
try:
|
|
428
|
+
state_resolved.relative_to(child_resolved)
|
|
429
|
+
_state_inside = True
|
|
430
|
+
except ValueError:
|
|
431
|
+
pass
|
|
432
|
+
if not _state_inside:
|
|
433
|
+
_remove_tree(child)
|
|
434
|
+
continue
|
|
435
|
+
# 状态文件在此目录内,逐项清理但保留状态文件本身
|
|
436
|
+
for sub in list(child.iterdir()):
|
|
437
|
+
if sub.resolve() == state_resolved:
|
|
438
|
+
continue
|
|
439
|
+
if sub.is_dir():
|
|
440
|
+
_remove_tree(sub)
|
|
441
|
+
else:
|
|
442
|
+
_unlink(sub)
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
# ==== 命令 ====
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
def _is_installed() -> bool:
|
|
449
|
+
"""判断本地知识库目录是否存在且非空。"""
|
|
450
|
+
return DOCS_TARGET_DIR.exists() and any(DOCS_TARGET_DIR.iterdir())
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
def cmd_update(state: dict, skip_check: bool) -> None:
|
|
454
|
+
"""检查远程版本;有更新或首次安装时下载、清空 assets 并写入新版本。"""
|
|
455
|
+
installed = _is_installed()
|
|
456
|
+
|
|
457
|
+
if installed and skip_check:
|
|
458
|
+
last = state.get(S_LAST_CHECK, "未知")
|
|
459
|
+
print(
|
|
460
|
+
f"知识库已是最新(上次检查: {last},{CHECK_INTERVAL_HOURS}H 内无需重复检查)。"
|
|
461
|
+
)
|
|
462
|
+
return
|
|
463
|
+
|
|
464
|
+
print("正在检查远程文档版本…")
|
|
465
|
+
remote = _head_url(DOCS_URL)
|
|
466
|
+
if "error" in remote:
|
|
467
|
+
print(
|
|
468
|
+
f"无法连接远程服务器,请检查网络后重试。\n 错误详情: {remote['error']}",
|
|
469
|
+
file=sys.stderr,
|
|
470
|
+
)
|
|
471
|
+
sys.exit(1)
|
|
472
|
+
|
|
473
|
+
state[S_LAST_CHECK] = _now_iso()
|
|
474
|
+
|
|
475
|
+
if installed and not _remote_changed(
|
|
476
|
+
state, remote, S_DOCS_REMOTE_ETAG, S_DOCS_REMOTE_MODIFIED
|
|
477
|
+
):
|
|
478
|
+
_save_state(state)
|
|
479
|
+
print("远程文档未发生变化,当前已是最新,无需更新。")
|
|
480
|
+
return
|
|
481
|
+
|
|
482
|
+
if not installed:
|
|
483
|
+
print("本地尚未安装知识库,开始首次下载…")
|
|
484
|
+
else:
|
|
485
|
+
print(
|
|
486
|
+
f"检测到远程文档已更新({remote.get(H_LAST_MODIFIED, '时间未知')}),开始下载…"
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
490
|
+
tmp = Path(tmp)
|
|
491
|
+
suffix = Path(DOCS_URL.split("?")[0]).suffix or ".zip"
|
|
492
|
+
archive = tmp / f"docs{suffix}"
|
|
493
|
+
|
|
494
|
+
_download_url(DOCS_URL, archive)
|
|
495
|
+
|
|
496
|
+
print("下载完成,正在解压…")
|
|
497
|
+
extract_dir = tmp / "out"
|
|
498
|
+
_extract(archive, extract_dir)
|
|
499
|
+
new_root = _find_content_root(extract_dir)
|
|
500
|
+
|
|
501
|
+
print("正在写入知识库...")
|
|
502
|
+
DOCS_TARGET_DIR.parent.mkdir(parents=True, exist_ok=True)
|
|
503
|
+
_clear_docs_dir()
|
|
504
|
+
copy_errors = _copy_tree(new_root, DOCS_TARGET_DIR)
|
|
505
|
+
if copy_errors:
|
|
506
|
+
print(
|
|
507
|
+
f"写入知识库时出现 {len(copy_errors)} 个文件错误(常见于 Windows 长路径或权限问题):",
|
|
508
|
+
file=sys.stderr,
|
|
509
|
+
)
|
|
510
|
+
for rel, msg in copy_errors[:10]:
|
|
511
|
+
print(f" - {rel}: {msg}", file=sys.stderr)
|
|
512
|
+
if len(copy_errors) > 10:
|
|
513
|
+
print(f" … 另有 {len(copy_errors) - 10} 个错误未列出", file=sys.stderr)
|
|
514
|
+
sys.exit(1)
|
|
515
|
+
|
|
516
|
+
state[S_LAST_UPDATE] = _now_iso()
|
|
517
|
+
# 为了抵抗代理/网关对 header value 的大小写改写,这里落盘时统一做小写。
|
|
518
|
+
state[S_DOCS_REMOTE_MODIFIED] = str(remote.get(H_LAST_MODIFIED, "") or "").lower()
|
|
519
|
+
state[S_DOCS_REMOTE_ETAG] = str(remote.get(H_ETAG, "") or "").lower()
|
|
520
|
+
_save_state(state)
|
|
521
|
+
|
|
522
|
+
count = sum(1 for _ in DOCS_TARGET_DIR.rglob(DOCS_FILE_GLOB))
|
|
523
|
+
print(f"更新完成,当前共 {count} 篇文档。")
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
def _is_skill_installed() -> bool:
|
|
527
|
+
"""判断 skill 是否已安装(SKILL.md 存在即视为已安装)。"""
|
|
528
|
+
return (SKILL_DIR / "SKILL.md").exists()
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
def cmd_skill_update(state: dict, skip_check: bool) -> None:
|
|
532
|
+
"""检查 Skill 远程版本;有更新时下载并替换(保留 assets 目录和状态文件)。"""
|
|
533
|
+
installed = _is_skill_installed()
|
|
534
|
+
|
|
535
|
+
if installed and skip_check:
|
|
536
|
+
last = state.get(S_LAST_CHECK, "未知")
|
|
537
|
+
print(
|
|
538
|
+
f"Skill 已是最新(上次检查: {last},{CHECK_INTERVAL_HOURS}H 内无需重复检查)。"
|
|
539
|
+
)
|
|
540
|
+
return
|
|
541
|
+
|
|
542
|
+
print("正在检查 Skill 远程版本…")
|
|
543
|
+
remote = _head_url(SKILL_URL)
|
|
544
|
+
if "error" in remote:
|
|
545
|
+
print(
|
|
546
|
+
f"无法连接 Skill 远程服务器,请检查网络后重试。\n"
|
|
547
|
+
f" 错误详情: {remote['error']}",
|
|
548
|
+
file=sys.stderr,
|
|
549
|
+
)
|
|
550
|
+
sys.exit(1)
|
|
551
|
+
|
|
552
|
+
state[S_LAST_CHECK] = _now_iso()
|
|
553
|
+
|
|
554
|
+
if installed and not _remote_changed(
|
|
555
|
+
state, remote, S_SKILL_REMOTE_ETAG, S_SKILL_REMOTE_MODIFIED
|
|
556
|
+
):
|
|
557
|
+
_save_state(state)
|
|
558
|
+
print("Skill 远程未发生变化,当前已是最新,无需更新。")
|
|
559
|
+
return
|
|
560
|
+
|
|
561
|
+
if not installed:
|
|
562
|
+
print("本地尚未安装 Skill,开始首次下载…")
|
|
563
|
+
else:
|
|
564
|
+
print(
|
|
565
|
+
f"检测到 Skill 已更新({remote.get(H_LAST_MODIFIED, '时间未知')}),"
|
|
566
|
+
f"开始下载…"
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
570
|
+
tmp = Path(tmp)
|
|
571
|
+
archive = tmp / "bundle.tar.gz"
|
|
572
|
+
|
|
573
|
+
_download_url(SKILL_URL, archive, label="下载 Skill")
|
|
574
|
+
|
|
575
|
+
print("下载完成,正在解压…")
|
|
576
|
+
extract_dir = tmp / "out"
|
|
577
|
+
_extract(archive, extract_dir)
|
|
578
|
+
new_root = _find_content_root(extract_dir)
|
|
579
|
+
|
|
580
|
+
print("正在更新 Skill…")
|
|
581
|
+
_clear_skill_dir()
|
|
582
|
+
copy_errors = _copy_tree(new_root, SKILL_DIR, SKILL_PRESERVE_DIRS)
|
|
583
|
+
if copy_errors:
|
|
584
|
+
print(
|
|
585
|
+
f"更新 Skill 时出现 {len(copy_errors)} 个文件错误:",
|
|
586
|
+
file=sys.stderr,
|
|
587
|
+
)
|
|
588
|
+
for rel, msg in copy_errors[:10]:
|
|
589
|
+
print(f" - {rel}: {msg}", file=sys.stderr)
|
|
590
|
+
if len(copy_errors) > 10:
|
|
591
|
+
print(
|
|
592
|
+
f" … 另有 {len(copy_errors) - 10} 个错误未列出", file=sys.stderr
|
|
593
|
+
)
|
|
594
|
+
sys.exit(1)
|
|
595
|
+
|
|
596
|
+
state[S_LAST_UPDATE] = _now_iso()
|
|
597
|
+
state[S_SKILL_REMOTE_MODIFIED] = str(
|
|
598
|
+
remote.get(H_LAST_MODIFIED, "") or ""
|
|
599
|
+
).lower()
|
|
600
|
+
state[S_SKILL_REMOTE_ETAG] = str(remote.get(H_ETAG, "") or "").lower()
|
|
601
|
+
_save_state(state)
|
|
602
|
+
|
|
603
|
+
print("Skill 更新完成。")
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
# ==== 入口 ====
|
|
607
|
+
_USAGE = """\
|
|
608
|
+
用法: python3 wechatpay-resource-sync.py update
|
|
609
|
+
|
|
610
|
+
update 检查远程 Skill 和知识库是否有更新;有变化时下载并替换(含首次安装)
|
|
611
|
+
默认 12 小时内不重复检查远程"""
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
def main() -> None:
|
|
615
|
+
if len(sys.argv) < 2 or sys.argv[1] in ("-h", "--help"):
|
|
616
|
+
print(_USAGE)
|
|
617
|
+
sys.exit(0)
|
|
618
|
+
|
|
619
|
+
cmd = sys.argv[1]
|
|
620
|
+
|
|
621
|
+
if cmd != "update":
|
|
622
|
+
print(f"未识别到有效命令: {cmd}\n")
|
|
623
|
+
print(_USAGE)
|
|
624
|
+
sys.exit(1)
|
|
625
|
+
|
|
626
|
+
# 状态只读一次;间隔判断必须在任何落盘之前算好,否则 Skill 更新写入的
|
|
627
|
+
# LAST_CHECK_TIME 会让紧随其后的知识库检查被误判为“12H 内已检查”。
|
|
628
|
+
state = _load_state()
|
|
629
|
+
skip_check = _within_interval(state)
|
|
630
|
+
|
|
631
|
+
# Skill 与知识库共用同一个 LAST_CHECK_TIME,两者都在间隔内时时间戳必然相同,
|
|
632
|
+
# 合并成一条提示,避免打印两遍。
|
|
633
|
+
if skip_check and _is_skill_installed() and _is_installed():
|
|
634
|
+
last = state.get(S_LAST_CHECK, "未知")
|
|
635
|
+
print(
|
|
636
|
+
f"Skill 与知识库均已是最新(上次检查: {last},"
|
|
637
|
+
f"{CHECK_INTERVAL_HOURS}H 内无需重复检查)。"
|
|
638
|
+
)
|
|
639
|
+
return
|
|
640
|
+
|
|
641
|
+
cmd_skill_update(state, skip_check)
|
|
642
|
+
cmd_update(state, skip_check)
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
if __name__ == "__main__":
|
|
646
|
+
main()
|