@contractspec/lib.contracts-spec 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/app-config/app-config.capability.d.ts +1 -0
- package/dist/app-config/app-config.capability.js +730 -0
- package/dist/app-config/app-config.contracts.d.ts +239 -0
- package/dist/app-config/app-config.contracts.js +713 -0
- package/dist/app-config/app-config.contracts.test.d.ts +1 -0
- package/dist/app-config/app-config.feature.d.ts +5 -0
- package/dist/app-config/app-config.feature.js +255 -0
- package/dist/app-config/branding.d.ts +52 -0
- package/dist/app-config/branding.js +1 -0
- package/dist/app-config/branding.test.d.ts +1 -0
- package/dist/app-config/docs/app-config.docblock.d.ts +2 -0
- package/dist/app-config/docs/app-config.docblock.js +383 -0
- package/dist/app-config/events.d.ts +115 -0
- package/dist/app-config/events.js +386 -0
- package/dist/app-config/events.test.d.ts +1 -0
- package/dist/app-config/index.d.ts +9 -0
- package/dist/app-config/index.js +2899 -0
- package/dist/app-config/lifecycle-contracts.d.ts +265 -0
- package/dist/app-config/lifecycle-contracts.js +870 -0
- package/dist/app-config/lifecycle-contracts.test.d.ts +1 -0
- package/dist/app-config/lifecycle.d.ts +23 -0
- package/dist/app-config/lifecycle.js +1 -0
- package/dist/app-config/lifecycle.test.d.ts +1 -0
- package/dist/app-config/runtime.d.ts +111 -0
- package/dist/app-config/runtime.js +734 -0
- package/dist/app-config/runtime.test.d.ts +1 -0
- package/dist/app-config/spec.d.ts +169 -0
- package/dist/app-config/spec.js +229 -0
- package/dist/app-config/spec.test.d.ts +1 -0
- package/dist/app-config/validation.d.ts +43 -0
- package/dist/app-config/validation.js +650 -0
- package/dist/app-config/validation.test.d.ts +1 -0
- package/dist/capabilities/capabilities.d.ts +96 -0
- package/dist/capabilities/capabilities.js +217 -0
- package/dist/capabilities/capabilities.test.d.ts +1 -0
- package/dist/capabilities/context.d.ts +110 -0
- package/dist/capabilities/context.js +101 -0
- package/dist/capabilities/context.test.d.ts +1 -0
- package/dist/capabilities/docs/capabilities.docblock.d.ts +2 -0
- package/dist/capabilities/docs/capabilities.docblock.js +353 -0
- package/dist/capabilities/guards.d.ts +121 -0
- package/dist/capabilities/guards.js +177 -0
- package/dist/capabilities/index.d.ts +6 -0
- package/dist/capabilities/index.js +739 -0
- package/dist/capabilities/meeting-recorder.d.ts +5 -0
- package/dist/capabilities/meeting-recorder.js +154 -0
- package/dist/capabilities/openbanking.d.ts +5 -0
- package/dist/capabilities/openbanking.js +166 -0
- package/dist/capabilities/validation.d.ts +79 -0
- package/dist/capabilities/validation.js +185 -0
- package/dist/capabilities/validation.test.d.ts +1 -0
- package/dist/contract-registry/index.d.ts +3 -0
- package/dist/contract-registry/index.js +129 -0
- package/dist/contract-registry/schemas.d.ts +120 -0
- package/dist/contract-registry/schemas.js +129 -0
- package/dist/contract-registry/schemas.test.d.ts +1 -0
- package/dist/contract-registry/types.d.ts +42 -0
- package/dist/contract-registry/types.js +1 -0
- package/dist/data-views/data-views.d.ts +4 -0
- package/dist/data-views/data-views.js +232 -0
- package/dist/data-views/data-views.test.d.ts +1 -0
- package/dist/data-views/docs/data-views.docblock.d.ts +2 -0
- package/dist/data-views/docs/data-views.docblock.js +164 -0
- package/dist/data-views/index.d.ts +4 -0
- package/dist/data-views/index.js +232 -0
- package/dist/data-views/query-generator.d.ts +35 -0
- package/dist/data-views/query-generator.js +89 -0
- package/dist/data-views/registry.d.ts +12 -0
- package/dist/data-views/registry.js +226 -0
- package/dist/data-views/registry.test.d.ts +1 -0
- package/dist/data-views/report/contractVerificationTable.d.ts +4 -0
- package/dist/data-views/report/contractVerificationTable.js +240 -0
- package/dist/data-views/report/contractVerificationTable.test.d.ts +1 -0
- package/dist/data-views/runtime.d.ts +25 -0
- package/dist/data-views/runtime.js +108 -0
- package/dist/data-views/runtime.test.d.ts +1 -0
- package/dist/data-views/spec.d.ts +22 -0
- package/dist/data-views/spec.js +38 -0
- package/dist/data-views/spec.test.d.ts +1 -0
- package/dist/data-views/types.d.ts +152 -0
- package/dist/data-views/types.js +1 -0
- package/dist/data-views/types.test.d.ts +1 -0
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.d.ts +2 -0
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +513 -0
- package/dist/docs/capabilities/documentationSystem.capability.d.ts +1 -0
- package/dist/docs/capabilities/documentationSystem.capability.js +784 -0
- package/dist/docs/capabilities/index.d.ts +1 -0
- package/dist/docs/capabilities/index.js +784 -0
- package/dist/docs/commands/docsGenerate.command.d.ts +88 -0
- package/dist/docs/commands/docsGenerate.command.js +802 -0
- package/dist/docs/commands/docsPublish.command.d.ts +57 -0
- package/dist/docs/commands/docsPublish.command.js +781 -0
- package/dist/docs/commands/index.d.ts +2 -0
- package/dist/docs/commands/index.js +906 -0
- package/dist/docs/constants.d.ts +4 -0
- package/dist/docs/constants.js +78 -0
- package/dist/docs/contracts.d.ts +430 -0
- package/dist/docs/contracts.js +1611 -0
- package/dist/docs/ensure-docblocks.d.ts +1 -0
- package/dist/docs/ensure-docblocks.js +264 -0
- package/dist/docs/events/docsGenerated.event.d.ts +56 -0
- package/dist/docs/events/docsGenerated.event.js +533 -0
- package/dist/docs/events/docsPublished.event.d.ts +64 -0
- package/dist/docs/events/docsPublished.event.js +534 -0
- package/dist/docs/events/index.d.ts +2 -0
- package/dist/docs/events/index.js +567 -0
- package/dist/docs/forms/docsSearch.form.d.ts +16 -0
- package/dist/docs/forms/docsSearch.form.js +676 -0
- package/dist/docs/forms/index.d.ts +1 -0
- package/dist/docs/forms/index.js +676 -0
- package/dist/docs/index.d.ts +40 -0
- package/dist/docs/index.js +4719 -0
- package/dist/docs/meta.docs.d.ts +2 -0
- package/dist/docs/meta.docs.js +176 -0
- package/dist/docs/presentations/docsLayout.presentation.d.ts +2 -0
- package/dist/docs/presentations/docsLayout.presentation.js +527 -0
- package/dist/docs/presentations/docsReferencePage.presentation.d.ts +2 -0
- package/dist/docs/presentations/docsReferencePage.presentation.js +527 -0
- package/dist/docs/presentations/index.d.ts +2 -0
- package/dist/docs/presentations/index.js +555 -0
- package/dist/docs/presentations.d.ts +27 -0
- package/dist/docs/presentations.js +97 -0
- package/dist/docs/presentations.test.d.ts +1 -0
- package/dist/docs/queries/contractReference.query.d.ts +211 -0
- package/dist/docs/queries/contractReference.query.js +752 -0
- package/dist/docs/queries/docsIndex.query.d.ts +266 -0
- package/dist/docs/queries/docsIndex.query.js +752 -0
- package/dist/docs/queries/index.d.ts +2 -0
- package/dist/docs/queries/index.js +827 -0
- package/dist/docs/registry.d.ts +19 -0
- package/dist/docs/registry.js +153 -0
- package/dist/docs/registry.test.d.ts +1 -0
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.d.ts +2 -0
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +221 -0
- package/dist/docs/tech/cli.docblock.d.ts +2 -0
- package/dist/docs/tech/cli.docblock.js +291 -0
- package/dist/docs/tech/contracts/README.docblock.d.ts +2 -0
- package/dist/docs/tech/contracts/README.docblock.js +164 -0
- package/dist/docs/tech/contracts/migrations.docblock.d.ts +2 -0
- package/dist/docs/tech/contracts/migrations.docblock.js +164 -0
- package/dist/docs/tech/contracts/openapi-export.docblock.d.ts +2 -0
- package/dist/docs/tech/contracts/openapi-export.docblock.js +201 -0
- package/dist/docs/tech/contracts/openapi-import.docblock.d.ts +2 -0
- package/dist/docs/tech/contracts/openapi-import.docblock.js +207 -0
- package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.d.ts +2 -0
- package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +225 -0
- package/dist/docs/tech/contracts/overlays.docblock.d.ts +2 -0
- package/dist/docs/tech/contracts/overlays.docblock.js +231 -0
- package/dist/docs/tech/contracts/tests.docblock.d.ts +2 -0
- package/dist/docs/tech/contracts/tests.docblock.js +164 -0
- package/dist/docs/tech/contracts/themes.docblock.d.ts +2 -0
- package/dist/docs/tech/contracts/themes.docblock.js +257 -0
- package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.d.ts +2 -0
- package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +269 -0
- package/dist/docs/tech/docs-system.docblock.d.ts +1 -0
- package/dist/docs/tech/docs-system.docblock.js +264 -0
- package/dist/docs/tech/lifecycle-stage-system.docblock.d.ts +2 -0
- package/dist/docs/tech/lifecycle-stage-system.docblock.js +376 -0
- package/dist/docs/tech/llm/llm-integration.docblock.d.ts +7 -0
- package/dist/docs/tech/llm/llm-integration.docblock.js +482 -0
- package/dist/docs/tech/mcp-endpoints.docblock.d.ts +2 -0
- package/dist/docs/tech/mcp-endpoints.docblock.js +185 -0
- package/dist/docs/tech/presentation-runtime.docblock.d.ts +2 -0
- package/dist/docs/tech/presentation-runtime.docblock.js +221 -0
- package/dist/docs/tech/report-verification-table.docblock.d.ts +1 -0
- package/dist/docs/tech/report-verification-table.docblock.js +191 -0
- package/dist/docs/tech/report-verification-table.test.d.ts +1 -0
- package/dist/docs/tech/schema/README.docblock.d.ts +2 -0
- package/dist/docs/tech/schema/README.docblock.js +164 -0
- package/dist/docs/tech/studio/learning-events.docblock.d.ts +2 -0
- package/dist/docs/tech/studio/learning-events.docblock.js +190 -0
- package/dist/docs/tech/studio/learning-journeys.docblock.d.ts +2 -0
- package/dist/docs/tech/studio/learning-journeys.docblock.js +227 -0
- package/dist/docs/tech/studio/platform-admin-panel.docblock.d.ts +2 -0
- package/dist/docs/tech/studio/platform-admin-panel.docblock.js +226 -0
- package/dist/docs/tech/studio/project-access-teams.docblock.d.ts +2 -0
- package/dist/docs/tech/studio/project-access-teams.docblock.js +200 -0
- package/dist/docs/tech/studio/project-routing.docblock.d.ts +2 -0
- package/dist/docs/tech/studio/project-routing.docblock.js +209 -0
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.d.ts +2 -0
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +183 -0
- package/dist/docs/tech/studio/team-invitations.docblock.d.ts +2 -0
- package/dist/docs/tech/studio/team-invitations.docblock.js +228 -0
- package/dist/docs/tech/studio/workspace-ops.docblock.d.ts +2 -0
- package/dist/docs/tech/studio/workspace-ops.docblock.js +189 -0
- package/dist/docs/tech/studio/workspaces.docblock.d.ts +2 -0
- package/dist/docs/tech/studio/workspaces.docblock.js +204 -0
- package/dist/docs/tech/telemetry-ingest.docblock.d.ts +2 -0
- package/dist/docs/tech/telemetry-ingest.docblock.js +305 -0
- package/dist/docs/tech/vscode-extension.docblock.d.ts +2 -0
- package/dist/docs/tech/vscode-extension.docblock.js +241 -0
- package/dist/docs/tech-contracts.docs.d.ts +2 -0
- package/dist/docs/tech-contracts.docs.js +239 -0
- package/dist/docs/types.d.ts +37 -0
- package/dist/docs/types.js +1 -0
- package/dist/docs/views/contractReference.dataView.d.ts +2 -0
- package/dist/docs/views/contractReference.dataView.js +838 -0
- package/dist/docs/views/docsIndex.dataView.d.ts +2 -0
- package/dist/docs/views/docsIndex.dataView.js +832 -0
- package/dist/docs/views/exampleCatalog.dataView.d.ts +2 -0
- package/dist/docs/views/exampleCatalog.dataView.js +816 -0
- package/dist/docs/views/index.d.ts +3 -0
- package/dist/docs/views/index.js +1031 -0
- package/dist/events.d.ts +142 -0
- package/dist/events.js +228 -0
- package/dist/events.test.d.ts +1 -0
- package/dist/examples/define.d.ts +5 -0
- package/dist/examples/define.js +36 -0
- package/dist/examples/docs/examples.docblock.d.ts +2 -0
- package/dist/examples/docs/examples.docblock.js +307 -0
- package/dist/examples/index.d.ts +7 -0
- package/dist/examples/index.js +604 -0
- package/dist/examples/registry.d.ts +38 -0
- package/dist/examples/registry.js +286 -0
- package/dist/examples/registry.test.d.ts +1 -0
- package/dist/examples/schema.d.ts +278 -0
- package/dist/examples/schema.js +166 -0
- package/dist/examples/schema.test.d.ts +1 -0
- package/dist/examples/types.d.ts +162 -0
- package/dist/examples/types.js +77 -0
- package/dist/examples/types.test.d.ts +1 -0
- package/dist/examples/validation.d.ts +61 -0
- package/dist/examples/validation.js +287 -0
- package/dist/examples/validation.test.d.ts +1 -0
- package/dist/experiments/docs/experiments.docblock.d.ts +2 -0
- package/dist/experiments/docs/experiments.docblock.js +291 -0
- package/dist/experiments/evaluator.d.ts +33 -0
- package/dist/experiments/evaluator.js +155 -0
- package/dist/experiments/evaluator.test.d.ts +1 -0
- package/dist/experiments/spec-resolver.d.ts +12 -0
- package/dist/experiments/spec-resolver.js +1 -0
- package/dist/experiments/spec.d.ts +79 -0
- package/dist/experiments/spec.js +227 -0
- package/dist/experiments/spec.test.d.ts +1 -0
- package/dist/features/index.d.ts +5 -0
- package/dist/features/index.js +275 -0
- package/dist/features/install.d.ts +14 -0
- package/dist/features/install.js +95 -0
- package/dist/features/install.test.d.ts +1 -0
- package/dist/features/registry.d.ts +21 -0
- package/dist/features/registry.js +192 -0
- package/dist/features/registry.test.d.ts +1 -0
- package/dist/features/types.d.ts +82 -0
- package/dist/features/types.js +36 -0
- package/dist/features/types.test.d.ts +1 -0
- package/dist/features/validation.d.ts +4 -0
- package/dist/features/validation.js +48 -0
- package/dist/features/validation.test.d.ts +1 -0
- package/dist/features.capabilities.test.d.ts +1 -0
- package/dist/forms/docs/forms.docblock.d.ts +2 -0
- package/dist/forms/docs/forms.docblock.js +164 -0
- package/dist/forms/forms.d.ts +264 -0
- package/dist/forms/forms.js +332 -0
- package/dist/forms/index.d.ts +1 -0
- package/dist/forms/index.js +332 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +2195 -0
- package/dist/install.d.ts +75 -0
- package/dist/install.js +60 -0
- package/dist/integrations/binding.d.ts +14 -0
- package/dist/integrations/binding.js +1 -0
- package/dist/integrations/connection.d.ts +47 -0
- package/dist/integrations/connection.js +1 -0
- package/dist/integrations/docs/integrations.docblock.d.ts +2 -0
- package/dist/integrations/docs/integrations.docblock.js +140 -0
- package/dist/integrations/health.d.ts +17 -0
- package/dist/integrations/health.js +103 -0
- package/dist/integrations/health.test.d.ts +1 -0
- package/dist/integrations/index.d.ts +11 -0
- package/dist/integrations/index.js +3293 -0
- package/dist/integrations/integrations.capability.d.ts +1 -0
- package/dist/integrations/integrations.capability.js +48 -0
- package/dist/integrations/integrations.feature.d.ts +5 -0
- package/dist/integrations/integrations.feature.js +63 -0
- package/dist/integrations/meeting-recorder/contracts/index.d.ts +7 -0
- package/dist/integrations/meeting-recorder/contracts/index.js +504 -0
- package/dist/integrations/meeting-recorder/contracts/meetings.d.ts +451 -0
- package/dist/integrations/meeting-recorder/contracts/meetings.js +249 -0
- package/dist/integrations/meeting-recorder/contracts/transcripts.d.ts +166 -0
- package/dist/integrations/meeting-recorder/contracts/transcripts.js +317 -0
- package/dist/integrations/meeting-recorder/contracts/webhooks.d.ts +85 -0
- package/dist/integrations/meeting-recorder/contracts/webhooks.js +202 -0
- package/dist/integrations/meeting-recorder/meeting-recorder.capability.d.ts +1 -0
- package/dist/integrations/meeting-recorder/meeting-recorder.capability.js +48 -0
- package/dist/integrations/meeting-recorder/meeting-recorder.feature.d.ts +5 -0
- package/dist/integrations/meeting-recorder/meeting-recorder.feature.js +63 -0
- package/dist/integrations/meeting-recorder/models.d.ts +402 -0
- package/dist/integrations/meeting-recorder/models.js +152 -0
- package/dist/integrations/meeting-recorder/telemetry.d.ts +13 -0
- package/dist/integrations/meeting-recorder/telemetry.js +84 -0
- package/dist/integrations/openbanking/contracts/accounts.d.ts +282 -0
- package/dist/integrations/openbanking/contracts/accounts.js +358 -0
- package/dist/integrations/openbanking/contracts/balances.d.ts +158 -0
- package/dist/integrations/openbanking/contracts/balances.js +322 -0
- package/dist/integrations/openbanking/contracts/index.d.ts +7 -0
- package/dist/integrations/openbanking/contracts/index.js +674 -0
- package/dist/integrations/openbanking/contracts/transactions.d.ts +206 -0
- package/dist/integrations/openbanking/contracts/transactions.js +328 -0
- package/dist/integrations/openbanking/guards.d.ts +8 -0
- package/dist/integrations/openbanking/guards.js +72 -0
- package/dist/integrations/openbanking/guards.test.d.ts +1 -0
- package/dist/integrations/openbanking/models.d.ts +223 -0
- package/dist/integrations/openbanking/models.js +140 -0
- package/dist/integrations/openbanking/openbanking.capability.d.ts +1 -0
- package/dist/integrations/openbanking/openbanking.capability.js +48 -0
- package/dist/integrations/openbanking/openbanking.feature.d.ts +5 -0
- package/dist/integrations/openbanking/openbanking.feature.js +65 -0
- package/dist/integrations/openbanking/telemetry.d.ts +12 -0
- package/dist/integrations/openbanking/telemetry.js +81 -0
- package/dist/integrations/operations.d.ts +430 -0
- package/dist/integrations/operations.js +327 -0
- package/dist/integrations/operations.test.d.ts +1 -0
- package/dist/integrations/providers/analytics-reader.d.ts +103 -0
- package/dist/integrations/providers/analytics-reader.js +1 -0
- package/dist/integrations/providers/analytics-writer.d.ts +6 -0
- package/dist/integrations/providers/analytics-writer.js +1 -0
- package/dist/integrations/providers/analytics.d.ts +47 -0
- package/dist/integrations/providers/analytics.js +1 -0
- package/dist/integrations/providers/calendar.d.ts +75 -0
- package/dist/integrations/providers/calendar.js +1 -0
- package/dist/integrations/providers/database.d.ts +12 -0
- package/dist/integrations/providers/database.js +1 -0
- package/dist/integrations/providers/elevenlabs.d.ts +3 -0
- package/dist/integrations/providers/elevenlabs.js +116 -0
- package/dist/integrations/providers/email.d.ts +83 -0
- package/dist/integrations/providers/email.js +1 -0
- package/dist/integrations/providers/embedding.d.ts +21 -0
- package/dist/integrations/providers/embedding.js +1 -0
- package/dist/integrations/providers/fal.d.ts +3 -0
- package/dist/integrations/providers/fal.js +142 -0
- package/dist/integrations/providers/fathom.d.ts +3 -0
- package/dist/integrations/providers/fathom.js +156 -0
- package/dist/integrations/providers/fireflies.d.ts +3 -0
- package/dist/integrations/providers/fireflies.js +136 -0
- package/dist/integrations/providers/gcs-storage.d.ts +3 -0
- package/dist/integrations/providers/gcs-storage.js +127 -0
- package/dist/integrations/providers/gmail.d.ts +3 -0
- package/dist/integrations/providers/gmail.js +139 -0
- package/dist/integrations/providers/google-calendar.d.ts +3 -0
- package/dist/integrations/providers/google-calendar.js +122 -0
- package/dist/integrations/providers/gradium.d.ts +3 -0
- package/dist/integrations/providers/gradium.js +140 -0
- package/dist/integrations/providers/granola.d.ts +3 -0
- package/dist/integrations/providers/granola.js +137 -0
- package/dist/integrations/providers/index.d.ts +38 -0
- package/dist/integrations/providers/index.js +2124 -0
- package/dist/integrations/providers/jira.d.ts +3 -0
- package/dist/integrations/providers/jira.js +138 -0
- package/dist/integrations/providers/linear.d.ts +3 -0
- package/dist/integrations/providers/linear.js +137 -0
- package/dist/integrations/providers/llm.d.ts +79 -0
- package/dist/integrations/providers/llm.js +1 -0
- package/dist/integrations/providers/meeting-recorder.d.ts +129 -0
- package/dist/integrations/providers/meeting-recorder.js +1 -0
- package/dist/integrations/providers/mistral.d.ts +3 -0
- package/dist/integrations/providers/mistral.js +124 -0
- package/dist/integrations/providers/notion.d.ts +3 -0
- package/dist/integrations/providers/notion.js +143 -0
- package/dist/integrations/providers/openbanking.d.ts +125 -0
- package/dist/integrations/providers/openbanking.js +1 -0
- package/dist/integrations/providers/payments.d.ts +106 -0
- package/dist/integrations/providers/payments.js +1 -0
- package/dist/integrations/providers/posthog-llm-telemetry.d.ts +51 -0
- package/dist/integrations/providers/posthog-llm-telemetry.js +206 -0
- package/dist/integrations/providers/posthog.d.ts +3 -0
- package/dist/integrations/providers/posthog.js +136 -0
- package/dist/integrations/providers/postmark.d.ts +3 -0
- package/dist/integrations/providers/postmark.js +128 -0
- package/dist/integrations/providers/powens.d.ts +3 -0
- package/dist/integrations/providers/powens.js +154 -0
- package/dist/integrations/providers/project-management.d.ts +32 -0
- package/dist/integrations/providers/project-management.js +1 -0
- package/dist/integrations/providers/providers.test.d.ts +1 -0
- package/dist/integrations/providers/qdrant.d.ts +3 -0
- package/dist/integrations/providers/qdrant.js +131 -0
- package/dist/integrations/providers/registry.d.ts +6 -0
- package/dist/integrations/providers/registry.js +1908 -0
- package/dist/integrations/providers/sms.d.ts +31 -0
- package/dist/integrations/providers/sms.js +1 -0
- package/dist/integrations/providers/storage.d.ts +57 -0
- package/dist/integrations/providers/storage.js +1 -0
- package/dist/integrations/providers/stripe.d.ts +3 -0
- package/dist/integrations/providers/stripe.js +135 -0
- package/dist/integrations/providers/supabase-postgres.d.ts +3 -0
- package/dist/integrations/providers/supabase-postgres.js +117 -0
- package/dist/integrations/providers/supabase-vector.d.ts +3 -0
- package/dist/integrations/providers/supabase-vector.js +137 -0
- package/dist/integrations/providers/tldv.d.ts +3 -0
- package/dist/integrations/providers/tldv.js +136 -0
- package/dist/integrations/providers/twilio-sms.d.ts +3 -0
- package/dist/integrations/providers/twilio-sms.js +121 -0
- package/dist/integrations/providers/vector-store.d.ts +39 -0
- package/dist/integrations/providers/vector-store.js +1 -0
- package/dist/integrations/providers/voice.d.ts +31 -0
- package/dist/integrations/providers/voice.js +1 -0
- package/dist/integrations/runtime.d.ts +95 -0
- package/dist/integrations/runtime.js +239 -0
- package/dist/integrations/runtime.test.d.ts +1 -0
- package/dist/integrations/secrets/aws-secret-manager.d.ts +28 -0
- package/dist/integrations/secrets/aws-secret-manager.js +376 -0
- package/dist/integrations/secrets/env-secret-provider.d.ts +28 -0
- package/dist/integrations/secrets/env-secret-provider.js +189 -0
- package/dist/integrations/secrets/gcp-secret-manager.d.ts +29 -0
- package/dist/integrations/secrets/gcp-secret-manager.js +377 -0
- package/dist/integrations/secrets/index.d.ts +6 -0
- package/dist/integrations/secrets/index.js +1159 -0
- package/dist/integrations/secrets/manager.d.ts +44 -0
- package/dist/integrations/secrets/manager.js +213 -0
- package/dist/integrations/secrets/provider.d.ts +49 -0
- package/dist/integrations/secrets/provider.js +104 -0
- package/dist/integrations/secrets/provider.test.d.ts +1 -0
- package/dist/integrations/secrets/scaleway-secret-manager.d.ts +35 -0
- package/dist/integrations/secrets/scaleway-secret-manager.js +405 -0
- package/dist/integrations/secrets-types.d.ts +14 -0
- package/dist/integrations/secrets-types.js +1 -0
- package/dist/integrations/spec.d.ts +72 -0
- package/dist/integrations/spec.js +52 -0
- package/dist/integrations/spec.test.d.ts +1 -0
- package/dist/jobs/define-job.d.ts +15 -0
- package/dist/jobs/define-job.js +41 -0
- package/dist/jobs/gcp-cloud-tasks.d.ts +38 -0
- package/dist/jobs/gcp-cloud-tasks.js +103 -0
- package/dist/jobs/gcp-pubsub.d.ts +22 -0
- package/dist/jobs/gcp-pubsub.js +91 -0
- package/dist/jobs/handlers/gmail-sync-handler.d.ts +5 -0
- package/dist/jobs/handlers/gmail-sync-handler.js +40 -0
- package/dist/jobs/handlers/handlers.test.d.ts +1 -0
- package/dist/jobs/handlers/index.d.ts +5 -0
- package/dist/jobs/handlers/index.js +83 -0
- package/dist/jobs/handlers/ping-handler.d.ts +6 -0
- package/dist/jobs/handlers/ping-handler.js +47 -0
- package/dist/jobs/handlers/storage-document-handler.d.ts +8 -0
- package/dist/jobs/handlers/storage-document-handler.js +47 -0
- package/dist/jobs/index.d.ts +2 -0
- package/dist/jobs/index.js +64 -0
- package/dist/jobs/memory-queue.d.ts +14 -0
- package/dist/jobs/memory-queue.js +129 -0
- package/dist/jobs/queue.d.ts +126 -0
- package/dist/jobs/queue.js +55 -0
- package/dist/jobs/queue.test.d.ts +1 -0
- package/dist/jobs/scaleway-sqs-queue.d.ts +27 -0
- package/dist/jobs/scaleway-sqs-queue.js +222 -0
- package/dist/jsonschema.d.ts +39 -0
- package/dist/jsonschema.js +73 -0
- package/dist/jsonschema.test.d.ts +1 -0
- package/dist/knowledge/binding.d.ts +22 -0
- package/dist/knowledge/binding.js +1 -0
- package/dist/knowledge/docs/knowledge.docblock.d.ts +2 -0
- package/dist/knowledge/docs/knowledge.docblock.js +301 -0
- package/dist/knowledge/index.d.ts +4 -0
- package/dist/knowledge/index.js +467 -0
- package/dist/knowledge/ingestion/document-processor.d.ts +22 -0
- package/dist/knowledge/ingestion/document-processor.js +95 -0
- package/dist/knowledge/ingestion/embedding-service.d.ts +8 -0
- package/dist/knowledge/ingestion/embedding-service.js +57 -0
- package/dist/knowledge/ingestion/gmail-adapter.d.ts +14 -0
- package/dist/knowledge/ingestion/gmail-adapter.js +103 -0
- package/dist/knowledge/ingestion/index.d.ts +5 -0
- package/dist/knowledge/ingestion/index.js +252 -0
- package/dist/knowledge/ingestion/ingestion.test.d.ts +1 -0
- package/dist/knowledge/ingestion/storage-adapter.d.ts +11 -0
- package/dist/knowledge/ingestion/storage-adapter.js +62 -0
- package/dist/knowledge/ingestion/vector-indexer.d.ts +14 -0
- package/dist/knowledge/ingestion/vector-indexer.js +63 -0
- package/dist/knowledge/knowledge.capability.d.ts +1 -0
- package/dist/knowledge/knowledge.capability.js +726 -0
- package/dist/knowledge/knowledge.feature.d.ts +5 -0
- package/dist/knowledge/knowledge.feature.js +300 -0
- package/dist/knowledge/operations.d.ts +311 -0
- package/dist/knowledge/operations.js +619 -0
- package/dist/knowledge/operations.test.d.ts +1 -0
- package/dist/knowledge/query/index.d.ts +1 -0
- package/dist/knowledge/query/index.js +110 -0
- package/dist/knowledge/query/service.d.ts +25 -0
- package/dist/knowledge/query/service.js +110 -0
- package/dist/knowledge/query/service.test.d.ts +1 -0
- package/dist/knowledge/runtime.d.ts +28 -0
- package/dist/knowledge/runtime.js +91 -0
- package/dist/knowledge/runtime.test.d.ts +1 -0
- package/dist/knowledge/source.d.ts +29 -0
- package/dist/knowledge/source.js +1 -0
- package/dist/knowledge/spaces/email-threads.d.ts +3 -0
- package/dist/knowledge/spaces/email-threads.js +102 -0
- package/dist/knowledge/spaces/financial-docs.d.ts +3 -0
- package/dist/knowledge/spaces/financial-docs.js +102 -0
- package/dist/knowledge/spaces/financial-overview.d.ts +3 -0
- package/dist/knowledge/spaces/financial-overview.js +102 -0
- package/dist/knowledge/spaces/index.d.ts +6 -0
- package/dist/knowledge/spaces/index.js +273 -0
- package/dist/knowledge/spaces/product-canon.d.ts +3 -0
- package/dist/knowledge/spaces/product-canon.js +102 -0
- package/dist/knowledge/spaces/spaces.test.d.ts +1 -0
- package/dist/knowledge/spaces/support-faq.d.ts +3 -0
- package/dist/knowledge/spaces/support-faq.js +103 -0
- package/dist/knowledge/spaces/uploaded-docs.d.ts +3 -0
- package/dist/knowledge/spaces/uploaded-docs.js +102 -0
- package/dist/knowledge/spec.d.ts +42 -0
- package/dist/knowledge/spec.js +228 -0
- package/dist/knowledge/spec.test.d.ts +1 -0
- package/dist/llm/exporters.d.ts +68 -0
- package/dist/llm/exporters.js +1011 -0
- package/dist/llm/index.d.ts +12 -0
- package/dist/llm/index.js +1465 -0
- package/dist/llm/prompts.d.ts +53 -0
- package/dist/llm/prompts.js +1456 -0
- package/dist/llm/types.d.ts +212 -0
- package/dist/llm/types.js +1 -0
- package/dist/markdown.d.ts +16 -0
- package/dist/markdown.js +529 -0
- package/dist/migrations.d.ts +48 -0
- package/dist/migrations.js +67 -0
- package/dist/migrations.test.d.ts +1 -0
- package/dist/model-registry.d.ts +9 -0
- package/dist/model-registry.js +64 -0
- package/dist/model-registry.test.d.ts +1 -0
- package/dist/node/app-config/app-config.capability.js +730 -0
- package/dist/node/app-config/app-config.contracts.js +713 -0
- package/dist/node/app-config/app-config.feature.js +255 -0
- package/dist/node/app-config/branding.js +0 -0
- package/dist/node/app-config/docs/app-config.docblock.js +383 -0
- package/dist/node/app-config/events.js +386 -0
- package/dist/node/app-config/index.js +2899 -0
- package/dist/node/app-config/lifecycle-contracts.js +870 -0
- package/dist/node/app-config/lifecycle.js +0 -0
- package/dist/node/app-config/runtime.js +734 -0
- package/dist/node/app-config/spec.js +229 -0
- package/dist/node/app-config/validation.js +650 -0
- package/dist/node/capabilities/capabilities.js +217 -0
- package/dist/node/capabilities/context.js +101 -0
- package/dist/node/capabilities/docs/capabilities.docblock.js +353 -0
- package/dist/node/capabilities/guards.js +177 -0
- package/dist/node/capabilities/index.js +739 -0
- package/dist/node/capabilities/meeting-recorder.js +154 -0
- package/dist/node/capabilities/openbanking.js +166 -0
- package/dist/node/capabilities/validation.js +185 -0
- package/dist/node/contract-registry/index.js +129 -0
- package/dist/node/contract-registry/schemas.js +129 -0
- package/dist/node/contract-registry/types.js +0 -0
- package/dist/node/data-views/data-views.js +232 -0
- package/dist/node/data-views/docs/data-views.docblock.js +164 -0
- package/dist/node/data-views/index.js +232 -0
- package/dist/node/data-views/query-generator.js +89 -0
- package/dist/node/data-views/registry.js +226 -0
- package/dist/node/data-views/report/contractVerificationTable.js +240 -0
- package/dist/node/data-views/runtime.js +108 -0
- package/dist/node/data-views/spec.js +38 -0
- package/dist/node/data-views/types.js +0 -0
- package/dist/node/docs/accessibility_wcag_compliance_specs.docblock.js +513 -0
- package/dist/node/docs/capabilities/documentationSystem.capability.js +784 -0
- package/dist/node/docs/capabilities/index.js +784 -0
- package/dist/node/docs/commands/docsGenerate.command.js +802 -0
- package/dist/node/docs/commands/docsPublish.command.js +781 -0
- package/dist/node/docs/commands/index.js +906 -0
- package/dist/node/docs/constants.js +78 -0
- package/dist/node/docs/contracts.js +1611 -0
- package/dist/node/docs/ensure-docblocks.js +264 -0
- package/dist/node/docs/events/docsGenerated.event.js +533 -0
- package/dist/node/docs/events/docsPublished.event.js +534 -0
- package/dist/node/docs/events/index.js +567 -0
- package/dist/node/docs/forms/docsSearch.form.js +676 -0
- package/dist/node/docs/forms/index.js +676 -0
- package/dist/node/docs/index.js +4719 -0
- package/dist/node/docs/meta.docs.js +176 -0
- package/dist/node/docs/presentations/docsLayout.presentation.js +527 -0
- package/dist/node/docs/presentations/docsReferencePage.presentation.js +527 -0
- package/dist/node/docs/presentations/index.js +555 -0
- package/dist/node/docs/presentations.js +97 -0
- package/dist/node/docs/queries/contractReference.query.js +752 -0
- package/dist/node/docs/queries/docsIndex.query.js +752 -0
- package/dist/node/docs/queries/index.js +827 -0
- package/dist/node/docs/registry.js +153 -0
- package/dist/node/docs/tech/auth/better-auth-nextjs.docblock.js +221 -0
- package/dist/node/docs/tech/cli.docblock.js +291 -0
- package/dist/node/docs/tech/contracts/README.docblock.js +164 -0
- package/dist/node/docs/tech/contracts/migrations.docblock.js +164 -0
- package/dist/node/docs/tech/contracts/openapi-export.docblock.js +201 -0
- package/dist/node/docs/tech/contracts/openapi-import.docblock.js +207 -0
- package/dist/node/docs/tech/contracts/ops-to-presentation-linking.docblock.js +225 -0
- package/dist/node/docs/tech/contracts/overlays.docblock.js +231 -0
- package/dist/node/docs/tech/contracts/tests.docblock.js +164 -0
- package/dist/node/docs/tech/contracts/themes.docblock.js +257 -0
- package/dist/node/docs/tech/contracts/vertical-pocket-family-office.docblock.js +269 -0
- package/dist/node/docs/tech/docs-system.docblock.js +264 -0
- package/dist/node/docs/tech/lifecycle-stage-system.docblock.js +376 -0
- package/dist/node/docs/tech/llm/llm-integration.docblock.js +482 -0
- package/dist/node/docs/tech/mcp-endpoints.docblock.js +185 -0
- package/dist/node/docs/tech/presentation-runtime.docblock.js +221 -0
- package/dist/node/docs/tech/report-verification-table.docblock.js +191 -0
- package/dist/node/docs/tech/schema/README.docblock.js +164 -0
- package/dist/node/docs/tech/studio/learning-events.docblock.js +190 -0
- package/dist/node/docs/tech/studio/learning-journeys.docblock.js +227 -0
- package/dist/node/docs/tech/studio/platform-admin-panel.docblock.js +226 -0
- package/dist/node/docs/tech/studio/project-access-teams.docblock.js +200 -0
- package/dist/node/docs/tech/studio/project-routing.docblock.js +209 -0
- package/dist/node/docs/tech/studio/sandbox-unlogged.docblock.js +183 -0
- package/dist/node/docs/tech/studio/team-invitations.docblock.js +228 -0
- package/dist/node/docs/tech/studio/workspace-ops.docblock.js +189 -0
- package/dist/node/docs/tech/studio/workspaces.docblock.js +204 -0
- package/dist/node/docs/tech/telemetry-ingest.docblock.js +305 -0
- package/dist/node/docs/tech/vscode-extension.docblock.js +241 -0
- package/dist/node/docs/tech-contracts.docs.js +239 -0
- package/dist/node/docs/types.js +0 -0
- package/dist/node/docs/views/contractReference.dataView.js +838 -0
- package/dist/node/docs/views/docsIndex.dataView.js +832 -0
- package/dist/node/docs/views/exampleCatalog.dataView.js +816 -0
- package/dist/node/docs/views/index.js +1031 -0
- package/dist/node/events.js +228 -0
- package/dist/node/examples/define.js +36 -0
- package/dist/node/examples/docs/examples.docblock.js +307 -0
- package/dist/node/examples/index.js +604 -0
- package/dist/node/examples/registry.js +286 -0
- package/dist/node/examples/schema.js +166 -0
- package/dist/node/examples/types.js +77 -0
- package/dist/node/examples/validation.js +287 -0
- package/dist/node/experiments/docs/experiments.docblock.js +291 -0
- package/dist/node/experiments/evaluator.js +155 -0
- package/dist/node/experiments/spec-resolver.js +0 -0
- package/dist/node/experiments/spec.js +227 -0
- package/dist/node/features/index.js +275 -0
- package/dist/node/features/install.js +95 -0
- package/dist/node/features/registry.js +192 -0
- package/dist/node/features/types.js +36 -0
- package/dist/node/features/validation.js +48 -0
- package/dist/node/forms/docs/forms.docblock.js +164 -0
- package/dist/node/forms/forms.js +332 -0
- package/dist/node/forms/index.js +332 -0
- package/dist/node/index.js +2195 -0
- package/dist/node/install.js +60 -0
- package/dist/node/integrations/binding.js +0 -0
- package/dist/node/integrations/connection.js +0 -0
- package/dist/node/integrations/docs/integrations.docblock.js +140 -0
- package/dist/node/integrations/health.js +103 -0
- package/dist/node/integrations/index.js +3293 -0
- package/dist/node/integrations/integrations.capability.js +48 -0
- package/dist/node/integrations/integrations.feature.js +63 -0
- package/dist/node/integrations/meeting-recorder/contracts/index.js +504 -0
- package/dist/node/integrations/meeting-recorder/contracts/meetings.js +249 -0
- package/dist/node/integrations/meeting-recorder/contracts/transcripts.js +317 -0
- package/dist/node/integrations/meeting-recorder/contracts/webhooks.js +202 -0
- package/dist/node/integrations/meeting-recorder/meeting-recorder.capability.js +48 -0
- package/dist/node/integrations/meeting-recorder/meeting-recorder.feature.js +63 -0
- package/dist/node/integrations/meeting-recorder/models.js +152 -0
- package/dist/node/integrations/meeting-recorder/telemetry.js +84 -0
- package/dist/node/integrations/openbanking/contracts/accounts.js +358 -0
- package/dist/node/integrations/openbanking/contracts/balances.js +322 -0
- package/dist/node/integrations/openbanking/contracts/index.js +674 -0
- package/dist/node/integrations/openbanking/contracts/transactions.js +328 -0
- package/dist/node/integrations/openbanking/guards.js +72 -0
- package/dist/node/integrations/openbanking/models.js +140 -0
- package/dist/node/integrations/openbanking/openbanking.capability.js +48 -0
- package/dist/node/integrations/openbanking/openbanking.feature.js +65 -0
- package/dist/node/integrations/openbanking/telemetry.js +81 -0
- package/dist/node/integrations/operations.js +327 -0
- package/dist/node/integrations/providers/analytics-reader.js +0 -0
- package/dist/node/integrations/providers/analytics-writer.js +0 -0
- package/dist/node/integrations/providers/analytics.js +0 -0
- package/dist/node/integrations/providers/calendar.js +0 -0
- package/dist/node/integrations/providers/database.js +0 -0
- package/dist/node/integrations/providers/elevenlabs.js +116 -0
- package/dist/node/integrations/providers/email.js +0 -0
- package/dist/node/integrations/providers/embedding.js +0 -0
- package/dist/node/integrations/providers/fal.js +142 -0
- package/dist/node/integrations/providers/fathom.js +156 -0
- package/dist/node/integrations/providers/fireflies.js +136 -0
- package/dist/node/integrations/providers/gcs-storage.js +127 -0
- package/dist/node/integrations/providers/gmail.js +139 -0
- package/dist/node/integrations/providers/google-calendar.js +122 -0
- package/dist/node/integrations/providers/gradium.js +140 -0
- package/dist/node/integrations/providers/granola.js +137 -0
- package/dist/node/integrations/providers/index.js +2124 -0
- package/dist/node/integrations/providers/jira.js +138 -0
- package/dist/node/integrations/providers/linear.js +137 -0
- package/dist/node/integrations/providers/llm.js +0 -0
- package/dist/node/integrations/providers/meeting-recorder.js +0 -0
- package/dist/node/integrations/providers/mistral.js +124 -0
- package/dist/node/integrations/providers/notion.js +143 -0
- package/dist/node/integrations/providers/openbanking.js +0 -0
- package/dist/node/integrations/providers/payments.js +0 -0
- package/dist/node/integrations/providers/posthog-llm-telemetry.js +206 -0
- package/dist/node/integrations/providers/posthog.js +136 -0
- package/dist/node/integrations/providers/postmark.js +128 -0
- package/dist/node/integrations/providers/powens.js +154 -0
- package/dist/node/integrations/providers/project-management.js +0 -0
- package/dist/node/integrations/providers/qdrant.js +131 -0
- package/dist/node/integrations/providers/registry.js +1908 -0
- package/dist/node/integrations/providers/sms.js +0 -0
- package/dist/node/integrations/providers/storage.js +0 -0
- package/dist/node/integrations/providers/stripe.js +135 -0
- package/dist/node/integrations/providers/supabase-postgres.js +117 -0
- package/dist/node/integrations/providers/supabase-vector.js +137 -0
- package/dist/node/integrations/providers/tldv.js +136 -0
- package/dist/node/integrations/providers/twilio-sms.js +121 -0
- package/dist/node/integrations/providers/vector-store.js +0 -0
- package/dist/node/integrations/providers/voice.js +0 -0
- package/dist/node/integrations/runtime.js +239 -0
- package/dist/node/integrations/secrets/aws-secret-manager.js +376 -0
- package/dist/node/integrations/secrets/env-secret-provider.js +189 -0
- package/dist/node/integrations/secrets/gcp-secret-manager.js +377 -0
- package/dist/node/integrations/secrets/index.js +1159 -0
- package/dist/node/integrations/secrets/manager.js +213 -0
- package/dist/node/integrations/secrets/provider.js +104 -0
- package/dist/node/integrations/secrets/scaleway-secret-manager.js +405 -0
- package/dist/node/integrations/secrets-types.js +0 -0
- package/dist/node/integrations/spec.js +52 -0
- package/dist/node/jobs/define-job.js +41 -0
- package/dist/node/jobs/gcp-cloud-tasks.js +103 -0
- package/dist/node/jobs/gcp-pubsub.js +91 -0
- package/dist/node/jobs/handlers/gmail-sync-handler.js +40 -0
- package/dist/node/jobs/handlers/index.js +83 -0
- package/dist/node/jobs/handlers/ping-handler.js +47 -0
- package/dist/node/jobs/handlers/storage-document-handler.js +47 -0
- package/dist/node/jobs/index.js +64 -0
- package/dist/node/jobs/memory-queue.js +129 -0
- package/dist/node/jobs/queue.js +55 -0
- package/dist/node/jobs/scaleway-sqs-queue.js +222 -0
- package/dist/node/jsonschema.js +73 -0
- package/dist/node/knowledge/binding.js +0 -0
- package/dist/node/knowledge/docs/knowledge.docblock.js +301 -0
- package/dist/node/knowledge/index.js +467 -0
- package/dist/node/knowledge/ingestion/document-processor.js +95 -0
- package/dist/node/knowledge/ingestion/embedding-service.js +57 -0
- package/dist/node/knowledge/ingestion/gmail-adapter.js +103 -0
- package/dist/node/knowledge/ingestion/index.js +252 -0
- package/dist/node/knowledge/ingestion/storage-adapter.js +62 -0
- package/dist/node/knowledge/ingestion/vector-indexer.js +63 -0
- package/dist/node/knowledge/knowledge.capability.js +726 -0
- package/dist/node/knowledge/knowledge.feature.js +300 -0
- package/dist/node/knowledge/operations.js +619 -0
- package/dist/node/knowledge/query/index.js +110 -0
- package/dist/node/knowledge/query/service.js +110 -0
- package/dist/node/knowledge/runtime.js +91 -0
- package/dist/node/knowledge/source.js +0 -0
- package/dist/node/knowledge/spaces/email-threads.js +102 -0
- package/dist/node/knowledge/spaces/financial-docs.js +102 -0
- package/dist/node/knowledge/spaces/financial-overview.js +102 -0
- package/dist/node/knowledge/spaces/index.js +273 -0
- package/dist/node/knowledge/spaces/product-canon.js +102 -0
- package/dist/node/knowledge/spaces/support-faq.js +103 -0
- package/dist/node/knowledge/spaces/uploaded-docs.js +102 -0
- package/dist/node/knowledge/spec.js +228 -0
- package/dist/node/llm/exporters.js +1011 -0
- package/dist/node/llm/index.js +1465 -0
- package/dist/node/llm/prompts.js +1456 -0
- package/dist/node/llm/types.js +0 -0
- package/dist/node/markdown.js +529 -0
- package/dist/node/migrations.js +67 -0
- package/dist/node/model-registry.js +64 -0
- package/dist/node/onboarding-base.js +597 -0
- package/dist/node/openapi.js +151 -0
- package/dist/node/operations/index.js +408 -0
- package/dist/node/operations/operation.js +51 -0
- package/dist/node/operations/registry.js +405 -0
- package/dist/node/operations/report/getContractVerificationStatus.js +170 -0
- package/dist/node/operations/report/index.js +305 -0
- package/dist/node/ownership.js +73 -0
- package/dist/node/policy/context.js +206 -0
- package/dist/node/policy/docs/policy.docblock.js +313 -0
- package/dist/node/policy/engine.js +325 -0
- package/dist/node/policy/guards.js +387 -0
- package/dist/node/policy/index.js +1313 -0
- package/dist/node/policy/opa-adapter.js +110 -0
- package/dist/node/policy/registry.js +221 -0
- package/dist/node/policy/spec.js +0 -0
- package/dist/node/policy/validation.js +391 -0
- package/dist/node/presentations/docs/presentations-conventions.docblock.js +171 -0
- package/dist/node/presentations/index.js +227 -0
- package/dist/node/presentations/presentations.js +38 -0
- package/dist/node/presentations/registry.js +221 -0
- package/dist/node/presentations/transform-engine.js +600 -0
- package/dist/node/product-intent/contract-patch-intent.js +68 -0
- package/dist/node/product-intent/contract-spec-patch.js +75 -0
- package/dist/node/product-intent/evidence.js +45 -0
- package/dist/node/product-intent/findings.js +81 -0
- package/dist/node/product-intent/impact-report.js +62 -0
- package/dist/node/product-intent/index.js +742 -0
- package/dist/node/product-intent/insights.js +63 -0
- package/dist/node/product-intent/opportunity-brief.js +106 -0
- package/dist/node/product-intent/problems.js +55 -0
- package/dist/node/product-intent/registry.js +242 -0
- package/dist/node/product-intent/runtime.js +320 -0
- package/dist/node/product-intent/spec.js +425 -0
- package/dist/node/product-intent/task-pack.js +69 -0
- package/dist/node/product-intent/tickets.js +57 -0
- package/dist/node/product-intent/types.js +378 -0
- package/dist/node/product-intent/ui-wireframe.js +73 -0
- package/dist/node/prompt.js +38 -0
- package/dist/node/promptRegistry.js +63 -0
- package/dist/node/regenerator/adapters.js +0 -0
- package/dist/node/regenerator/docs/regenerator.docblock.js +164 -0
- package/dist/node/regenerator/executor.js +157 -0
- package/dist/node/regenerator/index.js +341 -0
- package/dist/node/regenerator/service.js +183 -0
- package/dist/node/regenerator/sinks.js +64 -0
- package/dist/node/regenerator/types.js +0 -0
- package/dist/node/regenerator/utils.js +87 -0
- package/dist/node/registry-utils.js +163 -0
- package/dist/node/registry.js +215 -0
- package/dist/node/resources.js +83 -0
- package/dist/node/schema-to-markdown.js +278 -0
- package/dist/node/serialization/index.js +179 -0
- package/dist/node/serialization/serializers.js +180 -0
- package/dist/node/serialization/types.js +0 -0
- package/dist/node/telemetry/anomaly.js +91 -0
- package/dist/node/telemetry/docs/telemetry.docblock.js +164 -0
- package/dist/node/telemetry/index.js +417 -0
- package/dist/node/telemetry/spec.js +261 -0
- package/dist/node/telemetry/tracker.js +129 -0
- package/dist/node/tests/index.js +231 -0
- package/dist/node/tests/runner.js +189 -0
- package/dist/node/tests/spec.js +74 -0
- package/dist/node/themes.js +225 -0
- package/dist/node/translations/catalog.js +0 -0
- package/dist/node/translations/index.js +533 -0
- package/dist/node/translations/registry.js +170 -0
- package/dist/node/translations/spec.js +36 -0
- package/dist/node/translations/tenant.js +0 -0
- package/dist/node/translations/validation.js +392 -0
- package/dist/node/types.js +0 -0
- package/dist/node/versioning/index.js +274 -0
- package/dist/node/versioning/refs.js +99 -0
- package/dist/node/versioning/types.js +55 -0
- package/dist/node/versioning/utils.js +184 -0
- package/dist/node/workflow/adapters/db-adapter.js +127 -0
- package/dist/node/workflow/adapters/file-adapter.js +38 -0
- package/dist/node/workflow/adapters/index.js +194 -0
- package/dist/node/workflow/adapters/memory-store.js +93 -0
- package/dist/node/workflow/context.js +247 -0
- package/dist/node/workflow/expression.js +157 -0
- package/dist/node/workflow/index.js +1546 -0
- package/dist/node/workflow/overview.docblock.js +164 -0
- package/dist/node/workflow/runner.js +532 -0
- package/dist/node/workflow/sla-monitor.js +84 -0
- package/dist/node/workflow/spec.js +221 -0
- package/dist/node/workflow/state.js +0 -0
- package/dist/node/workflow/validation.js +425 -0
- package/dist/node/workspace-config/contractsrc-schema.js +344 -0
- package/dist/node/workspace-config/contractsrc-types.js +0 -0
- package/dist/node/workspace-config/index.js +325 -0
- package/dist/node/workspace-config/workspace-config.docblock.js +188 -0
- package/dist/onboarding-base.d.ts +131 -0
- package/dist/onboarding-base.js +597 -0
- package/dist/openapi.d.ts +33 -0
- package/dist/openapi.js +151 -0
- package/dist/operations/index.d.ts +2 -0
- package/dist/operations/index.js +408 -0
- package/dist/operations/operation.d.ts +191 -0
- package/dist/operations/operation.js +51 -0
- package/dist/operations/registry.d.ts +58 -0
- package/dist/operations/registry.js +405 -0
- package/dist/operations/report/getContractVerificationStatus.d.ts +68 -0
- package/dist/operations/report/getContractVerificationStatus.js +170 -0
- package/dist/operations/report/getContractVerificationStatus.test.d.ts +1 -0
- package/dist/operations/report/index.d.ts +10 -0
- package/dist/operations/report/index.js +305 -0
- package/dist/operations/report/index.test.d.ts +1 -0
- package/dist/ownership.d.ts +211 -0
- package/dist/ownership.js +73 -0
- package/dist/ownership.test.d.ts +1 -0
- package/dist/policy/context.d.ts +234 -0
- package/dist/policy/context.js +206 -0
- package/dist/policy/context.test.d.ts +1 -0
- package/dist/policy/docs/policy.docblock.d.ts +2 -0
- package/dist/policy/docs/policy.docblock.js +313 -0
- package/dist/policy/engine.d.ts +36 -0
- package/dist/policy/engine.js +325 -0
- package/dist/policy/engine.test.d.ts +1 -0
- package/dist/policy/guards.d.ts +156 -0
- package/dist/policy/guards.js +387 -0
- package/dist/policy/guards.test.d.ts +1 -0
- package/dist/policy/index.d.ts +12 -0
- package/dist/policy/index.js +1313 -0
- package/dist/policy/opa-adapter.d.ts +41 -0
- package/dist/policy/opa-adapter.js +110 -0
- package/dist/policy/opa-adapter.test.d.ts +1 -0
- package/dist/policy/registry.d.ts +5 -0
- package/dist/policy/registry.js +221 -0
- package/dist/policy/spec.d.ts +102 -0
- package/dist/policy/spec.js +1 -0
- package/dist/policy/validation.d.ts +84 -0
- package/dist/policy/validation.js +391 -0
- package/dist/policy/validation.test.d.ts +1 -0
- package/dist/presentations/docs/presentations-conventions.docblock.d.ts +2 -0
- package/dist/presentations/docs/presentations-conventions.docblock.js +171 -0
- package/dist/presentations/index.d.ts +2 -0
- package/dist/presentations/index.js +227 -0
- package/dist/presentations/presentations.d.ts +52 -0
- package/dist/presentations/presentations.js +38 -0
- package/dist/presentations/registry.d.ts +6 -0
- package/dist/presentations/registry.js +221 -0
- package/dist/presentations/transform-engine.d.ts +62 -0
- package/dist/presentations/transform-engine.js +600 -0
- package/dist/presentations/transform-engine.test.d.ts +1 -0
- package/dist/product-intent/contract-patch-intent.d.ts +100 -0
- package/dist/product-intent/contract-patch-intent.js +68 -0
- package/dist/product-intent/contract-spec-patch.d.ts +86 -0
- package/dist/product-intent/contract-spec-patch.js +75 -0
- package/dist/product-intent/evidence.d.ts +14 -0
- package/dist/product-intent/evidence.js +45 -0
- package/dist/product-intent/findings.d.ts +57 -0
- package/dist/product-intent/findings.js +81 -0
- package/dist/product-intent/impact-report.d.ts +57 -0
- package/dist/product-intent/impact-report.js +62 -0
- package/dist/product-intent/index.d.ts +13 -0
- package/dist/product-intent/index.js +742 -0
- package/dist/product-intent/insights.d.ts +62 -0
- package/dist/product-intent/insights.js +63 -0
- package/dist/product-intent/opportunity-brief.d.ts +192 -0
- package/dist/product-intent/opportunity-brief.js +106 -0
- package/dist/product-intent/problems.d.ts +59 -0
- package/dist/product-intent/problems.js +55 -0
- package/dist/product-intent/registry.d.ts +28 -0
- package/dist/product-intent/registry.js +242 -0
- package/dist/product-intent/registry.test.d.ts +1 -0
- package/dist/product-intent/runtime.d.ts +92 -0
- package/dist/product-intent/runtime.js +320 -0
- package/dist/product-intent/runtime.test.d.ts +1 -0
- package/dist/product-intent/spec.d.ts +664 -0
- package/dist/product-intent/spec.js +425 -0
- package/dist/product-intent/task-pack.d.ts +98 -0
- package/dist/product-intent/task-pack.js +69 -0
- package/dist/product-intent/tickets.d.ts +67 -0
- package/dist/product-intent/tickets.js +57 -0
- package/dist/product-intent/types.d.ts +11 -0
- package/dist/product-intent/types.js +378 -0
- package/dist/product-intent/ui-wireframe.d.ts +100 -0
- package/dist/product-intent/ui-wireframe.js +73 -0
- package/dist/prompt.d.ts +49 -0
- package/dist/prompt.js +38 -0
- package/dist/prompt.test.d.ts +1 -0
- package/dist/promptRegistry.d.ts +11 -0
- package/dist/promptRegistry.js +63 -0
- package/dist/promptRegistry.test.d.ts +1 -0
- package/dist/regenerator/adapters.d.ts +15 -0
- package/dist/regenerator/adapters.js +1 -0
- package/dist/regenerator/docs/regenerator.docblock.d.ts +2 -0
- package/dist/regenerator/docs/regenerator.docblock.js +164 -0
- package/dist/regenerator/executor.d.ts +66 -0
- package/dist/regenerator/executor.js +157 -0
- package/dist/regenerator/executor.test.d.ts +1 -0
- package/dist/regenerator/index.d.ts +6 -0
- package/dist/regenerator/index.js +341 -0
- package/dist/regenerator/service.d.ts +29 -0
- package/dist/regenerator/service.js +183 -0
- package/dist/regenerator/service.test.d.ts +1 -0
- package/dist/regenerator/sinks.d.ts +23 -0
- package/dist/regenerator/sinks.js +64 -0
- package/dist/regenerator/sinks.test.d.ts +1 -0
- package/dist/regenerator/types.d.ts +103 -0
- package/dist/regenerator/types.js +1 -0
- package/dist/regenerator/utils.d.ts +6 -0
- package/dist/regenerator/utils.js +87 -0
- package/dist/registry-utils.d.ts +105 -0
- package/dist/registry-utils.js +163 -0
- package/dist/registry-utils.test.d.ts +1 -0
- package/dist/registry.d.ts +27 -0
- package/dist/registry.js +215 -0
- package/dist/resources.d.ts +60 -0
- package/dist/resources.js +83 -0
- package/dist/schema-to-markdown.d.ts +56 -0
- package/dist/schema-to-markdown.js +278 -0
- package/dist/serialization/index.d.ts +10 -0
- package/dist/serialization/index.js +179 -0
- package/dist/serialization/serializers.d.ts +35 -0
- package/dist/serialization/serializers.js +180 -0
- package/dist/serialization/types.d.ts +100 -0
- package/dist/serialization/types.js +1 -0
- package/dist/telemetry/anomaly.d.ts +23 -0
- package/dist/telemetry/anomaly.js +91 -0
- package/dist/telemetry/anomaly.test.d.ts +1 -0
- package/dist/telemetry/docs/telemetry.docblock.d.ts +2 -0
- package/dist/telemetry/docs/telemetry.docblock.js +164 -0
- package/dist/telemetry/index.d.ts +3 -0
- package/dist/telemetry/index.js +417 -0
- package/dist/telemetry/spec.d.ts +87 -0
- package/dist/telemetry/spec.js +261 -0
- package/dist/telemetry/spec.test.d.ts +1 -0
- package/dist/telemetry/tracker.d.ts +48 -0
- package/dist/telemetry/tracker.js +129 -0
- package/dist/telemetry/tracker.test.d.ts +1 -0
- package/dist/tests/index.d.ts +2 -0
- package/dist/tests/index.js +231 -0
- package/dist/tests/runner.d.ts +38 -0
- package/dist/tests/runner.js +189 -0
- package/dist/tests/runner.test.d.ts +1 -0
- package/dist/tests/spec.d.ts +82 -0
- package/dist/tests/spec.js +74 -0
- package/dist/tests/spec.test.d.ts +1 -0
- package/dist/themes.d.ts +50 -0
- package/dist/themes.js +225 -0
- package/dist/themes.test.d.ts +1 -0
- package/dist/translations/catalog.d.ts +25 -0
- package/dist/translations/catalog.js +1 -0
- package/dist/translations/index.d.ts +44 -0
- package/dist/translations/index.js +533 -0
- package/dist/translations/registry.d.ts +172 -0
- package/dist/translations/registry.js +170 -0
- package/dist/translations/registry.test.d.ts +1 -0
- package/dist/translations/spec.d.ts +153 -0
- package/dist/translations/spec.js +36 -0
- package/dist/translations/spec.test.d.ts +1 -0
- package/dist/translations/tenant.d.ts +11 -0
- package/dist/translations/tenant.js +1 -0
- package/dist/translations/validation.d.ts +106 -0
- package/dist/translations/validation.js +392 -0
- package/dist/translations/validation.test.d.ts +1 -0
- package/dist/types.d.ts +212 -0
- package/dist/types.js +1 -0
- package/dist/versioning/index.d.ts +9 -0
- package/dist/versioning/index.js +274 -0
- package/dist/versioning/refs.d.ts +176 -0
- package/dist/versioning/refs.js +99 -0
- package/dist/versioning/refs.test.d.ts +4 -0
- package/dist/versioning/types.d.ts +130 -0
- package/dist/versioning/types.js +55 -0
- package/dist/versioning/utils.d.ts +93 -0
- package/dist/versioning/utils.js +184 -0
- package/dist/versioning/utils.test.d.ts +4 -0
- package/dist/workflow/adapters/db-adapter.d.ts +43 -0
- package/dist/workflow/adapters/db-adapter.js +127 -0
- package/dist/workflow/adapters/file-adapter.d.ts +10 -0
- package/dist/workflow/adapters/file-adapter.js +38 -0
- package/dist/workflow/adapters/index.d.ts +3 -0
- package/dist/workflow/adapters/index.js +194 -0
- package/dist/workflow/adapters/memory-store.d.ts +13 -0
- package/dist/workflow/adapters/memory-store.js +93 -0
- package/dist/workflow/context.d.ts +217 -0
- package/dist/workflow/context.js +247 -0
- package/dist/workflow/context.test.d.ts +1 -0
- package/dist/workflow/expression.d.ts +6 -0
- package/dist/workflow/expression.js +157 -0
- package/dist/workflow/expression.test.d.ts +1 -0
- package/dist/workflow/index.d.ts +13 -0
- package/dist/workflow/index.js +1546 -0
- package/dist/workflow/overview.docblock.d.ts +2 -0
- package/dist/workflow/overview.docblock.js +164 -0
- package/dist/workflow/runner.d.ts +71 -0
- package/dist/workflow/runner.js +532 -0
- package/dist/workflow/runner.test.d.ts +1 -0
- package/dist/workflow/sla-monitor.d.ts +16 -0
- package/dist/workflow/sla-monitor.js +84 -0
- package/dist/workflow/spec.d.ts +81 -0
- package/dist/workflow/spec.js +221 -0
- package/dist/workflow/state.d.ts +31 -0
- package/dist/workflow/state.js +1 -0
- package/dist/workflow/validation.d.ts +87 -0
- package/dist/workflow/validation.js +425 -0
- package/dist/workflow/validation.test.d.ts +1 -0
- package/dist/workspace-config/contractsrc-schema.d.ts +144 -0
- package/dist/workspace-config/contractsrc-schema.js +344 -0
- package/dist/workspace-config/contractsrc-schema.test.d.ts +1 -0
- package/dist/workspace-config/contractsrc-types.d.ts +342 -0
- package/dist/workspace-config/contractsrc-types.js +1 -0
- package/dist/workspace-config/index.d.ts +5 -0
- package/dist/workspace-config/index.js +325 -0
- package/dist/workspace-config/workspace-config.docblock.d.ts +2 -0
- package/dist/workspace-config/workspace-config.docblock.js +188 -0
- package/package.json +4426 -0
|
@@ -0,0 +1,2195 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
7
|
+
var __toCommonJS = (from) => {
|
|
8
|
+
var entry = __moduleCache.get(from), desc;
|
|
9
|
+
if (entry)
|
|
10
|
+
return entry;
|
|
11
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function")
|
|
13
|
+
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
}));
|
|
17
|
+
__moduleCache.set(from, entry);
|
|
18
|
+
return entry;
|
|
19
|
+
};
|
|
20
|
+
var __export = (target, all) => {
|
|
21
|
+
for (var name in all)
|
|
22
|
+
__defProp(target, name, {
|
|
23
|
+
get: all[name],
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
set: (newValue) => all[name] = () => newValue
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
30
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
31
|
+
|
|
32
|
+
// src/registry-utils.ts
|
|
33
|
+
var exports_registry_utils = {};
|
|
34
|
+
__export(exports_registry_utils, {
|
|
35
|
+
groupByToArray: () => groupByToArray,
|
|
36
|
+
groupByMultiple: () => groupByMultiple,
|
|
37
|
+
groupBy: () => groupBy,
|
|
38
|
+
getUniqueTags: () => getUniqueTags,
|
|
39
|
+
getUniqueOwners: () => getUniqueOwners,
|
|
40
|
+
getUniqueDomains: () => getUniqueDomains,
|
|
41
|
+
filterBy: () => filterBy,
|
|
42
|
+
GroupingStrategies: () => GroupingStrategies
|
|
43
|
+
});
|
|
44
|
+
function filterBy(items, filter) {
|
|
45
|
+
return items.filter((item) => {
|
|
46
|
+
if (filter.tags?.length) {
|
|
47
|
+
const hasMatchingTag = filter.tags.some((tag) => item.meta.tags?.includes(tag));
|
|
48
|
+
if (!hasMatchingTag)
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (filter.owners?.length) {
|
|
52
|
+
const hasMatchingOwner = filter.owners.some((owner) => item.meta.owners?.includes(owner));
|
|
53
|
+
if (!hasMatchingOwner)
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (filter.stability?.length) {
|
|
57
|
+
if (!filter.stability.includes(item.meta.stability ?? "stable")) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (filter.domain) {
|
|
62
|
+
const itemDomain = GroupingStrategies.byDomain(item);
|
|
63
|
+
if (itemDomain !== filter.domain)
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
if (filter.keyPattern) {
|
|
67
|
+
const name = item.meta.key ?? item.meta.key ?? "";
|
|
68
|
+
const pattern = filter.keyPattern.replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
69
|
+
const regex = new RegExp(`^${pattern}$`, "i");
|
|
70
|
+
if (!regex.test(name))
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function groupBy(items, keyFn) {
|
|
77
|
+
const groups = new Map;
|
|
78
|
+
for (const item of items) {
|
|
79
|
+
const key = keyFn(item);
|
|
80
|
+
const existing = groups.get(key);
|
|
81
|
+
if (existing) {
|
|
82
|
+
existing.push(item);
|
|
83
|
+
} else {
|
|
84
|
+
groups.set(key, [item]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return groups;
|
|
88
|
+
}
|
|
89
|
+
function groupByToArray(items, keyFn) {
|
|
90
|
+
const map = groupBy(items, keyFn);
|
|
91
|
+
return Array.from(map.entries()).map(([key, items2]) => ({ key, items: items2 }));
|
|
92
|
+
}
|
|
93
|
+
function groupByMultiple(items, keysFn) {
|
|
94
|
+
const groups = new Map;
|
|
95
|
+
for (const item of items) {
|
|
96
|
+
const keys = keysFn(item);
|
|
97
|
+
for (const key of keys) {
|
|
98
|
+
const existing = groups.get(key);
|
|
99
|
+
if (existing) {
|
|
100
|
+
existing.push(item);
|
|
101
|
+
} else {
|
|
102
|
+
groups.set(key, [item]);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return groups;
|
|
107
|
+
}
|
|
108
|
+
function getUniqueTags(items) {
|
|
109
|
+
const tags = new Set;
|
|
110
|
+
for (const item of items) {
|
|
111
|
+
for (const tag of item.meta.tags ?? []) {
|
|
112
|
+
tags.add(tag);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return Array.from(tags).sort();
|
|
116
|
+
}
|
|
117
|
+
function getUniqueOwners(items) {
|
|
118
|
+
const owners = new Set;
|
|
119
|
+
for (const item of items) {
|
|
120
|
+
for (const owner of item.meta.owners ?? []) {
|
|
121
|
+
owners.add(owner);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return Array.from(owners).sort();
|
|
125
|
+
}
|
|
126
|
+
function getUniqueDomains(items) {
|
|
127
|
+
const domains = new Set;
|
|
128
|
+
for (const item of items) {
|
|
129
|
+
domains.add(GroupingStrategies.byDomain(item));
|
|
130
|
+
}
|
|
131
|
+
return Array.from(domains).sort();
|
|
132
|
+
}
|
|
133
|
+
var GroupingStrategies;
|
|
134
|
+
var init_registry_utils = __esm(() => {
|
|
135
|
+
GroupingStrategies = {
|
|
136
|
+
byTag: (item) => item.meta.tags?.[0] ?? "untagged",
|
|
137
|
+
byAllTags: (item) => item.meta.tags?.length ? item.meta.tags : ["untagged"],
|
|
138
|
+
byOwner: (item) => item.meta.owners?.[0] ?? "unowned",
|
|
139
|
+
byDomain: (item) => {
|
|
140
|
+
const name = item.meta.key ?? item.meta.key ?? "";
|
|
141
|
+
return name.split(".")[0] ?? "default";
|
|
142
|
+
},
|
|
143
|
+
byStability: (item) => item.meta.stability ?? "stable",
|
|
144
|
+
byUrlPath: (level) => (item) => {
|
|
145
|
+
if (!item.path)
|
|
146
|
+
return "root";
|
|
147
|
+
const segments = item.path.split("/").filter(Boolean);
|
|
148
|
+
return segments.slice(0, level).join("/") || "root";
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// src/capabilities/capabilities.ts
|
|
154
|
+
import { compareVersions } from "compare-versions";
|
|
155
|
+
var capKey = (key, version) => `${key}.v${version}`;
|
|
156
|
+
|
|
157
|
+
class CapabilityRegistry {
|
|
158
|
+
items = new Map;
|
|
159
|
+
surfaceIndex = null;
|
|
160
|
+
register(spec) {
|
|
161
|
+
const key = capKey(spec.meta.key, spec.meta.version);
|
|
162
|
+
if (this.items.has(key))
|
|
163
|
+
throw new Error(`Duplicate capability ${key}`);
|
|
164
|
+
this.items.set(key, spec);
|
|
165
|
+
this.surfaceIndex = null;
|
|
166
|
+
return this;
|
|
167
|
+
}
|
|
168
|
+
list() {
|
|
169
|
+
return [...this.items.values()];
|
|
170
|
+
}
|
|
171
|
+
get(key, version) {
|
|
172
|
+
if (version != null)
|
|
173
|
+
return this.items.get(capKey(key, version));
|
|
174
|
+
let candidate;
|
|
175
|
+
for (const spec of this.items.values()) {
|
|
176
|
+
if (spec.meta.key !== key)
|
|
177
|
+
continue;
|
|
178
|
+
if (!candidate || compareVersions(spec.meta.version, candidate.meta.version) > 0) {
|
|
179
|
+
candidate = spec;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return candidate;
|
|
183
|
+
}
|
|
184
|
+
satisfies(requirement, additional) {
|
|
185
|
+
if (requirement.optional)
|
|
186
|
+
return true;
|
|
187
|
+
if (additional?.some((ref) => matchesRequirement(ref, requirement)))
|
|
188
|
+
return true;
|
|
189
|
+
const spec = requirement.version ? this.get(requirement.key, requirement.version) : this.get(requirement.key);
|
|
190
|
+
if (!spec)
|
|
191
|
+
return false;
|
|
192
|
+
if (requirement.kind && spec.meta.kind !== requirement.kind)
|
|
193
|
+
return false;
|
|
194
|
+
if (requirement.version != null && spec.meta.version !== requirement.version)
|
|
195
|
+
return false;
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
buildSurfaceIndex() {
|
|
199
|
+
if (this.surfaceIndex)
|
|
200
|
+
return this.surfaceIndex;
|
|
201
|
+
this.surfaceIndex = new Map;
|
|
202
|
+
for (const spec of this.items.values()) {
|
|
203
|
+
const capabilityKey = capKey(spec.meta.key, spec.meta.version);
|
|
204
|
+
for (const surface of spec.provides ?? []) {
|
|
205
|
+
const surfaceKey = `${surface.surface}:${surface.key}`;
|
|
206
|
+
if (!this.surfaceIndex.has(surfaceKey)) {
|
|
207
|
+
this.surfaceIndex.set(surfaceKey, new Set);
|
|
208
|
+
}
|
|
209
|
+
this.surfaceIndex.get(surfaceKey)?.add(capabilityKey);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return this.surfaceIndex;
|
|
213
|
+
}
|
|
214
|
+
getOperationsFor(capabilityKey, version) {
|
|
215
|
+
const spec = this.get(capabilityKey, version);
|
|
216
|
+
if (!spec)
|
|
217
|
+
return [];
|
|
218
|
+
return spec.provides?.filter((s) => s.surface === "operation").map((s) => s.key) ?? [];
|
|
219
|
+
}
|
|
220
|
+
getEventsFor(capabilityKey, version) {
|
|
221
|
+
const spec = this.get(capabilityKey, version);
|
|
222
|
+
if (!spec)
|
|
223
|
+
return [];
|
|
224
|
+
return spec.provides?.filter((s) => s.surface === "event").map((s) => s.key) ?? [];
|
|
225
|
+
}
|
|
226
|
+
getPresentationsFor(capabilityKey, version) {
|
|
227
|
+
const spec = this.get(capabilityKey, version);
|
|
228
|
+
if (!spec)
|
|
229
|
+
return [];
|
|
230
|
+
return spec.provides?.filter((s) => s.surface === "presentation").map((s) => s.key) ?? [];
|
|
231
|
+
}
|
|
232
|
+
getWorkflowsFor(capabilityKey, version) {
|
|
233
|
+
const spec = this.get(capabilityKey, version);
|
|
234
|
+
if (!spec)
|
|
235
|
+
return [];
|
|
236
|
+
return spec.provides?.filter((s) => s.surface === "workflow").map((s) => s.key) ?? [];
|
|
237
|
+
}
|
|
238
|
+
getResourcesFor(capabilityKey, version) {
|
|
239
|
+
const spec = this.get(capabilityKey, version);
|
|
240
|
+
if (!spec)
|
|
241
|
+
return [];
|
|
242
|
+
return spec.provides?.filter((s) => s.surface === "resource").map((s) => s.key) ?? [];
|
|
243
|
+
}
|
|
244
|
+
getCapabilitiesForOperation(operationKey) {
|
|
245
|
+
const index = this.buildSurfaceIndex();
|
|
246
|
+
const capKeys = index.get(`operation:${operationKey}`);
|
|
247
|
+
if (!capKeys)
|
|
248
|
+
return [];
|
|
249
|
+
return [...capKeys].map((k) => {
|
|
250
|
+
const spec = this.items.get(k);
|
|
251
|
+
return { key: spec?.meta.key ?? "", version: spec?.meta.version ?? "" };
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
getCapabilitiesForEvent(eventKey) {
|
|
255
|
+
const index = this.buildSurfaceIndex();
|
|
256
|
+
const capKeys = index.get(`event:${eventKey}`);
|
|
257
|
+
if (!capKeys)
|
|
258
|
+
return [];
|
|
259
|
+
return [...capKeys].map((k) => {
|
|
260
|
+
const spec = this.items.get(k);
|
|
261
|
+
return { key: spec?.meta.key ?? "", version: spec?.meta.version ?? "" };
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
getCapabilitiesForPresentation(presentationKey) {
|
|
265
|
+
const index = this.buildSurfaceIndex();
|
|
266
|
+
const capKeys = index.get(`presentation:${presentationKey}`);
|
|
267
|
+
if (!capKeys)
|
|
268
|
+
return [];
|
|
269
|
+
return [...capKeys].map((k) => {
|
|
270
|
+
const spec = this.items.get(k);
|
|
271
|
+
return { key: spec?.meta.key ?? "", version: spec?.meta.version ?? "" };
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
getAncestors(capabilityKey, version) {
|
|
275
|
+
const ancestors = [];
|
|
276
|
+
const visited = new Set;
|
|
277
|
+
let current = this.get(capabilityKey, version);
|
|
278
|
+
while (current?.extends) {
|
|
279
|
+
const parentKey = capKey(current.extends.key, current.extends.version);
|
|
280
|
+
if (visited.has(parentKey)) {
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
visited.add(parentKey);
|
|
284
|
+
const parent = this.get(current.extends.key, current.extends.version);
|
|
285
|
+
if (!parent)
|
|
286
|
+
break;
|
|
287
|
+
ancestors.push(parent);
|
|
288
|
+
current = parent;
|
|
289
|
+
}
|
|
290
|
+
return ancestors;
|
|
291
|
+
}
|
|
292
|
+
getEffectiveRequirements(capabilityKey, version) {
|
|
293
|
+
const spec = this.get(capabilityKey, version);
|
|
294
|
+
if (!spec)
|
|
295
|
+
return [];
|
|
296
|
+
const ancestors = this.getAncestors(capabilityKey, version);
|
|
297
|
+
const requirementMap = new Map;
|
|
298
|
+
for (const ancestor of [...ancestors].reverse()) {
|
|
299
|
+
for (const req of ancestor.requires ?? []) {
|
|
300
|
+
requirementMap.set(req.key, req);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
for (const req of spec.requires ?? []) {
|
|
304
|
+
requirementMap.set(req.key, req);
|
|
305
|
+
}
|
|
306
|
+
return [...requirementMap.values()];
|
|
307
|
+
}
|
|
308
|
+
getEffectiveSurfaces(capabilityKey, version) {
|
|
309
|
+
const spec = this.get(capabilityKey, version);
|
|
310
|
+
if (!spec)
|
|
311
|
+
return [];
|
|
312
|
+
const ancestors = this.getAncestors(capabilityKey, version);
|
|
313
|
+
const surfaces = [];
|
|
314
|
+
for (const ancestor of [...ancestors].reverse()) {
|
|
315
|
+
surfaces.push(...ancestor.provides ?? []);
|
|
316
|
+
}
|
|
317
|
+
surfaces.push(...spec.provides ?? []);
|
|
318
|
+
return surfaces;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function matchesRequirement(ref, requirement) {
|
|
322
|
+
if (ref.key !== requirement.key)
|
|
323
|
+
return false;
|
|
324
|
+
if (requirement.version != null && ref.version !== requirement.version)
|
|
325
|
+
return false;
|
|
326
|
+
return true;
|
|
327
|
+
}
|
|
328
|
+
function capabilityKey(spec) {
|
|
329
|
+
return capKey(spec.meta.key, spec.meta.version);
|
|
330
|
+
}
|
|
331
|
+
function defineCapability(spec) {
|
|
332
|
+
return spec;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// src/capabilities/validation.ts
|
|
336
|
+
function validateCapabilityConsistency(deps) {
|
|
337
|
+
const errors = [];
|
|
338
|
+
const warnings = [];
|
|
339
|
+
for (const capability of deps.capabilities.list()) {
|
|
340
|
+
const capKey2 = `${capability.meta.key}.v${capability.meta.version}`;
|
|
341
|
+
for (const surface of capability.provides ?? []) {
|
|
342
|
+
const exists = checkSurfaceExists(deps, surface.surface, surface.key);
|
|
343
|
+
if (!exists) {
|
|
344
|
+
errors.push({
|
|
345
|
+
type: "missing_surface_spec",
|
|
346
|
+
message: `Capability "${capKey2}" provides ${surface.surface} "${surface.key}" but spec not found`,
|
|
347
|
+
capabilityKey: capKey2,
|
|
348
|
+
surface: surface.surface,
|
|
349
|
+
specKey: surface.key
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (deps.operations) {
|
|
355
|
+
for (const op of deps.operations.list()) {
|
|
356
|
+
if (op.capability) {
|
|
357
|
+
const capSpec = deps.capabilities.get(op.capability.key, op.capability.version);
|
|
358
|
+
if (!capSpec) {
|
|
359
|
+
errors.push({
|
|
360
|
+
type: "capability_not_found",
|
|
361
|
+
message: `Operation "${op.meta.key}" references capability "${op.capability.key}.v${op.capability.version}" but capability not found`,
|
|
362
|
+
specKey: op.meta.key,
|
|
363
|
+
capabilityKey: `${op.capability.key}.v${op.capability.version}`,
|
|
364
|
+
surface: "operation"
|
|
365
|
+
});
|
|
366
|
+
} else {
|
|
367
|
+
const inProvides = capSpec.provides?.some((p) => p.surface === "operation" && p.key === op.meta.key);
|
|
368
|
+
if (!inProvides) {
|
|
369
|
+
errors.push({
|
|
370
|
+
type: "surface_not_in_provides",
|
|
371
|
+
message: `Operation "${op.meta.key}" claims capability "${op.capability.key}.v${op.capability.version}" but not in capability's provides`,
|
|
372
|
+
specKey: op.meta.key,
|
|
373
|
+
capabilityKey: `${op.capability.key}.v${op.capability.version}`,
|
|
374
|
+
surface: "operation"
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (deps.events) {
|
|
382
|
+
for (const event of deps.events.list()) {
|
|
383
|
+
if (event.capability) {
|
|
384
|
+
const capSpec = deps.capabilities.get(event.capability.key, event.capability.version);
|
|
385
|
+
if (!capSpec) {
|
|
386
|
+
errors.push({
|
|
387
|
+
type: "capability_not_found",
|
|
388
|
+
message: `Event "${event.meta.key}" references capability "${event.capability.key}.v${event.capability.version}" but capability not found`,
|
|
389
|
+
specKey: event.meta.key,
|
|
390
|
+
capabilityKey: `${event.capability.key}.v${event.capability.version}`,
|
|
391
|
+
surface: "event"
|
|
392
|
+
});
|
|
393
|
+
} else {
|
|
394
|
+
const inProvides = capSpec.provides?.some((p) => p.surface === "event" && p.key === event.meta.key);
|
|
395
|
+
if (!inProvides) {
|
|
396
|
+
errors.push({
|
|
397
|
+
type: "surface_not_in_provides",
|
|
398
|
+
message: `Event "${event.meta.key}" claims capability "${event.capability.key}.v${event.capability.version}" but not in capability's provides`,
|
|
399
|
+
specKey: event.meta.key,
|
|
400
|
+
capabilityKey: `${event.capability.key}.v${event.capability.version}`,
|
|
401
|
+
surface: "event"
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (deps.presentations) {
|
|
409
|
+
for (const pres of deps.presentations.list()) {
|
|
410
|
+
if (pres.capability) {
|
|
411
|
+
const capSpec = deps.capabilities.get(pres.capability.key, pres.capability.version);
|
|
412
|
+
if (!capSpec) {
|
|
413
|
+
errors.push({
|
|
414
|
+
type: "capability_not_found",
|
|
415
|
+
message: `Presentation "${pres.meta.key}" references capability "${pres.capability.key}.v${pres.capability.version}" but capability not found`,
|
|
416
|
+
specKey: pres.meta.key,
|
|
417
|
+
capabilityKey: `${pres.capability.key}.v${pres.capability.version}`,
|
|
418
|
+
surface: "presentation"
|
|
419
|
+
});
|
|
420
|
+
} else {
|
|
421
|
+
const inProvides = capSpec.provides?.some((p) => p.surface === "presentation" && p.key === pres.meta.key);
|
|
422
|
+
if (!inProvides) {
|
|
423
|
+
errors.push({
|
|
424
|
+
type: "surface_not_in_provides",
|
|
425
|
+
message: `Presentation "${pres.meta.key}" claims capability "${pres.capability.key}.v${pres.capability.version}" but not in capability's provides`,
|
|
426
|
+
specKey: pres.meta.key,
|
|
427
|
+
capabilityKey: `${pres.capability.key}.v${pres.capability.version}`,
|
|
428
|
+
surface: "presentation"
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return {
|
|
436
|
+
valid: errors.length === 0,
|
|
437
|
+
errors,
|
|
438
|
+
warnings
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
function checkSurfaceExists(deps, surface, key) {
|
|
442
|
+
switch (surface) {
|
|
443
|
+
case "operation":
|
|
444
|
+
return deps.operations?.has(key) ?? true;
|
|
445
|
+
case "event":
|
|
446
|
+
return deps.events?.has(key) ?? true;
|
|
447
|
+
case "presentation":
|
|
448
|
+
return deps.presentations?.has(key) ?? true;
|
|
449
|
+
case "workflow":
|
|
450
|
+
case "resource":
|
|
451
|
+
return true;
|
|
452
|
+
default:
|
|
453
|
+
return true;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function findOrphanSpecs(deps) {
|
|
457
|
+
const result = {
|
|
458
|
+
operations: [],
|
|
459
|
+
events: [],
|
|
460
|
+
presentations: []
|
|
461
|
+
};
|
|
462
|
+
if (deps.operations) {
|
|
463
|
+
for (const op of deps.operations.list()) {
|
|
464
|
+
if (!op.capability) {
|
|
465
|
+
result.operations.push(op.meta.key);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
if (deps.events) {
|
|
470
|
+
for (const event of deps.events.list()) {
|
|
471
|
+
if (!event.capability) {
|
|
472
|
+
result.events.push(event.meta.key);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
if (deps.presentations) {
|
|
477
|
+
for (const pres of deps.presentations.list()) {
|
|
478
|
+
if (!pres.capability) {
|
|
479
|
+
result.presentations.push(pres.meta.key);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return result;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// src/capabilities/context.ts
|
|
487
|
+
class CapabilityMissingError extends Error {
|
|
488
|
+
capabilityKey;
|
|
489
|
+
requiredVersion;
|
|
490
|
+
constructor(capabilityKey2, requiredVersion) {
|
|
491
|
+
const versionSuffix = requiredVersion ? `.v${requiredVersion}` : "";
|
|
492
|
+
super(`Missing required capability: ${capabilityKey2}${versionSuffix}`);
|
|
493
|
+
this.name = "CapabilityMissingError";
|
|
494
|
+
this.capabilityKey = capabilityKey2;
|
|
495
|
+
this.requiredVersion = requiredVersion;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
class CapabilityContextImpl {
|
|
500
|
+
capabilities;
|
|
501
|
+
capabilityVersions;
|
|
502
|
+
constructor(enabledCapabilities) {
|
|
503
|
+
const capSet = new Set;
|
|
504
|
+
const versionMap = new Map;
|
|
505
|
+
for (const cap of enabledCapabilities) {
|
|
506
|
+
capSet.add(cap.key);
|
|
507
|
+
versionMap.set(cap.key, cap.version);
|
|
508
|
+
}
|
|
509
|
+
this.capabilities = capSet;
|
|
510
|
+
this.capabilityVersions = versionMap;
|
|
511
|
+
}
|
|
512
|
+
hasCapability(key, version) {
|
|
513
|
+
if (!this.capabilities.has(key))
|
|
514
|
+
return false;
|
|
515
|
+
if (version != null) {
|
|
516
|
+
const enabledVersion = this.capabilityVersions.get(key);
|
|
517
|
+
return enabledVersion === version;
|
|
518
|
+
}
|
|
519
|
+
return true;
|
|
520
|
+
}
|
|
521
|
+
requireCapability(key, version) {
|
|
522
|
+
if (!this.hasCapability(key, version)) {
|
|
523
|
+
throw new CapabilityMissingError(key, version);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
hasAllCapabilities(keys) {
|
|
527
|
+
return keys.every((k) => this.capabilities.has(k));
|
|
528
|
+
}
|
|
529
|
+
hasAnyCapability(keys) {
|
|
530
|
+
return keys.some((k) => this.capabilities.has(k));
|
|
531
|
+
}
|
|
532
|
+
getMatchingCapabilities(pattern) {
|
|
533
|
+
if (!pattern.includes("*")) {
|
|
534
|
+
return this.capabilities.has(pattern) ? [pattern] : [];
|
|
535
|
+
}
|
|
536
|
+
const regexPattern = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
537
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
538
|
+
return [...this.capabilities].filter((key) => regex.test(key));
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function createCapabilityContext(enabledCapabilities) {
|
|
542
|
+
return new CapabilityContextImpl(enabledCapabilities);
|
|
543
|
+
}
|
|
544
|
+
function createEmptyCapabilityContext() {
|
|
545
|
+
return new CapabilityContextImpl([]);
|
|
546
|
+
}
|
|
547
|
+
function createBypassCapabilityContext(allCapabilities) {
|
|
548
|
+
return new CapabilityContextImpl(allCapabilities);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// src/capabilities/guards.ts
|
|
552
|
+
function checkCapabilityForOperation(ctx, operation) {
|
|
553
|
+
if (!operation.capability) {
|
|
554
|
+
return { allowed: true };
|
|
555
|
+
}
|
|
556
|
+
const { key, version } = operation.capability;
|
|
557
|
+
if (ctx.hasCapability(key, version)) {
|
|
558
|
+
return { allowed: true };
|
|
559
|
+
}
|
|
560
|
+
return {
|
|
561
|
+
allowed: false,
|
|
562
|
+
missingCapability: { key, version },
|
|
563
|
+
reason: `Operation "${operation.meta.key}" requires capability "${key}.v${version}"`
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function assertCapabilityForOperation(ctx, operation) {
|
|
567
|
+
const result = checkCapabilityForOperation(ctx, operation);
|
|
568
|
+
if (!result.allowed && result.missingCapability) {
|
|
569
|
+
throw new CapabilityMissingError(result.missingCapability.key, result.missingCapability.version);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
function checkCapabilityForEvent(ctx, event) {
|
|
573
|
+
if (!event.capability) {
|
|
574
|
+
return { allowed: true };
|
|
575
|
+
}
|
|
576
|
+
const { key, version } = event.capability;
|
|
577
|
+
if (ctx.hasCapability(key, version)) {
|
|
578
|
+
return { allowed: true };
|
|
579
|
+
}
|
|
580
|
+
return {
|
|
581
|
+
allowed: false,
|
|
582
|
+
missingCapability: { key, version },
|
|
583
|
+
reason: `Event "${event.meta.key}" requires capability "${key}.v${version}"`
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
function assertCapabilityForEvent(ctx, event) {
|
|
587
|
+
const result = checkCapabilityForEvent(ctx, event);
|
|
588
|
+
if (!result.allowed && result.missingCapability) {
|
|
589
|
+
throw new CapabilityMissingError(result.missingCapability.key, result.missingCapability.version);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
function checkCapabilityForPresentation(ctx, presentation) {
|
|
593
|
+
if (!presentation.capability) {
|
|
594
|
+
return { allowed: true };
|
|
595
|
+
}
|
|
596
|
+
const { key, version } = presentation.capability;
|
|
597
|
+
if (ctx.hasCapability(key, version)) {
|
|
598
|
+
return { allowed: true };
|
|
599
|
+
}
|
|
600
|
+
return {
|
|
601
|
+
allowed: false,
|
|
602
|
+
missingCapability: { key, version },
|
|
603
|
+
reason: `Presentation "${presentation.meta.key}" requires capability "${key}.v${version}"`
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
function assertCapabilityForPresentation(ctx, presentation) {
|
|
607
|
+
const result = checkCapabilityForPresentation(ctx, presentation);
|
|
608
|
+
if (!result.allowed && result.missingCapability) {
|
|
609
|
+
throw new CapabilityMissingError(result.missingCapability.key, result.missingCapability.version);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
function filterOperationsByCapability(ctx, operations) {
|
|
613
|
+
return operations.filter((op) => checkCapabilityForOperation(ctx, op).allowed);
|
|
614
|
+
}
|
|
615
|
+
function filterEventsByCapability(ctx, events) {
|
|
616
|
+
return events.filter((ev) => checkCapabilityForEvent(ctx, ev).allowed);
|
|
617
|
+
}
|
|
618
|
+
function filterPresentationsByCapability(ctx, presentations) {
|
|
619
|
+
return presentations.filter((pres) => checkCapabilityForPresentation(ctx, pres).allowed);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// src/ownership.ts
|
|
623
|
+
var StabilityEnum = {
|
|
624
|
+
Idea: "idea",
|
|
625
|
+
InCreation: "in_creation",
|
|
626
|
+
Experimental: "experimental",
|
|
627
|
+
Beta: "beta",
|
|
628
|
+
Stable: "stable",
|
|
629
|
+
Deprecated: "deprecated"
|
|
630
|
+
};
|
|
631
|
+
var OwnersEnum = {
|
|
632
|
+
PlatformCore: "platform.core",
|
|
633
|
+
PlatformSigil: "platform.sigil",
|
|
634
|
+
PlatformMarketplace: "platform.marketplace",
|
|
635
|
+
PlatformMessaging: "platform.messaging",
|
|
636
|
+
PlatformContent: "platform.content",
|
|
637
|
+
PlatformFeatureFlags: "platform.featureflags",
|
|
638
|
+
PlatformFinance: "platform.finance"
|
|
639
|
+
};
|
|
640
|
+
var Owners = OwnersEnum;
|
|
641
|
+
var TagsEnum = {
|
|
642
|
+
Spots: "spots",
|
|
643
|
+
Collectivity: "collectivity",
|
|
644
|
+
Marketplace: "marketplace",
|
|
645
|
+
Sellers: "sellers",
|
|
646
|
+
Auth: "auth",
|
|
647
|
+
Login: "login",
|
|
648
|
+
Signup: "signup",
|
|
649
|
+
Guide: "guide",
|
|
650
|
+
Docs: "docs",
|
|
651
|
+
I18n: "i18n",
|
|
652
|
+
Incident: "incident",
|
|
653
|
+
Automation: "automation",
|
|
654
|
+
Hygiene: "hygiene"
|
|
655
|
+
};
|
|
656
|
+
var Tags = TagsEnum;
|
|
657
|
+
|
|
658
|
+
// src/capabilities/openbanking.ts
|
|
659
|
+
var OWNERS = ["platform.finance"];
|
|
660
|
+
var TAGS = ["open-banking", "finance"];
|
|
661
|
+
var openBankingAccountsReadCapability = {
|
|
662
|
+
meta: {
|
|
663
|
+
key: "openbanking.accounts.read",
|
|
664
|
+
version: "1.0.0",
|
|
665
|
+
kind: "integration",
|
|
666
|
+
title: "Open Banking Accounts (Read)",
|
|
667
|
+
description: "Provides read-only access to linked bank accounts, including account summaries and metadata.",
|
|
668
|
+
domain: "finance",
|
|
669
|
+
owners: [...OWNERS],
|
|
670
|
+
tags: [...TAGS],
|
|
671
|
+
stability: StabilityEnum.Experimental
|
|
672
|
+
},
|
|
673
|
+
provides: [
|
|
674
|
+
{
|
|
675
|
+
surface: "operation",
|
|
676
|
+
key: "openbanking.accounts.list",
|
|
677
|
+
version: "1.0.0",
|
|
678
|
+
description: "List bank accounts linked to a Powens open banking connection."
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
surface: "operation",
|
|
682
|
+
key: "openbanking.accounts.get",
|
|
683
|
+
version: "1.0.0",
|
|
684
|
+
description: "Retrieve the canonical bank account record for a specific account."
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
surface: "operation",
|
|
688
|
+
key: "openbanking.accounts.sync",
|
|
689
|
+
version: "1.0.0",
|
|
690
|
+
description: "Trigger a refresh of bank account metadata from the open banking provider."
|
|
691
|
+
}
|
|
692
|
+
]
|
|
693
|
+
};
|
|
694
|
+
var openBankingTransactionsReadCapability = {
|
|
695
|
+
meta: {
|
|
696
|
+
key: "openbanking.transactions.read",
|
|
697
|
+
version: "1.0.0",
|
|
698
|
+
kind: "integration",
|
|
699
|
+
title: "Open Banking Transactions (Read)",
|
|
700
|
+
description: "Enables retrieval of transaction history for linked bank accounts via open banking providers.",
|
|
701
|
+
domain: "finance",
|
|
702
|
+
owners: [...OWNERS],
|
|
703
|
+
tags: [...TAGS, "transactions"],
|
|
704
|
+
stability: StabilityEnum.Experimental
|
|
705
|
+
},
|
|
706
|
+
provides: [
|
|
707
|
+
{
|
|
708
|
+
surface: "operation",
|
|
709
|
+
key: "openbanking.transactions.list",
|
|
710
|
+
version: "1.0.0",
|
|
711
|
+
description: "List transactions for a given bank account with optional date filtering."
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
surface: "operation",
|
|
715
|
+
key: "openbanking.transactions.sync",
|
|
716
|
+
version: "1.0.0",
|
|
717
|
+
description: "Synchronise transactions from the open banking provider into the canonical ledger."
|
|
718
|
+
}
|
|
719
|
+
]
|
|
720
|
+
};
|
|
721
|
+
var openBankingBalancesReadCapability = {
|
|
722
|
+
meta: {
|
|
723
|
+
key: "openbanking.balances.read",
|
|
724
|
+
version: "1.0.0",
|
|
725
|
+
kind: "integration",
|
|
726
|
+
title: "Open Banking Balances (Read)",
|
|
727
|
+
description: "Allows querying of current and available balances for linked bank accounts via open banking providers.",
|
|
728
|
+
domain: "finance",
|
|
729
|
+
owners: [...OWNERS],
|
|
730
|
+
tags: [...TAGS, "balances"],
|
|
731
|
+
stability: StabilityEnum.Experimental
|
|
732
|
+
},
|
|
733
|
+
provides: [
|
|
734
|
+
{
|
|
735
|
+
surface: "operation",
|
|
736
|
+
key: "openbanking.balances.get",
|
|
737
|
+
version: "1.0.0",
|
|
738
|
+
description: "Retrieve the latest known balances for a specified bank account."
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
surface: "operation",
|
|
742
|
+
key: "openbanking.balances.refresh",
|
|
743
|
+
version: "1.0.0",
|
|
744
|
+
description: "Force a balance refresh from the open banking provider."
|
|
745
|
+
}
|
|
746
|
+
]
|
|
747
|
+
};
|
|
748
|
+
function registerOpenBankingCapabilities(registry) {
|
|
749
|
+
return registry.register(openBankingAccountsReadCapability).register(openBankingTransactionsReadCapability).register(openBankingBalancesReadCapability);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// src/capabilities/meeting-recorder.ts
|
|
753
|
+
var OWNERS2 = ["platform.integrations"];
|
|
754
|
+
var TAGS2 = ["meeting-recorder", "transcripts", "integrations"];
|
|
755
|
+
var meetingRecorderMeetingsReadCapability = {
|
|
756
|
+
meta: {
|
|
757
|
+
key: "meeting-recorder.meetings.read",
|
|
758
|
+
version: "1.0.0",
|
|
759
|
+
kind: "integration",
|
|
760
|
+
title: "Meeting Recorder Meetings (Read)",
|
|
761
|
+
description: "Provides read-only access to recorded meetings and their metadata.",
|
|
762
|
+
domain: "integrations",
|
|
763
|
+
owners: [...OWNERS2],
|
|
764
|
+
tags: [...TAGS2, "meetings"],
|
|
765
|
+
stability: StabilityEnum.Experimental
|
|
766
|
+
},
|
|
767
|
+
provides: [
|
|
768
|
+
{
|
|
769
|
+
surface: "operation",
|
|
770
|
+
key: "meeting-recorder.meetings.list",
|
|
771
|
+
version: "1.0.0",
|
|
772
|
+
description: "List meetings available from the recorder provider."
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
surface: "operation",
|
|
776
|
+
key: "meeting-recorder.meetings.get",
|
|
777
|
+
version: "1.0.0",
|
|
778
|
+
description: "Fetch detailed metadata for a specific meeting."
|
|
779
|
+
}
|
|
780
|
+
]
|
|
781
|
+
};
|
|
782
|
+
var meetingRecorderTranscriptsReadCapability = {
|
|
783
|
+
meta: {
|
|
784
|
+
key: "meeting-recorder.transcripts.read",
|
|
785
|
+
version: "1.0.0",
|
|
786
|
+
kind: "integration",
|
|
787
|
+
title: "Meeting Recorder Transcripts (Read)",
|
|
788
|
+
description: "Enables retrieval of transcripts for recorded meetings from external providers.",
|
|
789
|
+
domain: "integrations",
|
|
790
|
+
owners: [...OWNERS2],
|
|
791
|
+
tags: [...TAGS2, "transcripts"],
|
|
792
|
+
stability: StabilityEnum.Experimental
|
|
793
|
+
},
|
|
794
|
+
provides: [
|
|
795
|
+
{
|
|
796
|
+
surface: "operation",
|
|
797
|
+
key: "meeting-recorder.transcripts.get",
|
|
798
|
+
version: "1.0.0",
|
|
799
|
+
description: "Fetch the transcript for a specific meeting recording."
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
surface: "operation",
|
|
803
|
+
key: "meeting-recorder.transcripts.sync",
|
|
804
|
+
version: "1.0.0",
|
|
805
|
+
description: "Trigger a transcript sync from the recorder provider."
|
|
806
|
+
}
|
|
807
|
+
]
|
|
808
|
+
};
|
|
809
|
+
var meetingRecorderWebhooksCapability = {
|
|
810
|
+
meta: {
|
|
811
|
+
key: "meeting-recorder.webhooks",
|
|
812
|
+
version: "1.0.0",
|
|
813
|
+
kind: "integration",
|
|
814
|
+
title: "Meeting Recorder Webhooks",
|
|
815
|
+
description: "Allows processing of webhook events for meeting transcript readiness.",
|
|
816
|
+
domain: "integrations",
|
|
817
|
+
owners: [...OWNERS2],
|
|
818
|
+
tags: [...TAGS2, "webhooks"],
|
|
819
|
+
stability: StabilityEnum.Experimental
|
|
820
|
+
},
|
|
821
|
+
provides: [
|
|
822
|
+
{
|
|
823
|
+
surface: "operation",
|
|
824
|
+
key: "meeting-recorder.webhooks.ingest",
|
|
825
|
+
version: "1.0.0",
|
|
826
|
+
description: "Ingest and verify meeting recorder webhook payloads."
|
|
827
|
+
}
|
|
828
|
+
]
|
|
829
|
+
};
|
|
830
|
+
function registerMeetingRecorderCapabilities(registry) {
|
|
831
|
+
return registry.register(meetingRecorderMeetingsReadCapability).register(meetingRecorderTranscriptsReadCapability).register(meetingRecorderWebhooksCapability);
|
|
832
|
+
}
|
|
833
|
+
// src/operations/operation.ts
|
|
834
|
+
var isEmitDeclRef = (e) => ("ref" in e);
|
|
835
|
+
var defineCommand = (spec) => ({
|
|
836
|
+
...spec,
|
|
837
|
+
meta: { ...spec.meta, kind: "command" },
|
|
838
|
+
policy: {
|
|
839
|
+
...spec.policy,
|
|
840
|
+
idempotent: spec.policy?.["policy"]?.idempotent ?? false
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
var defineQuery = (spec) => ({
|
|
844
|
+
...spec,
|
|
845
|
+
meta: { ...spec.meta, kind: "query" },
|
|
846
|
+
policy: { ...spec.policy, idempotent: true }
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
// src/registry.ts
|
|
850
|
+
init_registry_utils();
|
|
851
|
+
import { compareVersions as compareVersions2 } from "compare-versions";
|
|
852
|
+
var keyOfSpecContract = (spec) => `${spec.meta.key}.v${spec.meta.version}`;
|
|
853
|
+
|
|
854
|
+
class SpecContractRegistry {
|
|
855
|
+
contractType;
|
|
856
|
+
items = new Map;
|
|
857
|
+
constructor(contractType, items) {
|
|
858
|
+
this.contractType = contractType;
|
|
859
|
+
if (items) {
|
|
860
|
+
items.forEach((p) => this.register(p));
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
register(p) {
|
|
864
|
+
const key = keyOfSpecContract(p);
|
|
865
|
+
if (this.items.has(key))
|
|
866
|
+
throw new Error(`Duplicate contract \`${this.contractType}\` ${key}`);
|
|
867
|
+
this.items.set(key, p);
|
|
868
|
+
return this;
|
|
869
|
+
}
|
|
870
|
+
count() {
|
|
871
|
+
return this.items.size;
|
|
872
|
+
}
|
|
873
|
+
list() {
|
|
874
|
+
return [...this.items.values()];
|
|
875
|
+
}
|
|
876
|
+
get(key, version) {
|
|
877
|
+
if (version != null)
|
|
878
|
+
return this.items.get(`${key}.v${version}`);
|
|
879
|
+
let candidate;
|
|
880
|
+
for (const [k, p] of this.items.entries()) {
|
|
881
|
+
if (!k.startsWith(`${key}.v`))
|
|
882
|
+
continue;
|
|
883
|
+
if (!candidate || compareVersions2(p.meta.version, candidate.meta.version) > 0) {
|
|
884
|
+
candidate = p;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
return candidate;
|
|
888
|
+
}
|
|
889
|
+
has(key, version) {
|
|
890
|
+
return !!this.get(key, version);
|
|
891
|
+
}
|
|
892
|
+
filter(criteria) {
|
|
893
|
+
return filterBy(this.list(), criteria);
|
|
894
|
+
}
|
|
895
|
+
listByTag(tag) {
|
|
896
|
+
return this.list().filter((p) => p.meta.tags?.includes(tag));
|
|
897
|
+
}
|
|
898
|
+
listByOwner(owner) {
|
|
899
|
+
return this.list().filter((p) => p.meta.owners?.includes(owner));
|
|
900
|
+
}
|
|
901
|
+
groupBy(keyFn) {
|
|
902
|
+
return groupBy(this.list(), keyFn);
|
|
903
|
+
}
|
|
904
|
+
getUniqueTags() {
|
|
905
|
+
return getUniqueTags(this.list());
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// src/events.ts
|
|
910
|
+
function defineEvent(e) {
|
|
911
|
+
return e;
|
|
912
|
+
}
|
|
913
|
+
var eventKey = (key, version) => `${key}.v${version}`;
|
|
914
|
+
|
|
915
|
+
class EventRegistry extends SpecContractRegistry {
|
|
916
|
+
constructor(items) {
|
|
917
|
+
super("event", items);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// src/operations/registry.ts
|
|
922
|
+
function opKey(key, version) {
|
|
923
|
+
return `${key}.v${version}`;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
class OperationSpecRegistry extends SpecContractRegistry {
|
|
927
|
+
handlers = new Map;
|
|
928
|
+
constructor(items) {
|
|
929
|
+
super("operation", items);
|
|
930
|
+
}
|
|
931
|
+
bind(spec, handler) {
|
|
932
|
+
const key = opKey(spec.meta.key, spec.meta.version);
|
|
933
|
+
if (!this.items.has(key))
|
|
934
|
+
throw new Error(`Cannot bind; spec not found: ${key}`);
|
|
935
|
+
if (this.handlers.has(key))
|
|
936
|
+
throw new Error(`Handler already bound for ${key}`);
|
|
937
|
+
this.handlers.set(key, handler);
|
|
938
|
+
return this;
|
|
939
|
+
}
|
|
940
|
+
getHandler(key, version) {
|
|
941
|
+
const spec = this.get(key, version);
|
|
942
|
+
if (!spec)
|
|
943
|
+
return;
|
|
944
|
+
return this.handlers.get(opKey(spec.meta.key, spec.meta.version));
|
|
945
|
+
}
|
|
946
|
+
listBound() {
|
|
947
|
+
const out = [];
|
|
948
|
+
for (const [k, spec] of this.items.entries()) {
|
|
949
|
+
const h = this.handlers.get(k);
|
|
950
|
+
if (h)
|
|
951
|
+
out.push({ spec, handler: h });
|
|
952
|
+
}
|
|
953
|
+
return out;
|
|
954
|
+
}
|
|
955
|
+
async execute(key, version, rawInput, ctx) {
|
|
956
|
+
const baseSpec = this.get(key, version);
|
|
957
|
+
if (!baseSpec)
|
|
958
|
+
throw new Error(`Spec not found for ${key}${version ? `.v${version}` : ""}`);
|
|
959
|
+
const spec = await ctx.specVariantResolver?.resolve({
|
|
960
|
+
name: baseSpec.meta.key,
|
|
961
|
+
version: baseSpec.meta.version,
|
|
962
|
+
kind: baseSpec.meta.kind
|
|
963
|
+
}, ctx) ?? baseSpec;
|
|
964
|
+
let handlerKey = opKey(spec.meta.key, spec.meta.version);
|
|
965
|
+
let handler = this.handlers.get(handlerKey);
|
|
966
|
+
if (!handler) {
|
|
967
|
+
const fallbackKey = opKey(baseSpec.meta.key, baseSpec.meta.version);
|
|
968
|
+
handler = this.handlers.get(fallbackKey);
|
|
969
|
+
handlerKey = fallbackKey;
|
|
970
|
+
}
|
|
971
|
+
if (!handler)
|
|
972
|
+
throw new Error(`No handler bound for ${handlerKey}`);
|
|
973
|
+
const parsedInput = spec.io.input?.getZod().parse(rawInput);
|
|
974
|
+
if (ctx.decide) {
|
|
975
|
+
const [service, command] = spec.meta.key.split(".");
|
|
976
|
+
if (!service || !command)
|
|
977
|
+
throw new Error(`Invalid spec name: ${spec.meta.key}`);
|
|
978
|
+
const decision = await ctx.decide({
|
|
979
|
+
service,
|
|
980
|
+
command,
|
|
981
|
+
version: spec.meta.version,
|
|
982
|
+
actor: ctx.actor ?? "anonymous",
|
|
983
|
+
channel: ctx.channel,
|
|
984
|
+
roles: ctx.roles,
|
|
985
|
+
organizationId: ctx.organizationId,
|
|
986
|
+
userId: ctx.userId,
|
|
987
|
+
flags: []
|
|
988
|
+
});
|
|
989
|
+
if (decision.effect === "deny") {
|
|
990
|
+
throw new Error(`PolicyDenied: ${spec.meta.key}.v${spec.meta.version}`);
|
|
991
|
+
}
|
|
992
|
+
if (decision.rateLimit && ctx.rateLimit) {
|
|
993
|
+
const key2 = decision.rateLimit.key ?? "default";
|
|
994
|
+
const rpm = decision.rateLimit.rpm ?? 60;
|
|
995
|
+
await ctx.rateLimit(key2, 1, rpm);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
const allowedEvents = new Map;
|
|
999
|
+
if (spec.sideEffects?.emits) {
|
|
1000
|
+
for (const e of spec.sideEffects.emits) {
|
|
1001
|
+
if (isEmitDeclRef(e)) {
|
|
1002
|
+
const eventSpec = ctx.eventSpecResolver?.get(e.ref.key, e.ref.version);
|
|
1003
|
+
if (eventSpec) {
|
|
1004
|
+
allowedEvents.set(`${e.ref.key}.v${e.ref.version}`, eventSpec.payload);
|
|
1005
|
+
}
|
|
1006
|
+
} else {
|
|
1007
|
+
allowedEvents.set(`${e.key}.v${e.version}`, e.payload);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
const emitGuard = async (eventName, eventVersion, payload) => {
|
|
1012
|
+
const key2 = eventKey(eventName, eventVersion);
|
|
1013
|
+
const schema = allowedEvents.get(key2);
|
|
1014
|
+
if (!schema)
|
|
1015
|
+
throw new Error(`UndeclaredEvent: ${key2} not allowed by ${opKey(spec.meta.key, spec.meta.version)}`);
|
|
1016
|
+
const parsed = schema.getZod().parse(payload);
|
|
1017
|
+
await ctx.eventPublisher?.({
|
|
1018
|
+
key: eventName,
|
|
1019
|
+
version: eventVersion,
|
|
1020
|
+
payload: parsed,
|
|
1021
|
+
traceId: ctx.traceId
|
|
1022
|
+
});
|
|
1023
|
+
};
|
|
1024
|
+
if (ctx.appConfig) {
|
|
1025
|
+
if (!ctx.branding) {
|
|
1026
|
+
ctx.branding = ctx.appConfig.branding;
|
|
1027
|
+
}
|
|
1028
|
+
if (!ctx.translation) {
|
|
1029
|
+
ctx.translation = { config: ctx.appConfig.translation };
|
|
1030
|
+
} else if (!ctx.translation.config) {
|
|
1031
|
+
ctx.translation = {
|
|
1032
|
+
...ctx.translation,
|
|
1033
|
+
config: ctx.appConfig.translation
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
const telemetryContext = ctx.telemetry;
|
|
1038
|
+
const trackTelemetry = async (trigger, details) => {
|
|
1039
|
+
if (!telemetryContext || !trigger?.event)
|
|
1040
|
+
return;
|
|
1041
|
+
try {
|
|
1042
|
+
const props = trigger.properties?.(details) ?? {};
|
|
1043
|
+
await telemetryContext.track(trigger.event.key, trigger.event.version ?? "1.0.0", props, {
|
|
1044
|
+
tenantId: ctx.organizationId ?? undefined,
|
|
1045
|
+
organizationId: ctx.organizationId,
|
|
1046
|
+
userId: ctx.userId,
|
|
1047
|
+
actor: ctx.actor,
|
|
1048
|
+
channel: ctx.channel,
|
|
1049
|
+
metadata: ctx.traceId ? { traceId: ctx.traceId } : undefined
|
|
1050
|
+
});
|
|
1051
|
+
} catch (_error) {}
|
|
1052
|
+
};
|
|
1053
|
+
let result;
|
|
1054
|
+
try {
|
|
1055
|
+
result = await handler(parsedInput, {
|
|
1056
|
+
...ctx,
|
|
1057
|
+
__emitGuard__: emitGuard
|
|
1058
|
+
});
|
|
1059
|
+
} catch (error) {
|
|
1060
|
+
if (spec.telemetry?.failure) {
|
|
1061
|
+
await trackTelemetry(spec.telemetry.failure, {
|
|
1062
|
+
input: parsedInput ?? rawInput,
|
|
1063
|
+
error
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
throw error;
|
|
1067
|
+
}
|
|
1068
|
+
if (spec.telemetry?.success) {
|
|
1069
|
+
await trackTelemetry(spec.telemetry.success, {
|
|
1070
|
+
input: parsedInput ?? rawInput,
|
|
1071
|
+
output: result
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
const outputModel = spec.io.output;
|
|
1075
|
+
if (outputModel?.getZod) {
|
|
1076
|
+
const parsedOutput = outputModel.getZod().parse(result);
|
|
1077
|
+
return parsedOutput;
|
|
1078
|
+
}
|
|
1079
|
+
return result;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
// src/docs/presentations.ts
|
|
1083
|
+
var DEFAULT_TARGETS = [
|
|
1084
|
+
"markdown",
|
|
1085
|
+
"react"
|
|
1086
|
+
];
|
|
1087
|
+
function normalizeRoute(route) {
|
|
1088
|
+
if (!route.length)
|
|
1089
|
+
return "/";
|
|
1090
|
+
const withLeading = route.startsWith("/") ? route : `/${route}`;
|
|
1091
|
+
return withLeading === "/" ? "/" : withLeading.replace(/\/+$/, "");
|
|
1092
|
+
}
|
|
1093
|
+
function deriveRoute(block, routePrefix) {
|
|
1094
|
+
if (block.route)
|
|
1095
|
+
return normalizeRoute(block.route);
|
|
1096
|
+
const prefix = routePrefix ?? "/docs";
|
|
1097
|
+
const slug = block.id.replace(/^docs\.?/, "").replace(/\./g, "/").replace(/\/+/g, "/");
|
|
1098
|
+
const path = slug.startsWith("/") ? slug : `${prefix}/${slug}`;
|
|
1099
|
+
return normalizeRoute(path);
|
|
1100
|
+
}
|
|
1101
|
+
function buildName(block, namespace) {
|
|
1102
|
+
return namespace ? `${namespace}.${block.id}` : block.id;
|
|
1103
|
+
}
|
|
1104
|
+
function docBlockToPresentationSpec(block, options) {
|
|
1105
|
+
const targets = options?.defaultTargets ?? DEFAULT_TARGETS;
|
|
1106
|
+
const version = block.version ?? options?.defaultVersion ?? "1.0.0";
|
|
1107
|
+
const stability = block.stability ?? options?.defaultStability ?? "stable";
|
|
1108
|
+
return {
|
|
1109
|
+
meta: {
|
|
1110
|
+
key: buildName(block, options?.namespace),
|
|
1111
|
+
title: block.title,
|
|
1112
|
+
version,
|
|
1113
|
+
description: block.summary ?? block.title,
|
|
1114
|
+
tags: block.tags || [],
|
|
1115
|
+
owners: block.owners || [],
|
|
1116
|
+
domain: block.domain || "",
|
|
1117
|
+
stability,
|
|
1118
|
+
goal: `Documentation of: ${block.summary}`,
|
|
1119
|
+
context: `Auto-generated`
|
|
1120
|
+
},
|
|
1121
|
+
policy: block.visibility && block.visibility !== "public" ? { flags: [block.visibility] } : undefined,
|
|
1122
|
+
source: {
|
|
1123
|
+
type: "blocknotejs",
|
|
1124
|
+
docJson: block.body
|
|
1125
|
+
},
|
|
1126
|
+
targets
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
function docBlocksToPresentationRoutes(blocks, options) {
|
|
1130
|
+
return blocks.map((block) => ({
|
|
1131
|
+
block,
|
|
1132
|
+
route: deriveRoute(block, options?.routePrefix),
|
|
1133
|
+
descriptor: docBlockToPresentationSpec(block, options)
|
|
1134
|
+
}));
|
|
1135
|
+
}
|
|
1136
|
+
function docBlocksToPresentationSpecs(blocks, options) {
|
|
1137
|
+
return blocks.map((block) => docBlockToPresentationSpec(block, options));
|
|
1138
|
+
}
|
|
1139
|
+
function mapDocRoutes(routes) {
|
|
1140
|
+
return routes.map(({ route, descriptor }) => [route, descriptor]);
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
// src/docs/registry.ts
|
|
1144
|
+
class DocRegistry {
|
|
1145
|
+
routes = new Map;
|
|
1146
|
+
constructor(blocks = [], options) {
|
|
1147
|
+
blocks.forEach((block) => this.register(block, options));
|
|
1148
|
+
}
|
|
1149
|
+
register(block, options) {
|
|
1150
|
+
const [route] = docBlocksToPresentationRoutes([block], options);
|
|
1151
|
+
if (route) {
|
|
1152
|
+
this.routes.set(block.id, route);
|
|
1153
|
+
}
|
|
1154
|
+
return this;
|
|
1155
|
+
}
|
|
1156
|
+
list() {
|
|
1157
|
+
return [...this.routes.values()];
|
|
1158
|
+
}
|
|
1159
|
+
get(id) {
|
|
1160
|
+
return this.routes.get(id);
|
|
1161
|
+
}
|
|
1162
|
+
toRouteTuples() {
|
|
1163
|
+
return this.list().map(({ route, descriptor }) => [route, descriptor]);
|
|
1164
|
+
}
|
|
1165
|
+
toPresentationSpecs(options) {
|
|
1166
|
+
return this.list().map(({ block }) => docBlockToPresentationSpec(block, options));
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
var requiredFields = [
|
|
1170
|
+
"id",
|
|
1171
|
+
"title",
|
|
1172
|
+
"body",
|
|
1173
|
+
"kind",
|
|
1174
|
+
"visibility",
|
|
1175
|
+
"route"
|
|
1176
|
+
];
|
|
1177
|
+
var defaultDocRegistry = new DocRegistry;
|
|
1178
|
+
function registerDocBlocks(blocks) {
|
|
1179
|
+
for (const block of blocks) {
|
|
1180
|
+
for (const field of requiredFields) {
|
|
1181
|
+
if (!block[field]) {
|
|
1182
|
+
throw new Error(`DocBlock ${block.id ?? "<missing id>"} missing field ${String(field)}`);
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
defaultDocRegistry.register(block);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
function listRegisteredDocBlocks() {
|
|
1189
|
+
return defaultDocRegistry.list().map((r) => r.block);
|
|
1190
|
+
}
|
|
1191
|
+
function docId(id) {
|
|
1192
|
+
const found = defaultDocRegistry.get(id);
|
|
1193
|
+
if (!found)
|
|
1194
|
+
throw new Error(`DocBlock not registered: ${id}`);
|
|
1195
|
+
return id;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
// src/presentations/presentations.ts
|
|
1199
|
+
var definePresentation = (spec) => {
|
|
1200
|
+
return spec;
|
|
1201
|
+
};
|
|
1202
|
+
|
|
1203
|
+
// src/presentations/registry.ts
|
|
1204
|
+
class PresentationRegistry extends SpecContractRegistry {
|
|
1205
|
+
constructor(items) {
|
|
1206
|
+
super("presentation", items);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
// src/forms/forms.ts
|
|
1210
|
+
import { compareVersions as compareVersions3 } from "compare-versions";
|
|
1211
|
+
function formKey(meta) {
|
|
1212
|
+
return `${meta.key}.v${meta.version}`;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
class FormRegistry {
|
|
1216
|
+
items = new Map;
|
|
1217
|
+
register(spec) {
|
|
1218
|
+
const key = formKey(spec.meta);
|
|
1219
|
+
if (this.items.has(key))
|
|
1220
|
+
throw new Error(`Duplicate form ${key}`);
|
|
1221
|
+
this.items.set(key, spec);
|
|
1222
|
+
return this;
|
|
1223
|
+
}
|
|
1224
|
+
list() {
|
|
1225
|
+
return [...this.items.values()];
|
|
1226
|
+
}
|
|
1227
|
+
get(key, version) {
|
|
1228
|
+
if (version != null)
|
|
1229
|
+
return this.items.get(`${key}.v${version}`);
|
|
1230
|
+
let candidate;
|
|
1231
|
+
for (const [k, v] of this.items.entries()) {
|
|
1232
|
+
if (v.meta.key !== key)
|
|
1233
|
+
continue;
|
|
1234
|
+
if (!candidate || compareVersions3(v.meta.version, candidate.meta.version) > 0) {
|
|
1235
|
+
candidate = v;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
return candidate;
|
|
1239
|
+
}
|
|
1240
|
+
filter(criteria) {
|
|
1241
|
+
const { filterBy: filterBy2 } = (init_registry_utils(), __toCommonJS(exports_registry_utils));
|
|
1242
|
+
return filterBy2(this.list(), criteria);
|
|
1243
|
+
}
|
|
1244
|
+
listByTag(tag) {
|
|
1245
|
+
return this.list().filter((f) => f.meta.tags?.includes(tag));
|
|
1246
|
+
}
|
|
1247
|
+
listByOwner(owner) {
|
|
1248
|
+
return this.list().filter((f) => f.meta.owners?.includes(owner));
|
|
1249
|
+
}
|
|
1250
|
+
groupBy(keyFn) {
|
|
1251
|
+
const { groupBy: groupBy2 } = (init_registry_utils(), __toCommonJS(exports_registry_utils));
|
|
1252
|
+
return groupBy2(this.list(), keyFn);
|
|
1253
|
+
}
|
|
1254
|
+
getUniqueTags() {
|
|
1255
|
+
const { getUniqueTags: getUniqueTags2 } = (init_registry_utils(), __toCommonJS(exports_registry_utils));
|
|
1256
|
+
return getUniqueTags2(this.list());
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
function getAtPath(values, path) {
|
|
1260
|
+
if (!path)
|
|
1261
|
+
return;
|
|
1262
|
+
const segs = path.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
|
|
1263
|
+
let cur = values;
|
|
1264
|
+
for (const s of segs) {
|
|
1265
|
+
if (cur == null)
|
|
1266
|
+
return;
|
|
1267
|
+
if (cur && typeof cur === "object" && s in cur) {
|
|
1268
|
+
cur = cur[s];
|
|
1269
|
+
} else {
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
return cur;
|
|
1274
|
+
}
|
|
1275
|
+
function evalPredicate(values, pred) {
|
|
1276
|
+
if (!pred)
|
|
1277
|
+
return true;
|
|
1278
|
+
if (pred.not)
|
|
1279
|
+
return !evalPredicate(values, pred.not);
|
|
1280
|
+
if (pred.all && pred.all.length)
|
|
1281
|
+
return pred.all.every((p) => evalPredicate(values, p));
|
|
1282
|
+
if (pred.anyOf && pred.anyOf.length)
|
|
1283
|
+
return pred.anyOf.some((p) => evalPredicate(values, p));
|
|
1284
|
+
if (pred.when) {
|
|
1285
|
+
const { path, op = "truthy", value } = pred.when;
|
|
1286
|
+
const v = getAtPath(values, path);
|
|
1287
|
+
switch (op) {
|
|
1288
|
+
case "equals":
|
|
1289
|
+
return v === value;
|
|
1290
|
+
case "notEquals":
|
|
1291
|
+
return v !== value;
|
|
1292
|
+
case "in":
|
|
1293
|
+
return Array.isArray(value) && value.includes(v);
|
|
1294
|
+
case "notIn":
|
|
1295
|
+
return Array.isArray(value) && !value.includes(v);
|
|
1296
|
+
case "gt":
|
|
1297
|
+
return Number(v) > Number(value);
|
|
1298
|
+
case "gte":
|
|
1299
|
+
return Number(v) >= Number(value);
|
|
1300
|
+
case "lt":
|
|
1301
|
+
return Number(v) < Number(value);
|
|
1302
|
+
case "lte":
|
|
1303
|
+
return Number(v) <= Number(value);
|
|
1304
|
+
case "empty":
|
|
1305
|
+
return v == null || (Array.isArray(v) ? v.length === 0 : String(v).length === 0);
|
|
1306
|
+
case "lengthGt":
|
|
1307
|
+
return (Array.isArray(v) || typeof v === "string") && v.length > Number(value ?? 0);
|
|
1308
|
+
case "lengthGte":
|
|
1309
|
+
return (Array.isArray(v) || typeof v === "string") && v.length >= Number(value ?? 0);
|
|
1310
|
+
case "lengthLt":
|
|
1311
|
+
return (Array.isArray(v) || typeof v === "string") && v.length < Number(value ?? 0);
|
|
1312
|
+
case "lengthLte":
|
|
1313
|
+
return (Array.isArray(v) || typeof v === "string") && v.length <= Number(value ?? 0);
|
|
1314
|
+
case "truthy":
|
|
1315
|
+
default:
|
|
1316
|
+
return Boolean(v);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
return true;
|
|
1320
|
+
}
|
|
1321
|
+
function buildZodWithRelations(spec, handlers) {
|
|
1322
|
+
const base = spec.model.getZod();
|
|
1323
|
+
return base.superRefine((values, ctx) => {
|
|
1324
|
+
const visit = (field, parentPath) => {
|
|
1325
|
+
const path = field.name ? parentPath ? `${parentPath}.${field.name}` : field.name : parentPath ?? "";
|
|
1326
|
+
if (field.requiredWhen) {
|
|
1327
|
+
const should = evalPredicate(values, field.requiredWhen);
|
|
1328
|
+
if (should) {
|
|
1329
|
+
const v = getAtPath(values, path);
|
|
1330
|
+
const empty = v == null || typeof v === "string" && v.trim().length === 0 || Array.isArray(v) && v.length === 0;
|
|
1331
|
+
if (empty)
|
|
1332
|
+
ctx.addIssue({
|
|
1333
|
+
code: "custom",
|
|
1334
|
+
path: path.split("."),
|
|
1335
|
+
message: "required"
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
if (field.kind === "array") {
|
|
1340
|
+
const arr = getAtPath(values, path);
|
|
1341
|
+
if (field.min != null && Array.isArray(arr) && arr.length < field.min) {
|
|
1342
|
+
ctx.addIssue({
|
|
1343
|
+
code: "custom",
|
|
1344
|
+
path: path.split("."),
|
|
1345
|
+
message: `min:${field.min}`
|
|
1346
|
+
});
|
|
1347
|
+
}
|
|
1348
|
+
if (field.max != null && Array.isArray(arr) && arr.length > field.max) {
|
|
1349
|
+
ctx.addIssue({
|
|
1350
|
+
code: "custom",
|
|
1351
|
+
path: path.split("."),
|
|
1352
|
+
message: `max:${field.max}`
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
visit(field.of, path);
|
|
1356
|
+
} else if (field.kind === "group") {
|
|
1357
|
+
for (const child of field.fields)
|
|
1358
|
+
visit(child, path);
|
|
1359
|
+
}
|
|
1360
|
+
};
|
|
1361
|
+
for (const f of spec.fields)
|
|
1362
|
+
visit(f);
|
|
1363
|
+
if (spec.constraints && handlers) {
|
|
1364
|
+
for (const c of spec.constraints) {
|
|
1365
|
+
const fn = handlers[c.key];
|
|
1366
|
+
if (!fn)
|
|
1367
|
+
continue;
|
|
1368
|
+
const res = fn(values, c.paths, c.args);
|
|
1369
|
+
if (!res.ok) {
|
|
1370
|
+
ctx.addIssue({
|
|
1371
|
+
code: "custom",
|
|
1372
|
+
path: (res.path ?? c.paths[0] ?? "").split(".").filter(Boolean),
|
|
1373
|
+
message: res.message ?? c.messageI18n
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
function defineFormSpec(spec) {
|
|
1381
|
+
return spec;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
// src/examples/define.ts
|
|
1385
|
+
var defineExample = (spec) => spec;
|
|
1386
|
+
|
|
1387
|
+
// src/examples/registry.ts
|
|
1388
|
+
class ExampleRegistry extends SpecContractRegistry {
|
|
1389
|
+
constructor(items) {
|
|
1390
|
+
super("example", items);
|
|
1391
|
+
}
|
|
1392
|
+
listByKind(kind) {
|
|
1393
|
+
return this.list().filter((spec) => spec.meta.kind === kind);
|
|
1394
|
+
}
|
|
1395
|
+
listByVisibility(visibility) {
|
|
1396
|
+
return this.list().filter((spec) => spec.meta.visibility === visibility);
|
|
1397
|
+
}
|
|
1398
|
+
listByDomain(domain) {
|
|
1399
|
+
return this.list().filter((spec) => spec.meta.domain === domain);
|
|
1400
|
+
}
|
|
1401
|
+
listBySurface(surface) {
|
|
1402
|
+
return this.list().filter((spec) => {
|
|
1403
|
+
if (surface === "templates")
|
|
1404
|
+
return spec.surfaces.templates;
|
|
1405
|
+
if (surface === "sandbox")
|
|
1406
|
+
return spec.surfaces.sandbox.enabled;
|
|
1407
|
+
if (surface === "studio")
|
|
1408
|
+
return spec.surfaces.studio.enabled;
|
|
1409
|
+
if (surface === "mcp")
|
|
1410
|
+
return spec.surfaces.mcp.enabled;
|
|
1411
|
+
return false;
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
listInstallable() {
|
|
1415
|
+
return this.list().filter((spec) => spec.surfaces.studio.installable);
|
|
1416
|
+
}
|
|
1417
|
+
groupByKind() {
|
|
1418
|
+
const result = new Map;
|
|
1419
|
+
for (const spec of this.list()) {
|
|
1420
|
+
const existing = result.get(spec.meta.kind) ?? [];
|
|
1421
|
+
existing.push(spec);
|
|
1422
|
+
result.set(spec.meta.kind, existing);
|
|
1423
|
+
}
|
|
1424
|
+
return result;
|
|
1425
|
+
}
|
|
1426
|
+
getUniqueKinds() {
|
|
1427
|
+
const kinds = new Set;
|
|
1428
|
+
for (const spec of this.list()) {
|
|
1429
|
+
kinds.add(spec.meta.kind);
|
|
1430
|
+
}
|
|
1431
|
+
return [...kinds];
|
|
1432
|
+
}
|
|
1433
|
+
getUniqueDomains() {
|
|
1434
|
+
const domains = new Set;
|
|
1435
|
+
for (const spec of this.list()) {
|
|
1436
|
+
if (spec.meta.domain) {
|
|
1437
|
+
domains.add(spec.meta.domain);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
return [...domains];
|
|
1441
|
+
}
|
|
1442
|
+
search(query) {
|
|
1443
|
+
const q = query.toLowerCase().trim();
|
|
1444
|
+
if (!q)
|
|
1445
|
+
return this.list();
|
|
1446
|
+
return this.list().filter((spec) => {
|
|
1447
|
+
const hay = [
|
|
1448
|
+
spec.meta.key,
|
|
1449
|
+
spec.meta.title ?? "",
|
|
1450
|
+
spec.meta.description,
|
|
1451
|
+
spec.meta.summary ?? "",
|
|
1452
|
+
...spec.meta.tags
|
|
1453
|
+
].join(" ").toLowerCase();
|
|
1454
|
+
return hay.includes(q);
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
// src/features/registry.ts
|
|
1460
|
+
init_registry_utils();
|
|
1461
|
+
function keyOf(f) {
|
|
1462
|
+
return f.meta.key;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
class FeatureRegistry {
|
|
1466
|
+
items = new Map;
|
|
1467
|
+
register(f) {
|
|
1468
|
+
const key = keyOf(f);
|
|
1469
|
+
if (this.items.has(key))
|
|
1470
|
+
throw new Error(`Duplicate feature ${key}`);
|
|
1471
|
+
this.items.set(key, f);
|
|
1472
|
+
return this;
|
|
1473
|
+
}
|
|
1474
|
+
list() {
|
|
1475
|
+
return [...this.items.values()];
|
|
1476
|
+
}
|
|
1477
|
+
get(key) {
|
|
1478
|
+
return this.items.get(key);
|
|
1479
|
+
}
|
|
1480
|
+
filter(criteria) {
|
|
1481
|
+
return filterBy(this.list(), criteria);
|
|
1482
|
+
}
|
|
1483
|
+
listByTag(tag) {
|
|
1484
|
+
return this.list().filter((f) => f.meta.tags?.includes(tag));
|
|
1485
|
+
}
|
|
1486
|
+
listByOwner(owner) {
|
|
1487
|
+
return this.list().filter((f) => f.meta.owners?.includes(owner));
|
|
1488
|
+
}
|
|
1489
|
+
groupBy(keyFn) {
|
|
1490
|
+
return groupBy(this.list(), keyFn);
|
|
1491
|
+
}
|
|
1492
|
+
getUniqueTags() {
|
|
1493
|
+
return getUniqueTags(this.list());
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
// src/features/install.ts
|
|
1498
|
+
function installFeature(feature, deps) {
|
|
1499
|
+
if (deps.ops && feature.operations) {
|
|
1500
|
+
for (const o of feature.operations) {
|
|
1501
|
+
const s = deps.ops.get(o.key, o.version);
|
|
1502
|
+
if (!s)
|
|
1503
|
+
throw new Error(`installFeature: operation not found ${o.key}.v${o.version}`);
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
if (deps.presentations && feature.presentations) {
|
|
1507
|
+
for (const p of feature.presentations) {
|
|
1508
|
+
const pres = deps.presentations.get(p.key, p.version);
|
|
1509
|
+
if (!pres)
|
|
1510
|
+
throw new Error(`installFeature: presentation not found ${p.key}.v${p.version}`);
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
if (feature.presentationsTargets && deps.descriptors) {
|
|
1514
|
+
for (const req of feature.presentationsTargets) {
|
|
1515
|
+
const d = deps.descriptors.find((x) => x.meta.key === req.key && x.meta.version === req.version);
|
|
1516
|
+
if (!d)
|
|
1517
|
+
throw new Error(`installFeature: V2 descriptor not found ${req.key}.v${req.version}`);
|
|
1518
|
+
for (const t of req.targets) {
|
|
1519
|
+
if (!d.targets.includes(t))
|
|
1520
|
+
throw new Error(`installFeature: descriptor ${req.key}.v${req.version} missing target ${t}`);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
if (feature.opToPresentation && feature.opToPresentation.length > 0) {
|
|
1525
|
+
for (const link of feature.opToPresentation) {
|
|
1526
|
+
if (deps.ops) {
|
|
1527
|
+
const s = deps.ops.get(link.op.key, link.op.version);
|
|
1528
|
+
if (!s)
|
|
1529
|
+
throw new Error(`installFeature: linked op not found ${link.op.key}.v${link.op.version}`);
|
|
1530
|
+
}
|
|
1531
|
+
if (deps.presentations) {
|
|
1532
|
+
const pres = deps.presentations.get(link.pres.key, link.pres.version);
|
|
1533
|
+
if (!pres)
|
|
1534
|
+
throw new Error(`installFeature: linked presentation not found ${link.pres.key}.v${link.pres.version}`);
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
if (deps.capabilities && feature.capabilities?.provides) {
|
|
1539
|
+
for (const cap of feature.capabilities.provides) {
|
|
1540
|
+
const spec = deps.capabilities.get(cap.key, cap.version);
|
|
1541
|
+
if (!spec)
|
|
1542
|
+
throw new Error(`installFeature: capability not registered ${cap.key}.v${cap.version}`);
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
if (feature.capabilities?.requires?.length) {
|
|
1546
|
+
if (!deps.capabilities)
|
|
1547
|
+
throw new Error(`installFeature: capability registry required to validate capability requirements for ${feature.meta.key}`);
|
|
1548
|
+
const provided = feature.capabilities.provides ?? [];
|
|
1549
|
+
for (const req of feature.capabilities.requires) {
|
|
1550
|
+
const satisfied = deps.capabilities.satisfies(req, provided);
|
|
1551
|
+
if (!satisfied)
|
|
1552
|
+
throw new Error(`installFeature: capability requirement not satisfied ${req.key}${req.version ? `.v${req.version}` : ""}`);
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
deps.features.register(feature);
|
|
1556
|
+
return deps.features;
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
// src/features/validation.ts
|
|
1560
|
+
function validateFeatureTargetsV2(feature, descriptors) {
|
|
1561
|
+
if (!feature.presentationsTargets || feature.presentationsTargets.length === 0)
|
|
1562
|
+
return true;
|
|
1563
|
+
for (const req of feature.presentationsTargets) {
|
|
1564
|
+
const d = descriptors.find((x) => x.meta.key === req.key && x.meta.version === req.version);
|
|
1565
|
+
if (!d)
|
|
1566
|
+
throw new Error(`V2 descriptor not found ${req.key}.v${req.version}`);
|
|
1567
|
+
for (const t of req.targets)
|
|
1568
|
+
if (!d.targets.includes(t))
|
|
1569
|
+
throw new Error(`Descriptor ${req.key}.v${req.version} missing target ${t}`);
|
|
1570
|
+
}
|
|
1571
|
+
return true;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
// src/features/types.ts
|
|
1575
|
+
var defineFeature = (spec) => spec;
|
|
1576
|
+
// src/install.ts
|
|
1577
|
+
function makeEmit(_spec, ctx) {
|
|
1578
|
+
return {
|
|
1579
|
+
ref: async (ev, payload) => {
|
|
1580
|
+
await ctx.__emitGuard__?.(ev.meta.key, ev.meta.version, payload);
|
|
1581
|
+
},
|
|
1582
|
+
key: async (key, version, payload) => {
|
|
1583
|
+
await ctx.__emitGuard__?.(key, version, payload);
|
|
1584
|
+
},
|
|
1585
|
+
object: async (evt) => {
|
|
1586
|
+
await ctx.__emitGuard__?.(evt.key, evt.version, evt.payload);
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
function installOp(reg, spec, handler) {
|
|
1591
|
+
return reg.register(spec).bind(spec, handler);
|
|
1592
|
+
}
|
|
1593
|
+
function op(spec, handler) {
|
|
1594
|
+
return {
|
|
1595
|
+
spec,
|
|
1596
|
+
handler,
|
|
1597
|
+
install: (reg) => installOp(reg, spec, handler)
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
// src/prompt.ts
|
|
1602
|
+
function definePrompt(spec) {
|
|
1603
|
+
return spec;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
// src/promptRegistry.ts
|
|
1607
|
+
import { compareVersions as compareVersions4 } from "compare-versions";
|
|
1608
|
+
|
|
1609
|
+
class PromptRegistry {
|
|
1610
|
+
prompts = new Map;
|
|
1611
|
+
register(p) {
|
|
1612
|
+
const key = `${p.meta.key}-v${p.meta.version}`;
|
|
1613
|
+
if (this.prompts.has(key))
|
|
1614
|
+
throw new Error(`Duplicate prompt ${key}`);
|
|
1615
|
+
this.prompts.set(key, p);
|
|
1616
|
+
return this;
|
|
1617
|
+
}
|
|
1618
|
+
list() {
|
|
1619
|
+
return [...this.prompts.values()];
|
|
1620
|
+
}
|
|
1621
|
+
get(name, version) {
|
|
1622
|
+
if (version != null)
|
|
1623
|
+
return this.prompts.get(`${name}-v${version}`);
|
|
1624
|
+
let candidate;
|
|
1625
|
+
for (const [k, p] of this.prompts.entries()) {
|
|
1626
|
+
if (!k.startsWith(`${name}.v`))
|
|
1627
|
+
continue;
|
|
1628
|
+
if (!candidate || compareVersions4(p.meta.version, candidate.meta.version) > 0) {
|
|
1629
|
+
candidate = p;
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
return candidate;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
// src/resources.ts
|
|
1637
|
+
function defineResourceTemplate(spec) {
|
|
1638
|
+
return spec;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
class ResourceRegistry {
|
|
1642
|
+
templates = [];
|
|
1643
|
+
register(tmpl) {
|
|
1644
|
+
this.templates.push(tmpl);
|
|
1645
|
+
return this;
|
|
1646
|
+
}
|
|
1647
|
+
listTemplates() {
|
|
1648
|
+
return [...this.templates];
|
|
1649
|
+
}
|
|
1650
|
+
match(uri) {
|
|
1651
|
+
for (const tmpl of this.templates) {
|
|
1652
|
+
const re = new RegExp("^" + tmpl.meta.uriTemplate.replace(/\{[^}]+\}/g, "([^/]+)") + "$");
|
|
1653
|
+
const m = uri.match(re);
|
|
1654
|
+
if (!m)
|
|
1655
|
+
continue;
|
|
1656
|
+
const names = [...tmpl.meta.uriTemplate.matchAll(/\{([^}]+)\}/g)].map((x) => x[1]);
|
|
1657
|
+
const params = {};
|
|
1658
|
+
names.forEach((n, i) => {
|
|
1659
|
+
const val = m[i + 1];
|
|
1660
|
+
if (n && val) {
|
|
1661
|
+
params[n] = decodeURIComponent(val);
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
return { tmpl, params };
|
|
1665
|
+
}
|
|
1666
|
+
return;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
function resourceRef(uriTemplate, opts) {
|
|
1670
|
+
return {
|
|
1671
|
+
kind: "resource_ref",
|
|
1672
|
+
uriTemplate,
|
|
1673
|
+
varName: opts.varName ?? "id",
|
|
1674
|
+
graphQLType: opts.graphQLType,
|
|
1675
|
+
many: opts.many
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
function isResourceRef(x) {
|
|
1679
|
+
const o = x;
|
|
1680
|
+
return !!o && o.kind === "resource_ref" && typeof o.uriTemplate === "string";
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
// src/themes.ts
|
|
1684
|
+
class ThemeRegistry extends SpecContractRegistry {
|
|
1685
|
+
constructor(items) {
|
|
1686
|
+
super("theme", items);
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
function makeThemeRef(spec) {
|
|
1690
|
+
return { key: spec.meta.key, version: spec.meta.version };
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
// src/migrations.ts
|
|
1694
|
+
import { compareVersions as compareVersions5 } from "compare-versions";
|
|
1695
|
+
var migrationKey = (name, version) => `${name}.v${version}`;
|
|
1696
|
+
|
|
1697
|
+
class MigrationRegistry {
|
|
1698
|
+
items = new Map;
|
|
1699
|
+
register(spec) {
|
|
1700
|
+
const key = migrationKey(spec.meta.key, spec.meta.version);
|
|
1701
|
+
if (this.items.has(key))
|
|
1702
|
+
throw new Error(`Duplicate migration ${key}`);
|
|
1703
|
+
this.items.set(key, spec);
|
|
1704
|
+
return this;
|
|
1705
|
+
}
|
|
1706
|
+
list() {
|
|
1707
|
+
return [...this.items.values()].sort((a, b) => {
|
|
1708
|
+
const byName = a.meta.key.localeCompare(b.meta.key);
|
|
1709
|
+
return byName !== 0 ? byName : compareVersions5(a.meta.version, b.meta.version);
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
get(name, version) {
|
|
1713
|
+
if (version != null)
|
|
1714
|
+
return this.items.get(migrationKey(name, version));
|
|
1715
|
+
let candidate;
|
|
1716
|
+
for (const spec of this.items.values()) {
|
|
1717
|
+
if (spec.meta.key !== name)
|
|
1718
|
+
continue;
|
|
1719
|
+
if (!candidate || compareVersions5(spec.meta.version, candidate.meta.version) > 0) {
|
|
1720
|
+
candidate = spec;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
return candidate;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
// src/versioning/refs.ts
|
|
1727
|
+
function isVersionedSpecRef(ref) {
|
|
1728
|
+
return typeof ref === "object" && ref !== null && "key" in ref && typeof ref.key === "string" && ref.key.length > 0 && "version" in ref && typeof ref.version === "string" && ref.version.length > 0;
|
|
1729
|
+
}
|
|
1730
|
+
function isOptionalVersionedSpecRef(ref) {
|
|
1731
|
+
if (typeof ref !== "object" || ref === null)
|
|
1732
|
+
return false;
|
|
1733
|
+
if (!("key" in ref))
|
|
1734
|
+
return false;
|
|
1735
|
+
if (typeof ref.key !== "string" || ref.key.length === 0) {
|
|
1736
|
+
return false;
|
|
1737
|
+
}
|
|
1738
|
+
if ("version" in ref && ref.version != null) {
|
|
1739
|
+
return typeof ref.version === "string";
|
|
1740
|
+
}
|
|
1741
|
+
return true;
|
|
1742
|
+
}
|
|
1743
|
+
function isSpecKeyRef(ref) {
|
|
1744
|
+
return typeof ref === "object" && ref !== null && "key" in ref && typeof ref.key === "string" && ref.key.length > 0;
|
|
1745
|
+
}
|
|
1746
|
+
function createVersionedRef(key, version) {
|
|
1747
|
+
if (!key || key.trim().length === 0) {
|
|
1748
|
+
throw new Error("Spec key cannot be empty");
|
|
1749
|
+
}
|
|
1750
|
+
if (!version || version.trim().length === 0) {
|
|
1751
|
+
throw new Error("Spec version cannot be empty");
|
|
1752
|
+
}
|
|
1753
|
+
return { key: key.trim(), version: version.trim() };
|
|
1754
|
+
}
|
|
1755
|
+
function createOptionalRef(key, version) {
|
|
1756
|
+
if (!key || key.trim().length === 0) {
|
|
1757
|
+
throw new Error("Spec key cannot be empty");
|
|
1758
|
+
}
|
|
1759
|
+
const ref = { key: key.trim() };
|
|
1760
|
+
if (version != null && version.trim().length > 0) {
|
|
1761
|
+
ref.version = version.trim();
|
|
1762
|
+
}
|
|
1763
|
+
return ref;
|
|
1764
|
+
}
|
|
1765
|
+
function createKeyRef(key) {
|
|
1766
|
+
if (!key || key.trim().length === 0) {
|
|
1767
|
+
throw new Error("Spec key cannot be empty");
|
|
1768
|
+
}
|
|
1769
|
+
return { key: key.trim() };
|
|
1770
|
+
}
|
|
1771
|
+
function formatVersionedRefKey(ref) {
|
|
1772
|
+
return `${ref.key}.v${ref.version}`;
|
|
1773
|
+
}
|
|
1774
|
+
function parseVersionedRefKey(refKey) {
|
|
1775
|
+
const match = refKey.match(/^(.+)\.v(\d+\.\d+\.\d+(?:-.+)?)$/);
|
|
1776
|
+
if (!match)
|
|
1777
|
+
return;
|
|
1778
|
+
const key = match[1];
|
|
1779
|
+
const version = match[2];
|
|
1780
|
+
if (!key || !version)
|
|
1781
|
+
return;
|
|
1782
|
+
return { key, version };
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
// src/versioning/types.ts
|
|
1786
|
+
function isChangelogDocBlock(doc) {
|
|
1787
|
+
return doc.kind === "changelog" && "specKey" in doc && "entries" in doc;
|
|
1788
|
+
}
|
|
1789
|
+
function isVersionBumpType(value) {
|
|
1790
|
+
return value === "patch" || value === "minor" || value === "major";
|
|
1791
|
+
}
|
|
1792
|
+
function isChangeType(value) {
|
|
1793
|
+
const validTypes = [
|
|
1794
|
+
"added",
|
|
1795
|
+
"changed",
|
|
1796
|
+
"fixed",
|
|
1797
|
+
"removed",
|
|
1798
|
+
"deprecated",
|
|
1799
|
+
"breaking",
|
|
1800
|
+
"security"
|
|
1801
|
+
];
|
|
1802
|
+
return typeof value === "string" && validTypes.includes(value);
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
// src/versioning/utils.ts
|
|
1806
|
+
var SEMVER_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*))?(?:\+([a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*))?$/;
|
|
1807
|
+
function parseVersion(version) {
|
|
1808
|
+
const match = version.trim().match(SEMVER_REGEX);
|
|
1809
|
+
if (!match) {
|
|
1810
|
+
return null;
|
|
1811
|
+
}
|
|
1812
|
+
const majorStr = match[1];
|
|
1813
|
+
const minorStr = match[2];
|
|
1814
|
+
const patchStr = match[3];
|
|
1815
|
+
const prerelease = match[4];
|
|
1816
|
+
const build = match[5];
|
|
1817
|
+
if (!majorStr || !minorStr || !patchStr) {
|
|
1818
|
+
return null;
|
|
1819
|
+
}
|
|
1820
|
+
return {
|
|
1821
|
+
major: parseInt(majorStr, 10),
|
|
1822
|
+
minor: parseInt(minorStr, 10),
|
|
1823
|
+
patch: parseInt(patchStr, 10),
|
|
1824
|
+
...prerelease && { prerelease },
|
|
1825
|
+
...build && { build }
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
function parseVersionStrict(version) {
|
|
1829
|
+
const parsed = parseVersion(version);
|
|
1830
|
+
if (!parsed) {
|
|
1831
|
+
throw new Error(`Invalid semantic version: "${version}"`);
|
|
1832
|
+
}
|
|
1833
|
+
return parsed;
|
|
1834
|
+
}
|
|
1835
|
+
function formatVersion(version) {
|
|
1836
|
+
let result = `${version.major}.${version.minor}.${version.patch}`;
|
|
1837
|
+
if (version.prerelease) {
|
|
1838
|
+
result += `-${version.prerelease}`;
|
|
1839
|
+
}
|
|
1840
|
+
if (version.build) {
|
|
1841
|
+
result += `+${version.build}`;
|
|
1842
|
+
}
|
|
1843
|
+
return result;
|
|
1844
|
+
}
|
|
1845
|
+
function compareVersions6(a, b) {
|
|
1846
|
+
const versionA = parseVersionStrict(a);
|
|
1847
|
+
const versionB = parseVersionStrict(b);
|
|
1848
|
+
if (versionA.major !== versionB.major) {
|
|
1849
|
+
return versionA.major > versionB.major ? 1 : -1;
|
|
1850
|
+
}
|
|
1851
|
+
if (versionA.minor !== versionB.minor) {
|
|
1852
|
+
return versionA.minor > versionB.minor ? 1 : -1;
|
|
1853
|
+
}
|
|
1854
|
+
if (versionA.patch !== versionB.patch) {
|
|
1855
|
+
return versionA.patch > versionB.patch ? 1 : -1;
|
|
1856
|
+
}
|
|
1857
|
+
if (versionA.prerelease && !versionB.prerelease) {
|
|
1858
|
+
return -1;
|
|
1859
|
+
}
|
|
1860
|
+
if (!versionA.prerelease && versionB.prerelease) {
|
|
1861
|
+
return 1;
|
|
1862
|
+
}
|
|
1863
|
+
if (versionA.prerelease && versionB.prerelease) {
|
|
1864
|
+
return versionA.prerelease < versionB.prerelease ? -1 : versionA.prerelease > versionB.prerelease ? 1 : 0;
|
|
1865
|
+
}
|
|
1866
|
+
return 0;
|
|
1867
|
+
}
|
|
1868
|
+
function isVersionGreater(a, b) {
|
|
1869
|
+
return compareVersions6(a, b) === 1;
|
|
1870
|
+
}
|
|
1871
|
+
function isVersionLess(a, b) {
|
|
1872
|
+
return compareVersions6(a, b) === -1;
|
|
1873
|
+
}
|
|
1874
|
+
function isVersionEqual(a, b) {
|
|
1875
|
+
return compareVersions6(a, b) === 0;
|
|
1876
|
+
}
|
|
1877
|
+
function bumpVersion(current, bumpType) {
|
|
1878
|
+
const version = parseVersionStrict(current);
|
|
1879
|
+
switch (bumpType) {
|
|
1880
|
+
case "major":
|
|
1881
|
+
return formatVersion({
|
|
1882
|
+
major: version.major + 1,
|
|
1883
|
+
minor: 0,
|
|
1884
|
+
patch: 0
|
|
1885
|
+
});
|
|
1886
|
+
case "minor":
|
|
1887
|
+
return formatVersion({
|
|
1888
|
+
major: version.major,
|
|
1889
|
+
minor: version.minor + 1,
|
|
1890
|
+
patch: 0
|
|
1891
|
+
});
|
|
1892
|
+
case "patch":
|
|
1893
|
+
return formatVersion({
|
|
1894
|
+
major: version.major,
|
|
1895
|
+
minor: version.minor,
|
|
1896
|
+
patch: version.patch + 1
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
function determineBumpType(hasBreaking, hasNonBreaking) {
|
|
1901
|
+
if (hasBreaking) {
|
|
1902
|
+
return "major";
|
|
1903
|
+
}
|
|
1904
|
+
if (hasNonBreaking) {
|
|
1905
|
+
return "minor";
|
|
1906
|
+
}
|
|
1907
|
+
return "patch";
|
|
1908
|
+
}
|
|
1909
|
+
function getBumpTypePriority(bumpType) {
|
|
1910
|
+
switch (bumpType) {
|
|
1911
|
+
case "major":
|
|
1912
|
+
return 3;
|
|
1913
|
+
case "minor":
|
|
1914
|
+
return 2;
|
|
1915
|
+
case "patch":
|
|
1916
|
+
return 1;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
function getMaxBumpType(bumpTypes) {
|
|
1920
|
+
if (bumpTypes.length === 0) {
|
|
1921
|
+
return null;
|
|
1922
|
+
}
|
|
1923
|
+
return bumpTypes.reduce((max, current) => getBumpTypePriority(current) > getBumpTypePriority(max) ? current : max);
|
|
1924
|
+
}
|
|
1925
|
+
function isValidVersion(version) {
|
|
1926
|
+
return parseVersion(version) !== null;
|
|
1927
|
+
}
|
|
1928
|
+
function validateVersion(version) {
|
|
1929
|
+
const errors = [];
|
|
1930
|
+
if (!version || typeof version !== "string") {
|
|
1931
|
+
errors.push("Version must be a non-empty string");
|
|
1932
|
+
return errors;
|
|
1933
|
+
}
|
|
1934
|
+
const trimmed = version.trim();
|
|
1935
|
+
if (trimmed !== version) {
|
|
1936
|
+
errors.push("Version should not have leading or trailing whitespace");
|
|
1937
|
+
}
|
|
1938
|
+
if (!parseVersion(trimmed)) {
|
|
1939
|
+
errors.push(`Invalid semantic version format: "${version}". Expected format: MAJOR.MINOR.PATCH[-prerelease][+build]`);
|
|
1940
|
+
}
|
|
1941
|
+
return errors;
|
|
1942
|
+
}
|
|
1943
|
+
// src/serialization/serializers.ts
|
|
1944
|
+
function isResourceRefDescriptor(value) {
|
|
1945
|
+
return typeof value === "object" && value !== null && "kind" in value && value.kind === "resource_ref";
|
|
1946
|
+
}
|
|
1947
|
+
function getTypeName(type) {
|
|
1948
|
+
if (!type)
|
|
1949
|
+
return "unknown";
|
|
1950
|
+
if (typeof type === "string")
|
|
1951
|
+
return type;
|
|
1952
|
+
if (typeof type === "object") {
|
|
1953
|
+
if ("config" in type && type.config?.name) {
|
|
1954
|
+
return type.config.name;
|
|
1955
|
+
}
|
|
1956
|
+
if ("name" in type && typeof type.name === "string") {
|
|
1957
|
+
return type.name;
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
return "unknown";
|
|
1961
|
+
}
|
|
1962
|
+
function serializeSchemaModel(model) {
|
|
1963
|
+
if (!model)
|
|
1964
|
+
return null;
|
|
1965
|
+
if (isResourceRefDescriptor(model)) {
|
|
1966
|
+
return {
|
|
1967
|
+
name: `ResourceRef<${model.graphQLType}>`,
|
|
1968
|
+
description: `Reference to ${model.graphQLType} resource (${model.uriTemplate})`,
|
|
1969
|
+
fields: {}
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
if ("config" in model && model.config) {
|
|
1973
|
+
const config = model.config;
|
|
1974
|
+
return {
|
|
1975
|
+
name: config.name,
|
|
1976
|
+
description: config.description,
|
|
1977
|
+
fields: Object.fromEntries(Object.entries(config.fields).map(([key, field]) => [
|
|
1978
|
+
key,
|
|
1979
|
+
{
|
|
1980
|
+
typeName: getTypeName(field.type),
|
|
1981
|
+
isOptional: field.isOptional,
|
|
1982
|
+
isArray: field.isArray
|
|
1983
|
+
}
|
|
1984
|
+
]))
|
|
1985
|
+
};
|
|
1986
|
+
}
|
|
1987
|
+
return {
|
|
1988
|
+
name: "unknown",
|
|
1989
|
+
fields: {}
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
function serializeOperationSpec(spec) {
|
|
1993
|
+
if (!spec)
|
|
1994
|
+
return null;
|
|
1995
|
+
return {
|
|
1996
|
+
meta: {
|
|
1997
|
+
key: spec.meta.key,
|
|
1998
|
+
version: spec.meta.version,
|
|
1999
|
+
stability: spec.meta.stability,
|
|
2000
|
+
owners: spec.meta.owners,
|
|
2001
|
+
tags: spec.meta.tags,
|
|
2002
|
+
description: spec.meta.description,
|
|
2003
|
+
goal: spec.meta.goal,
|
|
2004
|
+
context: spec.meta.context
|
|
2005
|
+
},
|
|
2006
|
+
io: {
|
|
2007
|
+
input: serializeSchemaModel(spec.io.input),
|
|
2008
|
+
output: serializeSchemaModel(spec.io.output)
|
|
2009
|
+
},
|
|
2010
|
+
policy: spec.policy ? { auth: spec.policy.auth } : undefined
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
function serializeEventSpec(spec) {
|
|
2014
|
+
if (!spec)
|
|
2015
|
+
return null;
|
|
2016
|
+
return {
|
|
2017
|
+
meta: {
|
|
2018
|
+
key: spec.meta.key,
|
|
2019
|
+
version: spec.meta.version,
|
|
2020
|
+
stability: spec.meta.stability,
|
|
2021
|
+
owners: spec.meta.owners,
|
|
2022
|
+
tags: spec.meta.tags,
|
|
2023
|
+
description: spec.meta.description
|
|
2024
|
+
},
|
|
2025
|
+
payload: serializeSchemaModel(spec.payload)
|
|
2026
|
+
};
|
|
2027
|
+
}
|
|
2028
|
+
function serializePresentationSpec(spec) {
|
|
2029
|
+
if (!spec)
|
|
2030
|
+
return null;
|
|
2031
|
+
return {
|
|
2032
|
+
meta: {
|
|
2033
|
+
key: spec.meta.key,
|
|
2034
|
+
version: spec.meta.version,
|
|
2035
|
+
stability: spec.meta.stability,
|
|
2036
|
+
owners: spec.meta.owners,
|
|
2037
|
+
tags: spec.meta.tags,
|
|
2038
|
+
description: spec.meta.description,
|
|
2039
|
+
goal: spec.meta.goal,
|
|
2040
|
+
context: spec.meta.context
|
|
2041
|
+
},
|
|
2042
|
+
source: {
|
|
2043
|
+
type: spec.source.type,
|
|
2044
|
+
framework: spec.source.type === "component" ? spec.source.framework : undefined,
|
|
2045
|
+
componentKey: spec.source.type === "component" ? spec.source.componentKey : undefined
|
|
2046
|
+
},
|
|
2047
|
+
targets: spec.targets
|
|
2048
|
+
};
|
|
2049
|
+
}
|
|
2050
|
+
function serializeDataViewSpec(spec) {
|
|
2051
|
+
if (!spec)
|
|
2052
|
+
return null;
|
|
2053
|
+
return {
|
|
2054
|
+
meta: {
|
|
2055
|
+
key: spec.meta.key,
|
|
2056
|
+
version: spec.meta.version,
|
|
2057
|
+
stability: spec.meta.stability,
|
|
2058
|
+
owners: spec.meta.owners,
|
|
2059
|
+
tags: spec.meta.tags,
|
|
2060
|
+
description: spec.meta.description,
|
|
2061
|
+
title: spec.meta.title
|
|
2062
|
+
},
|
|
2063
|
+
source: spec.source,
|
|
2064
|
+
view: spec.view
|
|
2065
|
+
};
|
|
2066
|
+
}
|
|
2067
|
+
function serializeFormSpec(spec) {
|
|
2068
|
+
if (!spec)
|
|
2069
|
+
return null;
|
|
2070
|
+
return {
|
|
2071
|
+
meta: {
|
|
2072
|
+
key: spec.meta.key,
|
|
2073
|
+
version: spec.meta.version,
|
|
2074
|
+
stability: spec.meta.stability,
|
|
2075
|
+
owners: spec.meta.owners,
|
|
2076
|
+
tags: spec.meta.tags,
|
|
2077
|
+
description: spec.meta.description,
|
|
2078
|
+
title: spec.meta.title
|
|
2079
|
+
},
|
|
2080
|
+
fields: spec.fields,
|
|
2081
|
+
actions: spec.actions
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
// src/index.ts
|
|
2085
|
+
init_registry_utils();
|
|
2086
|
+
import { defineSchemaModel } from "@contractspec/lib.schema";
|
|
2087
|
+
export {
|
|
2088
|
+
validateVersion,
|
|
2089
|
+
validateFeatureTargetsV2,
|
|
2090
|
+
validateCapabilityConsistency,
|
|
2091
|
+
serializeSchemaModel,
|
|
2092
|
+
serializePresentationSpec,
|
|
2093
|
+
serializeOperationSpec,
|
|
2094
|
+
serializeFormSpec,
|
|
2095
|
+
serializeEventSpec,
|
|
2096
|
+
serializeDataViewSpec,
|
|
2097
|
+
resourceRef,
|
|
2098
|
+
registerOpenBankingCapabilities,
|
|
2099
|
+
registerMeetingRecorderCapabilities,
|
|
2100
|
+
registerDocBlocks,
|
|
2101
|
+
parseVersionedRefKey,
|
|
2102
|
+
parseVersionStrict,
|
|
2103
|
+
parseVersion,
|
|
2104
|
+
openBankingTransactionsReadCapability,
|
|
2105
|
+
openBankingBalancesReadCapability,
|
|
2106
|
+
openBankingAccountsReadCapability,
|
|
2107
|
+
opKey,
|
|
2108
|
+
op,
|
|
2109
|
+
meetingRecorderWebhooksCapability,
|
|
2110
|
+
meetingRecorderTranscriptsReadCapability,
|
|
2111
|
+
meetingRecorderMeetingsReadCapability,
|
|
2112
|
+
makeThemeRef,
|
|
2113
|
+
makeEmit,
|
|
2114
|
+
listRegisteredDocBlocks,
|
|
2115
|
+
isVersionedSpecRef,
|
|
2116
|
+
isVersionLess,
|
|
2117
|
+
isVersionGreater,
|
|
2118
|
+
isVersionEqual,
|
|
2119
|
+
isVersionBumpType,
|
|
2120
|
+
isValidVersion,
|
|
2121
|
+
isSpecKeyRef,
|
|
2122
|
+
isResourceRef,
|
|
2123
|
+
isOptionalVersionedSpecRef,
|
|
2124
|
+
isEmitDeclRef,
|
|
2125
|
+
isChangelogDocBlock,
|
|
2126
|
+
isChangeType,
|
|
2127
|
+
installOp,
|
|
2128
|
+
installFeature,
|
|
2129
|
+
groupByToArray,
|
|
2130
|
+
groupByMultiple,
|
|
2131
|
+
groupBy,
|
|
2132
|
+
getUniqueTags,
|
|
2133
|
+
getUniqueOwners,
|
|
2134
|
+
getUniqueDomains,
|
|
2135
|
+
getMaxBumpType,
|
|
2136
|
+
getBumpTypePriority,
|
|
2137
|
+
formatVersionedRefKey,
|
|
2138
|
+
formatVersion,
|
|
2139
|
+
findOrphanSpecs,
|
|
2140
|
+
filterPresentationsByCapability,
|
|
2141
|
+
filterOperationsByCapability,
|
|
2142
|
+
filterEventsByCapability,
|
|
2143
|
+
filterBy,
|
|
2144
|
+
eventKey,
|
|
2145
|
+
evalPredicate,
|
|
2146
|
+
docId,
|
|
2147
|
+
determineBumpType,
|
|
2148
|
+
defineSchemaModel,
|
|
2149
|
+
defineResourceTemplate,
|
|
2150
|
+
defineQuery,
|
|
2151
|
+
definePrompt,
|
|
2152
|
+
definePresentation,
|
|
2153
|
+
defineFormSpec,
|
|
2154
|
+
defineFeature,
|
|
2155
|
+
defineExample,
|
|
2156
|
+
defineEvent,
|
|
2157
|
+
defineCommand,
|
|
2158
|
+
defineCapability,
|
|
2159
|
+
defaultDocRegistry,
|
|
2160
|
+
createVersionedRef,
|
|
2161
|
+
createOptionalRef,
|
|
2162
|
+
createKeyRef,
|
|
2163
|
+
createEmptyCapabilityContext,
|
|
2164
|
+
createCapabilityContext,
|
|
2165
|
+
createBypassCapabilityContext,
|
|
2166
|
+
compareVersions6 as compareVersions,
|
|
2167
|
+
checkCapabilityForPresentation,
|
|
2168
|
+
checkCapabilityForOperation,
|
|
2169
|
+
checkCapabilityForEvent,
|
|
2170
|
+
capabilityKey,
|
|
2171
|
+
bumpVersion,
|
|
2172
|
+
buildZodWithRelations,
|
|
2173
|
+
assertCapabilityForPresentation,
|
|
2174
|
+
assertCapabilityForOperation,
|
|
2175
|
+
assertCapabilityForEvent,
|
|
2176
|
+
ThemeRegistry,
|
|
2177
|
+
TagsEnum,
|
|
2178
|
+
Tags,
|
|
2179
|
+
StabilityEnum,
|
|
2180
|
+
ResourceRegistry,
|
|
2181
|
+
PromptRegistry,
|
|
2182
|
+
PresentationRegistry,
|
|
2183
|
+
OwnersEnum,
|
|
2184
|
+
Owners,
|
|
2185
|
+
OperationSpecRegistry,
|
|
2186
|
+
MigrationRegistry,
|
|
2187
|
+
GroupingStrategies,
|
|
2188
|
+
FormRegistry,
|
|
2189
|
+
FeatureRegistry,
|
|
2190
|
+
ExampleRegistry,
|
|
2191
|
+
EventRegistry,
|
|
2192
|
+
DocRegistry,
|
|
2193
|
+
CapabilityRegistry,
|
|
2194
|
+
CapabilityMissingError
|
|
2195
|
+
};
|