@open-mercato/cli 0.6.7-develop.6863.1.61001cf9a8 → 0.6.7
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 +4 -4
- package/build.mjs +7 -24
- package/dist/agentic/claude-code/hooks/entity-migration-check.ts +88 -32
- package/dist/agentic/codex/enforcement-rules.md +16 -2
- package/dist/agentic/cursor/hooks/entity-migration-check.mjs +50 -19
- package/dist/agentic/cursor/rules/entity-guard.mdc +21 -9
- package/dist/agentic/cursor/rules/generated-guard.mdc +5 -3
- package/dist/agentic/cursor/rules/open-mercato.mdc +29 -3
- package/dist/agentic/guides/cache.md +45 -0
- package/dist/agentic/guides/core.md +453 -0
- package/dist/agentic/guides/events.md +117 -0
- package/dist/agentic/guides/module-facts.json +3833 -115419
- package/dist/agentic/guides/module-system.md +127 -12
- package/dist/agentic/guides/modules/ai_assistant.md +28 -227
- package/dist/agentic/guides/modules/api_docs.md +2 -58
- package/dist/agentic/guides/modules/api_keys.md +7 -92
- package/dist/agentic/guides/modules/attachments.md +14 -119
- package/dist/agentic/guides/modules/audit_logs.md +10 -131
- package/dist/agentic/guides/modules/auth.md +33 -276
- package/dist/agentic/guides/modules/business_rules.md +14 -149
- package/dist/agentic/guides/modules/catalog.md +43 -475
- package/dist/agentic/guides/modules/channel_gmail.md +3 -82
- package/dist/agentic/guides/modules/channel_imap.md +3 -82
- package/dist/agentic/guides/modules/checkout.md +27 -299
- package/dist/agentic/guides/modules/communication_channels.md +33 -315
- package/dist/agentic/guides/modules/configs.md +8 -104
- package/dist/agentic/guides/modules/content.md +2 -57
- package/dist/agentic/guides/modules/currencies.md +17 -152
- package/dist/agentic/guides/modules/customer_accounts.md +45 -387
- package/dist/agentic/guides/modules/customers.md +85 -746
- package/dist/agentic/guides/modules/dashboards.md +10 -155
- package/dist/agentic/guides/modules/data_sync.md +16 -149
- package/dist/agentic/guides/modules/dictionaries.md +12 -107
- package/dist/agentic/guides/modules/directory.md +15 -148
- package/dist/agentic/guides/modules/entities.md +13 -145
- package/dist/agentic/guides/modules/events.md +2 -59
- package/dist/agentic/guides/modules/feature_toggles.md +9 -119
- package/dist/agentic/guides/modules/gateway_stripe.md +4 -92
- package/dist/agentic/guides/modules/generators.md +2 -45
- package/dist/agentic/guides/modules/inbox_ops.md +27 -207
- package/dist/agentic/guides/modules/integrations.md +16 -146
- package/dist/agentic/guides/modules/messages.md +24 -223
- package/dist/agentic/guides/modules/notifications.md +8 -96
- package/dist/agentic/guides/modules/onboarding.md +6 -77
- package/dist/agentic/guides/modules/payment_gateways.md +21 -164
- package/dist/agentic/guides/modules/perspectives.md +7 -77
- package/dist/agentic/guides/modules/planner.md +18 -136
- package/dist/agentic/guides/modules/portal.md +2 -93
- package/dist/agentic/guides/modules/progress.md +14 -104
- package/dist/agentic/guides/modules/query_index.md +15 -154
- package/dist/agentic/guides/modules/record_locks.md +21 -206
- package/dist/agentic/guides/modules/resources.md +30 -197
- package/dist/agentic/guides/modules/sales.md +84 -678
- package/dist/agentic/guides/modules/scheduler.md +14 -133
- package/dist/agentic/guides/modules/search.md +6 -170
- package/dist/agentic/guides/modules/security.md +35 -294
- package/dist/agentic/guides/modules/shipping_carriers.md +18 -134
- package/dist/agentic/guides/modules/sso.md +26 -151
- package/dist/agentic/guides/modules/staff.md +57 -369
- package/dist/agentic/guides/modules/storage_s3.md +5 -95
- package/dist/agentic/guides/modules/sync_akeneo.md +3 -85
- package/dist/agentic/guides/modules/sync_excel.md +6 -75
- package/dist/agentic/guides/modules/system_status_overlays.md +2 -60
- package/dist/agentic/guides/modules/translations.md +10 -104
- package/dist/agentic/guides/modules/webhooks.md +24 -203
- package/dist/agentic/guides/modules/wms.md +46 -441
- package/dist/agentic/guides/modules/workflows.md +43 -302
- package/dist/agentic/guides/queue.md +53 -0
- package/dist/agentic/guides/search.md +115 -0
- package/dist/agentic/guides/shared.md +108 -0
- package/dist/agentic/guides/ui.md +347 -0
- package/dist/agentic/shared/AGENTS.md.template +311 -124
- package/dist/agentic/shared/ai/agentic.config.json +0 -2
- package/dist/agentic/shared/ai/lessons.md +3 -26
- package/dist/agentic/shared/ai/skills/om-auto-continue-pr-loop/SKILL.md +27 -0
- package/dist/agentic/shared/ai/skills/om-auto-create-pr-loop/SKILL.md +27 -0
- package/dist/agentic/shared/ai/skills/om-auto-review-pr/SKILL.md +0 -4
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/SKILL.md +241 -20
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/ui-components.md +260 -0
- package/dist/agentic/shared/ai/skills/om-data-model-design/SKILL.md +601 -16
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/mikro-orm-cheatsheet.md +146 -0
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/SKILL.md +310 -14
- package/dist/agentic/shared/ai/skills/om-help/SKILL.md +97 -15
- package/dist/agentic/shared/ai/skills/om-help/references/skills-catalog.md +84 -0
- package/dist/agentic/shared/ai/skills/om-help/references/workflow-sequences.md +193 -0
- package/dist/agentic/shared/ai/skills/om-implement-spec/SKILL.md +152 -33
- package/dist/agentic/shared/ai/skills/om-integration-builder/SKILL.md +708 -24
- package/dist/agentic/shared/ai/skills/om-integration-builder/STANDALONE.md +34 -0
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/adapter-contracts.md +762 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +820 -20
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/naming-conventions.md +50 -0
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/navigation-patterns.md +97 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +843 -19
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-contracts.md +271 -0
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/SKILL.md +63 -15
- package/dist/agentic/shared/ai/skills/om-troubleshooter/SKILL.md +467 -16
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnostic-commands.md +101 -0
- package/dist/agentic/shared/ai/skills/tiers.json +21 -143
- package/dist/agentic/shared/ai/skills/tiers.schema.json +40 -52
- package/dist/agentic/shared/ai/specs/README.md +3 -4
- package/dist/agentic/shared/ai/specs/SPEC-000-template.md +10 -226
- package/dist/agentic/shared/ai/trackers/github.md +4 -108
- package/dist/agentic/shared/scripts/install-skills.sh +694 -4
- package/dist/bin.js +1 -13
- package/dist/bin.js.map +2 -2
- package/dist/lib/__integration__/TC-INT-008.spec.js +8 -88
- package/dist/lib/__integration__/TC-INT-008.spec.js.map +2 -2
- package/dist/lib/agentic-init.js +3 -13
- package/dist/lib/agentic-init.js.map +2 -2
- package/dist/lib/agentic-setup.js +186 -418
- package/dist/lib/agentic-setup.js.map +2 -2
- package/dist/lib/generators/extensions/injection-widgets.js +0 -20
- package/dist/lib/generators/extensions/injection-widgets.js.map +2 -2
- package/dist/lib/generators/module-facts-discovery.js +7 -41
- package/dist/lib/generators/module-facts-discovery.js.map +2 -2
- package/dist/lib/generators/module-facts.js +45 -1387
- package/dist/lib/generators/module-facts.js.map +3 -3
- package/dist/lib/generators/module-registry.js +5 -11
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/resolver.js +0 -2
- package/dist/lib/resolver.js.map +2 -2
- package/dist/lib/testing/integration.js +0 -5
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +1 -23
- package/dist/mercato.js.map +2 -2
- package/package.json +11 -13
- package/src/bin.ts +1 -33
- package/src/lib/__integration__/TC-INT-008.spec.ts +9 -107
- package/src/lib/__tests__/agentic-init.test.ts +5 -41
- package/src/lib/agentic-init.ts +3 -15
- package/src/lib/agentic-setup.ts +224 -530
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +2 -88
- package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +0 -1
- package/src/lib/generators/__tests__/module-facts.discovery.test.ts +10 -54
- package/src/lib/generators/__tests__/module-subset.test.ts +0 -18
- package/src/lib/generators/extensions/injection-widgets.ts +0 -51
- package/src/lib/generators/module-facts-discovery.ts +7 -58
- package/src/lib/generators/module-facts.ts +46 -1851
- package/src/lib/generators/module-registry.ts +6 -16
- package/src/lib/resolver.ts +0 -3
- package/src/lib/testing/__tests__/integration.test.ts +0 -4
- package/src/lib/testing/integration.ts +0 -5
- package/src/mercato.ts +1 -26
- package/dist/agentic/guides/ai-workflows.md +0 -76
- package/dist/agentic/guides/architecture.md +0 -107
- package/dist/agentic/guides/backend-ui.md +0 -80
- package/dist/agentic/guides/contracts.md +0 -92
- package/dist/agentic/guides/extensions.md +0 -121
- package/dist/agentic/guides/framework-extension-points.md +0 -36
- package/dist/agentic/guides/integrations.md +0 -81
- package/dist/agentic/guides/modules/design_system.md +0 -102
- package/dist/agentic/guides/spec-delivery.md +0 -22
- package/dist/agentic/guides/testing-debugging.md +0 -80
- package/dist/agentic/guides/upstream/AGENTS.md +0 -298
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +0 -316
- package/dist/agentic/guides/upstream/manifest.json +0 -8
- package/dist/agentic/shared/ai/harness/README.md +0 -50
- package/dist/agentic/shared/ai/harness/RELEASE.md +0 -57
- package/dist/agentic/shared/ai/harness/cases.json +0 -13680
- package/dist/agentic/shared/ai/harness/cases.schema.json +0 -133
- package/dist/agentic/shared/ai/harness/fixtures/index.json +0 -49
- package/dist/agentic/shared/ai/harness/fixtures/seeds.json +0 -162
- package/dist/agentic/shared/ai/harness/generated-code-review-policy.md +0 -21
- package/dist/agentic/shared/ai/harness/generated-code-review-response.schema.json +0 -96
- package/dist/agentic/shared/ai/harness/generated-code-review-result.schema.json +0 -172
- package/dist/agentic/shared/ai/harness/release-matrix.json +0 -158
- package/dist/agentic/shared/ai/harness/release-result.schema.json +0 -219
- package/dist/agentic/shared/ai/harness/result.schema.json +0 -76
- package/dist/agentic/shared/ai/harness/routing-response.schema.json +0 -12
- package/dist/agentic/shared/ai/harness/target-validation-result.schema.json +0 -73
- package/dist/agentic/shared/ai/harness/validators.json +0 -78
- package/dist/agentic/shared/ai/harness/writable-ast-oracles.mjs +0 -2121
- package/dist/agentic/shared/ai/harness/writable-behavior-oracles.mjs +0 -1096
- package/dist/agentic/shared/ai/lessons/_template.md +0 -16
- package/dist/agentic/shared/ai/review-checklist.md +0 -36
- package/dist/agentic/shared/ai/skills/om-auto-implement-spec/SKILL.md +0 -21
- package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.6.6-to-0.6.7/SKILL.md +0 -98
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/crud-surfaces.md +0 -16
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/frontend-and-design-system.md +0 -53
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/page-and-navigation.md +0 -13
- package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/quality-states.md +0 -11
- package/dist/agentic/shared/ai/skills/om-build-workflow/SKILL.md +0 -30
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/activity-contracts.md +0 -12
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/durability-and-progress.md +0 -13
- package/dist/agentic/shared/ai/skills/om-build-workflow/references/workflow-design.md +0 -14
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/SKILL.md +0 -28
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/attachments-and-overrides.md +0 -12
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/module-agents-and-tools.md +0 -22
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/orchestrator-agents.md +0 -12
- package/dist/agentic/shared/ai/skills/om-create-ai-agent/references/surface-selector.md +0 -19
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +0 -19
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/migration-workflow.md +0 -13
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/schema-design.md +0 -14
- package/dist/agentic/shared/ai/skills/om-data-model-design/references/sensitive-data.md +0 -10
- package/dist/agentic/shared/ai/skills/om-eject-and-customize/references/decision-and-procedure.md +0 -17
- package/dist/agentic/shared/ai/skills/om-evolve-harness/SKILL.md +0 -29
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-template.md +0 -100
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-workflow.md +0 -16
- package/dist/agentic/shared/ai/skills/om-evolve-harness/references/owner-selection.md +0 -17
- package/dist/agentic/shared/ai/skills/om-framework-context/SKILL.md +0 -25
- package/dist/agentic/shared/ai/skills/om-framework-context/references/resolver-procedure.md +0 -11
- package/dist/agentic/shared/ai/skills/om-framework-context/references/skew-and-escalation.md +0 -13
- package/dist/agentic/shared/ai/skills/om-help/references/delivery-workflows.md +0 -18
- package/dist/agentic/shared/ai/skills/om-help/references/task-families.md +0 -20
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/phases-and-gates.md +0 -33
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/planning-and-progress.md +0 -40
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/report-templates.md +0 -27
- package/dist/agentic/shared/ai/skills/om-implement-spec/references/spec-resolution.md +0 -24
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/package-and-activation.md +0 -16
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +0 -14
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/security-and-reliability.md +0 -15
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/sync-and-files.md +0 -12
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/SKILL.md +0 -34
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/agents/openai.yaml +0 -4
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/agentic-setup.md +0 -11
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/input-normalization.md +0 -31
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/judge-workflow.md +0 -39
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/report-template.md +0 -43
- package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/rules.md +0 -11
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +0 -19
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/business-one-shot-blueprints.md +0 -172
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/data-and-migrations.md +0 -12
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/discovery-surface-catalog.md +0 -83
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/module-surfaces.md +0 -21
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/planning.md +0 -11
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/runtime-cache-and-queues.md +0 -22
- package/dist/agentic/shared/ai/skills/om-module-scaffold/references/verification.md +0 -13
- package/dist/agentic/shared/ai/skills/om-share-this-session/SKILL.md +0 -41
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/agentic-setup.md +0 -19
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/bundle-preparation.md +0 -44
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/consent-and-review.md +0 -39
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/publication.md +0 -20
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/report-templates.md +0 -57
- package/dist/agentic/shared/ai/skills/om-share-this-session/references/rules.md +0 -11
- package/dist/agentic/shared/ai/skills/om-share-this-session/scripts/prepare-share-bundle.mjs +0 -486
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +0 -18
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +0 -27
- package/dist/agentic/shared/ai/skills/om-system-extension/references/read-write-roundtrip.md +0 -13
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +0 -41
- package/dist/agentic/shared/ai/skills/om-system-extension/references/verification.md +0 -11
- package/dist/agentic/shared/ai/skills/om-trim-unused-modules/references/dependency-and-redirect.md +0 -15
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnosis-map.md +0 -16
- package/dist/agentic/shared/ai/skills/om-troubleshooter/references/regression-oracles.md +0 -14
- package/dist/agentic/shared/scripts/agent-harness-tool-server.mjs +0 -187
- package/dist/agentic/shared/scripts/check-lessons.mjs +0 -178
- package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +0 -2958
- package/dist/agentic/shared/scripts/execution-sandbox.mjs +0 -329
- package/dist/agentic/shared/scripts/framework-context.mjs +0 -888
- package/dist/agentic/shared/scripts/install-skills.mjs +0 -1029
- package/dist/agentic/shared/scripts/prepare-agent-harness-fixture.mjs +0 -222
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +0 -1774
- package/dist/lib/generators/module-extension-facts.js +0 -1840
- package/dist/lib/generators/module-extension-facts.js.map +0 -7
- package/dist/lib/generators/module-fact-sources.js +0 -70
- package/dist/lib/generators/module-fact-sources.js.map +0 -7
- package/dist/lib/generators/module-override-targets.js +0 -688
- package/dist/lib/generators/module-override-targets.js.map +0 -7
- package/dist/lib/load-env.js +0 -24
- package/dist/lib/load-env.js.map +0 -7
- package/dist/lib/telemetry-init.js +0 -358
- package/dist/lib/telemetry-init.js.map +0 -7
- package/src/lib/__tests__/agentic-setup.ownership.test.ts +0 -386
- package/src/lib/__tests__/injection-widget-id-validation.test.ts +0 -184
- package/src/lib/__tests__/load-env.test.ts +0 -65
- package/src/lib/__tests__/telemetry-init.test.ts +0 -298
- package/src/lib/generators/__tests__/activation-adapter-coverage.test.ts +0 -92
- package/src/lib/generators/__tests__/module-extension-activations.test.ts +0 -762
- package/src/lib/generators/__tests__/module-extension-facts.test.ts +0 -404
- package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +0 -108
- package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +0 -561
- package/src/lib/generators/__tests__/module-facts.source-links.test.ts +0 -119
- package/src/lib/generators/__tests__/module-override-targets.roundtrip.test.ts +0 -149
- package/src/lib/generators/__tests__/module-override-targets.test.ts +0 -304
- package/src/lib/generators/module-extension-facts.ts +0 -2365
- package/src/lib/generators/module-fact-sources.ts +0 -108
- package/src/lib/generators/module-override-targets.ts +0 -863
- package/src/lib/load-env.ts +0 -30
- package/src/lib/telemetry-init.ts +0 -461
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs'
|
|
2
|
-
import os from 'node:os'
|
|
3
|
-
import path from 'node:path'
|
|
4
|
-
import {
|
|
5
|
-
assertNoUnresolvedExtensionTargets,
|
|
6
|
-
correlateModuleExtensionFacts,
|
|
7
|
-
extractModuleExtensionFacts,
|
|
8
|
-
getFrameworkExtensionHosts,
|
|
9
|
-
renderFrameworkExtensionPointsMarkdown,
|
|
10
|
-
} from '../module-extension-facts'
|
|
11
|
-
import type { ModuleFactsJsonEntry } from '../module-facts'
|
|
12
|
-
|
|
13
|
-
function write(root: string, relativePath: string, source: string): void {
|
|
14
|
-
const filePath = path.join(root, relativePath)
|
|
15
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true })
|
|
16
|
-
fs.writeFileSync(filePath, source)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
describe('module extension facts', () => {
|
|
20
|
-
let moduleRoot: string
|
|
21
|
-
|
|
22
|
-
beforeEach(() => {
|
|
23
|
-
moduleRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'module-extension-facts-'))
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
afterEach(() => {
|
|
27
|
-
fs.rmSync(moduleRoot, { recursive: true, force: true })
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('expands declared host families and preserves fact references and browser transports', () => {
|
|
31
|
-
write(moduleRoot, 'extension-points.ts', `
|
|
32
|
-
import { defineModuleExtensionPoints, dataTableExtensionHost, crudFormExtensionHost, injectionExtensionHost } from 'x'
|
|
33
|
-
export const extensionPoints = defineModuleExtensionPoints({
|
|
34
|
-
moduleId: 'alpha',
|
|
35
|
-
hosts: {
|
|
36
|
-
records: dataTableExtensionHost({ tableId: 'alpha.records.list', baseSpotId: 'data-table:alpha.records', source: 'Records.tsx' }),
|
|
37
|
-
editor: crudFormExtensionHost({ entityId: 'alpha.record', source: 'Edit.tsx' }),
|
|
38
|
-
detail: injectionExtensionHost({
|
|
39
|
-
family: 'detail', pattern: 'detail:alpha.record:{recordId}',
|
|
40
|
-
parameters: { recordId: { source: 'record.id', pattern: '^[a-z]+$' } },
|
|
41
|
-
supported: ['render-widget'], source: 'Detail.tsx', fallbacks: ['detail:alpha.record'],
|
|
42
|
-
}),
|
|
43
|
-
},
|
|
44
|
-
})
|
|
45
|
-
`)
|
|
46
|
-
write(moduleRoot, 'Records.tsx', 'export const tableId = extensionPoints.hosts.records.tableId')
|
|
47
|
-
write(moduleRoot, 'Edit.tsx', 'export const entityId = extensionPoints.hosts.editor.entityId')
|
|
48
|
-
write(moduleRoot, 'Detail.tsx', 'export const spotId = extensionPoints.hosts.detail.pattern')
|
|
49
|
-
|
|
50
|
-
const facts = extractModuleExtensionFacts({
|
|
51
|
-
moduleId: 'alpha',
|
|
52
|
-
moduleRoot,
|
|
53
|
-
sourceRoot: 'node_modules/pkg/src/modules/alpha',
|
|
54
|
-
entities: [{ id: 'alpha:record' }],
|
|
55
|
-
events: [{ id: 'alpha.record.updated', clientBroadcast: true, portalBroadcast: true }],
|
|
56
|
-
apiRoutes: [{ path: '/alpha/records', methods: ['GET', 'POST'] }],
|
|
57
|
-
searchEntities: ['alpha:record'],
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
expect(facts.hosts).toEqual(expect.arrayContaining([
|
|
61
|
-
expect.objectContaining({ id: 'data-table:alpha.records:header', bound: true }),
|
|
62
|
-
expect.objectContaining({ id: 'data-table:alpha.records.list:columns', capabilities: ['column-widget'] }),
|
|
63
|
-
expect.objectContaining({ id: 'data-table:alpha.records:empty-state', bound: false }),
|
|
64
|
-
expect.objectContaining({ id: 'crud-form:alpha.record:fields', capabilities: ['field-widget'] }),
|
|
65
|
-
expect.objectContaining({ id: 'detail:alpha.record:{recordId}', resolution: 'pattern' }),
|
|
66
|
-
expect.objectContaining({ id: 'alpha:record', resolution: 'fact-ref' }),
|
|
67
|
-
expect.objectContaining({
|
|
68
|
-
id: 'alpha.record.updated',
|
|
69
|
-
capabilities: ['async-subscriber', 'sync-subscriber', 'browser-client', 'browser-portal'],
|
|
70
|
-
}),
|
|
71
|
-
expect.objectContaining({ id: 'alpha.record.querying', activation: 'caller-opt-in' }),
|
|
72
|
-
expect.objectContaining({ id: 'alpha.record.queried', phases: ['result-transform', 'scope-reapply'] }),
|
|
73
|
-
]))
|
|
74
|
-
expect(facts.unresolved).toEqual([])
|
|
75
|
-
const hostOrder = facts.hosts.map((host) => `${host.family}\u0000${host.id}`)
|
|
76
|
-
expect(hostOrder).toEqual([...hostOrder].sort((left, right) => left.localeCompare(right)))
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
it('extracts outgoing mechanisms with kind-specific contracts and correlates targets', () => {
|
|
80
|
-
write(moduleRoot, 'extension-points.ts', `
|
|
81
|
-
import { defineModuleExtensionPoints, dataTableExtensionHost } from 'x'
|
|
82
|
-
export const extensionPoints = defineModuleExtensionPoints({
|
|
83
|
-
moduleId: 'alpha', hosts: { records: dataTableExtensionHost({ tableId: 'alpha.records', source: 'Records.tsx' }) },
|
|
84
|
-
})
|
|
85
|
-
`)
|
|
86
|
-
write(moduleRoot, 'Records.tsx', 'export const tableId = extensionPoints.hosts.records.tableId')
|
|
87
|
-
write(moduleRoot, 'widgets/injection-table.ts', `
|
|
88
|
-
export const injectionTable = {
|
|
89
|
-
'data-table:alpha.records:columns': [{ widgetId: 'alpha.columns', priority: 20, features: ['alpha.view'] }],
|
|
90
|
-
'menu:backend.sidebar': [{ widgetId: 'alpha.menu' }],
|
|
91
|
-
}
|
|
92
|
-
`)
|
|
93
|
-
write(moduleRoot, 'data/enrichers.ts', `
|
|
94
|
-
const enricher = {
|
|
95
|
-
id: 'alpha.records.enricher', targetEntity: 'alpha:record', features: ['alpha.view'], timeout: 750,
|
|
96
|
-
fallback: {}, queryEngine: { enabled: true, engines: ['json'], applyOn: ['list'] },
|
|
97
|
-
async enrichOne() {}, async enrichMany() {},
|
|
98
|
-
}
|
|
99
|
-
export const enrichers = [enricher]
|
|
100
|
-
`)
|
|
101
|
-
write(moduleRoot, 'api/interceptors.ts', `
|
|
102
|
-
export const interceptors = [{
|
|
103
|
-
id: 'alpha.records.interceptor', targetRoute: 'alpha/records', methods: ['POST'],
|
|
104
|
-
async before() {}, async after() {},
|
|
105
|
-
}]
|
|
106
|
-
`)
|
|
107
|
-
write(moduleRoot, 'commands/interceptors.ts', `
|
|
108
|
-
export const interceptors = [{
|
|
109
|
-
id: 'alpha.records.command', targetCommand: 'alpha.records.update',
|
|
110
|
-
async beforeExecute() {}, async afterUndo() {},
|
|
111
|
-
}]
|
|
112
|
-
`)
|
|
113
|
-
write(moduleRoot, 'commands/update.ts', `
|
|
114
|
-
const updateCommand = { id: 'alpha.records.update', async execute() {} }
|
|
115
|
-
registerCommand(updateCommand)
|
|
116
|
-
`)
|
|
117
|
-
write(moduleRoot, 'data/guards.ts', `
|
|
118
|
-
const guard = { id: 'alpha.records.guard', targetEntity: 'alpha:record', operations: ['update', 'delete'], async validate() {}, async afterSuccess() {} }
|
|
119
|
-
export const guards = [guard]
|
|
120
|
-
`)
|
|
121
|
-
write(moduleRoot, 'data/extensions.ts', `
|
|
122
|
-
export const extensions = [{ base: 'alpha:record', extension: 'beta:record_meta', join: { baseKey: 'id', extensionKey: 'record_id' } }]
|
|
123
|
-
`)
|
|
124
|
-
write(moduleRoot, 'subscribers/updated.ts', `
|
|
125
|
-
export const metadata = { event: 'alpha.record.updated', id: 'alpha:record-updated', persistent: true, priority: 10 }
|
|
126
|
-
`)
|
|
127
|
-
|
|
128
|
-
const surface = extractModuleExtensionFacts({
|
|
129
|
-
moduleId: 'alpha',
|
|
130
|
-
moduleRoot,
|
|
131
|
-
sourceRoot: 'node_modules/pkg/src/modules/alpha',
|
|
132
|
-
entities: [{ id: 'alpha:record' }],
|
|
133
|
-
events: [{ id: 'alpha.record.updated', clientBroadcast: true }],
|
|
134
|
-
apiRoutes: [{ path: '/alpha/records', methods: ['POST'] }],
|
|
135
|
-
searchEntities: [],
|
|
136
|
-
})
|
|
137
|
-
const correlated = correlateModuleExtensionFacts({
|
|
138
|
-
surfacesByModule: { alpha: surface },
|
|
139
|
-
entityIds: new Set(['alpha:record']),
|
|
140
|
-
eventIds: new Set(['alpha.record.updated']),
|
|
141
|
-
apiRoutes: new Set(['/alpha/records']),
|
|
142
|
-
commandIds: new Set(['alpha.records.update']),
|
|
143
|
-
}).alpha
|
|
144
|
-
|
|
145
|
-
expect(correlated.contributions).toEqual(expect.arrayContaining([
|
|
146
|
-
expect.objectContaining({
|
|
147
|
-
id: 'alpha.records.enricher',
|
|
148
|
-
kind: 'response-enricher',
|
|
149
|
-
details: expect.objectContaining({
|
|
150
|
-
targetEntity: 'alpha:record', surfaces: ['list', 'detail'], timeoutMs: 750,
|
|
151
|
-
queryEngine: { engines: ['json'], applyOn: ['list'], activation: 'caller-opt-in' },
|
|
152
|
-
}),
|
|
153
|
-
}),
|
|
154
|
-
expect.objectContaining({
|
|
155
|
-
id: 'alpha.records.interceptor', kind: 'api-interceptor',
|
|
156
|
-
targets: [expect.objectContaining({
|
|
157
|
-
resolution: 'fact-ref',
|
|
158
|
-
factRef: { factSection: 'apiRoutes', factKey: '/alpha/records' },
|
|
159
|
-
})],
|
|
160
|
-
details: expect.objectContaining({ phases: ['before', 'after'] }),
|
|
161
|
-
}),
|
|
162
|
-
expect.objectContaining({
|
|
163
|
-
id: 'alpha.records.command',
|
|
164
|
-
targets: [expect.objectContaining({
|
|
165
|
-
factRef: { factSection: 'ownedContracts.command', factKey: 'alpha.records.update' },
|
|
166
|
-
})],
|
|
167
|
-
details: expect.objectContaining({ phases: ['before-execute', 'after-undo'] }),
|
|
168
|
-
}),
|
|
169
|
-
expect.objectContaining({ id: 'alpha.records.guard', details: expect.objectContaining({ optimisticLock: 'preserved' }) }),
|
|
170
|
-
expect.objectContaining({ kind: 'entity-extension', details: expect.objectContaining({ linkId: 'id:record_id' }) }),
|
|
171
|
-
expect.objectContaining({ id: 'alpha:record-updated', details: expect.objectContaining({ persistent: true, sync: false, priority: 10 }) }),
|
|
172
|
-
expect.objectContaining({ id: 'alpha.columns@data-table:alpha.records:columns', targets: [expect.objectContaining({ resolution: 'exact' })] }),
|
|
173
|
-
expect.objectContaining({ id: 'alpha.menu@menu:backend.sidebar', targets: [expect.objectContaining({ resolution: 'framework' })] }),
|
|
174
|
-
expect.objectContaining({ id: 'alpha.record.updated.browser', kind: 'browser-reaction' }),
|
|
175
|
-
]))
|
|
176
|
-
expect(correlated.unresolved).toEqual([])
|
|
177
|
-
const contributionOrder = correlated.contributions.map((contribution) => `${contribution.kind}\u0000${contribution.id}`)
|
|
178
|
-
expect(contributionOrder).toEqual([...contributionOrder].sort((left, right) => left.localeCompare(right)))
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
it('renders a deterministic separate framework catalog', () => {
|
|
182
|
-
type ExtensionSurfacesAreOptional = {} extends Pick<ModuleFactsJsonEntry, 'extensionSurfaces'> ? true : false
|
|
183
|
-
const extensionSurfacesAreOptional: ExtensionSurfacesAreOptional = true
|
|
184
|
-
const first = renderFrameworkExtensionPointsMarkdown()
|
|
185
|
-
const second = renderFrameworkExtensionPointsMarkdown()
|
|
186
|
-
expect(second).toBe(first)
|
|
187
|
-
expect(first).toContain('# Framework extension points (generated, do not edit)')
|
|
188
|
-
expect(first).toContain('integrations.detail:{integrationId}')
|
|
189
|
-
expect(first).toContain('menu:backend.sidebar')
|
|
190
|
-
expect(extensionSurfacesAreOptional).toBe(true)
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
it('projects every wired unified override key with its supported mode', () => {
|
|
194
|
-
const overrides = getFrameworkExtensionHosts()
|
|
195
|
-
.filter((host) => host.family === 'module-override')
|
|
196
|
-
.map((host) => [host.id, host.operations?.[0]])
|
|
197
|
-
|
|
198
|
-
expect(overrides).toEqual([
|
|
199
|
-
['module-override:acl.features', 'disable-replace'],
|
|
200
|
-
['module-override:ai.agents', 'disable-replace'],
|
|
201
|
-
['module-override:ai.extensions', 'additive'],
|
|
202
|
-
['module-override:ai.tools', 'disable-replace'],
|
|
203
|
-
['module-override:cli', 'disable-replace'],
|
|
204
|
-
['module-override:commandInterceptors', 'disable-replace'],
|
|
205
|
-
['module-override:di', 'disable-replace'],
|
|
206
|
-
['module-override:encryption.maps', 'disable-replace'],
|
|
207
|
-
['module-override:enrichers', 'disable-replace'],
|
|
208
|
-
['module-override:events.subscribers', 'disable-replace'],
|
|
209
|
-
['module-override:guards', 'disable-replace'],
|
|
210
|
-
['module-override:interceptors', 'disable-replace'],
|
|
211
|
-
['module-override:nav.groupOrder', 'additive'],
|
|
212
|
-
['module-override:notifications.handlers', 'disable-replace'],
|
|
213
|
-
['module-override:notifications.types', 'disable-replace'],
|
|
214
|
-
['module-override:routes.api', 'disable-replace'],
|
|
215
|
-
['module-override:routes.pages', 'disable-replace'],
|
|
216
|
-
['module-override:setup', 'replace'],
|
|
217
|
-
['module-override:widgets.components', 'disable-replace'],
|
|
218
|
-
['module-override:widgets.dashboard', 'disable-replace'],
|
|
219
|
-
['module-override:widgets.injection', 'disable-replace'],
|
|
220
|
-
['module-override:workers', 'disable-replace'],
|
|
221
|
-
])
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
it('projects dashboard, notification, integration, vector, provider, and workflow registries', () => {
|
|
225
|
-
write(moduleRoot, 'notifications.handlers.ts', `
|
|
226
|
-
export const notificationHandlers = [{
|
|
227
|
-
id: 'alpha.alert-toast', notificationType: 'alpha.alert', features: ['alpha.view'], priority: 80,
|
|
228
|
-
handle() {},
|
|
229
|
-
}]
|
|
230
|
-
`)
|
|
231
|
-
write(moduleRoot, 'integration.ts', `
|
|
232
|
-
export const integration = { id: 'alpha_gateway', category: 'payment', providerKey: 'alpha-pay' }
|
|
233
|
-
export const integrations = [integration]
|
|
234
|
-
`)
|
|
235
|
-
write(moduleRoot, 'vector.ts', `
|
|
236
|
-
export const vectorConfig = { entities: [{ entityId: 'alpha:record' }] }
|
|
237
|
-
export default vectorConfig
|
|
238
|
-
`)
|
|
239
|
-
write(moduleRoot, 'workflows.ts', `
|
|
240
|
-
const approval = defineWorkflow({ workflowId: 'alpha.approval', steps: [], transitions: [] })
|
|
241
|
-
export const workflowsConfig = createWorkflowsModuleConfig({ moduleId: 'alpha', workflows: [approval] })
|
|
242
|
-
`)
|
|
243
|
-
write(moduleRoot, 'di.ts', `
|
|
244
|
-
export function register() {
|
|
245
|
-
registerPaymentGatewayDescriptor({ providerKey: 'alpha-pay', label: 'Alpha Pay' })
|
|
246
|
-
registerShippingAdapter({ providerKey: 'alpha-ship' })
|
|
247
|
-
registerCurrencyProvider({ id: 'alpha-rates' })
|
|
248
|
-
}
|
|
249
|
-
`)
|
|
250
|
-
write(moduleRoot, 'widgets/dashboard/summary/widget.ts', `
|
|
251
|
-
const widget = { metadata: { id: 'alpha.dashboard.summary', features: ['alpha.view'] }, Widget() {} }
|
|
252
|
-
export default widget
|
|
253
|
-
`)
|
|
254
|
-
|
|
255
|
-
const facts = extractModuleExtensionFacts({
|
|
256
|
-
moduleId: 'alpha',
|
|
257
|
-
moduleRoot,
|
|
258
|
-
sourceRoot: 'node_modules/pkg/src/modules/alpha',
|
|
259
|
-
entities: [],
|
|
260
|
-
events: [],
|
|
261
|
-
apiRoutes: [],
|
|
262
|
-
searchEntities: ['alpha:record'],
|
|
263
|
-
notifications: ['alpha.alert'],
|
|
264
|
-
aiTools: [{ name: 'alpha_lookup', sourcePath: 'node_modules/pkg/src/modules/alpha/ai-tools.ts' }],
|
|
265
|
-
aiAgents: [{ id: 'alpha_agent', sourcePath: 'node_modules/pkg/src/modules/alpha/ai-agents.ts' }],
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
expect(facts.contributions).toEqual(expect.arrayContaining([
|
|
269
|
-
expect.objectContaining({
|
|
270
|
-
id: 'alpha.alert-toast',
|
|
271
|
-
kind: 'browser-reaction',
|
|
272
|
-
targets: [expect.objectContaining({ id: 'alpha.alert', resolution: 'fact-ref' })],
|
|
273
|
-
details: expect.objectContaining({ transports: ['notification-effect'], hooks: ['useNotificationEffect'] }),
|
|
274
|
-
}),
|
|
275
|
-
expect.objectContaining({ id: 'dashboard:alpha.dashboard.summary', kind: 'widget', details: expect.objectContaining({ payload: 'dashboard' }) }),
|
|
276
|
-
expect.objectContaining({ id: 'integration:alpha_gateway', details: expect.objectContaining({ specialistRoute: 'integrations' }) }),
|
|
277
|
-
expect.objectContaining({ id: 'notification:alpha.alert', details: expect.objectContaining({ registry: 'notification' }) }),
|
|
278
|
-
expect.objectContaining({ id: 'search:alpha:record', details: expect.objectContaining({ registry: 'search' }) }),
|
|
279
|
-
expect.objectContaining({ id: 'vector:alpha:record', details: expect.objectContaining({ registry: 'vector' }) }),
|
|
280
|
-
expect.objectContaining({ id: 'ai:alpha_lookup', details: expect.objectContaining({ specialistRoute: 'aiTools' }) }),
|
|
281
|
-
expect.objectContaining({ id: 'ai:alpha_agent', details: expect.objectContaining({ specialistRoute: 'aiAgents' }) }),
|
|
282
|
-
expect.objectContaining({ id: 'payment:alpha-pay', source: expect.objectContaining({ symbol: 'registerPaymentGatewayDescriptor' }) }),
|
|
283
|
-
expect.objectContaining({ id: 'shipping:alpha-ship', details: expect.objectContaining({ specialistRoute: 'shippingCarriers' }) }),
|
|
284
|
-
expect.objectContaining({ id: 'currency:alpha-rates', details: expect.objectContaining({ specialistRoute: 'currencies' }) }),
|
|
285
|
-
expect.objectContaining({ id: 'workflow:alpha.approval', details: expect.objectContaining({ specialistRoute: 'workflows' }) }),
|
|
286
|
-
]))
|
|
287
|
-
expect(facts.contributions.filter((fact) => fact.id === 'payment:alpha-pay')).toHaveLength(1)
|
|
288
|
-
})
|
|
289
|
-
|
|
290
|
-
it('resolves factory-built contributions and generated entity registry references', () => {
|
|
291
|
-
write(moduleRoot, 'data/enrichers.ts', `
|
|
292
|
-
function makeEnricher(targetEntity) {
|
|
293
|
-
return { id: \`alpha.image:\${targetEntity}\`, targetEntity, async enrichMany(records) { return records } }
|
|
294
|
-
}
|
|
295
|
-
const registryEnricher = { id: 'alpha.registry', targetEntity: E.alpha.record, async enrichOne(record) { return record } }
|
|
296
|
-
export const enrichers = [makeEnricher('alpha:line'), registryEnricher]
|
|
297
|
-
`)
|
|
298
|
-
|
|
299
|
-
const facts = extractModuleExtensionFacts({
|
|
300
|
-
moduleId: 'alpha',
|
|
301
|
-
moduleRoot,
|
|
302
|
-
sourceRoot: 'node_modules/pkg/src/modules/alpha',
|
|
303
|
-
entities: [],
|
|
304
|
-
events: [],
|
|
305
|
-
apiRoutes: [],
|
|
306
|
-
searchEntities: [],
|
|
307
|
-
})
|
|
308
|
-
|
|
309
|
-
expect(facts.contributions).toEqual(expect.arrayContaining([
|
|
310
|
-
expect.objectContaining({ id: 'alpha.image:alpha:line', targets: [expect.objectContaining({ id: 'alpha:line' })] }),
|
|
311
|
-
expect.objectContaining({ id: 'alpha.registry', targets: [expect.objectContaining({ id: 'alpha:record' })] }),
|
|
312
|
-
]))
|
|
313
|
-
})
|
|
314
|
-
|
|
315
|
-
it('reports declarations whose authoritative source no longer binds the host key', () => {
|
|
316
|
-
write(moduleRoot, 'extension-points.ts', `
|
|
317
|
-
export const extensionPoints = defineModuleExtensionPoints({
|
|
318
|
-
moduleId: 'alpha',
|
|
319
|
-
hosts: { records: dataTableExtensionHost({ tableId: 'alpha.records', source: 'Records.tsx' }) },
|
|
320
|
-
})
|
|
321
|
-
`)
|
|
322
|
-
write(moduleRoot, 'Records.tsx', "export const tableId = 'alpha.records'")
|
|
323
|
-
|
|
324
|
-
const facts = extractModuleExtensionFacts({
|
|
325
|
-
moduleId: 'alpha',
|
|
326
|
-
moduleRoot,
|
|
327
|
-
sourceRoot: 'node_modules/pkg/src/modules/alpha',
|
|
328
|
-
entities: [],
|
|
329
|
-
events: [],
|
|
330
|
-
apiRoutes: [],
|
|
331
|
-
searchEntities: [],
|
|
332
|
-
})
|
|
333
|
-
|
|
334
|
-
expect(facts.unresolved).toEqual([
|
|
335
|
-
expect.objectContaining({ key: 'alpha.records', reason: 'unbound-declaration' }),
|
|
336
|
-
])
|
|
337
|
-
expect(facts.hosts.filter((host) => host.key.startsWith('records.')).every((host) => !host.bound)).toBe(true)
|
|
338
|
-
})
|
|
339
|
-
|
|
340
|
-
it('fails closed when a correlated first-party target remains unresolved', () => {
|
|
341
|
-
expect(() => assertNoUnresolvedExtensionTargets({
|
|
342
|
-
alpha: {
|
|
343
|
-
hosts: [],
|
|
344
|
-
contributions: [],
|
|
345
|
-
unresolved: [{
|
|
346
|
-
key: 'alpha.widget:data-table:alpha.missing',
|
|
347
|
-
source: { path: 'widgets/injection-table.ts' },
|
|
348
|
-
reason: 'unresolved-first-party-target',
|
|
349
|
-
}],
|
|
350
|
-
},
|
|
351
|
-
})).toThrow('alpha:alpha.widget:data-table:alpha.missing')
|
|
352
|
-
})
|
|
353
|
-
|
|
354
|
-
it('does not trust a claimed fact reference before matching a known first-party host', () => {
|
|
355
|
-
write(moduleRoot, 'data/enrichers.ts', `
|
|
356
|
-
export const enrichers = [{
|
|
357
|
-
id: 'alpha.typo', targetEntity: 'alpha.missing', async enrichOne(record) { return record },
|
|
358
|
-
}]
|
|
359
|
-
`)
|
|
360
|
-
const surface = extractModuleExtensionFacts({
|
|
361
|
-
moduleId: 'alpha',
|
|
362
|
-
moduleRoot,
|
|
363
|
-
sourceRoot: 'node_modules/pkg/src/modules/alpha',
|
|
364
|
-
entities: [{ id: 'alpha:record' }],
|
|
365
|
-
events: [],
|
|
366
|
-
apiRoutes: [],
|
|
367
|
-
searchEntities: [],
|
|
368
|
-
})
|
|
369
|
-
const correlated = correlateModuleExtensionFacts({
|
|
370
|
-
surfacesByModule: { alpha: surface },
|
|
371
|
-
entityIds: new Set(['alpha:record']),
|
|
372
|
-
eventIds: new Set(),
|
|
373
|
-
apiRoutes: new Set(),
|
|
374
|
-
commandIds: new Set(),
|
|
375
|
-
})
|
|
376
|
-
|
|
377
|
-
expect(() => assertNoUnresolvedExtensionTargets(correlated)).toThrow('alpha.typo:alpha.missing')
|
|
378
|
-
})
|
|
379
|
-
|
|
380
|
-
it('rejects wildcard targets that match no known first-party contract', () => {
|
|
381
|
-
const correlated = correlateModuleExtensionFacts({
|
|
382
|
-
surfacesByModule: {
|
|
383
|
-
alpha: {
|
|
384
|
-
hosts: [],
|
|
385
|
-
contributions: [{
|
|
386
|
-
id: 'alpha.typo-pattern',
|
|
387
|
-
kind: 'command-interceptor',
|
|
388
|
-
targets: [{ id: 'alpha.typo.*', resolution: 'unresolved' }],
|
|
389
|
-
scopeContract: 'tenant-and-organization',
|
|
390
|
-
source: { path: 'commands/interceptors.ts' },
|
|
391
|
-
details: { targetCommand: 'alpha.typo.*', phases: ['before-execute'] },
|
|
392
|
-
}],
|
|
393
|
-
unresolved: [],
|
|
394
|
-
},
|
|
395
|
-
},
|
|
396
|
-
entityIds: new Set(),
|
|
397
|
-
eventIds: new Set(),
|
|
398
|
-
apiRoutes: new Set(),
|
|
399
|
-
commandIds: new Set(['alpha.records.update']),
|
|
400
|
-
})
|
|
401
|
-
|
|
402
|
-
expect(() => assertNoUnresolvedExtensionTargets(correlated)).toThrow('alpha.typo-pattern:alpha.typo.*')
|
|
403
|
-
})
|
|
404
|
-
})
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs'
|
|
2
|
-
import os from 'node:os'
|
|
3
|
-
import path from 'node:path'
|
|
4
|
-
import { extractModuleFacts } from '../module-facts'
|
|
5
|
-
|
|
6
|
-
function findCoreSrcRoot(): string {
|
|
7
|
-
let dir = __dirname
|
|
8
|
-
for (let depth = 0; depth < 10; depth += 1) {
|
|
9
|
-
const candidate = path.join(dir, 'packages', 'core', 'src', 'modules')
|
|
10
|
-
if (fs.existsSync(candidate)) return candidate
|
|
11
|
-
dir = path.dirname(dir)
|
|
12
|
-
}
|
|
13
|
-
throw new Error('[internal] could not locate packages/core/src/modules from the test directory')
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function write(filePath: string, source: string): void {
|
|
17
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true })
|
|
18
|
-
fs.writeFileSync(filePath, source)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
describe('module-facts extension host extraction', () => {
|
|
22
|
-
const coreSrcRoot = findCoreSrcRoot()
|
|
23
|
-
|
|
24
|
-
it('resolves generated E.<module>.<entity> custom-field declarations from shipped modules', () => {
|
|
25
|
-
const expectedByModule: Record<string, string[]> = {
|
|
26
|
-
attachments: ['attachments:attachment'],
|
|
27
|
-
catalog: [
|
|
28
|
-
'catalog:catalog_product',
|
|
29
|
-
'catalog:catalog_product_variant',
|
|
30
|
-
'catalog:catalog_product_price',
|
|
31
|
-
],
|
|
32
|
-
sales: [
|
|
33
|
-
'sales:sales_order',
|
|
34
|
-
'sales:sales_order_line',
|
|
35
|
-
'sales:sales_order_adjustment',
|
|
36
|
-
'sales:sales_quote',
|
|
37
|
-
'sales:sales_quote_line',
|
|
38
|
-
'sales:sales_quote_adjustment',
|
|
39
|
-
'sales:sales_invoice',
|
|
40
|
-
'sales:sales_invoice_line',
|
|
41
|
-
'sales:sales_payment',
|
|
42
|
-
'sales:sales_payment_allocation',
|
|
43
|
-
'sales:sales_credit_memo',
|
|
44
|
-
'sales:sales_credit_memo_line',
|
|
45
|
-
'sales:sales_shipment',
|
|
46
|
-
'sales:sales_shipment_item',
|
|
47
|
-
'sales:sales_note',
|
|
48
|
-
],
|
|
49
|
-
staff: ['staff:staff_team_member'],
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
for (const [moduleId, expected] of Object.entries(expectedByModule)) {
|
|
53
|
-
const facts = extractModuleFacts({ moduleId, coreSrcRoot })
|
|
54
|
-
expect(facts.entities.filter((entity) => entity.customFields).map((entity) => entity.id).sort()).toEqual(
|
|
55
|
-
[...expected].sort(),
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
it('discovers literal and conditional DataTable IDs outside backend while excluding test sources', () => {
|
|
61
|
-
const tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'module-facts-extension-hosts-'))
|
|
62
|
-
const moduleRoot = path.join(tmpRoot, 'alpha')
|
|
63
|
-
try {
|
|
64
|
-
write(
|
|
65
|
-
path.join(moduleRoot, 'data', 'entities.ts'),
|
|
66
|
-
`@Entity({ tableName: 'alpha_records' })\nexport class AlphaRecord { updatedAt?: Date }\n`,
|
|
67
|
-
)
|
|
68
|
-
write(
|
|
69
|
-
path.join(moduleRoot, 'ce.ts'),
|
|
70
|
-
`export const entities = [{ id: E.alpha.alpha_record, fields: [] }]\n`,
|
|
71
|
-
)
|
|
72
|
-
write(
|
|
73
|
-
path.join(moduleRoot, 'components', 'AlphaTable.tsx'),
|
|
74
|
-
`export const props = {
|
|
75
|
-
perspective: { tableId: kind === 'one' ? 'alpha.one' : 'alpha.two' },
|
|
76
|
-
extensionTableId: 'alpha.extension',
|
|
77
|
-
}\n`,
|
|
78
|
-
)
|
|
79
|
-
write(
|
|
80
|
-
path.join(moduleRoot, 'components', 'Noise.test.tsx'),
|
|
81
|
-
`export const noise = { tableId: 'alpha.test-noise' }\n`,
|
|
82
|
-
)
|
|
83
|
-
write(
|
|
84
|
-
path.join(moduleRoot, 'backend', '__tests__', 'noise.tsx'),
|
|
85
|
-
`export const noise = { extensionTableId: 'alpha.test-directory-noise' }\n`,
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
const facts = extractModuleFacts({ moduleId: 'alpha', moduleRoot })
|
|
89
|
-
expect(facts.entities).toEqual([
|
|
90
|
-
expect.objectContaining({ id: 'alpha:alpha_record', customFields: true }),
|
|
91
|
-
])
|
|
92
|
-
expect(facts.hostTokens.tableIds).toEqual(['alpha.extension', 'alpha.one', 'alpha.two'])
|
|
93
|
-
} finally {
|
|
94
|
-
fs.rmSync(tmpRoot, { recursive: true, force: true })
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
it('captures shipped component-level table hosts used by catalog and sales', () => {
|
|
99
|
-
const catalog = extractModuleFacts({ moduleId: 'catalog', coreSrcRoot })
|
|
100
|
-
expect(catalog.hostTokens.tableIds).toEqual([
|
|
101
|
-
'catalog.categories.list',
|
|
102
|
-
'catalog.products.list',
|
|
103
|
-
])
|
|
104
|
-
|
|
105
|
-
const sales = extractModuleFacts({ moduleId: 'sales', coreSrcRoot })
|
|
106
|
-
expect(sales.hostTokens.tableIds).toEqual(['sales.orders', 'sales.quotes'])
|
|
107
|
-
})
|
|
108
|
-
})
|