@open-mercato/cli 0.11.1-develop.8589.1.db1a76ea60 → 0.11.1-develop.8665.1.2455b2503c
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 -2
- package/AGENTS.md +3 -0
- package/dist/agentic/guides/architecture.md +2 -2
- package/dist/agentic/guides/extensions.md +7 -2
- package/dist/agentic/guides/framework-extension-points.md +1 -0
- package/dist/agentic/guides/infrastructure-providers.md +20 -0
- package/dist/agentic/guides/integrations.md +2 -2
- package/dist/agentic/guides/module-facts.json +2564 -265
- package/dist/agentic/guides/module-facts.v2.json +2580 -265
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/index.md +1 -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/assisted_selling/acl-features.md +16 -0
- package/dist/agentic/guides/modules/assisted_selling/contribution-resolutions.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/domain-commands.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/entities.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/events.md +22 -0
- package/dist/agentic/guides/modules/assisted_selling/exact-override-targets.md +17 -0
- package/dist/agentic/guides/modules/assisted_selling/index.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/setup.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/umes-contributions.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/umes-hosts.md +23 -0
- package/dist/agentic/guides/modules/attachments/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/workers.md +1 -1
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/backups/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/backups/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/backups/exact-override-targets.md +11 -0
- package/dist/agentic/guides/modules/backups/index.md +5 -2
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
- package/dist/agentic/guides/modules/cart/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/acl-features.md +2 -1
- package/dist/agentic/guides/modules/catalog/active-extension-bindings.md +2 -0
- package/dist/agentic/guides/modules/catalog/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/catalog/contribution-resolutions.md +5 -0
- package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +8 -7
- package/dist/agentic/guides/modules/catalog/di-service-tokens.md +5 -4
- package/dist/agentic/guides/modules/catalog/domain-commands.md +2 -0
- package/dist/agentic/guides/modules/catalog/entities.md +1 -0
- package/dist/agentic/guides/modules/catalog/events.md +4 -1
- package/dist/agentic/guides/modules/catalog/exact-override-targets.md +13 -7
- package/dist/agentic/guides/modules/catalog/index.md +9 -9
- package/dist/agentic/guides/modules/catalog/umes-contributions.md +5 -0
- package/dist/agentic/guides/modules/catalog/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/catalog/workers.md +1 -0
- 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/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.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/index.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +2 -0
- package/dist/agentic/guides/modules/customer_accounts/index.md +2 -2
- package/dist/agentic/guides/modules/customer_accounts/workers.md +2 -0
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customers/active-extension-bindings.md +2 -1
- package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +1 -0
- package/dist/agentic/guides/modules/customers/index.md +3 -3
- package/dist/agentic/guides/modules/customers/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/dashboards/active-extension-bindings.md +0 -1
- package/dist/agentic/guides/modules/dashboards/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/dashboards/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/dashboards/index.md +2 -3
- 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/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/index.md +1 -1
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
- package/dist/agentic/guides/modules/entities/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/index.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/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
- package/dist/agentic/guides/modules/integrations/di-registrations-rich.md +8 -8
- package/dist/agentic/guides/modules/integrations/di-service-tokens.md +4 -4
- package/dist/agentic/guides/modules/integrations/exact-override-targets.md +14 -12
- package/dist/agentic/guides/modules/integrations/index.md +2 -2
- package/dist/agentic/guides/modules/integrations/setup.md +1 -1
- package/dist/agentic/guides/modules/integrations/workers.md +3 -1
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- 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/index.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/index.md +1 -1
- package/dist/agentic/guides/modules/promotions/index.md +1 -1
- package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/exact-override-targets.md +3 -3
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/resources/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/resources/setup.md +1 -1
- package/dist/agentic/guides/modules/sales/contribution-resolutions.md +1 -0
- package/dist/agentic/guides/modules/sales/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/sales/index.md +3 -3
- package/dist/agentic/guides/modules/sales/umes-contributions.md +1 -0
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/security/index.md +1 -1
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/contribution-resolutions.md +1 -1
- package/dist/agentic/guides/modules/staff/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/staff/index.md +1 -1
- package/dist/agentic/guides/modules/staff/workers.md +1 -1
- 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/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/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/reference-module-facts.json +811 -21
- package/dist/agentic/guides/reference-modules/example/active-extension-bindings.md +1 -0
- package/dist/agentic/guides/reference-modules/example/backend-pages.md +2 -0
- package/dist/agentic/guides/reference-modules/example/contribution-resolutions.md +3 -1
- 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/entities.md +2 -0
- package/dist/agentic/guides/reference-modules/example/events.md +2 -1
- package/dist/agentic/guides/reference-modules/example/exact-override-targets.md +25 -8
- package/dist/agentic/guides/reference-modules/example/index.md +7 -7
- package/dist/agentic/guides/reference-modules/example/notifications.md +1 -0
- package/dist/agentic/guides/reference-modules/example/setup.md +1 -1
- package/dist/agentic/guides/reference-modules/example/umes-contributions.md +3 -1
- package/dist/agentic/guides/reference-modules/example/umes-hosts.md +4 -0
- package/dist/agentic/guides/upstream/AGENTS.md +5 -4
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +37 -20
- package/dist/agentic/guides/upstream/manifest.json +3 -3
- package/dist/agentic/shared/AGENTS.md.template +11 -15
- package/dist/agentic/shared/ai/harness/README.md +4 -2
- package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
- package/dist/agentic/shared/ai/harness/cases.json +1420 -41
- package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
- package/dist/agentic/shared/ai/harness/design-system-inventory.json +640 -142
- package/dist/agentic/shared/ai/harness/source-link-inventory.json +223 -16
- package/dist/agentic/shared/ai/harness/validators.json +1 -1
- package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +1 -1
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +25 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +1 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +2 -0
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +21 -1
- package/dist/lib/cache-provider-manifest.js +9 -0
- package/dist/lib/cache-provider-manifest.js.map +7 -0
- package/dist/lib/generate-child-process.js +21 -3
- package/dist/lib/generate-child-process.js.map +2 -2
- package/dist/lib/generate-watch-events.js +135 -19
- package/dist/lib/generate-watch-events.js.map +2 -2
- package/dist/lib/generate-watch-plan.js +170 -0
- package/dist/lib/generate-watch-plan.js.map +7 -0
- package/dist/lib/generate-watch-runner.js +54 -0
- package/dist/lib/generate-watch-runner.js.map +7 -0
- package/dist/lib/generate-watch-structure.js +578 -203
- package/dist/lib/generate-watch-structure.js.map +3 -3
- package/dist/lib/generators/ast/writers.js +5 -1
- package/dist/lib/generators/ast/writers.js.map +2 -2
- package/dist/lib/generators/cache-providers.js +80 -0
- package/dist/lib/generators/cache-providers.js.map +7 -0
- package/dist/lib/generators/extensions/agent-files.js +1 -0
- package/dist/lib/generators/extensions/agent-files.js.map +2 -2
- package/dist/lib/generators/form-section-ast.js +156 -0
- package/dist/lib/generators/form-section-ast.js.map +7 -0
- package/dist/lib/generators/form-section-extension-compiler.js +568 -0
- package/dist/lib/generators/form-section-extension-compiler.js.map +7 -0
- package/dist/lib/generators/form-section-extension-source.js +245 -0
- package/dist/lib/generators/form-section-extension-source.js.map +7 -0
- package/dist/lib/generators/form-section-runtime-revisions.js +184 -0
- package/dist/lib/generators/form-section-runtime-revisions.js.map +7 -0
- package/dist/lib/generators/form-sections.js +773 -0
- package/dist/lib/generators/form-sections.js.map +7 -0
- package/dist/lib/generators/index.js +2 -0
- package/dist/lib/generators/index.js.map +2 -2
- package/dist/lib/generators/module-entities.js +21 -2
- package/dist/lib/generators/module-entities.js.map +2 -2
- package/dist/lib/generators/module-extension-facts.js +2 -1
- package/dist/lib/generators/module-extension-facts.js.map +2 -2
- package/dist/lib/generators/module-facts.js +30 -1
- package/dist/lib/generators/module-facts.js.map +2 -2
- package/dist/lib/generators/module-override-targets.js +24 -2
- package/dist/lib/generators/module-override-targets.js.map +2 -2
- package/dist/lib/generators/module-registry.js +223 -194
- package/dist/lib/generators/module-registry.js.map +3 -3
- package/dist/lib/generators/openapi.js +51 -18
- package/dist/lib/generators/openapi.js.map +2 -2
- package/dist/lib/generators/web-research-adapters.js +54 -22
- package/dist/lib/generators/web-research-adapters.js.map +2 -2
- package/dist/lib/in-process-generate-watcher.js +98 -75
- package/dist/lib/in-process-generate-watcher.js.map +2 -2
- package/dist/lib/post-generate-invalidation.js +20 -1
- package/dist/lib/post-generate-invalidation.js.map +2 -2
- package/dist/lib/resolver.js +195 -1
- package/dist/lib/resolver.js.map +3 -3
- package/dist/lib/single-instance-strategy-guard.js +26 -3
- package/dist/lib/single-instance-strategy-guard.js.map +2 -2
- package/dist/mercato.js +106 -50
- package/dist/mercato.js.map +2 -2
- package/jest.config.cjs +2 -0
- package/package.json +7 -7
- package/src/__tests__/mercato.test.ts +18 -0
- package/src/__tests__/rotation-json-output.test.ts +52 -0
- package/src/lib/__tests__/cache-provider-manifest.test.ts +76 -0
- package/src/lib/__tests__/generate-child-process.test.ts +30 -0
- package/src/lib/__tests__/generate-watch-events.test.ts +377 -8
- package/src/lib/__tests__/generate-watch-plan.test.ts +99 -0
- package/src/lib/__tests__/generate-watch-runner.test.ts +138 -0
- package/src/lib/__tests__/generate-watch-structure.test.ts +556 -1
- package/src/lib/__tests__/in-process-generate-watcher.test.ts +393 -6
- package/src/lib/__tests__/module-inspection.test.ts +17 -11
- package/src/lib/__tests__/post-generate-invalidation.test.ts +108 -0
- package/src/lib/__tests__/resolver.form-section-gates.test.ts +82 -0
- package/src/lib/__tests__/single-instance-strategy-guard.test.ts +129 -0
- package/src/lib/cache-provider-manifest.ts +8 -0
- package/src/lib/generate-child-process.ts +26 -3
- package/src/lib/generate-watch-events.ts +189 -17
- package/src/lib/generate-watch-plan.ts +180 -0
- package/src/lib/generate-watch-runner.ts +63 -0
- package/src/lib/generate-watch-structure.ts +670 -227
- package/src/lib/generators/__tests__/cache-providers.test.ts +102 -0
- package/src/lib/generators/__tests__/derived-crud-route-collisions.test.ts +85 -0
- package/src/lib/generators/__tests__/form-section-outbox.test.ts +53 -0
- package/src/lib/generators/__tests__/form-sections.test.ts +896 -0
- package/src/lib/generators/__tests__/incremental-registry.test.ts +262 -0
- package/src/lib/generators/__tests__/module-extension-facts.test.ts +1 -0
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +8 -6
- package/src/lib/generators/__tests__/module-facts.example-fact-coverage.test.ts +37 -13
- package/src/lib/generators/__tests__/module-facts.local-reference.test.ts +13 -0
- package/src/lib/generators/__tests__/module-override-targets.test.ts +2 -3
- package/src/lib/generators/__tests__/module-subset.test.ts +1 -1
- package/src/lib/generators/__tests__/openapi.test.ts +147 -10
- package/src/lib/generators/__tests__/structural-contracts.test.ts +2 -2
- package/src/lib/generators/__tests__/web-research-adapters.test.ts +298 -87
- package/src/lib/generators/ast/writers.ts +6 -1
- package/src/lib/generators/cache-providers.ts +111 -0
- package/src/lib/generators/extension.ts +2 -0
- package/src/lib/generators/extensions/agent-files.ts +1 -0
- package/src/lib/generators/form-section-ast.ts +166 -0
- package/src/lib/generators/form-section-extension-compiler.ts +632 -0
- package/src/lib/generators/form-section-extension-source.ts +308 -0
- package/src/lib/generators/form-section-runtime-revisions.ts +211 -0
- package/src/lib/generators/form-sections.ts +896 -0
- package/src/lib/generators/index.ts +1 -0
- package/src/lib/generators/module-entities.ts +22 -4
- package/src/lib/generators/module-extension-facts.ts +1 -0
- package/src/lib/generators/module-facts.ts +40 -0
- package/src/lib/generators/module-override-targets.ts +19 -0
- package/src/lib/generators/module-registry.ts +246 -202
- package/src/lib/generators/openapi.ts +65 -20
- package/src/lib/generators/web-research-adapters.ts +76 -21
- package/src/lib/in-process-generate-watcher.ts +151 -96
- package/src/lib/post-generate-invalidation.ts +28 -1
- package/src/lib/resolver.ts +218 -0
- package/src/lib/single-instance-strategy-guard.ts +51 -1
- package/src/mercato.ts +117 -57
- package/dist/agentic/guides/modules/dashboards/incoming-installed-contributions.md +0 -11
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/generators/form-section-extension-compiler.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport { createHash } from 'node:crypto'\nimport ts from 'typescript-js'\nimport { escapeGeneratedJsonLiteral, stringLiteral } from './ast/writers'\nimport {\n applyCrudFormSectionPlacements, canonicalSectionJson, compareSectionIds, crudFormSectionHostKey,\n} from '@open-mercato/shared/lib/crud/form-sections/composition'\nimport { derivedCrudFormSectionRetryFact, projectCrudFormSectionClientMutationFact } from '@open-mercato/shared/lib/crud/form-sections/client-mutation-facts'\nimport type { CustomFieldDefinition, CustomFieldSet } from '@open-mercato/shared/modules/entities'\nimport type { CompiledCrudFormAlternative, CompiledCrudFormCustomField } from '@open-mercato/shared/lib/crud/form-sections/compiled-extensions'\nimport type { CrudFormSectionAddress, CrudFormSectionContributionFact, CrudFormSectionSurfaceAlternativeFact } from '@open-mercato/shared/modules/form-section-facts'\nimport type { CrudFormSectionClientHostFact } from '@open-mercato/shared/modules/form-sections'\nimport type { FormSectionOverride, FormSectionOverridesMap } from '@open-mercato/shared/modules/overrides'\nimport { InjectionPosition } from '@open-mercato/shared/modules/widgets/injection-position'\nimport { arrayField, exportedDeclaration, fieldsOf, literalData, literalValue, readIdentity, readSectionRuntimeFields } from './form-section-ast'\nimport {\n sectionSymbol, type SectionExtensionChange, type SectionExtensionField, type SectionExtensionSource, type SectionBrowserLoader,\n} from './form-section-extension-source'\nimport { hashCompiledSectionSource } from './form-section-runtime-revisions'\n\nconst maximumAlternatives = 128\nconst revisionFilename = 'form-sections.revisions.json'\n\ntype Invalid = (reason: string) => never\ntype Ownership = CrudFormSectionSurfaceAlternativeFact['ownershipFacts'][number]\ntype Revision = { n: number; baseRoundTripId: string | null; patchHash: string }\ntype Runtime = { source: ts.SourceFile; runtimePath: string }\ntype Write = { filename: string; content: string }\n\nexport type CompilerModule = {\n moduleId: string\n derivedRoutes?: readonly { index: number; hostDescriptorId: string; routePath: string; outboxRetry: boolean }[]\n importPath: string\n sourceBase: string\n authoredSource: boolean\n extensionSources: readonly SectionExtensionSource[]\n clientHosts: CrudFormSectionClientHostFact[]\n contributedOverrides: FormSectionOverridesMap\n runtimeSources: ReadonlyMap<string, Runtime>\n customFieldSeedEntities: ReadonlyMap<string, Readonly<Record<string, string>>>\n primitiveContributions: readonly Pick<CrudFormSectionContributionFact, 'id' | 'address' | 'operation'>[]\n}\ntype AuthoredChange = { module: CompilerModule; extension: SectionExtensionSource; change: SectionExtensionChange }\ntype CompiledField = { authored: AuthoredChange; field: SectionExtensionField; payloadPath?: string; customField?: CompiledCrudFormCustomField; seed?: CustomFieldDefinition }\ntype CompiledChange = {\n id: string\n source: AuthoredChange\n target: Omit<CrudFormSectionAddress, 'sectionId'>\n override: FormSectionOverride\n ownership?: Ownership\n contribution: CrudFormSectionContributionFact\n file: string\n fields: CompiledField[]\n sinks: { id: string; roundTripId: string; capabilityId: string; hostDetailEntityId: string; fields: CompiledField[] }[]\n defaults: { owner: AuthoredChange; id: string; payloadPath: string; readsPayloadPaths: readonly string[]; scoped: boolean }[]\n}\n\nexport type CompiledSectionExtensions = {\n contributionsByModule: ReadonlyMap<string, readonly CompiledChange[]>\n alternativesByModule: ReadonlyMap<string, readonly CompiledCrudFormAlternative[]>\n runtimeFiles: readonly { name: string; content: string }[]\n revisionWrites: readonly Write[]\n fallbacks: FormSectionOverridesMap\n customFieldSetsByModule: ReadonlyMap<string, readonly CustomFieldSet[]>\n}\n\nfunction includesDefaultTarget(targets: SectionExtensionSource['defaults'][number]['targets'], target: Omit<CrudFormSectionAddress, 'sectionId'>): boolean {\n return !targets || targets.some(({ formVariant, formOperation }) =>\n formVariant === target.formVariant && formOperation === target.formOperation)\n}\n\nfunction digest(value: unknown): string {\n return createHash('sha256').update(canonicalSectionJson(value)).digest('hex')\n}\n\nfunction validPath(value: string): boolean {\n return /^[a-zA-Z0-9_:-]+(?:\\.[a-zA-Z0-9_:-]+)*$/.test(value)\n && !value.split('.').some((component) => ['constructor', 'prototype', '__proto__'].includes(component))\n}\n\nfunction readRevisions(module: CompilerModule, invalid: Invalid) {\n const filename = path.join(module.sourceBase, revisionFilename)\n const stats = fs.lstatSync(filename, { throwIfNoEntry: false })\n const original = stats?.isFile() ? fs.readFileSync(filename, 'utf8') : ''\n let values: unknown\n try { values = original ? JSON.parse(original) : {} } catch { return invalid(`invalid ${revisionFilename}`) }\n if ((stats && !stats.isFile()) || !values || typeof values !== 'object' || Array.isArray(values)) return invalid(`invalid ${revisionFilename}`)\n const revisions = new Map<string, Revision>()\n for (const [id, value] of Object.entries(values)) {\n if (!value || typeof value !== 'object' || !Number.isSafeInteger(value.n) || value.n < 1\n || (value.baseRoundTripId !== null && typeof value.baseRoundTripId !== 'string')\n || typeof value.patchHash !== 'string' || !/^[a-f0-9]{64}$/.test(value.patchHash)) {\n return invalid(`invalid revision for \"${id}\" in ${revisionFilename}`)\n }\n revisions.set(id, value)\n }\n return { filename, original, revisions }\n}\n\nfunction runtimeFields(runtime: Runtime, invalid: Invalid) {\n const initializer = exportedDeclaration(runtime.source, 'crudFormSectionRuntime')\n if (!initializer) return invalid('missing crudFormSectionRuntime')\n return readSectionRuntimeFields(initializer, runtime.source, invalid)\n}\n\nfunction granularFields(base: Map<string, ts.Expression>, invalid: Invalid): Map<string, string[]> {\n const paths = base.get('fieldPayloadPaths')\n if (!paths || !base.has('fieldSchemas') || !base.has('projectField')) return invalid('modify requires a field-granular base descriptor')\n return new Map([...fieldsOf(paths, invalid)].map(([field, entry]) => {\n const values = literalData(entry, invalid)\n if (!Array.isArray(values) || values.some((value: unknown) => typeof value !== 'string' || !validPath(value))) {\n return invalid(`invalid payload paths for base field \"${field}\"`)\n }\n return [field, values as string[]]\n }))\n}\n\nfunction baseDescriptor(runtime: Runtime, sectionId: string, invalid: Invalid, sourceRoot: string) {\n const fields = runtimeFields(runtime, invalid)\n const section = (fields.has('sectionDescriptors')\n ? arrayField(fields, 'sectionDescriptors', invalid).map((entry) => readSectionRuntimeFields(entry, runtime.source, invalid, new Set(), sourceRoot))\n : [fields]).find((entry) => {\n const group = entry.get('group')\n return group && literalData(fieldsOf(group, invalid).get('id')!, invalid) === sectionId\n })\n if (!section) return invalid(`host did not publish a runtime descriptor for section \"${sectionId}\"`)\n return section\n}\n\nfunction exactPaths(values: readonly string[]) {\n return [...values].sort(compareSectionIds)\n}\n\nfunction matchingPaths(left: readonly string[], right: readonly string[]): boolean {\n return canonicalSectionJson(exactPaths(left)) === canonicalSectionJson(exactPaths(right))\n}\n\nfunction pathsOverlap(paths: readonly string[]): boolean {\n const ordered = exactPaths(paths)\n return ordered.some((entry, index) => ordered.slice(index + 1).some((other) => other === entry || other.startsWith(entry + '.')))\n}\n\nfunction explicitPlacement(change: SectionExtensionChange): FormSectionOverride & { operation: 'add' } {\n const relativeTo = change.before ?? change.after\n const position = change.before ? InjectionPosition.Before : change.after ? InjectionPosition.After : InjectionPosition.Last\n return { operation: 'add', contributionId: '', ...(relativeTo ? { placement: { relativeTo, position } } : {}) }\n}\n\nfunction overrideKey({ hostId, formVariant, formOperation, sectionId }: CrudFormSectionAddress) {\n return [hostId, formVariant, formOperation, sectionId].join('/')\n}\n\nfunction renderBrowserRuntime(candidate: CompiledChange, hostRuntime: Runtime, customDefinitionSet: string | undefined): string {\n const { contribution, source, fields } = candidate\n const identity = { id: contribution.id, roundTripId: contribution.roundTripId }\n const { change } = source\n const output = ['// Auto-generated by yarn generate. Do not edit.']\n const identityLiteral = escapeGeneratedJsonLiteral(JSON.stringify(identity))\n if (change.operation === 'hide') return [...output, `export const crudFormSectionRuntime = ${identityLiteral} as const`, ''].join('\\n')\n if (change.replacement) {\n return [...output,\n `import { crudFormSectionRuntime as replacement } from ${stringLiteral(change.replacement.importPath)}`,\n `export const crudFormSectionRuntime = { ...replacement, ...${identityLiteral} }`, '',\n ].join('\\n')\n }\n const helpers = [\n 'deriveCrudFormFieldGranularSection',\n ...(change.operation === 'modify' ? ['getCrudFormFieldGranularBase'] : []),\n ...(fields.some(({ field }) => field.loaders.options) ? ['crudFormExtensionOptionsLoader'] : []),\n ]\n output.push(`import { ${helpers.join(', ')} } from '@open-mercato/ui/backend/crud-form-field-granular'`)\n if (change.operation === 'modify') {\n output.push(`import { crudFormSectionRuntime as hostRuntime } from ${stringLiteral(hostRuntime.runtimePath)}`)\n output.push(`const base = getCrudFormFieldGranularBase(hostRuntime, ${stringLiteral(change.id)})`)\n }\n const imports: string[] = []\n const prepared: string[] = []\n const address = escapeGeneratedJsonLiteral(JSON.stringify(contribution.address))\n for (const [index, item] of fields.entries()) {\n const { field, payloadPath } = item\n const fieldId = stringLiteral(field.id)\n const payloadPathLiteral = payloadPath === undefined ? 'undefined' : stringLiteral(payloadPath)\n const settings: string[] = []\n for (const [kind, loader] of Object.entries(field.loaders)) {\n const variable = `field${index}${kind}`\n imports.push(`import ${variable} from ${stringLiteral((loader as SectionBrowserLoader).importPath)}`)\n if (kind === 'options') settings.push(`loadOptions: crudFormExtensionOptionsLoader(${variable}, () => ({ address: ${address}, fieldId: ${fieldId}, payloadPath: ${payloadPathLiteral}, values: {} }))`)\n else settings.push(`${kind}: ${variable}`)\n }\n if (field.loaders.clientRule) settings.push(`validationPayloadPath: ${payloadPathLiteral}`)\n if (settings.length) prepared.push(`${fieldId}: { ${settings.join(', ')} }`)\n }\n output.push(...imports)\n const changes = Object.fromEntries(fields.map(({ field }) => [field.id, field.operation === 'remove' ? { operation: 'remove' }\n : { operation: field.operation, [field.operation === 'add' ? 'definition' : 'patch']: field.browser }]))\n const added = Object.fromEntries(fields.filter(({ field }) => field.operation === 'add').map(({ field, payloadPath }) => [field.id, payloadPath]))\n output.push('export const crudFormSectionRuntime = deriveCrudFormFieldGranularSection({',\n ` identity: ${identityLiteral}, address: ${address},`,\n ...(change.operation === 'modify' ? [' base,'] : []),\n ...(change.titleKey ? [` titleKey: ${stringLiteral(change.titleKey)},`] : []),\n ...(customDefinitionSet ? [` customFieldDefinitionSetId: ${stringLiteral(customDefinitionSet)},`] : []),\n ` changes: ${escapeGeneratedJsonLiteral(JSON.stringify(changes))}, addedPayloadPaths: ${escapeGeneratedJsonLiteral(JSON.stringify(added))},`,\n ` prepared: { ${prepared.join(', ')} },`, '})', '')\n return output.join('\\n')\n}\n\nfunction surfaceKey(surface: CrudFormSectionSurfaceAlternativeFact): string | null {\n return surface.hostId === null ? null : crudFormSectionHostKey({ ...surface, hostId: surface.hostId })\n}\n\nfunction chooseProof(host: CrudFormSectionClientHostFact, baseline: CrudFormSectionSurfaceAlternativeFact) {\n if (baseline.clientMutationSurfaces?.some(({ kind }) => kind === 'parent-submit')) return baseline\n const proofs = host.alternatives.filter((surface) => surfaceKey(surface) === surfaceKey(baseline)\n && surface.clientMutationSurfaces?.some(({ kind }) => kind === 'parent-submit'))\n const signatures = new Set(proofs.map(({ clientMutationSurfaces }) => canonicalSectionJson(clientMutationSurfaces)))\n return signatures.size === 1 ? proofs[0] : undefined\n}\n\nexport function compileCrudFormSectionExtensions(\n modules: readonly CompilerModule[], configured: Readonly<FormSectionOverridesMap>,\n): CompiledSectionExtensions {\n const contributionsByModule = new Map<string, CompiledChange[]>()\n const alternativesByModule = new Map<string, CompiledCrudFormAlternative[]>()\n const runtimeFiles: { name: string; content: string }[] = []\n const ledgers = new Map<string, ReturnType<typeof readRevisions>>()\n const fallbacks: FormSectionOverridesMap = {}\n const primitiveOverrides = Object.assign({}, ...modules.map(({ contributedOverrides }) => contributedOverrides)) as FormSectionOverridesMap\n const primitiveClaims = new Map(modules.flatMap(({ primitiveContributions }) =>\n primitiveContributions.map((fact) => [fact.id, fact] as const)))\n const ids = new Set<string>()\n const extensionIds = new Set<string>()\n const seeds = new Map<string, { moduleId: string; entity: string; field: CustomFieldDefinition }>()\n const tuples = new Map<string, { target: CompiledChange['target']; changes: AuthoredChange[] }>()\n const diagnostics = (module: CompilerModule, reason: string): never => {\n throw new Error(`[generate] crudFormExtensions for \"${module.moduleId}\" (${module.sourceBase}): ${reason}`)\n }\n for (const module of modules) for (const extension of module.extensionSources) {\n if (extensionIds.has(extension.id)) diagnostics(module, `duplicate extension id \"${extension.id}\"`)\n extensionIds.add(extension.id)\n for (const target of extension.targets) {\n const address = { hostId: extension.hostId, ...target }\n const key = crudFormSectionHostKey(address)\n const current = tuples.get(key) ?? { target: address, changes: [] }\n current.changes.push(...extension.changes.map((change) => ({ module, extension, change })))\n tuples.set(key, current)\n }\n }\n for (const [key, { target, changes }] of [...tuples.entries()].sort(([left], [right]) => compareSectionIds(left, right))) {\n const invalid: Invalid = (reason) => diagnostics(changes[0].module, reason)\n const matches = modules.flatMap((module) => module.clientHosts.flatMap((host) => host.alternatives\n .filter((surface) => !surface.contributionIds.length && surfaceKey(surface) === key)\n .map((baseline) => ({ module, host, baseline }))))\n if (matches.length !== 1) return invalid(`expected one published host and baseline for ${key}`)\n const [{ module: hostModule, host, baseline }] = matches\n const runtime = hostModule.runtimeSources.get(host.id)\n const seedEntities = hostModule.customFieldSeedEntities.get(host.id) ?? {}\n if (!runtime) return invalid(`host runtime missing for ${key}`)\n const needsMutation = changes.some(({ change }) => change.operation !== 'add' || change.fields.length > 0)\n const proof = needsMutation ? chooseProof(host, baseline) : baseline\n if (!proof) return invalid(`host ${key} has no unambiguous parent-submit fa\u00E7ade proof`)\n const mutationIds = proof.clientMutationSurfaces?.filter(({ kind, requestOperation }) =>\n kind === 'parent-submit' && requestOperation === target.formOperation).map(({ id }) => id) ?? []\n if (needsMutation && mutationIds.length !== 1) return invalid(`host ${key} requires one exact parent-submit surface`)\n const groups = new Map<string, AuthoredChange[]>()\n for (const authored of changes) {\n const { change } = authored\n const owners = groups.get(change.id) ?? []\n owners.push(authored)\n groups.set(change.id, owners)\n }\n\n function compile(source: AuthoredChange, members: readonly AuthoredChange[], declarationId: string): CompiledChange {\n const { module, change } = source\n const invalid: Invalid = (reason) => diagnostics(module, reason)\n const id = sectionSymbol(declarationId, 'derived descriptor ID', invalid)\n if (ids.has(id)) invalid(`duplicate derived section \"${id}\"`)\n ids.add(id)\n const address = { ...target, sectionId: change.id }\n if (baseline.orderedSectionIds.includes(change.id) === (change.operation === 'add')) invalid(`invalid section target \"${change.id}\" for \"${id}\"`)\n const ownership = baseline.ownershipFacts.find(({ sectionId }) => sectionId === change.id)\n const base = change.operation === 'add' ? undefined : baseDescriptor(runtime!, change.id, invalid, hostModule.sourceBase)\n const baseRoundTripId = base ? readIdentity(base, invalid).roundTripId : null\n let descriptor = base\n const standardPaths = new Set(ownership?.payloadPaths)\n const authoredCustom = ownership?.customFieldOwnership ?? { mode: 'none' }\n const customKeys = new Set(authoredCustom.mode === 'ids' ? authoredCustom.ids : [])\n const customDefinitionSets = new Set(baseline.ownershipFacts.flatMap(({ customFieldOwnership }) =>\n customFieldOwnership.mode !== 'none' && customFieldOwnership.definitionSetId ? [customFieldOwnership.definitionSetId] : []))\n const definitionSet = authoredCustom.mode !== 'none' && authoredCustom.definitionSetId\n ? authoredCustom.definitionSetId : customDefinitionSets.size === 1 ? [...customDefinitionSets][0]\n : Object.keys(seedEntities).length === 1 ? Object.keys(seedEntities)[0] : undefined\n const byField = change.operation === 'modify' && base ? granularFields(base, invalid) : new Map<string, string[]>()\n if (byField.size && (!matchingPaths([...byField.values()].flat().filter((leaf) => !leaf.startsWith('customFields.')), [...standardPaths])\n || [...byField.values()].flat().some((leaf) => leaf.startsWith('customFields.') && !customKeys.has(leaf.slice('customFields.'.length))))) {\n return invalid(`granular section \"${change.id}\" diverges from published payload ownership`)\n }\n const changedFields = members.flatMap((authored): CompiledField[] => authored.change.fields.map((field) => ({ field, authored })))\n const removed = new Set(changedFields.filter(({ field }) => field.operation === 'remove').map(({ field }) => field.id))\n if (base && removed.size) for (const entry of arrayField(base, 'refinements', invalid)) {\n const refinement = fieldsOf(entry, invalid)\n const mandatory = refinement.get('mandatory')\n if (!mandatory || literalData(mandatory, invalid) !== true) continue\n if (arrayField(refinement, 'fieldPaths', invalid).some((field) => removed.has(literalValue(field, 'refinement field', invalid)))) {\n invalid(`removal intersects mandatory refinement \"${literalValue(refinement.get('id'), 'refinement id', invalid)}\"`)\n }\n }\n if (change.replacement) {\n const alternate = runtimeFields({ source: change.replacement.source, runtimePath: change.replacement.importPath }, invalid)\n descriptor = alternate\n const group = alternate.get('group')\n if (!group || literalValue(fieldsOf(group, invalid).get('id'), 'replacement group', invalid) !== change.id) invalid('replacement group does not match the base section')\n const ownedPaths = alternate.get('ownedPayloadPaths') ?? alternate.get('ownedFieldPaths')\n const alternativePaths = alternate.has('fieldPayloadPaths') ? [...granularFields(alternate, invalid).values()].flat()\n : ownedPaths ? literalData(ownedPaths, invalid) : undefined\n if (!Array.isArray(alternativePaths) || !matchingPaths(alternativePaths.filter((leaf) => typeof leaf === 'string' && !leaf.startsWith('customFields.')), [...standardPaths])) {\n invalid(`replacement must preserve exact payload ownership for \"${change.id}\"`)\n }\n const custom = alternate.get('ownedCustomFieldIds')\n const keys = custom ? literalData(custom, invalid) : []\n const replacementSet = alternate.get('customFieldDefinitionSetId')\n if ((authoredCustom.mode !== 'none' && authoredCustom.definitionSetId !== (replacementSet && literalData(replacementSet, invalid)))\n || (authoredCustom.mode === 'all' ? keys !== 'all' : !Array.isArray(keys) || !matchingPaths(keys, [...customKeys]))) {\n invalid(`replacement must preserve exact custom-field ownership for \"${change.id}\"`)\n }\n }\n for (const item of changedFields) {\n const { field, authored } = item\n const prior = byField.get(field.id)\n if (field.operation === 'add') {\n if (prior) invalid(`field \"${field.id}\" is already declared`)\n if (!validPath(field.id)) invalid(`invalid added payload key \"${field.id}\"`)\n const store = field.store!\n if (store.kind === 'customField') {\n if (!definitionSet || authoredCustom.mode === 'all') invalid(`custom field \"${field.id}\" requires a bounded host definition set`)\n const fieldKey = store.key ?? field.id\n if (!/^[a-z0-9_]{1,100}$/.test(fieldKey) || customKeys.has(fieldKey)) invalid(`invalid or duplicate snake_case custom field \"${fieldKey}\"`)\n const entityId = definitionSet && Object.hasOwn(seedEntities, definitionSet) ? seedEntities[definitionSet] : undefined\n if (!entityId || !definitionSet) return invalid(`custom field \"${field.id}\" needs a published host customFieldSeedEntities binding`)\n const type = field.browser.type\n const kind = type === 'number' ? 'float' : type === 'textarea' ? 'multiline' : type\n if (kind !== 'text' && kind !== 'multiline' && kind !== 'float' && kind !== 'boolean' && kind !== 'date' && kind !== 'select') {\n return invalid(`custom field \"${field.id}\" requires a supported custom-field kind`)\n }\n const options = field.browser.options\n if (kind === 'select' && (!Array.isArray(options) || !options.length || field.loaders.options\n || options.some((entry) => !entry || typeof entry.value !== 'string' || typeof entry.labelKey !== 'string'))) {\n return invalid(`custom-field select \"${field.id}\" requires literal options and label keys`)\n }\n const label = typeof field.browser.labelKey === 'string' ? field.browser.labelKey : `${id}.fields.${field.id}`\n item.customField = { definitionSetId: definitionSet, entityId, key: fieldKey, kind }\n item.seed = { key: fieldKey, kind, label, required: field.browser.required === true, formEditable: true, sectionOnly: true, listVisible: false,\n ...(kind === 'select' && Array.isArray(options) ? { options: options.map(({ value, labelKey }) => ({ value, label: labelKey })) } : {}) }\n customKeys.add(fieldKey)\n item.payloadPath = `customFields.${fieldKey}`\n } else {\n if (!store.entityId?.startsWith(authored.module.moduleId + ':')) invalid(`store target \"${store.entityId}\" must be owned by \"${authored.module.moduleId}\"`)\n if (field.id.includes('.') || !validPath(authored.module.moduleId)) invalid('extension sink keys must be literal single segments')\n item.payloadPath = `extensions.${authored.module.moduleId}.${field.id}`\n if (standardPaths.has(item.payloadPath)) invalid(`duplicate payload path \"${item.payloadPath}\"`)\n standardPaths.add(item.payloadPath)\n }\n } else {\n if (!prior) return invalid(`unknown base field \"${field.id}\"`)\n if (field.operation === 'remove') for (const leaf of prior) {\n if (leaf.startsWith('customFields.')) customKeys.delete(leaf.slice('customFields.'.length))\n else standardPaths.delete(leaf)\n }\n if (field.loaders.clientRule || field.loaders.options || field.server || field.rules.some(({ enforce }) => enforce === 'client-and-server')) {\n if (prior.length !== 1) invalid(`field \"${field.id}\" needs one exact rule or option payload path`)\n item.payloadPath = prior[0]\n }\n }\n }\n const resultOwnership: Ownership | undefined = change.operation === 'hide' ? undefined : {\n sectionId: change.id, payloadPaths: exactPaths([...standardPaths]),\n customFieldOwnership: authoredCustom.mode === 'all' ? authoredCustom : customKeys.size\n ? { mode: 'ids', ids: exactPaths([...customKeys]), ...(definitionSet ? { definitionSetId: definitionSet } : {}) } : { mode: 'none' },\n }\n const baseSyntax = base?.get('group')?.parent.parent\n const patchHash = digest({\n base: baseSyntax && ts.isObjectLiteralExpression(baseSyntax) ? hashCompiledSectionSource(baseSyntax, hostModule.sourceBase) : null,\n changes: members.map(({ module: owner, extension, change: changed }) => ({\n module: owner.moduleId,\n source: hashCompiledSectionSource(changed.syntax, owner.sourceBase),\n defaults: extension.defaults.map(({ syntax }) => hashCompiledSectionSource(syntax, owner.sourceBase)),\n replacement: changed.replacement ? hashCompiledSectionSource(exportedDeclaration(changed.replacement.source, 'crudFormSectionRuntime')!, owner.sourceBase) : null,\n })),\n })\n const ledger = ledgers.get(module.moduleId) ?? readRevisions(module, invalid)\n ledgers.set(module.moduleId, ledger)\n const previous = ledger.revisions.get(id)\n if (!module.authoredSource && (!previous || previous.baseRoundTripId !== baseRoundTripId)) {\n return invalid('packaged extension requires its reviewed revision ledger and a matching base revision')\n }\n const current = previous && (!module.authoredSource || (previous.baseRoundTripId === baseRoundTripId && previous.patchHash === patchHash))\n ? previous : { n: (previous?.n ?? 0) + 1, baseRoundTripId, patchHash }\n if (!Number.isSafeInteger(current.n)) invalid('descriptor revision exhausted')\n ledger.revisions.set(id, current)\n const roundTripId = `${id}@v${current.n}`\n const operation = change.operation === 'modify' ? 'replace' : change.operation\n const file = `crud-form-section-extension-${digest(id).slice(0, 20)}.generated.ts`\n const sinkGroups = new Map<string, CompiledField[]>()\n for (const item of changedFields) {\n const { authored, field } = item\n if (!field.store || field.store.kind === 'customField') continue\n const key = canonicalSectionJson([authored.module.moduleId,\n field.store.kind === 'table' ? field.store.entityId : authored.extension.id,\n field.store.kind === 'table' ? null : field.store.fieldOverride ? field.id : null])\n const group = sinkGroups.get(key) ?? []\n group.push(item)\n sinkGroups.set(key, group)\n }\n const sinks = [...sinkGroups.entries()].map(([key, group]) => {\n const sinkId = `${id}.sink-${digest(key).slice(0, 12)}`\n if (!host.hostResourceKind) return invalid('sink requires an exact host detail resource')\n return { id: sinkId, roundTripId: `${sinkId}@v${current.n}`, capabilityId: `${sinkId}.capability`,\n hostDetailEntityId: host.hostResourceKind, fields: group }\n })\n const displayOnly = change.operation === 'add' && !changedFields.length\n const requiredSectionIds = descriptor && operation !== 'hide'\n ? arrayField(descriptor, 'requiredSectionIds', invalid).map((entry) => literalValue(entry, 'required section id', invalid)) : []\n const requiredDataContractIds = descriptor && operation !== 'hide'\n ? arrayField(descriptor, 'requiredDataContractIds', invalid).map((entry) => literalValue(entry, 'required data contract id', invalid)) : []\n const contribution: CrudFormSectionContributionFact = {\n id, address, operation, roundTripId,\n ...(requiredSectionIds.length ? { requiredSectionIds } : {}),\n ...(requiredDataContractIds.length ? { requiredDataContractIds } : {}),\n requiredCapabilities: [{ capabilityId: `${id}.compiled`, protocol: 'crud-form-sections/v1',\n modes: displayOnly ? ['display-only'] : ['domain-adapter'], mutationSurfaceIds: displayOnly ? [] : mutationIds,\n payloadPaths: (resultOwnership?.payloadPaths ?? []).filter((path) => !path.startsWith('extensions.')),\n customFieldOwnership: resultOwnership?.customFieldOwnership ?? { mode: 'none' } },\n ...sinks.map(({ capabilityId, fields }): CrudFormSectionContributionFact['requiredCapabilities'][number] => ({\n capabilityId, protocol: 'crud-form-sections/v1', modes: ['extension-sink'], mutationSurfaceIds: mutationIds,\n payloadPaths: fields.map(({ payloadPath }) => payloadPath!), allowAfterCommitSink: true,\n }))],\n }\n const dropped = (ownership?.payloadPaths ?? []).filter((leaf) => !resultOwnership?.payloadPaths.includes(leaf))\n const defaults = members.flatMap((owner) => owner.extension.defaults.filter(({ payloadPath, targets }) =>\n dropped.includes(payloadPath) && includesDefaultTarget(targets, target)).map(({ payloadPath, readsPayloadPaths, targets }) => ({\n owner, payloadPath, readsPayloadPaths, scoped: !!targets, id: `${id}.default-${digest(payloadPath).slice(0, 12)}`,\n })))\n const override: FormSectionOverride = change.operation === 'add'\n ? { ...explicitPlacement(change), contributionId: id } : { operation: operation as 'hide' | 'replace', contributionId: id }\n const result: CompiledChange = { id, source, target, override, ownership: displayOnly ? undefined : resultOwnership, contribution, file, defaults, sinks, fields: changedFields }\n const moduleContributions = contributionsByModule.get(module.moduleId) ?? []\n moduleContributions.push(result)\n contributionsByModule.set(module.moduleId, moduleContributions)\n const ownedDefinitionSet = resultOwnership?.customFieldOwnership.mode !== 'none'\n ? resultOwnership?.customFieldOwnership.definitionSetId : undefined\n runtimeFiles.push({ name: file, content: renderBrowserRuntime(result, runtime!, ownedDefinitionSet) })\n return result\n }\n\n const published = host.alternatives.filter((surface) => surfaceKey(surface) === key)\n const selections: CompiledChange[][] = []\n const effective: CompiledChange[] = []\n for (const [sectionId, authors] of [...groups.entries()].sort(([left], [right]) => compareSectionIds(left, right))) {\n authors.sort((left, right) => compareSectionIds(left.module.moduleId, right.module.moduleId))\n const alternatives = authors.map((author) => {\n const extensionId = author.extension.targets.length === 1 ? author.extension.id\n : `${author.extension.id}.${target.formVariant}.${target.formOperation}`\n return compile(author, [author], `${extensionId}.${sectionId}`)\n })\n const fieldIds = authors.flatMap(({ change }) => change.fields.map(({ id }) => id))\n const addedLeaves = alternatives.flatMap(({ fields }) => fields.flatMap(({ field, payloadPath }) =>\n field.operation === 'add' && payloadPath ? [payloadPath] : []))\n const canCompose = authors.length > 1 && authors.every(({ change }) => change.operation === 'modify')\n && new Set(fieldIds).size === fieldIds.length && !pathsOverlap(addedLeaves)\n const first = authors[0]\n const fallback = canCompose\n ? compile(first, authors, `${first.extension.id}.combined-${digest(alternatives.map(({ id }) => id)).slice(0, 12)}.${sectionId}`)\n : alternatives.length === 1 ? alternatives[0] : undefined\n const canonicalKey = overrideKey({ ...target, sectionId })\n const authoredResolutions = configured[canonicalKey]\n const explicit = Object.hasOwn(configured, canonicalKey)\n const choices = fallback && canCompose ? [...alternatives, fallback] : alternatives\n selections.push(choices)\n const choice = explicit\n ? authoredResolutions && choices.find(({ override }) => override.contributionId === authoredResolutions.contributionId\n && override.operation === authoredResolutions.operation)\n : fallback\n const selectedPrimitive = authoredResolutions\n ? primitiveClaims.get(authoredResolutions.contributionId) : undefined\n const selectsPrimitive = selectedPrimitive && overrideKey(selectedPrimitive.address) === canonicalKey\n && selectedPrimitive.operation === authoredResolutions?.operation\n if ((explicit && authoredResolutions && !choice && !selectsPrimitive) || (!explicit && !choice)) {\n invalid(`conflicting form section \"${canonicalKey}\" from ${authors.map(({ module }) => module.moduleId).join(', ')} requires an exact modules.ts selector or null`)\n }\n if (fallback) fallbacks[canonicalKey] = fallback.override\n if (choice) effective.push(choice)\n }\n\n for (const candidate of effective) for (const { customField, seed, authored } of candidate.fields) {\n if (!customField || !seed) continue\n const identity = canonicalSectionJson([customField.entityId, customField.key])\n const previous = seeds.get(identity)\n if (previous && (previous.moduleId !== authored.module.moduleId || canonicalSectionJson(previous.field) !== canonicalSectionJson(seed))) {\n invalid(`conflicting custom field seed \"${customField.entityId}/${customField.key}\" from ${previous.moduleId} and ${authored.module.moduleId}`)\n }\n seeds.set(identity, { moduleId: authored.module.moduleId, entity: customField.entityId, field: seed })\n }\n\n const effectiveDefaultKeys = new Set<string>()\n for (const candidate of effective) for (const value of candidate.defaults) {\n if (effectiveDefaultKeys.has(value.payloadPath)) invalid(`conflicting default for \"${value.payloadPath}\" in ${key}`)\n effectiveDefaultKeys.add(value.payloadPath)\n }\n for (const { extension } of changes) for (const { payloadPath: leaf, targets } of extension.defaults) {\n if (!includesDefaultTarget(targets, target)) continue\n if (!selections.flat().some(({ defaults }) => defaults.some(({ owner, payloadPath }) => owner.extension === extension && payloadPath === leaf))) {\n invalid(`default \"${leaf}\" is not bound to an omitted leaf of ${key}`)\n }\n }\n const numberOfSelections = selections.reduce((total, choices) => total * (choices.length + 1), published.length)\n if (numberOfSelections > maximumAlternatives) invalid(`host ${key} exceeds the ${maximumAlternatives} finite alternative limit (${numberOfSelections})`)\n const generated = alternativesByModule.get(hostModule.moduleId) ?? []\n const emitted = new Set<string>()\n function addAlternative(\n chosen: readonly CompiledChange[], original: CrudFormSectionSurfaceAlternativeFact,\n manual: ReadonlyMap<string, FormSectionOverride>, effectiveSelection = false,\n ): boolean {\n if (!chosen.length) return true\n if (chosen.some(({ contribution }) => manual.has(contribution.address.sectionId))) return false\n const overrides = new Map([...manual, ...chosen.map(({ contribution, override }) => [contribution.address.sectionId,\n effectiveSelection && configured[overrideKey(contribution.address)] || override] as const)])\n const orderedSectionIds = applyCrudFormSectionPlacements(baseline.orderedSectionIds, overrides)\n const active = new Map(original.ownershipFacts.map((item) => [item.sectionId, item]))\n for (const { ownership, contribution } of chosen) {\n if (ownership) active.set(ownership.sectionId, ownership)\n else active.delete(contribution.address.sectionId)\n }\n const ownershipFacts = [...active.values()]\n const custom = ownershipFacts.flatMap(({ customFieldOwnership }, index) => customFieldOwnership.mode === 'ids'\n ? customFieldOwnership.ids.map((id) => `customFields.${id}`)\n : customFieldOwnership.mode === 'all' ? [`customFields\\u0000${index}`] : [])\n const rules = chosen.flatMap(({ defaults }) => defaults)\n const genericTableTargets = chosen.flatMap(({ sinks }) => sinks.flatMap(({ fields }) =>\n fields[0].field.store?.kind === 'table' ? [fields[0].field.store.entityId] : []))\n if (new Set(genericTableTargets).size !== genericTableTargets.length) return false\n if (!orderedSectionIds || chosen.some(({ contribution }) => contribution.requiredSectionIds\n ?.some((sectionId) => !orderedSectionIds.includes(sectionId)))\n || pathsOverlap([...ownershipFacts.flatMap(({ payloadPaths }) => payloadPaths), ...custom])\n || (custom.some((name) => name.startsWith('customFields\\u0000')) && custom.length > 1)\n || new Set(rules.map(({ payloadPath }) => payloadPath)).size !== rules.length\n || rules.some(({ readsPayloadPaths }) => readsPayloadPaths.some((path) =>\n !ownershipFacts.some(({ payloadPaths }) => payloadPaths.includes(path))))) return false\n const contributionIds = [...original.contributionIds, ...chosen.map(({ id }) => id)].sort(compareSectionIds)\n const signature = canonicalSectionJson(contributionIds)\n if (emitted.has(signature)) return true\n emitted.add(signature)\n const selectedProof = original.clientMutationSurfaces?.some(({ kind }) => kind === 'parent-submit') ? original : proof!\n if (mutationIds.some((id) => !selectedProof.mutationSurfaceIds.includes(id))) return false\n const retryRoute = hostModule.derivedRoutes?.find(({ hostDescriptorId, outboxRetry }) => hostDescriptorId === host.id && outboxRetry)\n const outboxRetrySinkIds = retryRoute ? chosen.flatMap(({ sinks }) => sinks.flatMap(({ id, fields }) =>\n fields[0].field.store?.kind === 'external' ? [id] : [])) : []\n const retryFacts = outboxRetrySinkIds.map((sinkId) => projectCrudFormSectionClientMutationFact(\n derivedCrudFormSectionRetryFact({ sinkId, route: retryRoute!.routePath, resourceKind: host.hostResourceKind! })))\n const surface = {\n ...original, id: `${baseline.id}.compiled-${digest(contributionIds).slice(0, 12)}`,\n orderedSectionIds, contributionIds, ownershipFacts,\n mutationSurfaceIds: [...selectedProof.mutationSurfaceIds, ...retryFacts.map(({ id }) => id)],\n clientMutationSurfaces: retryFacts.length ? [...selectedProof.clientMutationSurfaces ?? [], ...retryFacts] : selectedProof.clientMutationSurfaces,\n dependencies: [...original.dependencies, ...chosen.flatMap(({ contribution }) => {\n const { id, requiredSectionIds = [], requiredDataContractIds = [] } = contribution\n return requiredSectionIds.length || requiredDataContractIds.length\n ? [{ consumerContributionId: id, requiredSectionIds, requiredDataContractIds }] : []\n })],\n }\n generated.push({ hostDescriptorId: host.id, proofAlternativeId: selectedProof.id, surface, defaultProviders: rules.map(({ id, payloadPath }) => ({ id, payloadPath })),\n ...(outboxRetrySinkIds.length ? { outboxRetrySinkIds } : {}) })\n host.alternatives = [...host.alternatives, surface]\n return true\n }\n function manualOverrides(original: CrudFormSectionSurfaceAlternativeFact): Map<string, FormSectionOverride> | null {\n const result = new Map<string, FormSectionOverride>()\n for (const id of original.contributionIds) {\n const claim = primitiveClaims.get(id)\n if (!claim || crudFormSectionHostKey(claim.address) !== key || result.has(claim.address.sectionId)) return null\n const address = overrideKey(claim.address)\n const configuredChoice = configured[address]\n const contributedChoice = primitiveOverrides[address]\n const selector = configuredChoice?.contributionId === id ? configuredChoice\n : contributedChoice?.contributionId === id ? contributedChoice\n : claim.operation === 'add' ? undefined : { operation: claim.operation, contributionId: id }\n if (!selector || selector.operation !== claim.operation) return null\n result.set(claim.address.sectionId, selector)\n }\n return canonicalSectionJson(applyCrudFormSectionPlacements(baseline.orderedSectionIds, result))\n === canonicalSectionJson(original.orderedSectionIds) ? result : null\n }\n const rawEffective = { ...primitiveOverrides, ...fallbacks, ...configured }\n const effectiveManual = Object.entries(rawEffective).flatMap(([address, override]) => {\n const claim = override && primitiveClaims.get(override.contributionId)\n return claim && crudFormSectionHostKey(claim.address) === key && overrideKey(claim.address) === address ? [claim.id] : []\n }).sort(compareSectionIds)\n const effectiveOriginal = published.find(({ contributionIds }) =>\n canonicalSectionJson([...contributionIds].sort(compareSectionIds)) === canonicalSectionJson(effectiveManual))\n const manual = effectiveOriginal && manualOverrides(effectiveOriginal)\n if (effective.length && (!effectiveOriginal || !manual || !addAlternative(effective, effectiveOriginal, manual, true))) {\n invalid(`effective alternatives for ${key} have conflicting fields, defaults, placement or unpublished handwritten contributions`)\n }\n for (const original of published) {\n const manual = manualOverrides(original)\n if (!manual) continue\n function walk(index: number, chosen: CompiledChange[]) {\n if (index === selections.length) {\n addAlternative(chosen, original, manual!)\n return\n }\n walk(index + 1, chosen)\n for (const candidate of selections[index]) walk(index + 1, [...chosen, candidate])\n }\n walk(0, [])\n }\n alternativesByModule.set(hostModule.moduleId, generated)\n }\n const revisionWrites = [...ledgers].flatMap(([moduleId, ledger]) => {\n const module = modules.find((entry) => entry.moduleId === moduleId)!\n const content = JSON.stringify(Object.fromEntries([...ledger.revisions.keys()].sort(compareSectionIds).map((id) => [id, ledger.revisions.get(id)])), null, 2) + '\\n'\n return module.authoredSource && content !== ledger.original ? [{ filename: ledger.filename, content }] : []\n })\n const customFieldSetsByModule = new Map<string, CustomFieldSet[]>()\n for (const { moduleId, entity, field } of seeds.values()) {\n const sets = customFieldSetsByModule.get(moduleId) ?? []\n const existing = sets.find((entry) => entry.entity === entity)\n if (existing) existing.fields.push(field)\n else sets.push({ entity, fields: [field], source: moduleId })\n customFieldSetsByModule.set(moduleId, sets)\n }\n return { contributionsByModule, alternativesByModule, runtimeFiles, revisionWrites, fallbacks, customFieldSetsByModule }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAC3B,OAAO,QAAQ;AACf,SAAS,4BAA4B,qBAAqB;AAC1D;AAAA,EACE;AAAA,EAAgC;AAAA,EAAsB;AAAA,EAAmB;AAAA,OACpE;AACP,SAAS,iCAAiC,gDAAgD;AAM1F,SAAS,yBAAyB;AAClC,SAAS,YAAY,qBAAqB,UAAU,aAAa,cAAc,cAAc,gCAAgC;AAC7H;AAAA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KAAK,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,OAAO,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI;AAChK,WAAO,OAAO,kBAAkB,YAAY,OAAO,WAAW,CAAC,EAAE,UAAU,OAAO,UAAU,QAAQ,CAAC,IAAI,CAAC;AAAA,EAC5G,CAAC;AACD,QAAM,0BAA0B,oBAAI,IAA8B;AAClE,aAAW,EAAE,UAAU,QAAQ,MAAM,KAAK,MAAM,OAAO,GAAG;AACxD,UAAM,OAAO,wBAAwB,IAAI,QAAQ,KAAK,CAAC;AACvD,UAAM,WAAW,KAAK,KAAK,CAAC,UAAU,MAAM,WAAW,MAAM;AAC7D,QAAI,SAAU,UAAS,OAAO,KAAK,KAAK;AAAA,QACnC,MAAK,KAAK,EAAE,QAAQ,QAAQ,CAAC,KAAK,GAAG,QAAQ,SAAS,CAAC;AAC5D,4BAAwB,IAAI,UAAU,IAAI;AAAA,EAC5C;AACA,SAAO,EAAE,uBAAuB,sBAAsB,cAAc,gBAAgB,WAAW,wBAAwB;AACzH;",
|
|
6
|
+
"names": ["compile", "invalid", "key", "path", "addAlternative", "manual", "manualOverrides", "host", "baseline", "walk"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import ts from "typescript-js";
|
|
4
|
+
import { normalizeCrudFormFieldRules } from "@open-mercato/shared/lib/crud/form-sections/field-rules";
|
|
5
|
+
import { symbolicIdSchema } from "@open-mercato/shared/lib/crud/form-sections/protocol";
|
|
6
|
+
import { arrayField, fieldsOf, literalData, literalValue, getLocalSectionInitializer, readSectionBuilder, unwrap } from "./form-section-ast.js";
|
|
7
|
+
import { MODULE_CODE_EXTENSIONS, stripModuleCodeExtension } from "./scanner.js";
|
|
8
|
+
function sectionSymbol(value, label, invalid) {
|
|
9
|
+
const parsed = symbolicIdSchema.safeParse(value);
|
|
10
|
+
return parsed.success ? parsed.data : invalid(`invalid ${label}`);
|
|
11
|
+
}
|
|
12
|
+
function formLeaf(value, label, invalid) {
|
|
13
|
+
return typeof value === "string" && /^[A-Za-z0-9_:-]+(?:\.[A-Za-z0-9_:-]+)*$/.test(value) && value.length <= 160 && !value.split(".").some((part) => ["constructor", "prototype", "__proto__"].includes(part)) ? value : invalid(`invalid ${label}`);
|
|
14
|
+
}
|
|
15
|
+
function labelKey(value, invalid) {
|
|
16
|
+
return typeof value === "string" && /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,191}$/.test(value) ? value : invalid("expected an i18n key");
|
|
17
|
+
}
|
|
18
|
+
function optionalLiteral(value, invalid) {
|
|
19
|
+
return value === void 0 ? void 0 : literalData(value, invalid);
|
|
20
|
+
}
|
|
21
|
+
function safePlacement(fields, invalid) {
|
|
22
|
+
if (fields.has("before") && fields.has("after")) return invalid("before and after cannot both be specified");
|
|
23
|
+
return Object.fromEntries(["before", "after"].flatMap((key) => fields.has(key) ? [[key, sectionSymbol(optionalLiteral(fields.get(key), invalid), key, invalid)]] : []));
|
|
24
|
+
}
|
|
25
|
+
function browserLoader(input, sourceBase, importBase, invalid) {
|
|
26
|
+
const arrow = unwrap(input);
|
|
27
|
+
if (!ts.isArrowFunction(arrow) || arrow.parameters.length || ts.isBlock(arrow.body)) {
|
|
28
|
+
return invalid("browser loaders must be zero-argument arrows returning literal imports");
|
|
29
|
+
}
|
|
30
|
+
const call = unwrap(arrow.body);
|
|
31
|
+
if (!ts.isCallExpression(call) || call.expression.kind !== ts.SyntaxKind.ImportKeyword || call.arguments.length !== 1) {
|
|
32
|
+
return invalid("browser loader must use a literal dynamic import");
|
|
33
|
+
}
|
|
34
|
+
const specifier = literalValue(call.arguments[0], "browser loader", invalid);
|
|
35
|
+
const relative = stripModuleCodeExtension(path.posix.normalize(specifier));
|
|
36
|
+
if (!specifier.startsWith("./") || specifier.includes("\\") || relative.startsWith("../") || !relative.endsWith(".client")) {
|
|
37
|
+
return invalid(`browser import "${specifier}" must resolve to an owning-module .client file`);
|
|
38
|
+
}
|
|
39
|
+
const candidate = MODULE_CODE_EXTENSIONS.map((extension) => path.join(sourceBase, relative + extension)).find((filename) => fs.existsSync(filename));
|
|
40
|
+
if (!candidate) return invalid(`browser import "${specifier}" does not exist`);
|
|
41
|
+
const fromBase = path.relative(fs.realpathSync(sourceBase), fs.realpathSync(candidate));
|
|
42
|
+
if (fromBase.startsWith(".." + path.sep) || path.isAbsolute(fromBase)) return invalid("browser import escapes its module");
|
|
43
|
+
return {
|
|
44
|
+
importPath: importBase + "/" + relative,
|
|
45
|
+
source: ts.createSourceFile(candidate, fs.readFileSync(candidate, "utf8"), ts.ScriptTarget.Latest, true)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function readStore(input, fieldOverride, invalid) {
|
|
49
|
+
const { name, args } = readSectionBuilder(input, invalid);
|
|
50
|
+
switch (name) {
|
|
51
|
+
case "store.customField":
|
|
52
|
+
if (args.length <= 1) return {
|
|
53
|
+
kind: "customField",
|
|
54
|
+
fieldOverride,
|
|
55
|
+
...args[0] ? { key: formLeaf(literalData(args[0], invalid), "custom-field key", invalid) } : {}
|
|
56
|
+
};
|
|
57
|
+
break;
|
|
58
|
+
case "store.table":
|
|
59
|
+
if (args.length === 1) {
|
|
60
|
+
return { kind: "table", fieldOverride, entityId: sectionSymbol(literalData(args[0], invalid), "store entity", invalid) };
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
case "store.sink":
|
|
64
|
+
case "store.external":
|
|
65
|
+
if (args.length === 1) {
|
|
66
|
+
const configuration = unwrap(args[0]);
|
|
67
|
+
if (!ts.isObjectLiteralExpression(configuration)) break;
|
|
68
|
+
const propertyName = name === "store.sink" ? "entityId" : "mirror";
|
|
69
|
+
const property = configuration.properties.find((candidate) => ts.isPropertyAssignment(candidate) && (ts.isIdentifier(candidate.name) || ts.isStringLiteralLike(candidate.name)) && candidate.name.text === propertyName);
|
|
70
|
+
const entityId = sectionSymbol(property && literalData(property.initializer, invalid), "store entity", invalid);
|
|
71
|
+
return { kind: name === "store.sink" ? "sink" : "external", fieldOverride, entityId };
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
return invalid(`invalid store builder "${name}"`);
|
|
76
|
+
}
|
|
77
|
+
function parseFields(input, sectionStore, sourceBase, importBase, invalid) {
|
|
78
|
+
if (!input) return invalid("missing field declarations");
|
|
79
|
+
return [...fieldsOf(input, invalid)].map(([fieldId, declaration]) => {
|
|
80
|
+
const id = formLeaf(fieldId, "field id", invalid);
|
|
81
|
+
const { name, args } = readSectionBuilder(declaration, invalid);
|
|
82
|
+
if (name === "field.remove" && !args.length) return { id, operation: "remove", browser: {}, loaders: {}, rules: [], server: false };
|
|
83
|
+
if (name !== "field.add" && name !== "field.patch" || args.length !== 1) return invalid(`invalid builder for field "${id}"`);
|
|
84
|
+
const operation = name === "field.add" ? "add" : "patch";
|
|
85
|
+
const fields = fieldsOf(args[0], invalid);
|
|
86
|
+
const browser = safePlacement(fields, invalid);
|
|
87
|
+
const loaders = {};
|
|
88
|
+
const store = operation === "add" ? fields.get("store") ? readStore(fields.get("store"), true, invalid) : sectionStore ?? { kind: "customField", fieldOverride: false } : void 0;
|
|
89
|
+
for (const [key, value] of fields) {
|
|
90
|
+
if (["before", "after", "validate", "store"].includes(key)) continue;
|
|
91
|
+
if (key === "labelKey") browser[key] = labelKey(optionalLiteral(value, invalid), invalid);
|
|
92
|
+
else if (key === "options" && ts.isArrowFunction(unwrap(value))) loaders.options = browserLoader(value, sourceBase, importBase, invalid);
|
|
93
|
+
else if (key === "customComponent") loaders.component = browserLoader(value, sourceBase, importBase, invalid);
|
|
94
|
+
else if (["type", "required", "options", "readOnly", "visibleWhen", "optionsCacheTtl"].includes(key)) browser[key] = literalData(value, invalid);
|
|
95
|
+
else invalid(`unsupported field option "${key}"`);
|
|
96
|
+
}
|
|
97
|
+
if (operation === "add" && !["text", "textarea", "number", "boolean", "select", "date", "custom"].includes(String(browser.type))) {
|
|
98
|
+
invalid(`unsupported field type for "${id}"`);
|
|
99
|
+
}
|
|
100
|
+
if (operation === "patch" && (fields.has("type") || fields.has("required") || fields.has("store") || loaders.component)) {
|
|
101
|
+
invalid(`cannot replace the schema or storage of field "${id}" using patch`);
|
|
102
|
+
}
|
|
103
|
+
const rules = [];
|
|
104
|
+
const validation = fields.get("validate");
|
|
105
|
+
let server = false;
|
|
106
|
+
if (validation) {
|
|
107
|
+
const values = fieldsOf(validation, invalid);
|
|
108
|
+
const callback = values.get("client");
|
|
109
|
+
if (callback) loaders.clientRule = browserLoader(callback, sourceBase, importBase, invalid);
|
|
110
|
+
server = values.has("server");
|
|
111
|
+
for (const rule of arrayField(values, "rules", invalid)) rules.push(literalData(rule, invalid));
|
|
112
|
+
const inline = Object.fromEntries([...values].filter(([key]) => !["client", "server", "rules"].includes(key)).map(([key, value]) => [key, literalData(value, invalid)]));
|
|
113
|
+
if (Object.keys(inline).length) rules.push(inline);
|
|
114
|
+
}
|
|
115
|
+
for (const rule of rules) labelKey(rule.messageKey, invalid);
|
|
116
|
+
const normalized = normalizeCrudFormFieldRules(rules);
|
|
117
|
+
if (rules.length) browser.rules = rules;
|
|
118
|
+
return { id, operation, browser, loaders, rules: normalized, server, store };
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function inferDefaultReads(syntax, invalid) {
|
|
122
|
+
const input = unwrap(syntax);
|
|
123
|
+
const definition = ts.isIdentifier(input) ? getLocalSectionInitializer(input.getSourceFile(), input.text) ?? input.getSourceFile().statements.find((statement) => ts.isFunctionDeclaration(statement) && statement.name?.text === input.text) : input;
|
|
124
|
+
if (!definition || !ts.isArrowFunction(definition) && !ts.isFunctionExpression(definition) && !ts.isFunctionDeclaration(definition)) {
|
|
125
|
+
return invalid("a default must name a local callback with explicit payload reads");
|
|
126
|
+
}
|
|
127
|
+
const param = definition.parameters[0]?.name;
|
|
128
|
+
if (!param || !definition.body) return [];
|
|
129
|
+
const aliases = /* @__PURE__ */ new Set();
|
|
130
|
+
const contextName = ts.isIdentifier(param) ? param.text : null;
|
|
131
|
+
if (ts.isObjectBindingPattern(param)) for (const binding of param.elements) {
|
|
132
|
+
if ((binding.propertyName ?? binding.name).getText().replace(/^['"]|['"]$/g, "") === "payload") {
|
|
133
|
+
if (!ts.isIdentifier(binding.name)) return invalid("default payload binding must be a named object");
|
|
134
|
+
aliases.add(binding.name.text);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const paths = /* @__PURE__ */ new Set();
|
|
138
|
+
function chain(node) {
|
|
139
|
+
if (ts.isIdentifier(node)) return { base: node.text, parts: [] };
|
|
140
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
141
|
+
const prefix = chain(node.expression);
|
|
142
|
+
return prefix && { ...prefix, parts: [...prefix.parts, node.name.text] };
|
|
143
|
+
}
|
|
144
|
+
if (ts.isElementAccessExpression(node) && ts.isStringLiteralLike(node.argumentExpression)) {
|
|
145
|
+
const prefix = chain(node.expression);
|
|
146
|
+
return prefix && { ...prefix, parts: [...prefix.parts, node.argumentExpression.text] };
|
|
147
|
+
}
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
function visit(node) {
|
|
151
|
+
if ((ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) && (!node.parent || !(ts.isPropertyAccessExpression(node.parent) || ts.isElementAccessExpression(node.parent)) || node.parent.expression !== node)) {
|
|
152
|
+
const access = chain(node);
|
|
153
|
+
if (access) {
|
|
154
|
+
const leaf = aliases.has(access.base) ? access.parts : access.base === contextName && access.parts[0] === "payload" ? access.parts.slice(1) : void 0;
|
|
155
|
+
if (leaf) {
|
|
156
|
+
if (!leaf.length) invalid("default must read a concrete payload path");
|
|
157
|
+
paths.add(formLeaf(leaf.join("."), "default payload read", invalid));
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (ts.isIdentifier(node) && aliases.has(node.text)) invalid("default cannot use its whole payload or a computed payload path");
|
|
163
|
+
if (ts.isIdentifier(node) && node.text === contextName && (!ts.isPropertyAccessExpression(node.parent) || node.parent.expression !== node)) {
|
|
164
|
+
invalid("default cannot use a computed context path");
|
|
165
|
+
}
|
|
166
|
+
ts.forEachChild(node, visit);
|
|
167
|
+
}
|
|
168
|
+
visit(definition.body);
|
|
169
|
+
return [...paths].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
170
|
+
}
|
|
171
|
+
function parseSectionExtensionSources(initializer, sourceBase, importPath, invalid) {
|
|
172
|
+
if (!initializer) return [];
|
|
173
|
+
const array = unwrap(initializer);
|
|
174
|
+
if (!ts.isArrayLiteralExpression(array)) return invalid("crudFormExtensions must be a literal array");
|
|
175
|
+
const importBase = importPath.slice(0, importPath.lastIndexOf("/"));
|
|
176
|
+
const hosts = /* @__PURE__ */ new Set();
|
|
177
|
+
return array.elements.map((syntax, index) => {
|
|
178
|
+
const { name, args } = readSectionBuilder(syntax, invalid);
|
|
179
|
+
if (name !== "defineCrudFormExtension" || args.length !== 1) return invalid("expected defineCrudFormExtension with one argument");
|
|
180
|
+
const fields = fieldsOf(args[0], invalid);
|
|
181
|
+
if ([...fields.keys()].some((key) => !["id", "host", "targets", "sections", "defaults"].includes(key))) return invalid("unexpected extension property");
|
|
182
|
+
const id = sectionSymbol(optionalLiteral(fields.get("id"), invalid), "extension id", invalid);
|
|
183
|
+
const host = literalValue(fields.get("host"), "host spot", invalid);
|
|
184
|
+
if (!host.startsWith("crud-form:")) return invalid("extension host must be a crud-form: spot");
|
|
185
|
+
const hostId = sectionSymbol(host.slice("crud-form:".length), "host id", invalid);
|
|
186
|
+
if (hosts.has(hostId)) return invalid(`multiple extension definitions for host "${hostId}" in one module`);
|
|
187
|
+
hosts.add(hostId);
|
|
188
|
+
function readTargets(fieldMap) {
|
|
189
|
+
const entries = arrayField(fieldMap, "targets", invalid).map((target) => {
|
|
190
|
+
const fields2 = fieldsOf(target, invalid);
|
|
191
|
+
const formVariant = sectionSymbol(optionalLiteral(fields2.get("formVariant"), invalid), "form variant", invalid);
|
|
192
|
+
const formOperation = optionalLiteral(fields2.get("formOperation"), invalid);
|
|
193
|
+
if (fields2.size !== 2 || formOperation !== "create" && formOperation !== "update") return invalid("invalid extension target");
|
|
194
|
+
return { formVariant, formOperation };
|
|
195
|
+
});
|
|
196
|
+
if (!entries.length || entries.length !== new Set(entries.map(({ formVariant, formOperation }) => formVariant + "/" + formOperation)).size) {
|
|
197
|
+
return invalid("expected unique extension targets");
|
|
198
|
+
}
|
|
199
|
+
return entries;
|
|
200
|
+
}
|
|
201
|
+
const targets = readTargets(fields);
|
|
202
|
+
const raw = fields.get("sections");
|
|
203
|
+
if (!raw) return invalid("missing extension sections");
|
|
204
|
+
const changes = [...fieldsOf(raw, invalid)].map(([sectionId, declaration]) => {
|
|
205
|
+
const id2 = sectionSymbol(sectionId, "section id", invalid);
|
|
206
|
+
const { name: name2, args: args2 } = readSectionBuilder(declaration, invalid);
|
|
207
|
+
const base = { id: id2, fields: [], syntax: declaration };
|
|
208
|
+
if (name2 === "hide" && !args2.length) return { ...base, operation: "hide" };
|
|
209
|
+
if (name2 === "replace" && args2.length === 1) {
|
|
210
|
+
return { ...base, operation: "replace", replacement: browserLoader(args2[0], sourceBase, importBase, invalid) };
|
|
211
|
+
}
|
|
212
|
+
if (name2 !== "modify" && name2 !== "add" || args2.length !== 1) return invalid(`invalid section builder for "${id2}"`);
|
|
213
|
+
const opts = fieldsOf(args2[0], invalid);
|
|
214
|
+
if ([...opts.keys()].some((key) => !(name2 === "add" ? ["fields", "before", "after", "store", "titleKey"] : ["fields"]).includes(key))) {
|
|
215
|
+
return invalid(`unsupported options for section "${id2}"`);
|
|
216
|
+
}
|
|
217
|
+
const sectionStore = opts.get("store") ? readStore(opts.get("store"), false, invalid) : void 0;
|
|
218
|
+
const projected = parseFields(opts.get("fields"), sectionStore, sourceBase, importBase, invalid);
|
|
219
|
+
const titleKey = opts.get("titleKey") ? labelKey(optionalLiteral(opts.get("titleKey"), invalid), invalid) : void 0;
|
|
220
|
+
if (!projected.length && (name2 === "modify" || !titleKey) || name2 === "add" && projected.some(({ operation }) => operation !== "add")) return invalid("invalid empty or non-add field declaration");
|
|
221
|
+
return { ...base, ...safePlacement(opts, invalid), operation: name2, fields: projected, titleKey };
|
|
222
|
+
});
|
|
223
|
+
if (!changes.length) return invalid("expected at least one section change");
|
|
224
|
+
const defaultMap = fields.get("defaults");
|
|
225
|
+
const defaults = defaultMap ? [...fieldsOf(defaultMap, invalid)].map(([key, syntax2]) => {
|
|
226
|
+
const payloadPath = formLeaf(key, "default payload path", invalid);
|
|
227
|
+
const value = unwrap(syntax2);
|
|
228
|
+
if (!ts.isObjectLiteralExpression(value)) return { payloadPath, syntax: syntax2, readsPayloadPaths: inferDefaultReads(value, invalid) };
|
|
229
|
+
const defaultFields = fieldsOf(value, invalid);
|
|
230
|
+
const resolve = defaultFields.get("resolve");
|
|
231
|
+
if (defaultFields.size !== 2 || !resolve) return invalid("expected scoped default targets and resolve callback");
|
|
232
|
+
const scopedTargets = readTargets(defaultFields);
|
|
233
|
+
if (scopedTargets.some((target) => !targets.some(({ formVariant, formOperation }) => formVariant === target.formVariant && formOperation === target.formOperation))) {
|
|
234
|
+
return invalid("scoped default targets must belong to the extension");
|
|
235
|
+
}
|
|
236
|
+
return { payloadPath, syntax: syntax2, targets: scopedTargets, readsPayloadPaths: inferDefaultReads(resolve, invalid) };
|
|
237
|
+
}) : [];
|
|
238
|
+
return { index, id, hostId, targets, changes, defaults, syntax };
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
export {
|
|
242
|
+
parseSectionExtensionSources,
|
|
243
|
+
sectionSymbol
|
|
244
|
+
};
|
|
245
|
+
//# sourceMappingURL=form-section-extension-source.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/generators/form-section-extension-source.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport ts from 'typescript-js'\nimport { normalizeCrudFormFieldRules, type CrudFormDeclarativeFieldConstraint } from '@open-mercato/shared/lib/crud/form-sections/field-rules'\nimport { symbolicIdSchema } from '@open-mercato/shared/lib/crud/form-sections/protocol'\nimport type { CrudFormSectionAddress } from '@open-mercato/shared/modules/form-section-facts'\nimport { arrayField, fieldsOf, literalData, literalValue, getLocalSectionInitializer, readSectionBuilder, unwrap } from './form-section-ast'\nimport { MODULE_CODE_EXTENSIONS, stripModuleCodeExtension } from './scanner'\n\ntype Invalid = (reason: string) => never\ntype SourceTarget = Pick<CrudFormSectionAddress, 'formVariant' | 'formOperation'>\nexport type SectionBrowserLoader = { importPath: string; source: ts.SourceFile }\nexport type SectionExtensionStore = { kind: 'customField' | 'table' | 'sink' | 'external'; key?: string; entityId?: string; fieldOverride: boolean }\n\nexport type SectionExtensionField = {\n id: string\n operation: 'add' | 'patch' | 'remove'\n browser: Record<string, unknown>\n loaders: Partial<Record<'options' | 'clientRule' | 'component', SectionBrowserLoader>>\n rules: ReturnType<typeof normalizeCrudFormFieldRules>\n server: boolean\n store?: SectionExtensionStore\n}\n\nexport type SectionExtensionChange = {\n id: string\n operation: 'add' | 'hide' | 'modify' | 'replace'\n before?: string\n after?: string\n titleKey?: string\n replacement?: SectionBrowserLoader\n fields: SectionExtensionField[]\n syntax: ts.Expression\n}\n\nexport type SectionExtensionSource = {\n index: number\n id: string\n hostId: string\n targets: SourceTarget[]\n changes: SectionExtensionChange[]\n defaults: readonly { payloadPath: string; syntax: ts.Expression; readsPayloadPaths: readonly string[]; targets?: readonly SourceTarget[] }[]\n syntax: ts.Expression\n}\n\nexport function sectionSymbol(value: unknown, label: string, invalid: Invalid): string {\n const parsed = symbolicIdSchema.safeParse(value)\n return parsed.success ? parsed.data : invalid(`invalid ${label}`)\n}\n\nfunction formLeaf(value: unknown, label: string, invalid: Invalid): string {\n return typeof value === 'string' && /^[A-Za-z0-9_:-]+(?:\\.[A-Za-z0-9_:-]+)*$/.test(value)\n && value.length <= 160 && !value.split('.').some((part) => ['constructor', 'prototype', '__proto__'].includes(part))\n ? value : invalid(`invalid ${label}`)\n}\n\nfunction labelKey(value: unknown, invalid: Invalid): string {\n return typeof value === 'string' && /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,191}$/.test(value)\n ? value : invalid('expected an i18n key')\n}\n\nfunction optionalLiteral(value: ts.Expression | undefined, invalid: Invalid): unknown {\n return value === undefined ? undefined : literalData(value, invalid)\n}\n\nfunction safePlacement(fields: Map<string, ts.Expression>, invalid: Invalid): { before?: string; after?: string } {\n if (fields.has('before') && fields.has('after')) return invalid('before and after cannot both be specified')\n return Object.fromEntries(['before', 'after'].flatMap((key) => fields.has(key)\n ? [[key, sectionSymbol(optionalLiteral(fields.get(key), invalid), key, invalid)]] : []))\n}\n\nfunction browserLoader(\n input: ts.Expression, sourceBase: string, importBase: string, invalid: Invalid,\n): SectionBrowserLoader {\n const arrow = unwrap(input)\n if (!ts.isArrowFunction(arrow) || arrow.parameters.length || ts.isBlock(arrow.body)) {\n return invalid('browser loaders must be zero-argument arrows returning literal imports')\n }\n const call = unwrap(arrow.body)\n if (!ts.isCallExpression(call) || call.expression.kind !== ts.SyntaxKind.ImportKeyword || call.arguments.length !== 1) {\n return invalid('browser loader must use a literal dynamic import')\n }\n const specifier = literalValue(call.arguments[0], 'browser loader', invalid)\n const relative = stripModuleCodeExtension(path.posix.normalize(specifier))\n if (!specifier.startsWith('./') || specifier.includes('\\\\') || relative.startsWith('../') || !relative.endsWith('.client')) {\n return invalid(`browser import \"${specifier}\" must resolve to an owning-module .client file`)\n }\n const candidate = MODULE_CODE_EXTENSIONS.map((extension) => path.join(sourceBase, relative + extension))\n .find((filename) => fs.existsSync(filename))\n if (!candidate) return invalid(`browser import \"${specifier}\" does not exist`)\n const fromBase = path.relative(fs.realpathSync(sourceBase), fs.realpathSync(candidate))\n if (fromBase.startsWith('..' + path.sep) || path.isAbsolute(fromBase)) return invalid('browser import escapes its module')\n return {\n importPath: importBase + '/' + relative,\n source: ts.createSourceFile(candidate, fs.readFileSync(candidate, 'utf8'), ts.ScriptTarget.Latest, true),\n }\n}\n\nfunction readStore(input: ts.Expression, fieldOverride: boolean, invalid: Invalid): SectionExtensionStore {\n const { name, args } = readSectionBuilder(input, invalid)\n switch (name) {\n case 'store.customField':\n if (args.length <= 1) return { kind: 'customField', fieldOverride,\n ...(args[0] ? { key: formLeaf(literalData(args[0], invalid), 'custom-field key', invalid) } : {}) }\n break\n case 'store.table':\n if (args.length === 1) {\n return { kind: 'table', fieldOverride, entityId: sectionSymbol(literalData(args[0], invalid), 'store entity', invalid) }\n }\n break\n case 'store.sink':\n case 'store.external':\n if (args.length === 1) {\n const configuration = unwrap(args[0])\n if (!ts.isObjectLiteralExpression(configuration)) break\n const propertyName = name === 'store.sink' ? 'entityId' : 'mirror'\n const property = configuration.properties.find((candidate): candidate is ts.PropertyAssignment =>\n ts.isPropertyAssignment(candidate) && (ts.isIdentifier(candidate.name) || ts.isStringLiteralLike(candidate.name))\n && candidate.name.text === propertyName)\n const entityId = sectionSymbol(property && literalData(property.initializer, invalid), 'store entity', invalid)\n return { kind: name === 'store.sink' ? 'sink' : 'external', fieldOverride, entityId }\n }\n break\n }\n return invalid(`invalid store builder \"${name}\"`)\n}\n\nfunction parseFields(\n input: ts.Expression | undefined, sectionStore: SectionExtensionStore | undefined,\n sourceBase: string, importBase: string, invalid: Invalid,\n): SectionExtensionField[] {\n if (!input) return invalid('missing field declarations')\n return [...fieldsOf(input, invalid)].map(([fieldId, declaration]) => {\n const id = formLeaf(fieldId, 'field id', invalid)\n const { name, args } = readSectionBuilder(declaration, invalid)\n if (name === 'field.remove' && !args.length) return { id, operation: 'remove', browser: {}, loaders: {}, rules: [], server: false }\n if ((name !== 'field.add' && name !== 'field.patch') || args.length !== 1) return invalid(`invalid builder for field \"${id}\"`)\n const operation = name === 'field.add' ? 'add' : 'patch'\n const fields = fieldsOf(args[0], invalid)\n const browser: Record<string, unknown> = safePlacement(fields, invalid)\n const loaders: SectionExtensionField['loaders'] = {}\n const store = operation === 'add'\n ? fields.get('store') ? readStore(fields.get('store')!, true, invalid) : sectionStore ?? { kind: 'customField' as const, fieldOverride: false }\n : undefined\n for (const [key, value] of fields) {\n if (['before', 'after', 'validate', 'store'].includes(key)) continue\n if (key === 'labelKey') browser[key] = labelKey(optionalLiteral(value, invalid), invalid)\n else if (key === 'options' && ts.isArrowFunction(unwrap(value))) loaders.options = browserLoader(value, sourceBase, importBase, invalid)\n else if (key === 'customComponent') loaders.component = browserLoader(value, sourceBase, importBase, invalid)\n else if (['type', 'required', 'options', 'readOnly', 'visibleWhen', 'optionsCacheTtl'].includes(key)) browser[key] = literalData(value, invalid)\n else invalid(`unsupported field option \"${key}\"`)\n }\n if (operation === 'add' && !['text', 'textarea', 'number', 'boolean', 'select', 'date', 'custom'].includes(String(browser.type))) {\n invalid(`unsupported field type for \"${id}\"`)\n }\n if (operation === 'patch' && (fields.has('type') || fields.has('required') || fields.has('store') || loaders.component)) {\n invalid(`cannot replace the schema or storage of field \"${id}\" using patch`)\n }\n const rules: CrudFormDeclarativeFieldConstraint[] = []\n const validation = fields.get('validate')\n let server = false\n if (validation) {\n const values = fieldsOf(validation, invalid)\n const callback = values.get('client')\n if (callback) loaders.clientRule = browserLoader(callback, sourceBase, importBase, invalid)\n server = values.has('server')\n for (const rule of arrayField(values, 'rules', invalid)) rules.push(literalData(rule, invalid) as CrudFormDeclarativeFieldConstraint)\n const inline = Object.fromEntries([...values].filter(([key]) => !['client', 'server', 'rules'].includes(key))\n .map(([key, value]) => [key, literalData(value, invalid)]))\n if (Object.keys(inline).length) rules.push(inline as CrudFormDeclarativeFieldConstraint)\n }\n for (const rule of rules) labelKey(rule.messageKey, invalid)\n const normalized = normalizeCrudFormFieldRules(rules)\n if (rules.length) browser.rules = rules\n return { id, operation, browser, loaders, rules: normalized, server, store }\n })\n}\n\nfunction inferDefaultReads(syntax: ts.Expression, invalid: Invalid): string[] {\n const input = unwrap(syntax)\n const definition = ts.isIdentifier(input) ? getLocalSectionInitializer(input.getSourceFile(), input.text)\n ?? input.getSourceFile().statements.find((statement): statement is ts.FunctionDeclaration =>\n ts.isFunctionDeclaration(statement) && statement.name?.text === input.text) : input\n if (!definition || (!ts.isArrowFunction(definition) && !ts.isFunctionExpression(definition) && !ts.isFunctionDeclaration(definition))) {\n return invalid('a default must name a local callback with explicit payload reads')\n }\n const param = definition.parameters[0]?.name\n if (!param || !definition.body) return []\n const aliases = new Set<string>()\n const contextName = ts.isIdentifier(param) ? param.text : null\n if (ts.isObjectBindingPattern(param)) for (const binding of param.elements) {\n if ((binding.propertyName ?? binding.name).getText().replace(/^['\"]|['\"]$/g, '') === 'payload') {\n if (!ts.isIdentifier(binding.name)) return invalid('default payload binding must be a named object')\n aliases.add(binding.name.text)\n }\n }\n const paths = new Set<string>()\n function chain(node: ts.Node): { base: string; parts: string[] } | null {\n if (ts.isIdentifier(node)) return { base: node.text, parts: [] }\n if (ts.isPropertyAccessExpression(node)) {\n const prefix = chain(node.expression)\n return prefix && { ...prefix, parts: [...prefix.parts, node.name.text] }\n }\n if (ts.isElementAccessExpression(node) && ts.isStringLiteralLike(node.argumentExpression)) {\n const prefix = chain(node.expression)\n return prefix && { ...prefix, parts: [...prefix.parts, node.argumentExpression.text] }\n }\n return null\n }\n function visit(node: ts.Node): void {\n if ((ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node))\n && (!node.parent || !(ts.isPropertyAccessExpression(node.parent) || ts.isElementAccessExpression(node.parent))\n || node.parent.expression !== node)) {\n const access = chain(node)\n if (access) {\n const leaf = aliases.has(access.base) ? access.parts\n : access.base === contextName && access.parts[0] === 'payload' ? access.parts.slice(1) : undefined\n if (leaf) {\n if (!leaf.length) invalid('default must read a concrete payload path')\n paths.add(formLeaf(leaf.join('.'), 'default payload read', invalid))\n return\n }\n }\n }\n if (ts.isIdentifier(node) && aliases.has(node.text)) invalid('default cannot use its whole payload or a computed payload path')\n if (ts.isIdentifier(node) && node.text === contextName && (!ts.isPropertyAccessExpression(node.parent) || node.parent.expression !== node)) {\n invalid('default cannot use a computed context path')\n }\n ts.forEachChild(node, visit)\n }\n visit(definition.body)\n return [...paths].sort((left, right) => left < right ? -1 : left > right ? 1 : 0)\n}\n\nexport function parseSectionExtensionSources(\n initializer: ts.Expression | undefined, sourceBase: string, importPath: string, invalid: Invalid,\n): SectionExtensionSource[] {\n if (!initializer) return []\n const array = unwrap(initializer)\n if (!ts.isArrayLiteralExpression(array)) return invalid('crudFormExtensions must be a literal array')\n const importBase = importPath.slice(0, importPath.lastIndexOf('/'))\n const hosts = new Set<string>()\n return array.elements.map((syntax, index) => {\n const { name, args } = readSectionBuilder(syntax, invalid)\n if (name !== 'defineCrudFormExtension' || args.length !== 1) return invalid('expected defineCrudFormExtension with one argument')\n const fields = fieldsOf(args[0], invalid)\n if ([...fields.keys()].some((key) => !['id', 'host', 'targets', 'sections', 'defaults'].includes(key))) return invalid('unexpected extension property')\n const id = sectionSymbol(optionalLiteral(fields.get('id'), invalid), 'extension id', invalid)\n const host = literalValue(fields.get('host'), 'host spot', invalid)\n if (!host.startsWith('crud-form:')) return invalid('extension host must be a crud-form: spot')\n const hostId = sectionSymbol(host.slice('crud-form:'.length), 'host id', invalid)\n if (hosts.has(hostId)) return invalid(`multiple extension definitions for host \"${hostId}\" in one module`)\n hosts.add(hostId)\n function readTargets(fieldMap: Map<string, ts.Expression>): SourceTarget[] {\n const entries = arrayField(fieldMap, 'targets', invalid).map((target): SourceTarget => {\n const fields = fieldsOf(target, invalid)\n const formVariant = sectionSymbol(optionalLiteral(fields.get('formVariant'), invalid), 'form variant', invalid)\n const formOperation = optionalLiteral(fields.get('formOperation'), invalid)\n if (fields.size !== 2 || (formOperation !== 'create' && formOperation !== 'update')) return invalid('invalid extension target')\n return { formVariant, formOperation }\n })\n if (!entries.length || entries.length !== new Set(entries.map(({ formVariant, formOperation }) => formVariant + '/' + formOperation)).size) {\n return invalid('expected unique extension targets')\n }\n return entries\n }\n const targets = readTargets(fields)\n const raw = fields.get('sections')\n if (!raw) return invalid('missing extension sections')\n const changes = [...fieldsOf(raw, invalid)].map(([sectionId, declaration]): SectionExtensionChange => {\n const id = sectionSymbol(sectionId, 'section id', invalid)\n const { name, args } = readSectionBuilder(declaration, invalid)\n const base = { id, fields: [], syntax: declaration }\n if (name === 'hide' && !args.length) return { ...base, operation: 'hide' }\n if (name === 'replace' && args.length === 1) {\n return { ...base, operation: 'replace', replacement: browserLoader(args[0], sourceBase, importBase, invalid) }\n }\n if ((name !== 'modify' && name !== 'add') || args.length !== 1) return invalid(`invalid section builder for \"${id}\"`)\n const opts = fieldsOf(args[0], invalid)\n if ([...opts.keys()].some((key) => !(name === 'add' ? ['fields', 'before', 'after', 'store', 'titleKey'] : ['fields']).includes(key))) {\n return invalid(`unsupported options for section \"${id}\"`)\n }\n const sectionStore = opts.get('store') ? readStore(opts.get('store')!, false, invalid) : undefined\n const projected = parseFields(opts.get('fields'), sectionStore, sourceBase, importBase, invalid)\n const titleKey = opts.get('titleKey') ? labelKey(optionalLiteral(opts.get('titleKey'), invalid), invalid) : undefined\n if ((!projected.length && (name === 'modify' || !titleKey))\n || (name === 'add' && projected.some(({ operation }) => operation !== 'add'))) return invalid('invalid empty or non-add field declaration')\n return { ...base, ...safePlacement(opts, invalid), operation: name, fields: projected, titleKey }\n })\n if (!changes.length) return invalid('expected at least one section change')\n const defaultMap = fields.get('defaults')\n const defaults = defaultMap ? [...fieldsOf(defaultMap, invalid)].map(([key, syntax]) => {\n const payloadPath = formLeaf(key, 'default payload path', invalid)\n const value = unwrap(syntax)\n if (!ts.isObjectLiteralExpression(value)) return { payloadPath, syntax, readsPayloadPaths: inferDefaultReads(value, invalid) }\n const defaultFields = fieldsOf(value, invalid)\n const resolve = defaultFields.get('resolve')\n if (defaultFields.size !== 2 || !resolve) return invalid('expected scoped default targets and resolve callback')\n const scopedTargets = readTargets(defaultFields)\n if (scopedTargets.some((target) => !targets.some(({ formVariant, formOperation }) =>\n formVariant === target.formVariant && formOperation === target.formOperation))) {\n return invalid('scoped default targets must belong to the extension')\n }\n return { payloadPath, syntax, targets: scopedTargets, readsPayloadPaths: inferDefaultReads(resolve, invalid) }\n }) : []\n return { index, id, hostId, targets, changes, defaults, syntax }\n })\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,mCAA4E;AACrF,SAAS,wBAAwB;AAEjC,SAAS,YAAY,UAAU,aAAa,cAAc,4BAA4B,oBAAoB,cAAc;AACxH,SAAS,wBAAwB,gCAAgC;AAsC1D,SAAS,cAAc,OAAgB,OAAe,SAA0B;AACrF,QAAM,SAAS,iBAAiB,UAAU,KAAK;AAC/C,SAAO,OAAO,UAAU,OAAO,OAAO,QAAQ,WAAW,KAAK,EAAE;AAClE;AAEA,SAAS,SAAS,OAAgB,OAAe,SAA0B;AACzE,SAAO,OAAO,UAAU,YAAY,0CAA0C,KAAK,KAAK,KACnF,MAAM,UAAU,OAAO,CAAC,MAAM,MAAM,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,aAAa,WAAW,EAAE,SAAS,IAAI,CAAC,IACjH,QAAQ,QAAQ,WAAW,KAAK,EAAE;AACxC;AAEA,SAAS,SAAS,OAAgB,SAA0B;AAC1D,SAAO,OAAO,UAAU,YAAY,sCAAsC,KAAK,KAAK,IAChF,QAAQ,QAAQ,sBAAsB;AAC5C;AAEA,SAAS,gBAAgB,OAAkC,SAA2B;AACpF,SAAO,UAAU,SAAY,SAAY,YAAY,OAAO,OAAO;AACrE;AAEA,SAAS,cAAc,QAAoC,SAAuD;AAChH,MAAI,OAAO,IAAI,QAAQ,KAAK,OAAO,IAAI,OAAO,EAAG,QAAO,QAAQ,2CAA2C;AAC3G,SAAO,OAAO,YAAY,CAAC,UAAU,OAAO,EAAE,QAAQ,CAAC,QAAQ,OAAO,IA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