@open-mercato/cli 0.9.1-develop.7574.1.837288eec1 → 0.10.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/.turbo/turbo-build.log +12 -2
- package/build.mjs +1 -0
- package/dist/agentic/claude-code/mcp.json.example +5 -1
- package/dist/agentic/codex/mcp.json.example +3 -0
- package/dist/agentic/cursor/mcp.json.example +4 -1
- package/dist/agentic/github-copilot/mcp.json.example +5 -1
- package/dist/agentic/guides/ai-workflows.md +1 -0
- package/dist/agentic/guides/architecture.md +7 -5
- package/dist/agentic/guides/module-facts.json +17621 -2604
- package/dist/agentic/guides/module-facts.v2.json +17710 -2604
- package/dist/agentic/guides/module-tool.md +21 -0
- package/dist/agentic/guides/modules/agent_orchestrator/acl-features.md +2 -1
- package/dist/agentic/guides/modules/agent_orchestrator/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/agent_orchestrator/backend-pages.md +3 -0
- package/dist/agentic/guides/modules/agent_orchestrator/cli-commands.md +4 -0
- package/dist/agentic/guides/modules/agent_orchestrator/contribution-resolutions.md +6 -0
- package/dist/agentic/guides/modules/agent_orchestrator/di-registrations-rich.md +32 -32
- package/dist/agentic/guides/modules/agent_orchestrator/di-service-tokens.md +14 -14
- package/dist/agentic/guides/modules/agent_orchestrator/domain-commands.md +3 -0
- package/dist/agentic/guides/modules/agent_orchestrator/events.md +30 -29
- package/dist/agentic/guides/modules/agent_orchestrator/exact-override-targets.md +104 -35
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +17 -6
- package/dist/agentic/guides/modules/agent_orchestrator/setup.md +1 -1
- package/dist/agentic/guides/modules/agent_orchestrator/umes-contributions.md +6 -0
- package/dist/agentic/guides/modules/agent_orchestrator/umes-hosts.md +2 -1
- package/dist/agentic/guides/modules/agent_orchestrator/workers.md +2 -0
- package/dist/agentic/guides/modules/ai_assistant/acl-features.md +4 -1
- package/dist/agentic/guides/modules/ai_assistant/ai-tools-mcp-capabilities.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/backend-pages.md +4 -0
- package/dist/agentic/guides/modules/ai_assistant/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/contribution-resolutions.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/di-registrations-rich.md +5 -3
- package/dist/agentic/guides/modules/ai_assistant/di-service-tokens.md +4 -2
- package/dist/agentic/guides/modules/ai_assistant/encryption.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/entities.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/events.md +9 -8
- package/dist/agentic/guides/modules/ai_assistant/exact-override-targets.md +23 -6
- package/dist/agentic/guides/modules/ai_assistant/index.md +9 -9
- package/dist/agentic/guides/modules/ai_assistant/notifications.md +1 -0
- package/dist/agentic/guides/modules/ai_assistant/setup.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/umes-contributions.md +3 -0
- package/dist/agentic/guides/modules/ai_assistant/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/ai_assistant/workers.md +2 -1
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/active-extension-bindings.md +12 -0
- package/dist/agentic/guides/modules/attachments/ai-tools-mcp-capabilities.md +11 -0
- package/dist/agentic/guides/modules/attachments/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/attachments/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/attachments/contribution-resolutions.md +13 -0
- package/dist/agentic/guides/modules/attachments/di-registrations-rich.md +6 -6
- package/dist/agentic/guides/modules/attachments/di-service-tokens.md +5 -5
- package/dist/agentic/guides/modules/attachments/domain-commands.md +11 -0
- package/dist/agentic/guides/modules/attachments/encryption.md +12 -0
- package/dist/agentic/guides/modules/attachments/entities.md +2 -0
- package/dist/agentic/guides/modules/attachments/events.md +3 -3
- package/dist/agentic/guides/modules/attachments/exact-override-targets.md +17 -7
- package/dist/agentic/guides/modules/attachments/generator-plugins.md +11 -0
- package/dist/agentic/guides/modules/attachments/index.md +13 -5
- package/dist/agentic/guides/modules/attachments/search-entities.md +11 -0
- package/dist/agentic/guides/modules/attachments/setup.md +1 -1
- package/dist/agentic/guides/modules/attachments/umes-contributions.md +13 -0
- package/dist/agentic/guides/modules/attachments/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/attachments/workers.md +2 -0
- package/dist/agentic/guides/modules/audit_logs/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/audit_logs/incoming-installed-contributions.md +12 -0
- package/dist/agentic/guides/modules/audit_logs/index.md +4 -2
- package/dist/agentic/guides/modules/auth/events.md +12 -12
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/events.md +3 -3
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/events.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/acl-features.md +12 -0
- package/dist/agentic/guides/modules/carrier_inpost/contribution-resolutions.md +13 -0
- package/dist/agentic/guides/modules/carrier_inpost/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/carrier_inpost/exact-override-targets.md +16 -0
- package/dist/agentic/guides/modules/carrier_inpost/index.md +18 -0
- package/dist/agentic/guides/modules/carrier_inpost/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/carrier_inpost/setup.md +11 -0
- package/dist/agentic/guides/modules/carrier_inpost/umes-contributions.md +13 -0
- package/dist/agentic/guides/modules/cart/acl-features.md +19 -0
- package/dist/agentic/guides/modules/cart/contribution-resolutions.md +24 -0
- package/dist/agentic/guides/modules/cart/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/cart/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/cart/domain-commands.md +24 -0
- package/dist/agentic/guides/modules/cart/encryption.md +11 -0
- package/dist/agentic/guides/modules/cart/entities.md +15 -0
- package/dist/agentic/guides/modules/cart/events.md +35 -0
- package/dist/agentic/guides/modules/cart/exact-override-targets.md +27 -0
- package/dist/agentic/guides/modules/cart/index.md +25 -0
- package/dist/agentic/guides/modules/cart/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/cart/setup.md +11 -0
- package/dist/agentic/guides/modules/cart/umes-contributions.md +24 -0
- package/dist/agentic/guides/modules/cart/umes-hosts.md +40 -0
- package/dist/agentic/guides/modules/cart/workers.md +14 -0
- package/dist/agentic/guides/modules/catalog/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +7 -5
- package/dist/agentic/guides/modules/catalog/di-service-tokens.md +4 -2
- package/dist/agentic/guides/modules/catalog/events.md +18 -18
- package/dist/agentic/guides/modules/catalog/exact-override-targets.md +7 -5
- package/dist/agentic/guides/modules/catalog/index.md +2 -2
- package/dist/agentic/guides/modules/catalog/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/channel_smtp/acl-features.md +12 -0
- package/dist/agentic/guides/modules/channel_smtp/contribution-resolutions.md +11 -0
- package/dist/agentic/guides/modules/channel_smtp/di-registrations-rich.md +12 -0
- package/dist/agentic/guides/modules/channel_smtp/exact-override-targets.md +16 -0
- package/dist/agentic/guides/modules/channel_smtp/index.md +18 -0
- package/dist/agentic/guides/modules/channel_smtp/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/channel_smtp/setup.md +11 -0
- package/dist/agentic/guides/modules/channel_smtp/umes-contributions.md +11 -0
- package/dist/agentic/guides/modules/checkout/events.md +16 -16
- package/dist/agentic/guides/modules/checkout/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/setup.md +1 -1
- package/dist/agentic/guides/modules/checkout/workers.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/events.md +17 -17
- package/dist/agentic/guides/modules/communication_channels/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/communication_channels/index.md +2 -2
- package/dist/agentic/guides/modules/communication_channels/setup.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/workers.md +2 -2
- package/dist/agentic/guides/modules/configs/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/currencies/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/currencies/events.md +6 -6
- package/dist/agentic/guides/modules/currencies/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/currencies/index.md +4 -2
- package/dist/agentic/guides/modules/customer_accounts/active-extension-bindings.md +1 -0
- package/dist/agentic/guides/modules/customer_accounts/contribution-resolutions.md +2 -2
- package/dist/agentic/guides/modules/customer_accounts/domain-commands.md +11 -0
- package/dist/agentic/guides/modules/customer_accounts/events.md +27 -26
- package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/index.md +5 -4
- package/dist/agentic/guides/modules/customer_accounts/umes-contributions.md +2 -2
- package/dist/agentic/guides/modules/customer_accounts/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/customer_groups/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/customer_groups/contribution-resolutions.md +2 -2
- package/dist/agentic/guides/modules/customer_groups/events.md +7 -7
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customer_groups/umes-contributions.md +2 -2
- package/dist/agentic/guides/modules/customers/active-extension-bindings.md +9 -10
- package/dist/agentic/guides/modules/customers/di-registrations-rich.md +6 -5
- package/dist/agentic/guides/modules/customers/encryption.md +1 -1
- package/dist/agentic/guides/modules/customers/events.md +51 -51
- package/dist/agentic/guides/modules/customers/exact-override-targets.md +6 -5
- package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +12 -8
- package/dist/agentic/guides/modules/customers/index.md +12 -4
- package/dist/agentic/guides/modules/customers/umes-hosts.md +46 -0
- package/dist/agentic/guides/modules/dashboards/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/events.md +4 -4
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/events.md +5 -5
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/events.md +3 -3
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/directory/contribution-resolutions.md +1 -0
- package/dist/agentic/guides/modules/directory/events.md +6 -6
- package/dist/agentic/guides/modules/directory/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/directory/incoming-installed-contributions.md +4 -0
- package/dist/agentic/guides/modules/directory/index.md +2 -2
- package/dist/agentic/guides/modules/directory/umes-contributions.md +1 -0
- package/dist/agentic/guides/modules/documents/contribution-resolutions.md +3 -3
- package/dist/agentic/guides/modules/documents/events.md +15 -15
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/documents/umes-contributions.md +5 -5
- package/dist/agentic/guides/modules/ecommerce/contribution-resolutions.md +1 -0
- package/dist/agentic/guides/modules/ecommerce/events.md +12 -12
- package/dist/agentic/guides/modules/ecommerce/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/ecommerce/index.md +3 -3
- package/dist/agentic/guides/modules/ecommerce/umes-contributions.md +1 -0
- package/dist/agentic/guides/modules/entities/contribution-resolutions.md +14 -0
- package/dist/agentic/guides/modules/entities/exact-override-targets.md +4 -0
- package/dist/agentic/guides/modules/entities/index.md +5 -3
- package/dist/agentic/guides/modules/entities/umes-contributions.md +14 -0
- package/dist/agentic/guides/modules/eudr/events.md +23 -23
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/events.md +18 -18
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/forms/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/acl-features.md +12 -0
- package/dist/agentic/guides/modules/gateway_autopay/cli-commands.md +12 -0
- package/dist/agentic/guides/modules/gateway_autopay/contribution-resolutions.md +12 -0
- package/dist/agentic/guides/modules/gateway_autopay/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/gateway_autopay/exact-override-targets.md +17 -0
- package/dist/agentic/guides/modules/gateway_autopay/index.md +19 -0
- package/dist/agentic/guides/modules/gateway_autopay/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/gateway_autopay/setup.md +11 -0
- package/dist/agentic/guides/modules/gateway_autopay/umes-contributions.md +12 -0
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/contribution-resolutions.md +1 -0
- package/dist/agentic/guides/modules/gateway_tpay/di-registrations-rich.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/exact-override-targets.md +6 -3
- package/dist/agentic/guides/modules/gateway_tpay/index.md +5 -4
- package/dist/agentic/guides/modules/gateway_tpay/setup.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/umes-contributions.md +1 -0
- package/dist/agentic/guides/modules/gateway_tpay/workers.md +11 -0
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/events.md +13 -13
- package/dist/agentic/guides/modules/inbox_ops/index.md +2 -2
- package/dist/agentic/guides/modules/integrations/events.md +4 -4
- package/dist/agentic/guides/modules/integrations/exact-override-targets.md +3 -2
- package/dist/agentic/guides/modules/integrations/incoming-installed-contributions.md +11 -0
- package/dist/agentic/guides/modules/integrations/index.md +3 -2
- package/dist/agentic/guides/modules/integrations/setup.md +1 -1
- package/dist/agentic/guides/modules/messages/entities.md +2 -0
- package/dist/agentic/guides/modules/messages/events.md +9 -9
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/messages/umes-hosts.md +2 -0
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/di-registrations-rich.md +4 -4
- package/dist/agentic/guides/modules/payment_gateways/di-service-tokens.md +2 -2
- package/dist/agentic/guides/modules/payment_gateways/events.md +9 -9
- package/dist/agentic/guides/modules/payment_gateways/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/setup.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/events.md +3 -3
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/planner/events.md +6 -6
- package/dist/agentic/guides/modules/planner/exact-override-targets.md +3 -3
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/planner/setup.md +1 -1
- package/dist/agentic/guides/modules/portal/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/portal/frontend-pages.md +1 -0
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/events.md +6 -6
- package/dist/agentic/guides/modules/progress/index.md +2 -2
- package/dist/agentic/guides/modules/promotions/acl-features.md +18 -0
- package/dist/agentic/guides/modules/promotions/active-extension-bindings.md +12 -0
- package/dist/agentic/guides/modules/promotions/backend-pages.md +16 -0
- package/dist/agentic/guides/modules/promotions/contribution-resolutions.md +18 -0
- package/dist/agentic/guides/modules/promotions/di-registrations-rich.md +15 -0
- package/dist/agentic/guides/modules/promotions/di-service-tokens.md +15 -0
- package/dist/agentic/guides/modules/promotions/domain-commands.md +23 -0
- package/dist/agentic/guides/modules/promotions/entities.md +19 -0
- package/dist/agentic/guides/modules/promotions/events.md +24 -0
- package/dist/agentic/guides/modules/promotions/exact-override-targets.md +41 -0
- package/dist/agentic/guides/modules/promotions/index.md +26 -0
- package/dist/agentic/guides/modules/promotions/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/promotions/setup.md +11 -0
- package/dist/agentic/guides/modules/promotions/umes-contributions.md +18 -0
- package/dist/agentic/guides/modules/promotions/umes-hosts.md +33 -0
- package/dist/agentic/guides/modules/promotions/workers.md +12 -0
- package/dist/agentic/guides/modules/push_notifications/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/push_notifications/events.md +2 -2
- package/dist/agentic/guides/modules/push_notifications/index.md +3 -2
- package/dist/agentic/guides/modules/query_index/events.md +8 -8
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/events.md +10 -10
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/events.md +15 -15
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/sales/active-extension-bindings.md +5 -0
- package/dist/agentic/guides/modules/sales/di-registrations-rich.md +30 -30
- package/dist/agentic/guides/modules/sales/di-service-tokens.md +5 -5
- package/dist/agentic/guides/modules/sales/domain-commands.md +1 -0
- package/dist/agentic/guides/modules/sales/events.md +44 -44
- package/dist/agentic/guides/modules/sales/exact-override-targets.md +30 -30
- package/dist/agentic/guides/modules/sales/incoming-installed-contributions.md +3 -1
- package/dist/agentic/guides/modules/sales/index.md +4 -4
- package/dist/agentic/guides/modules/sales/umes-hosts.md +5 -2
- package/dist/agentic/guides/modules/scheduler/events.md +4 -4
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/search/events.md +1 -1
- package/dist/agentic/guides/modules/search/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/search/workers.md +1 -1
- package/dist/agentic/guides/modules/security/contribution-resolutions.md +2 -0
- package/dist/agentic/guides/modules/security/events.md +22 -21
- package/dist/agentic/guides/modules/security/exact-override-targets.md +2 -0
- package/dist/agentic/guides/modules/security/index.md +2 -2
- package/dist/agentic/guides/modules/security/notifications.md +1 -0
- package/dist/agentic/guides/modules/security/umes-contributions.md +2 -0
- package/dist/agentic/guides/modules/security/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/contribution-resolutions.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/events.md +7 -7
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/umes-contributions.md +1 -1
- package/dist/agentic/guides/modules/sso/di-registrations-rich.md +8 -7
- package/dist/agentic/guides/modules/sso/di-service-tokens.md +7 -6
- package/dist/agentic/guides/modules/sso/events.md +12 -12
- package/dist/agentic/guides/modules/sso/exact-override-targets.md +8 -7
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/active-extension-bindings.md +5 -3
- package/dist/agentic/guides/modules/staff/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/staff/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/staff/contribution-resolutions.md +23 -0
- package/dist/agentic/guides/modules/staff/di-registrations-rich.md +8 -8
- package/dist/agentic/guides/modules/staff/domain-commands.md +2 -0
- package/dist/agentic/guides/modules/staff/encryption.md +1 -0
- package/dist/agentic/guides/modules/staff/entities.md +3 -0
- package/dist/agentic/guides/modules/staff/events.md +75 -70
- package/dist/agentic/guides/modules/staff/exact-override-targets.md +99 -12
- package/dist/agentic/guides/modules/staff/frontend-pages.md +3 -0
- package/dist/agentic/guides/modules/staff/index.md +26 -13
- package/dist/agentic/guides/modules/staff/notifications.md +4 -0
- package/dist/agentic/guides/modules/staff/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/staff/setup.md +1 -1
- package/dist/agentic/guides/modules/staff/umes-contributions.md +24 -1
- package/dist/agentic/guides/modules/staff/umes-hosts.md +9 -0
- package/dist/agentic/guides/modules/storage_s3/di-registrations-rich.md +3 -3
- package/dist/agentic/guides/modules/storage_s3/di-service-tokens.md +1 -1
- package/dist/agentic/guides/modules/storage_s3/exact-override-targets.md +3 -3
- package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
- package/dist/agentic/guides/modules/telemetry/index.md +1 -1
- package/dist/agentic/guides/modules/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/translations/events.md +2 -2
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/contribution-resolutions.md +2 -2
- package/dist/agentic/guides/modules/warranty_claims/events.md +14 -14
- package/dist/agentic/guides/modules/warranty_claims/exact-override-targets.md +5 -4
- package/dist/agentic/guides/modules/warranty_claims/index.md +2 -2
- package/dist/agentic/guides/modules/warranty_claims/setup.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/umes-contributions.md +2 -2
- package/dist/agentic/guides/modules/warranty_claims/workers.md +1 -1
- package/dist/agentic/guides/modules/webhooks/events.md +12 -12
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/acl-features.md +3 -1
- package/dist/agentic/guides/modules/wms/backend-pages.md +4 -0
- package/dist/agentic/guides/modules/wms/contribution-resolutions.md +7 -1
- package/dist/agentic/guides/modules/wms/custom-entities.md +3 -0
- package/dist/agentic/guides/modules/wms/domain-commands.md +16 -0
- package/dist/agentic/guides/modules/wms/entities.md +3 -0
- package/dist/agentic/guides/modules/wms/events.md +40 -29
- package/dist/agentic/guides/modules/wms/exact-override-targets.md +10 -0
- package/dist/agentic/guides/modules/wms/host-extension-points.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +14 -10
- package/dist/agentic/guides/modules/wms/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/wms/search-entities.md +2 -0
- package/dist/agentic/guides/modules/wms/umes-contributions.md +7 -1
- package/dist/agentic/guides/modules/wms/umes-diagnostics.md +2 -0
- package/dist/agentic/guides/modules/wms/umes-hosts.md +53 -0
- package/dist/agentic/guides/modules/workflows/contribution-resolutions.md +3 -3
- package/dist/agentic/guides/modules/workflows/events.md +32 -32
- package/dist/agentic/guides/modules/workflows/exact-override-targets.md +2 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/setup.md +1 -1
- package/dist/agentic/guides/modules/workflows/umes-contributions.md +3 -3
- package/dist/agentic/guides/production-deployment.md +82 -0
- package/dist/agentic/guides/reference-module-facts.json +384 -16
- package/dist/agentic/guides/reference-modules/example/contribution-resolutions.md +6 -0
- package/dist/agentic/guides/reference-modules/example/di-registrations-rich.md +3 -3
- package/dist/agentic/guides/reference-modules/example/di-service-tokens.md +1 -1
- package/dist/agentic/guides/reference-modules/example/events.md +5 -5
- package/dist/agentic/guides/reference-modules/example/exact-override-targets.md +12 -8
- package/dist/agentic/guides/reference-modules/example/index.md +4 -4
- package/dist/agentic/guides/reference-modules/example/setup.md +1 -1
- package/dist/agentic/guides/reference-modules/example/umes-contributions.md +6 -0
- package/dist/agentic/guides/template-tool.md +38 -0
- package/dist/agentic/guides/testing-debugging.md +2 -2
- package/dist/agentic/guides/upstream/AGENTS.md +3 -3
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +321 -230
- package/dist/agentic/guides/upstream/manifest.json +3 -3
- package/dist/agentic/shared/AGENTS.md.template +16 -11
- package/dist/agentic/shared/ai/harness/README.md +6 -2
- package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
- package/dist/agentic/shared/ai/harness/cases.json +282 -19
- package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
- package/dist/agentic/shared/ai/harness/source-link-inventory.json +204 -4
- package/dist/agentic/shared/ai/harness/validators.json +1 -1
- package/dist/agentic/shared/ai/qa/tests/playwright.config.ts +1 -0
- package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.9.0-to-0.10.0/SKILL.md +269 -0
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +6 -5
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +27 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +1 -1
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +13 -1
- package/dist/agentic/shared/ai/skills/om-find-module/SKILL.md +52 -0
- package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +1 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +1 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +7 -5
- package/dist/agentic/shared/ai/skills/om-setup-ci/SKILL.md +42 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/scripts/setup-ci.mjs +525 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/scripts/verify-semgrep-rules.mjs +54 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/docs/README.md +463 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/gitleaks/action.yml +25 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/playwright/action.yml +31 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/setup/action.yml +55 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/dependabot.yml +27 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/audit.yml +193 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/ci.yml +477 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/codeql.yml +63 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/security.yml +254 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/audit-ci-allowlist.json +4 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/audit-ci.mjs +283 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/semgrep/open-mercato.fixture.txt +89 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/semgrep/open-mercato.yml +146 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/time-bomb-scanner.mjs +286 -0
- package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/zap-rules.tsv +11 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +1 -1
- package/dist/agentic/shared/ai/skills/tiers.json +5 -2
- package/dist/agentic/shared/ai/trackers/github.md +314 -44
- package/dist/agentic/shared/scripts/execution-sandbox.mjs +1 -0
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +3 -3
- package/dist/i18n/de.json +4 -0
- package/dist/i18n/en.json +4 -0
- package/dist/i18n/es.json +4 -0
- package/dist/i18n/ko.json +4 -0
- package/dist/i18n/pl.json +4 -0
- package/dist/lib/__fixtures__/module-search/built-in.json +235 -0
- package/dist/lib/__fixtures__/module-search/catalog-parity.json +4076 -0
- package/dist/lib/__fixtures__/module-search/modules-index.json +1980 -0
- package/dist/lib/__fixtures__/official-module-package/package.json +33 -0
- package/dist/lib/__integration__/TC-INT-007.spec.js +241 -21
- package/dist/lib/__integration__/TC-INT-007.spec.js.map +2 -2
- package/dist/lib/__integration__/TC-INT-009.spec.js +267 -0
- package/dist/lib/__integration__/TC-INT-009.spec.js.map +7 -0
- package/dist/lib/db/commands.js +2 -0
- package/dist/lib/db/commands.js.map +2 -2
- package/dist/lib/db/numeric-snapshots.js +13 -0
- package/dist/lib/db/numeric-snapshots.js.map +7 -0
- package/dist/lib/eject.js +25 -9
- package/dist/lib/eject.js.map +2 -2
- package/dist/lib/env-example.js +25 -0
- package/dist/lib/env-example.js.map +7 -0
- package/dist/lib/generate-child-process.js +23 -0
- package/dist/lib/generate-child-process.js.map +7 -0
- package/dist/lib/generators/ast/imports.js +9 -4
- package/dist/lib/generators/ast/imports.js.map +2 -2
- package/dist/lib/generators/entity-ids.js +12 -12
- package/dist/lib/generators/entity-ids.js.map +2 -2
- package/dist/lib/generators/extensions/agent-files.js +119 -4
- package/dist/lib/generators/extensions/agent-files.js.map +2 -2
- package/dist/lib/generators/module-di.js +8 -9
- package/dist/lib/generators/module-di.js.map +2 -2
- package/dist/lib/generators/module-entities.js +8 -9
- package/dist/lib/generators/module-entities.js.map +2 -2
- package/dist/lib/generators/module-facts.js +7 -5
- package/dist/lib/generators/module-facts.js.map +2 -2
- package/dist/lib/generators/module-override-targets.js +6 -1
- package/dist/lib/generators/module-override-targets.js.map +2 -2
- package/dist/lib/generators/module-package-sources.js +6 -4
- package/dist/lib/generators/module-package-sources.js.map +2 -2
- package/dist/lib/generators/module-registry.js +157 -144
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/generators/openapi.js +9 -2
- package/dist/lib/generators/openapi.js.map +2 -2
- package/dist/lib/generators/source-exports.js +73 -0
- package/dist/lib/generators/source-exports.js.map +7 -0
- package/dist/lib/in-process-generate-watcher.js +11 -5
- package/dist/lib/in-process-generate-watcher.js.map +2 -2
- package/dist/lib/init-existing-database.js +26 -0
- package/dist/lib/init-existing-database.js.map +7 -0
- package/dist/lib/init-secrets.js +33 -1
- package/dist/lib/init-secrets.js.map +2 -2
- package/dist/lib/init-summary.js +44 -0
- package/dist/lib/init-summary.js.map +7 -0
- package/dist/lib/module-github.js +98 -0
- package/dist/lib/module-github.js.map +7 -0
- package/dist/lib/module-identity.js +131 -0
- package/dist/lib/module-identity.js.map +7 -0
- package/dist/lib/module-inspection.js +124 -0
- package/dist/lib/module-inspection.js.map +7 -0
- package/dist/lib/module-install.js +186 -19
- package/dist/lib/module-install.js.map +3 -3
- package/dist/lib/module-package.js +205 -15
- package/dist/lib/module-package.js.map +2 -2
- package/dist/lib/module-search-args.js +97 -0
- package/dist/lib/module-search-args.js.map +7 -0
- package/dist/lib/module-search-index.js +681 -0
- package/dist/lib/module-search-index.js.map +7 -0
- package/dist/lib/module-search.js +727 -0
- package/dist/lib/module-search.js.map +7 -0
- package/dist/lib/modules-config.js +210 -66
- package/dist/lib/modules-config.js.map +2 -2
- package/dist/lib/queue-worker-supervisor.js +3 -0
- package/dist/lib/queue-worker-supervisor.js.map +2 -2
- package/dist/lib/resolver.js +54 -35
- package/dist/lib/resolver.js.map +2 -2
- package/dist/lib/telemetry-init.js +1 -1
- package/dist/lib/telemetry-init.js.map +1 -1
- package/dist/lib/testing/integration-discovery.js +61 -21
- package/dist/lib/testing/integration-discovery.js.map +2 -2
- package/dist/lib/testing/integration.js +33 -4
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +126 -66
- package/dist/mercato.js.map +2 -2
- package/jest.config.cjs +1 -1
- package/package.json +9 -9
- package/src/__tests__/documented-queue-subcommands.test.ts +63 -0
- package/src/__tests__/mercato.test.ts +429 -4
- package/src/i18n/de.json +4 -0
- package/src/i18n/en.json +4 -0
- package/src/i18n/es.json +4 -0
- package/src/i18n/ko.json +4 -0
- package/src/i18n/pl.json +4 -0
- package/src/lib/__fixtures__/module-search/README.md +97 -0
- package/src/lib/__fixtures__/module-search/built-in.json +235 -0
- package/src/lib/__fixtures__/module-search/catalog-parity.json +4076 -0
- package/src/lib/__fixtures__/module-search/modules-index.json +1980 -0
- package/src/lib/__fixtures__/official-module-package/dist/modules/test_package/widgets/injection/test/widget.js +1 -0
- package/src/lib/__integration__/TC-INT-007.spec.ts +259 -21
- package/src/lib/__integration__/TC-INT-009.spec.ts +279 -0
- package/src/lib/__tests__/agentic-setup.ownership.test.ts +4 -0
- package/src/lib/__tests__/eject.test.ts +98 -4
- package/src/lib/__tests__/env-example.test.ts +58 -0
- package/src/lib/__tests__/generate-child-process.test.ts +185 -0
- package/src/lib/__tests__/generate-quiet-entrypoint.test.ts +47 -0
- package/src/lib/__tests__/in-process-generate-watcher.test.ts +91 -0
- package/src/lib/__tests__/init-existing-database.test.ts +27 -0
- package/src/lib/__tests__/init-secrets.test.ts +85 -1
- package/src/lib/__tests__/init-summary.test.ts +50 -0
- package/src/lib/__tests__/module-github.test.ts +108 -0
- package/src/lib/__tests__/module-identity.test.ts +144 -0
- package/src/lib/__tests__/module-inspection.test.ts +195 -0
- package/src/lib/__tests__/module-install.test.ts +614 -19
- package/src/lib/__tests__/module-package.test.ts +154 -0
- package/src/lib/__tests__/module-search.test.ts +1040 -0
- package/src/lib/__tests__/modules-config.test.ts +453 -1
- package/src/lib/__tests__/queue-worker-supervisor.test.ts +145 -1
- package/src/lib/__tests__/resolver.enterprise.test.ts +60 -0
- package/src/lib/__tests__/resolver.packages.test.ts +29 -0
- package/src/lib/__tests__/telemetry-init.test.ts +1 -1
- package/src/lib/db/__tests__/identifiers.test.ts +19 -0
- package/src/lib/db/__tests__/numeric-snapshots.test.ts +79 -0
- package/src/lib/db/commands.ts +2 -0
- package/src/lib/db/numeric-snapshots.ts +12 -0
- package/src/lib/eject.ts +28 -10
- package/src/lib/env-example.ts +31 -0
- package/src/lib/generate-child-process.ts +35 -0
- package/src/lib/generators/__tests__/agent-files-extension.test.ts +178 -0
- package/src/lib/generators/__tests__/attachment-access.test.ts +70 -0
- package/src/lib/generators/__tests__/module-extension-activations.test.ts +42 -18
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +9 -8
- package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +5 -1
- package/src/lib/generators/__tests__/module-id-collisions.test.ts +146 -0
- package/src/lib/generators/__tests__/module-override-targets.test.ts +8 -2
- package/src/lib/generators/__tests__/module-package-sources.test.ts +26 -6
- package/src/lib/generators/__tests__/module-registry-requires-enforcement.test.ts +130 -0
- package/src/lib/generators/__tests__/module-requirements.test.ts +56 -0
- package/src/lib/generators/__tests__/module-requires.test.ts +242 -0
- package/src/lib/generators/__tests__/module-subset.test.ts +103 -0
- package/src/lib/generators/__tests__/openapi.test.ts +24 -0
- package/src/lib/generators/ast/imports.ts +14 -4
- package/src/lib/generators/entity-ids.ts +12 -12
- package/src/lib/generators/extensions/agent-files.ts +154 -4
- package/src/lib/generators/module-di.ts +8 -9
- package/src/lib/generators/module-entities.ts +8 -9
- package/src/lib/generators/module-facts.ts +9 -5
- package/src/lib/generators/module-override-targets.ts +6 -1
- package/src/lib/generators/module-package-sources.ts +7 -5
- package/src/lib/generators/module-registry.ts +224 -182
- package/src/lib/generators/openapi.ts +10 -2
- package/src/lib/generators/source-exports.ts +93 -0
- package/src/lib/in-process-generate-watcher.ts +14 -6
- package/src/lib/init-existing-database.ts +24 -0
- package/src/lib/init-secrets.ts +37 -0
- package/src/lib/init-summary.ts +54 -0
- package/src/lib/module-github.ts +109 -0
- package/src/lib/module-identity.ts +145 -0
- package/src/lib/module-inspection.ts +133 -0
- package/src/lib/module-install.ts +214 -22
- package/src/lib/module-package.ts +243 -16
- package/src/lib/module-search-args.ts +116 -0
- package/src/lib/module-search-index.ts +1037 -0
- package/src/lib/module-search.ts +1013 -0
- package/src/lib/modules-config.ts +278 -80
- package/src/lib/queue-worker-supervisor.ts +3 -0
- package/src/lib/resolver.ts +58 -40
- package/src/lib/telemetry-init.ts +1 -1
- package/src/lib/testing/__tests__/integration-discovery.test.ts +89 -0
- package/src/lib/testing/__tests__/integration.test.ts +55 -0
- package/src/lib/testing/integration-discovery.ts +101 -32
- package/src/lib/testing/integration.ts +34 -4
- package/src/mercato.ts +167 -84
- package/src/types/cross-spawn.d.ts +2 -2
- package/src/lib/__tests__/agentic-build-artifacts.test.ts +0 -28
|
@@ -0,0 +1,681 @@
|
|
|
1
|
+
import MiniSearch from "minisearch";
|
|
2
|
+
import { satisfies } from "semver";
|
|
3
|
+
const SEARCH_BOOST = {
|
|
4
|
+
title: 3,
|
|
5
|
+
npm: 3,
|
|
6
|
+
summary: 2,
|
|
7
|
+
whenToUse: 2,
|
|
8
|
+
providers: 2,
|
|
9
|
+
tags: 1.5,
|
|
10
|
+
aliases: 1.5,
|
|
11
|
+
renamedFrom: 1,
|
|
12
|
+
category: 1,
|
|
13
|
+
anatomy: 1
|
|
14
|
+
};
|
|
15
|
+
const SEARCH_FIELDS = Object.keys(SEARCH_BOOST);
|
|
16
|
+
const ALIASES_META_KEY = "com.openmercato.modules/aliases";
|
|
17
|
+
const INSTALLABLE_META_KEY = "com.openmercato.modules/installable";
|
|
18
|
+
const BUILTIN_MAX = 5;
|
|
19
|
+
const BUILTIN_RATIO = 0.5;
|
|
20
|
+
const BOOST_VERIFIED = 0.15;
|
|
21
|
+
const BOOST_OFFICIAL = 0.1;
|
|
22
|
+
const MIN_AND_RESULTS = 3;
|
|
23
|
+
const WEAK_HIT_RATIO = 0.2;
|
|
24
|
+
const SEARCH_MAX_LIMIT = 20;
|
|
25
|
+
const SEARCH_DEFAULTS = { verifiedOnly: false, includeBuiltIn: true, includeExamples: false, limit: 10 };
|
|
26
|
+
const CORE_PACKAGE = "@open-mercato/core";
|
|
27
|
+
const ENTERPRISE_PACKAGE = "@open-mercato/enterprise";
|
|
28
|
+
const ENTERPRISE_ENABLE_STEP = "echo OM_ENABLE_ENTERPRISE_MODULES=true >> .env";
|
|
29
|
+
const PREVIEW_LINE = "Receipts: Preview run in Docker on the maintainer's machine, not CI. The first nightly CI run replaces it.";
|
|
30
|
+
const VERDICT_STATES = /* @__PURE__ */ new Set(["verified", "broken", "harness-red", "infra-error"]);
|
|
31
|
+
const STOPWORDS = /* @__PURE__ */ new Set([
|
|
32
|
+
"a",
|
|
33
|
+
"an",
|
|
34
|
+
"and",
|
|
35
|
+
"are",
|
|
36
|
+
"as",
|
|
37
|
+
"at",
|
|
38
|
+
"be",
|
|
39
|
+
"by",
|
|
40
|
+
"for",
|
|
41
|
+
"from",
|
|
42
|
+
"i",
|
|
43
|
+
"in",
|
|
44
|
+
"into",
|
|
45
|
+
"is",
|
|
46
|
+
"it",
|
|
47
|
+
"its",
|
|
48
|
+
"me",
|
|
49
|
+
"module",
|
|
50
|
+
"modules",
|
|
51
|
+
"my",
|
|
52
|
+
"of",
|
|
53
|
+
"on",
|
|
54
|
+
"or",
|
|
55
|
+
"our",
|
|
56
|
+
"that",
|
|
57
|
+
"the",
|
|
58
|
+
"this",
|
|
59
|
+
"to",
|
|
60
|
+
"via",
|
|
61
|
+
"we",
|
|
62
|
+
"with",
|
|
63
|
+
"you",
|
|
64
|
+
"your",
|
|
65
|
+
"can",
|
|
66
|
+
"do",
|
|
67
|
+
"does",
|
|
68
|
+
"how",
|
|
69
|
+
"need",
|
|
70
|
+
"needs",
|
|
71
|
+
"use",
|
|
72
|
+
"used",
|
|
73
|
+
"uses",
|
|
74
|
+
"want",
|
|
75
|
+
"wants",
|
|
76
|
+
"what",
|
|
77
|
+
"when",
|
|
78
|
+
"which"
|
|
79
|
+
]);
|
|
80
|
+
function tokenize(text) {
|
|
81
|
+
const lower = text.toLowerCase();
|
|
82
|
+
const tokens = lower.split(/[^a-z0-9*]+/).filter((token) => token !== "");
|
|
83
|
+
for (const match of lower.matchAll(/[a-z0-9]+(?:[._-][a-z0-9*]+)+/g)) tokens.push(match[0]);
|
|
84
|
+
return tokens;
|
|
85
|
+
}
|
|
86
|
+
function processTerm(term) {
|
|
87
|
+
return term.length < 2 || STOPWORDS.has(term) ? null : term;
|
|
88
|
+
}
|
|
89
|
+
const SEARCH_OPTIONS = {
|
|
90
|
+
idField: "id",
|
|
91
|
+
fields: SEARCH_FIELDS,
|
|
92
|
+
storeFields: ["group"],
|
|
93
|
+
tokenize,
|
|
94
|
+
processTerm,
|
|
95
|
+
searchOptions: { prefix: true, fuzzy: 0.2, boost: { ...SEARCH_BOOST } }
|
|
96
|
+
};
|
|
97
|
+
function anatomyIds(anatomy, moduleIds) {
|
|
98
|
+
const lists = anatomy?.lists;
|
|
99
|
+
return {
|
|
100
|
+
event: [.../* @__PURE__ */ new Set([...lists?.eventsEmitted ?? [], ...lists?.eventsConsumed ?? []])],
|
|
101
|
+
emits: [...lists?.eventsEmitted ?? []],
|
|
102
|
+
consumes: [...lists?.eventsConsumed ?? []],
|
|
103
|
+
entity: lists?.tables ?? [],
|
|
104
|
+
permission: lists?.aclFeatures ?? [],
|
|
105
|
+
env: lists?.env ?? [],
|
|
106
|
+
host: lists?.hosts ?? [],
|
|
107
|
+
setting: (lists?.credentials ?? []).map((credential) => credential.key),
|
|
108
|
+
module: [...moduleIds]
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const anatomyText = (ids) => [...ids.module, ...ids.entity, ...ids.event, ...ids.permission, ...ids.setting, ...ids.env, ...ids.host].join(" ");
|
|
112
|
+
function aliasesOf(entry) {
|
|
113
|
+
const value = entry._meta?.[ALIASES_META_KEY];
|
|
114
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
115
|
+
}
|
|
116
|
+
function moduleDoc(entry, ids) {
|
|
117
|
+
return {
|
|
118
|
+
id: entry.locator,
|
|
119
|
+
group: "module",
|
|
120
|
+
title: entry.title,
|
|
121
|
+
npm: [entry.npm ?? entry.locator.replace(/^github:/, ""), entry.path].join(" "),
|
|
122
|
+
summary: entry.summary,
|
|
123
|
+
whenToUse: entry.whenToUse,
|
|
124
|
+
providers: entry.providers.map((provider) => `${provider.name} ${provider.label}`).join(" "),
|
|
125
|
+
tags: entry.tags.join(" "),
|
|
126
|
+
aliases: aliasesOf(entry).join(" "),
|
|
127
|
+
renamedFrom: entry.renamedFrom.map((locator) => locator.replace(/^(npm|github):/, "")).join(" "),
|
|
128
|
+
category: entry.category,
|
|
129
|
+
anatomy: anatomyText(ids)
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function builtInDoc(coreModule, ids) {
|
|
133
|
+
return {
|
|
134
|
+
id: `core:${coreModule.id}`,
|
|
135
|
+
group: "builtin",
|
|
136
|
+
title: coreModule.title,
|
|
137
|
+
npm: coreModule.id,
|
|
138
|
+
summary: coreModule.description,
|
|
139
|
+
whenToUse: "",
|
|
140
|
+
providers: "",
|
|
141
|
+
tags: "",
|
|
142
|
+
aliases: "",
|
|
143
|
+
renamedFrom: "",
|
|
144
|
+
category: coreModule.category,
|
|
145
|
+
anatomy: anatomyText(ids)
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function createCatalogSearcher(index, builtIn) {
|
|
149
|
+
const miniSearch = new MiniSearch(SEARCH_OPTIONS);
|
|
150
|
+
const modules = /* @__PURE__ */ new Map();
|
|
151
|
+
const builtInModules = /* @__PURE__ */ new Map();
|
|
152
|
+
const docs = [];
|
|
153
|
+
for (const entry of index.entries.filter((candidate) => candidate.listed)) {
|
|
154
|
+
const ids = anatomyIds(entry.anatomy, entry.moduleIds);
|
|
155
|
+
modules.set(entry.locator, {
|
|
156
|
+
entry,
|
|
157
|
+
ids,
|
|
158
|
+
example: entry.tags.includes("example"),
|
|
159
|
+
omQuality: entry.quality !== null && entry.quality !== void 0
|
|
160
|
+
});
|
|
161
|
+
docs.push(moduleDoc(entry, ids));
|
|
162
|
+
}
|
|
163
|
+
for (const coreModule of builtIn?.modules ?? []) {
|
|
164
|
+
const ids = anatomyIds(coreModule.anatomy, [coreModule.id]);
|
|
165
|
+
builtInModules.set(coreModule.id, { module: coreModule, ids });
|
|
166
|
+
docs.push(builtInDoc(coreModule, ids));
|
|
167
|
+
}
|
|
168
|
+
miniSearch.addAll(docs);
|
|
169
|
+
const loaded = MiniSearch.loadJS(miniSearch.toJSON(), SEARCH_OPTIONS);
|
|
170
|
+
return { miniSearch: loaded, index, builtIn, site: index.site.replace(/\/+$/, ""), modules, builtInModules };
|
|
171
|
+
}
|
|
172
|
+
const absolute = (site, page) => /^https?:\/\//.test(page) ? page : `${site}${page}`;
|
|
173
|
+
function latestLine(lines) {
|
|
174
|
+
return lines.find((line) => line.source === "latest") ?? null;
|
|
175
|
+
}
|
|
176
|
+
const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/;
|
|
177
|
+
function resolveLine(omVersion, lines) {
|
|
178
|
+
const found = (line2) => line2 ? { line: line2.key, version: line2.version, note: null } : { line: null, version: null, note: null };
|
|
179
|
+
const raw = (omVersion ?? "").trim();
|
|
180
|
+
if (raw === "") return found(latestLine(lines));
|
|
181
|
+
const byKey = lines.find((line2) => line2.key === raw);
|
|
182
|
+
if (byKey) return found(byKey);
|
|
183
|
+
const version = raw.replace(/^(?:v|=|\^|~|>=)\s*/, "");
|
|
184
|
+
const semver = SEMVER.exec(version);
|
|
185
|
+
const lineKey = /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(version);
|
|
186
|
+
if (!semver && !lineKey || semver?.[4]?.split(".").some((part) => /^0\d+$/.test(part))) {
|
|
187
|
+
return { line: null, version: null, note: "Unknown Open Mercato version." };
|
|
188
|
+
}
|
|
189
|
+
const exact = lines.find((line2) => line2.version === version);
|
|
190
|
+
if (exact) return found(exact);
|
|
191
|
+
if (semver && semver[4] && /(^|[.-])develop([.-]|$)/.test(semver[4])) {
|
|
192
|
+
const next = lines.find((line2) => line2.source === "develop");
|
|
193
|
+
if (next) return found(next);
|
|
194
|
+
}
|
|
195
|
+
const majorMinor = semver ?? lineKey;
|
|
196
|
+
if (!majorMinor) return { line: null, version: null, note: "Unknown Open Mercato version." };
|
|
197
|
+
const key = `${Number(majorMinor[1])}.${Number(majorMinor[2])}`;
|
|
198
|
+
const line = lines.find((candidate) => candidate.key === key);
|
|
199
|
+
if (line) return found(line);
|
|
200
|
+
return { line: null, version: null, note: `Line ${key} is not tested by the catalog.` };
|
|
201
|
+
}
|
|
202
|
+
function matchedOn(match, meta, queryTerms = []) {
|
|
203
|
+
const chips = [];
|
|
204
|
+
const add = (chip) => {
|
|
205
|
+
if (!chips.includes(chip)) chips.push(chip);
|
|
206
|
+
};
|
|
207
|
+
const has = (id, term) => tokenize(id).includes(term);
|
|
208
|
+
const order = ["title", "npm", "aliases", "renamedFrom", "providers", "anatomy", "summary", "whenToUse", "tags", "category"];
|
|
209
|
+
const typed = new Set(queryTerms);
|
|
210
|
+
const fieldsByTerm = Object.entries(match).sort(
|
|
211
|
+
(left, right) => Number(typed.has(right[0])) - Number(typed.has(left[0])) || right[0].length - left[0].length
|
|
212
|
+
);
|
|
213
|
+
for (const field of order) {
|
|
214
|
+
for (const [term, fields] of fieldsByTerm) {
|
|
215
|
+
if (!fields.includes(field)) continue;
|
|
216
|
+
if (field === "title" || field === "npm" || field === "aliases" || field === "renamedFrom") add("name");
|
|
217
|
+
else if (field === "summary" || field === "whenToUse") add("summary");
|
|
218
|
+
else if (field === "tags") {
|
|
219
|
+
const tag = meta.tags?.find((candidate) => has(candidate, term));
|
|
220
|
+
add(tag ? `tag ${tag}` : "summary");
|
|
221
|
+
} else if (field === "category" && meta.category) add(`category ${meta.category}`);
|
|
222
|
+
else if (field === "providers") {
|
|
223
|
+
const provider = meta.providers?.find((candidate) => has(candidate.name, term) || has(candidate.label, term));
|
|
224
|
+
add(provider ? `provider ${provider.label}` : "provider");
|
|
225
|
+
} else if (field === "anatomy") anatomyChips(meta.ids, fieldsByTerm, has).forEach(add);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return chips.slice(0, 5);
|
|
229
|
+
}
|
|
230
|
+
function anatomyChips(ids, fieldsByTerm, has) {
|
|
231
|
+
const kinds = ["event", "entity", "permission", "env", "setting", "host", "module"];
|
|
232
|
+
const terms = fieldsByTerm.filter(([, fields]) => fields.includes("anatomy")).map(([term]) => term);
|
|
233
|
+
const left = new Set(terms);
|
|
234
|
+
const chips = [];
|
|
235
|
+
while (left.size > 0) {
|
|
236
|
+
let best = null;
|
|
237
|
+
for (const kind of kinds)
|
|
238
|
+
for (const id of ids[kind]) {
|
|
239
|
+
const covers = terms.filter((term) => left.has(term) && (id === term || has(id, term)));
|
|
240
|
+
if (covers.length === 0) continue;
|
|
241
|
+
const exact = covers.includes(id);
|
|
242
|
+
const first = terms.indexOf(covers[0]);
|
|
243
|
+
const better = !best || covers.length > best.covers.length || covers.length === best.covers.length && (exact && !best.exact ? true : exact === best.exact && first < best.first);
|
|
244
|
+
if (better) best = { chip: `${kind} ${id}`, covers, exact, first };
|
|
245
|
+
}
|
|
246
|
+
if (!best) break;
|
|
247
|
+
chips.push(best.chip);
|
|
248
|
+
for (const term of best.covers) left.delete(term);
|
|
249
|
+
}
|
|
250
|
+
return chips;
|
|
251
|
+
}
|
|
252
|
+
const STABLE_VERSION = /^\d+\.\d+\.\d+$/;
|
|
253
|
+
function satisfiesRange(version, range) {
|
|
254
|
+
try {
|
|
255
|
+
return satisfies(version, range, { includePrerelease: true });
|
|
256
|
+
} catch {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function lineVersion(entry, line) {
|
|
261
|
+
return (line !== null ? entry.compat.ships?.[line] : void 0) ?? installVersion(entry, line);
|
|
262
|
+
}
|
|
263
|
+
function judgedCell(entry, line) {
|
|
264
|
+
const cell = entry.compat.lines[line] ?? null;
|
|
265
|
+
if (!cell || cell.moduleVersion === null || cell.moduleVersion === void 0 || !VERDICT_STATES.has(cell.status)) return cell;
|
|
266
|
+
const installs = lineVersion(entry, line);
|
|
267
|
+
return installs === null || cell.moduleVersion === installs ? cell : null;
|
|
268
|
+
}
|
|
269
|
+
function statusOn(entry, line) {
|
|
270
|
+
if (entry.version.recommended[line]) return "verified";
|
|
271
|
+
return judgedCell(entry, line)?.status ?? "untested";
|
|
272
|
+
}
|
|
273
|
+
function installableOn(entry, line) {
|
|
274
|
+
if (line === null) return void 0;
|
|
275
|
+
const map = entry._meta?.[INSTALLABLE_META_KEY];
|
|
276
|
+
if (!map || typeof map !== "object") return void 0;
|
|
277
|
+
const value = map[line];
|
|
278
|
+
return typeof value === "string" ? value : value === null ? null : void 0;
|
|
279
|
+
}
|
|
280
|
+
function installVersion(entry, line) {
|
|
281
|
+
return (line !== null ? entry.version.recommended[line] : null) ?? installableOn(entry, line) ?? entry.version.latest ?? entry.version.preview ?? null;
|
|
282
|
+
}
|
|
283
|
+
function declaredRangeOf(entry, version) {
|
|
284
|
+
const builtFor = entry.compat.builtFor;
|
|
285
|
+
if (!builtFor || builtFor.kind === "missing" || builtFor.kind === "star") return null;
|
|
286
|
+
if (builtFor.ranges) {
|
|
287
|
+
for (const [line, range] of Object.entries(builtFor.ranges)) if (lineVersion(entry, line) === version) return range;
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
const lines = /* @__PURE__ */ new Set([...Object.keys(entry.compat.lines), ...Object.keys(entry.compat.ships ?? {})]);
|
|
291
|
+
return [...lines].some((line) => lineVersion(entry, line) === version) ? builtFor.range : null;
|
|
292
|
+
}
|
|
293
|
+
function emptyPresetVersion(entry, line) {
|
|
294
|
+
const version = installVersion(entry, line);
|
|
295
|
+
if (line === null || !version) return version;
|
|
296
|
+
const ships = entry.compat.ships?.[line];
|
|
297
|
+
if (!ships || ships === version) return version;
|
|
298
|
+
const isolation = entry.compat.isolation?.[line];
|
|
299
|
+
if (isolation?.moduleVersion === version) return isolation.status === "broken" ? ships : version;
|
|
300
|
+
const range = declaredRangeOf(entry, version);
|
|
301
|
+
return STABLE_VERSION.test(ships) && range !== null && !satisfiesRange(ships, range) ? ships : version;
|
|
302
|
+
}
|
|
303
|
+
function builtInEnableCommand(id) {
|
|
304
|
+
return `yarn mercato module enable ${CORE_PACKAGE} --module ${id}`;
|
|
305
|
+
}
|
|
306
|
+
const isAdapter = (entry) => entry.kind === "provider" && entry.moduleIds.length === 0;
|
|
307
|
+
function peerLibrarySpecs(entry, version, line, find) {
|
|
308
|
+
if (!find || !entry.npm || !isAdapter(entry)) return [];
|
|
309
|
+
const specs = [];
|
|
310
|
+
for (const requirement of entry.requires ?? []) {
|
|
311
|
+
const peer = requirement.resolvesTo?.startsWith("npm:") ? find(requirement.resolvesTo) : null;
|
|
312
|
+
if (!peer?.npm || peer.kind !== "library" || peer.npm === entry.npm) continue;
|
|
313
|
+
const sameRelease = Boolean(version) && peer.npm.startsWith("@open-mercato/") && entry.npm.startsWith("@open-mercato/");
|
|
314
|
+
const peerVersion = sameRelease ? version : installVersion(peer, line);
|
|
315
|
+
const spec = peerVersion ? `${peer.npm}@${peerVersion}` : peer.npm;
|
|
316
|
+
if (!specs.includes(spec)) specs.push(spec);
|
|
317
|
+
}
|
|
318
|
+
return specs;
|
|
319
|
+
}
|
|
320
|
+
function packageCommand(entry, spec, peers = []) {
|
|
321
|
+
if (entry.kind === "tool") return entry.tags.includes("cli") ? `npx ${spec}` : `yarn add ${spec}`;
|
|
322
|
+
if (isAdapter(entry)) return `yarn add ${[...peers, spec].join(" ")}`;
|
|
323
|
+
return entry.kind === "library" ? `yarn add ${spec}` : null;
|
|
324
|
+
}
|
|
325
|
+
function inPreset(entry, enabled) {
|
|
326
|
+
if (!enabled || !entry.npm || entry.moduleIds.length === 0) return false;
|
|
327
|
+
return entry.moduleIds.every((id) => enabled.some((item) => item.id === id && item.from === entry.npm));
|
|
328
|
+
}
|
|
329
|
+
function installCli(entry, line, preset, version = installVersion(entry, line), find) {
|
|
330
|
+
if (entry.npm === null) {
|
|
331
|
+
const repo = entry.locator.replace(/^github:/, "");
|
|
332
|
+
const ref = entry.version.gitRef ? ` --ref ${entry.version.gitRef}` : "";
|
|
333
|
+
return `npx create-mercato-module install ${repo}${ref}`;
|
|
334
|
+
}
|
|
335
|
+
const spec = version ? `${entry.npm}@${version}` : entry.npm;
|
|
336
|
+
const own = packageCommand(entry, spec, peerLibrarySpecs(entry, version, line, find));
|
|
337
|
+
if (own) return own;
|
|
338
|
+
if (inPreset(entry, preset)) return `yarn add ${spec}`;
|
|
339
|
+
const moduleFlag = entry.install.moduleFlag ?? null;
|
|
340
|
+
if (entry.npm === ENTERPRISE_PACKAGE && !moduleFlag) return `${ENTERPRISE_ENABLE_STEP} && yarn generate`;
|
|
341
|
+
const thirdParty = entry.npm.startsWith("@open-mercato/") ? "" : " --allow-third-party";
|
|
342
|
+
if (!moduleFlag && entry.moduleIds.length > 1) {
|
|
343
|
+
return entry.moduleIds.map((id) => `yarn mercato module add ${spec}${thirdParty} --module ${id}`).join(" && ");
|
|
344
|
+
}
|
|
345
|
+
return `yarn mercato module add ${spec}${thirdParty}${moduleFlag ? ` --module ${moduleFlag}` : ""}`;
|
|
346
|
+
}
|
|
347
|
+
function installCommand(entry, line, latest, find) {
|
|
348
|
+
if (line === null || line === latest) return entry.install.cli;
|
|
349
|
+
const both = entry.npm !== null && (entry.compat.inEmptyPreset ?? []).includes(line);
|
|
350
|
+
const version = (entry.compat.inPresets ?? []).includes(line) ? emptyPresetVersion(entry, line) : installVersion(entry, line);
|
|
351
|
+
const npm = entry.npm;
|
|
352
|
+
return installCli(entry, line, both && npm ? entry.moduleIds.map((id) => ({ id, from: npm })) : null, version, find);
|
|
353
|
+
}
|
|
354
|
+
function listAnd(items) {
|
|
355
|
+
return items.length <= 1 ? items[0] ?? "" : `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`;
|
|
356
|
+
}
|
|
357
|
+
const EMPTY_PRESET_LEAD = "In an app from the empty preset:";
|
|
358
|
+
function presetInstallText(moduleIds) {
|
|
359
|
+
return `Nothing to install: a new app already registers ${moduleIds.length ? listAnd(moduleIds) : "it"} in src/modules.ts.`;
|
|
360
|
+
}
|
|
361
|
+
function newAppInstallText(moduleIds, emptyCommand) {
|
|
362
|
+
return emptyCommand ? `${presetInstallText(moduleIds)} ${EMPTY_PRESET_LEAD} ${emptyCommand}` : presetInstallText(moduleIds);
|
|
363
|
+
}
|
|
364
|
+
function installFields(entry, line, latest, find) {
|
|
365
|
+
const command = installCommand(entry, line, latest, find);
|
|
366
|
+
if (line === null || !(entry.compat.inPresets ?? []).includes(line)) return { install: command };
|
|
367
|
+
const empty = (entry.compat.inEmptyPreset ?? []).includes(line) ? null : command;
|
|
368
|
+
return {
|
|
369
|
+
install: presetInstallText(entry.moduleIds),
|
|
370
|
+
presetNote: newAppInstallText(entry.moduleIds, empty),
|
|
371
|
+
installEmptyPreset: empty
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function builtInPresetText(coreModule, line) {
|
|
375
|
+
if (!line || !coreModule.inPresets?.includes(line)) return null;
|
|
376
|
+
const on = `On in a new app on ${line}: nothing to enable.`;
|
|
377
|
+
if (coreModule.inEmptyPreset?.includes(line)) return on;
|
|
378
|
+
return `${on} ${EMPTY_PRESET_LEAD} ${coreModule.install || builtInEnableCommand(coreModule.id)}`;
|
|
379
|
+
}
|
|
380
|
+
function builtInNotes(coreModule, line) {
|
|
381
|
+
const text = builtInPresetText(coreModule, line);
|
|
382
|
+
if (text) return [`Built into Open Mercato core as ${coreModule.id}.`, text];
|
|
383
|
+
return [`Built into Open Mercato core as ${coreModule.id}. Enable it: ${builtInEnableCommand(coreModule.id)}`];
|
|
384
|
+
}
|
|
385
|
+
function relevanceCompare(line) {
|
|
386
|
+
const level = (meta) => meta.omQuality ? 0 : meta.entry.tier === "verified" ? 1 : meta.entry.tier === "listed" ? 2 : 3;
|
|
387
|
+
const fresh = (meta) => {
|
|
388
|
+
const at = line ? judgedCell(meta.entry, line)?.at : null;
|
|
389
|
+
return at ? Date.parse(at) : 0;
|
|
390
|
+
};
|
|
391
|
+
return (left, right) => level(left) - level(right) || Number(right.entry.featured) - Number(left.entry.featured) || fresh(right) - fresh(left) || left.entry.title.localeCompare(right.entry.title);
|
|
392
|
+
}
|
|
393
|
+
function swapVariants(query) {
|
|
394
|
+
const words = query.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
395
|
+
if (words.length > 6) return [];
|
|
396
|
+
const variants = [];
|
|
397
|
+
words.forEach((word, wordIndex) => {
|
|
398
|
+
if (word.length < 3 || word.length > 24 || !/^[a-z0-9]+$/.test(word) || processTerm(word) === null) return;
|
|
399
|
+
for (let index = 0; index < word.length - 1; index++) {
|
|
400
|
+
if (word[index] === word[index + 1]) continue;
|
|
401
|
+
const swapped = `${word.slice(0, index)}${word[index + 1]}${word[index]}${word.slice(index + 2)}`;
|
|
402
|
+
variants.push([...words.slice(0, wordIndex), swapped, ...words.slice(wordIndex + 1)].join(" "));
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
return [...new Set(variants)].slice(0, 60);
|
|
406
|
+
}
|
|
407
|
+
function rankModules(searcher, rawInput) {
|
|
408
|
+
const input = {
|
|
409
|
+
...rawInput,
|
|
410
|
+
query: rawInput.query ?? "",
|
|
411
|
+
verifiedOnly: rawInput.verifiedOnly ?? SEARCH_DEFAULTS.verifiedOnly,
|
|
412
|
+
includeBuiltIn: rawInput.includeBuiltIn ?? SEARCH_DEFAULTS.includeBuiltIn,
|
|
413
|
+
includeExamples: rawInput.includeExamples ?? SEARCH_DEFAULTS.includeExamples
|
|
414
|
+
};
|
|
415
|
+
const lines = searcher.index.lines;
|
|
416
|
+
const latest = latestLine(lines)?.key ?? null;
|
|
417
|
+
const line = input.omVersion ? resolveLine(input.omVersion, lines).line : latest;
|
|
418
|
+
const boostDocument = (id) => {
|
|
419
|
+
const meta = searcher.modules.get(String(id));
|
|
420
|
+
if (!meta) return 1;
|
|
421
|
+
const verified = line !== null && statusOn(meta.entry, line) === "verified" ? 1 : 0;
|
|
422
|
+
return 1 + BOOST_VERIFIED * verified + BOOST_OFFICIAL * (meta.entry.type === "official" ? 1 : 0);
|
|
423
|
+
};
|
|
424
|
+
const wantKinds = input.kind;
|
|
425
|
+
const provider = input.provider?.toLowerCase();
|
|
426
|
+
const providerMatches = (item) => item.name === provider || item.label.toLowerCase() === provider;
|
|
427
|
+
const moduleOk = (meta) => {
|
|
428
|
+
const entry = meta.entry;
|
|
429
|
+
return entry.listed && (input.includeExamples || !meta.example) && (!input.category || entry.category === input.category) && (!input.type || input.type.includes(entry.type)) && (!wantKinds || wantKinds.includes(entry.kind)) && (!input.verifiedOnly || line !== null && statusOn(entry, line) === "verified") && (!input.verifiedModulesOnly || entry.kind !== "module" || line !== null && Boolean(entry.version.recommended[line])) && (!input.emits || meta.ids.emits.includes(input.emits)) && (!input.consumes || meta.ids.consumes.includes(input.consumes)) && (!provider || entry.providers.some(providerMatches));
|
|
430
|
+
};
|
|
431
|
+
const builtInOk = (meta) => input.includeBuiltIn && (!wantKinds || wantKinds.includes("built-in")) && (!input.type || input.type.includes("official")) && (!input.category || meta.module.category === input.category) && !input.provider && !input.verifiedOnly && (!input.emits || meta.ids.emits.includes(input.emits)) && (!input.consumes || meta.ids.consumes.includes(input.consumes));
|
|
432
|
+
const builtInCard = (meta, chips) => ({
|
|
433
|
+
id: meta.module.id,
|
|
434
|
+
title: meta.module.title,
|
|
435
|
+
description: meta.module.description,
|
|
436
|
+
category: meta.module.category,
|
|
437
|
+
enabled: null,
|
|
438
|
+
install: meta.module.install || builtInEnableCommand(meta.module.id),
|
|
439
|
+
page: absolute(searcher.site, meta.module.page),
|
|
440
|
+
matchedOn: chips,
|
|
441
|
+
presetNote: builtInPresetText(meta.module, line)
|
|
442
|
+
});
|
|
443
|
+
const filtered = Boolean(
|
|
444
|
+
input.category || input.emits || input.consumes || input.provider || input.type || wantKinds || input.verifiedOnly
|
|
445
|
+
);
|
|
446
|
+
const words = tokenize(input.query).some((term) => processTerm(term) !== null);
|
|
447
|
+
if (input.query.trim() === "" || filtered && !words) {
|
|
448
|
+
const filterChips = (category, providers) => [
|
|
449
|
+
...input.emits ? [`event ${input.emits}`] : [],
|
|
450
|
+
...input.consumes && input.consumes !== input.emits ? [`event ${input.consumes}`] : [],
|
|
451
|
+
...provider ? providers.filter(providerMatches).slice(0, 1).map((item) => `provider ${item.label}`) : [],
|
|
452
|
+
...input.category ? [`category ${category}`] : []
|
|
453
|
+
];
|
|
454
|
+
const modules2 = [...searcher.modules.values()].filter(moduleOk).sort(relevanceCompare(line));
|
|
455
|
+
const narrowed = Boolean(input.category || input.emits || input.consumes || wantKinds);
|
|
456
|
+
const builtIns = narrowed ? [...searcher.builtInModules.values()].filter(builtInOk).sort((left, right) => left.module.title.localeCompare(right.module.title)) : [];
|
|
457
|
+
return {
|
|
458
|
+
line,
|
|
459
|
+
latest,
|
|
460
|
+
modules: modules2.map((meta) => ({ meta, matchedOn: filterChips(meta.entry.category, meta.entry.providers) })),
|
|
461
|
+
builtIn: builtIns.slice(0, BUILTIN_MAX).map((meta) => builtInCard(meta, filterChips(meta.module.category, []))),
|
|
462
|
+
didYouMean: null
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
const run = (combineWith, query2 = input.query) => {
|
|
466
|
+
const hits = searcher.miniSearch.search(query2, {
|
|
467
|
+
combineWith,
|
|
468
|
+
prefix: true,
|
|
469
|
+
fuzzy: 0.2,
|
|
470
|
+
boost: { ...SEARCH_BOOST },
|
|
471
|
+
boostDocument
|
|
472
|
+
});
|
|
473
|
+
const modules2 = [];
|
|
474
|
+
const builtIns = [];
|
|
475
|
+
for (const result of hits) {
|
|
476
|
+
const id = String(result.id);
|
|
477
|
+
if (result["group"] === "builtin") {
|
|
478
|
+
const meta = searcher.builtInModules.get(id.replace(/^core:/, ""));
|
|
479
|
+
if (meta && builtInOk(meta)) builtIns.push({ meta, result });
|
|
480
|
+
} else {
|
|
481
|
+
const meta = searcher.modules.get(id);
|
|
482
|
+
if (meta && moduleOk(meta)) modules2.push({ meta, result });
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
return { modules: modules2, builtIns };
|
|
486
|
+
};
|
|
487
|
+
const none = (hits) => hits.modules.length === 0 && hits.builtIns.length === 0;
|
|
488
|
+
const topOf = (hits) => Math.max(hits.modules[0]?.result.score ?? 0, hits.builtIns[0]?.result.score ?? 0);
|
|
489
|
+
const typed = new Set(tokenize(input.query).filter((term) => processTerm(term) !== null));
|
|
490
|
+
const strong = (hits, top) => hits.filter((hit) => hit.result.score >= WEAK_HIT_RATIO * top || Object.keys(hit.result.match).some((term) => typed.has(term)));
|
|
491
|
+
let found = run("AND");
|
|
492
|
+
let didYouMean = null;
|
|
493
|
+
if (none(found)) {
|
|
494
|
+
const orHits = run("OR");
|
|
495
|
+
const top = topOf(orHits);
|
|
496
|
+
found = { modules: strong(orHits.modules, top), builtIns: strong(orHits.builtIns, top) };
|
|
497
|
+
if (none(found)) {
|
|
498
|
+
let best2 = null;
|
|
499
|
+
for (const variant of swapVariants(input.query)) {
|
|
500
|
+
const hits = run("AND", variant);
|
|
501
|
+
const top2 = topOf(hits);
|
|
502
|
+
if (!none(hits) && (!best2 || top2 > best2.top)) best2 = { variant, hits, top: top2 };
|
|
503
|
+
}
|
|
504
|
+
if (best2) {
|
|
505
|
+
found = best2.hits;
|
|
506
|
+
didYouMean = best2.variant;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
} else if (found.modules.length < MIN_AND_RESULTS && tokenize(input.query).filter((term) => processTerm(term)).length > 1) {
|
|
510
|
+
const orHits = run("OR");
|
|
511
|
+
const top = Math.max(topOf(found), topOf(orHits));
|
|
512
|
+
const seen = new Set(found.modules.map((hit) => hit.meta.entry.locator));
|
|
513
|
+
found = {
|
|
514
|
+
modules: [...found.modules, ...strong(orHits.modules, top).filter((hit) => !seen.has(hit.meta.entry.locator))],
|
|
515
|
+
builtIns: found.builtIns
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
const best = found.modules[0]?.result.score ?? 0;
|
|
519
|
+
const query = (didYouMean ?? input.query).trim().toLowerCase();
|
|
520
|
+
const builtIn = found.builtIns.filter(
|
|
521
|
+
({ meta, result }) => result.score >= BUILTIN_RATIO * best || meta.module.title.toLowerCase() === query || meta.module.id === query.replace(/[\s-]+/g, "_")
|
|
522
|
+
).slice(0, BUILTIN_MAX).map(({ meta, result }) => builtInCard(meta, matchedOn(result.match, { ids: meta.ids }, result.queryTerms)));
|
|
523
|
+
const modules = found.modules.map(({ meta, result }) => ({
|
|
524
|
+
meta,
|
|
525
|
+
matchedOn: matchedOn(
|
|
526
|
+
result.match,
|
|
527
|
+
{ providers: meta.entry.providers, tags: meta.entry.tags, ids: meta.ids, category: meta.entry.category },
|
|
528
|
+
result.queryTerms
|
|
529
|
+
)
|
|
530
|
+
}));
|
|
531
|
+
return { line, latest, modules, builtIn, didYouMean };
|
|
532
|
+
}
|
|
533
|
+
function toModuleCard(searcher, hit, line, latest) {
|
|
534
|
+
const entry = hit.meta.entry;
|
|
535
|
+
return {
|
|
536
|
+
locator: entry.locator,
|
|
537
|
+
path: entry.path,
|
|
538
|
+
title: entry.title,
|
|
539
|
+
summary: entry.summary,
|
|
540
|
+
whenToUse: entry.whenToUse,
|
|
541
|
+
type: entry.type,
|
|
542
|
+
kind: entry.kind,
|
|
543
|
+
category: entry.category,
|
|
544
|
+
license: { spdx: entry.license.spdx, kind: entry.license.kind },
|
|
545
|
+
tier: entry.tier,
|
|
546
|
+
omQuality: hit.meta.omQuality,
|
|
547
|
+
verifiedOn: entry.compat.verifiedOn,
|
|
548
|
+
line,
|
|
549
|
+
status: line ? statusOn(entry, line) : null,
|
|
550
|
+
agentPolicy: line ? entry.agentPolicy[line] ?? null : null,
|
|
551
|
+
installableFrom: entry.version.installableFrom,
|
|
552
|
+
...installFields(entry, line, latest, peerLookup(searcher)),
|
|
553
|
+
matchedOn: hit.matchedOn,
|
|
554
|
+
card: absolute(searcher.site, entry.links.page)
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
function peerLookup(searcher) {
|
|
558
|
+
return (locator) => searcher.modules.get(locator)?.entry;
|
|
559
|
+
}
|
|
560
|
+
function receiptSourceOf(searcher) {
|
|
561
|
+
const source = searcher.index.dataAsOf?.source;
|
|
562
|
+
return source === "ci" || source === "preview" ? source : null;
|
|
563
|
+
}
|
|
564
|
+
function searchModules(searcher, input) {
|
|
565
|
+
const limit = Math.min(SEARCH_MAX_LIMIT, Math.max(1, Math.floor(input.limit ?? SEARCH_DEFAULTS.limit)));
|
|
566
|
+
const ranked = rankModules(searcher, input);
|
|
567
|
+
return {
|
|
568
|
+
results: ranked.modules.slice(0, limit).map((hit) => toModuleCard(searcher, hit, ranked.line, ranked.latest)),
|
|
569
|
+
builtIn: ranked.builtIn,
|
|
570
|
+
total: ranked.modules.length,
|
|
571
|
+
line: ranked.line,
|
|
572
|
+
dataVersion: searcher.index.dataVersion,
|
|
573
|
+
generatedAt: searcher.index.generatedAt,
|
|
574
|
+
receiptSource: receiptSourceOf(searcher),
|
|
575
|
+
...ranked.didYouMean ? { didYouMean: ranked.didYouMean } : {}
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
function stripVersion(ref) {
|
|
579
|
+
const match = /^(.+?)@(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/.exec(ref.trim());
|
|
580
|
+
return match ? { name: match[1], version: match[2] } : { name: ref.trim(), version: null };
|
|
581
|
+
}
|
|
582
|
+
const normalizeRef = (value) => value.trim().toLowerCase();
|
|
583
|
+
const rankEntry = (entry) => (entry.type === "official" ? 0 : 2) + (entry.tier === "verified" ? 0 : 1);
|
|
584
|
+
function resolveRef(ref, entries, builtIn) {
|
|
585
|
+
const wanted = normalizeRef(stripVersion(ref).name);
|
|
586
|
+
const direct = entries.find(
|
|
587
|
+
(entry) => normalizeRef(entry.locator) === wanted || entry.npm !== null && normalizeRef(entry.npm) === wanted || normalizeRef(entry.path) === wanted || normalizeRef(`/m/${entry.path}`) === wanted || entry.renamedFrom.some((previous) => normalizeRef(previous) === wanted || normalizeRef(previous) === `npm:${wanted}`)
|
|
588
|
+
);
|
|
589
|
+
if (direct) return { kind: "entry", entry: direct, candidates: [] };
|
|
590
|
+
const githubPath = wanted.startsWith("github:") ? `github/${wanted.slice(7)}` : wanted.replace(/^https:\/\/github\.com\//, "github/");
|
|
591
|
+
const github = entries.find((entry) => normalizeRef(entry.path) === githubPath);
|
|
592
|
+
if (github) return { kind: "entry", entry: github, candidates: [] };
|
|
593
|
+
const id = wanted.replace(/^core:/, "");
|
|
594
|
+
const byId = entries.filter((entry) => entry.moduleIds.includes(id)).sort((left, right) => rankEntry(left) - rankEntry(right));
|
|
595
|
+
const core = builtIn.find((coreModule) => coreModule.id === id);
|
|
596
|
+
if (core) return { kind: "builtin", builtIn: core, candidates: byId.map((entry) => entry.locator).slice(0, 10) };
|
|
597
|
+
if (byId.length === 1) return { kind: "entry", entry: byId[0], candidates: [] };
|
|
598
|
+
if (byId.length > 1) return { kind: "none", candidates: byId.map((entry) => entry.locator).slice(0, 10) };
|
|
599
|
+
const loose = entries.filter(
|
|
600
|
+
(entry) => wanted.length >= 3 && (normalizeRef(entry.locator).includes(wanted) || entry.moduleIds.some((moduleId) => moduleId.includes(wanted.replace(/-/g, "_"))))
|
|
601
|
+
).sort((left, right) => rankEntry(left) - rankEntry(right));
|
|
602
|
+
return { kind: "none", candidates: loose.map((entry) => entry.locator).slice(0, 10) };
|
|
603
|
+
}
|
|
604
|
+
const clip = (text, max = 200) => text.length > max ? `${text.slice(0, max - 3)}...` : text;
|
|
605
|
+
function entryWarnings(entry, today, line, receiptSource = null) {
|
|
606
|
+
const warnings = [];
|
|
607
|
+
if (!entry.listed) warnings.push(`Not listed: ${(line ? entry.agentPolicy[line] : null)?.reasons[0]?.text ?? "see the card."}`);
|
|
608
|
+
if (entry.status !== "active") warnings.push(`Status: ${entry.status}.`);
|
|
609
|
+
if (entry.version.installableFrom && entry.version.installableFrom > today)
|
|
610
|
+
warnings.push(
|
|
611
|
+
`${entry.version.latest ?? "The newest release"} is installable from ${entry.version.installableFrom} (Yarn age gate).`
|
|
612
|
+
);
|
|
613
|
+
if (entry.license.mismatch) warnings.push("License sources disagree. See the card.");
|
|
614
|
+
const supplyChain = entry.signals?.supplyChain;
|
|
615
|
+
if (supplyChain && supplyChain.status !== "ok")
|
|
616
|
+
warnings.push(`Supply chain ${supplyChain.status}: ${supplyChain.reasons.join("; ") || "see the card"}.`);
|
|
617
|
+
const hygiene = entry.signals?.hygiene;
|
|
618
|
+
if (hygiene && hygiene.status !== "ok") warnings.push(`Hygiene ${hygiene.status}: ${hygiene.failing.join(", ") || "see the card"}.`);
|
|
619
|
+
if (entry.signals?.anatomy === "hidden") warnings.push("Anatomy is not published for this entry.");
|
|
620
|
+
return [...receiptSource === "preview" ? [PREVIEW_LINE] : [], ...warnings.map((warning) => clip(warning))].slice(0, 10);
|
|
621
|
+
}
|
|
622
|
+
function unknownModuleMessage(ref, candidates) {
|
|
623
|
+
return candidates.length > 0 ? `Unknown module "${ref.slice(0, 80)}". Did you mean: ${candidates.join(", ")}?` : `Unknown module "${ref.slice(0, 80)}".`;
|
|
624
|
+
}
|
|
625
|
+
function builtInWarnings(coreModule, line) {
|
|
626
|
+
return builtInNotes(coreModule, line).map((note) => clip(note));
|
|
627
|
+
}
|
|
628
|
+
function sharedModuleIdWarning(id, count) {
|
|
629
|
+
return clip(`Module ID ${id} is provided by ${count} entries. Pick one of the candidates.`);
|
|
630
|
+
}
|
|
631
|
+
function cardUrl(searcher, page) {
|
|
632
|
+
return absolute(searcher.site, page);
|
|
633
|
+
}
|
|
634
|
+
export {
|
|
635
|
+
ALIASES_META_KEY,
|
|
636
|
+
BOOST_OFFICIAL,
|
|
637
|
+
BOOST_VERIFIED,
|
|
638
|
+
BUILTIN_MAX,
|
|
639
|
+
BUILTIN_RATIO,
|
|
640
|
+
CORE_PACKAGE,
|
|
641
|
+
ENTERPRISE_ENABLE_STEP,
|
|
642
|
+
ENTERPRISE_PACKAGE,
|
|
643
|
+
INSTALLABLE_META_KEY,
|
|
644
|
+
MIN_AND_RESULTS,
|
|
645
|
+
PREVIEW_LINE,
|
|
646
|
+
SEARCH_BOOST,
|
|
647
|
+
SEARCH_DEFAULTS,
|
|
648
|
+
SEARCH_MAX_LIMIT,
|
|
649
|
+
WEAK_HIT_RATIO,
|
|
650
|
+
builtInEnableCommand,
|
|
651
|
+
builtInNotes,
|
|
652
|
+
builtInPresetText,
|
|
653
|
+
builtInWarnings,
|
|
654
|
+
cardUrl,
|
|
655
|
+
createCatalogSearcher,
|
|
656
|
+
emptyPresetVersion,
|
|
657
|
+
entryWarnings,
|
|
658
|
+
installCommand,
|
|
659
|
+
installFields,
|
|
660
|
+
installVersion,
|
|
661
|
+
isAdapter,
|
|
662
|
+
latestLine,
|
|
663
|
+
lineVersion,
|
|
664
|
+
newAppInstallText,
|
|
665
|
+
peerLibrarySpecs,
|
|
666
|
+
peerLookup,
|
|
667
|
+
processTerm,
|
|
668
|
+
rankModules,
|
|
669
|
+
receiptSourceOf,
|
|
670
|
+
resolveLine,
|
|
671
|
+
resolveRef,
|
|
672
|
+
searchModules,
|
|
673
|
+
sharedModuleIdWarning,
|
|
674
|
+
statusOn,
|
|
675
|
+
stripVersion,
|
|
676
|
+
swapVariants,
|
|
677
|
+
toModuleCard,
|
|
678
|
+
tokenize,
|
|
679
|
+
unknownModuleMessage
|
|
680
|
+
};
|
|
681
|
+
//# sourceMappingURL=module-search-index.js.map
|