@lssm/lib.contracts 1.41.1 → 1.42.1
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/LICENSE +21 -0
- package/README.md +7 -4
- package/dist/_virtual/rolldown_runtime.js +37 -1
- package/dist/app-config/app-config.feature.d.ts +11 -0
- package/dist/app-config/app-config.feature.js +54 -1
- package/dist/app-config/branding.d.ts +55 -0
- package/dist/app-config/contracts.d.ts +245 -0
- package/dist/app-config/contracts.js +395 -1
- package/dist/app-config/docs/app-config.docblock.d.ts +6 -0
- package/dist/app-config/docs/app-config.docblock.js +21 -220
- package/dist/app-config/events.d.ts +122 -0
- package/dist/app-config/events.js +174 -1
- package/dist/app-config/index.d.ts +9 -0
- package/dist/app-config/index.js +8 -1
- package/dist/app-config/lifecycle-contracts.d.ts +273 -0
- package/dist/app-config/lifecycle-contracts.js +440 -1
- package/dist/app-config/lifecycle.d.ts +27 -0
- package/dist/app-config/runtime.d.ts +117 -0
- package/dist/app-config/runtime.js +617 -1
- package/dist/app-config/spec.d.ts +172 -0
- package/dist/app-config/spec.js +36 -1
- package/dist/app-config/validation.d.ts +49 -0
- package/dist/app-config/validation.js +538 -1
- package/dist/capabilities/capabilities.d.ts +48 -0
- package/dist/capabilities/capabilities.js +50 -0
- package/dist/capabilities/docs/capabilities.docblock.d.ts +6 -0
- package/dist/capabilities/docs/capabilities.docblock.js +21 -1
- package/dist/capabilities/index.d.ts +3 -0
- package/dist/capabilities/index.js +4 -0
- package/dist/capabilities/openbanking.d.ts +10 -0
- package/dist/capabilities/openbanking.js +92 -1
- package/dist/client/index.d.ts +6 -0
- package/dist/client/index.js +9 -1
- package/dist/client/react/drivers/rn-reusables.d.ts +22 -0
- package/dist/client/react/drivers/rn-reusables.js +21 -1
- package/dist/client/react/drivers/shadcn.d.ts +12 -0
- package/dist/client/react/drivers/shadcn.js +11 -1
- package/dist/client/react/feature-render.d.ts +21 -0
- package/dist/client/react/feature-render.js +44 -1
- package/dist/client/react/form-render.d.ts +92 -0
- package/dist/client/react/form-render.js +298 -1
- package/dist/client/react/index.d.ts +5 -0
- package/dist/client/react/index.js +8 -1
- package/dist/contract-registry/index.d.ts +3 -0
- package/dist/contract-registry/index.js +3 -1
- package/dist/contract-registry/schemas.d.ts +124 -0
- package/dist/contract-registry/schemas.js +61 -1
- package/dist/contract-registry/types.d.ts +46 -0
- package/dist/data-views/data-views.d.ts +138 -0
- package/dist/data-views/data-views.js +58 -0
- package/dist/data-views/docs/data-views.docblock.d.ts +6 -0
- package/dist/data-views/docs/data-views.docblock.js +21 -1
- package/dist/data-views/index.d.ts +4 -0
- package/dist/data-views/index.js +5 -0
- package/dist/data-views/query-generator.d.ts +40 -0
- package/dist/data-views/query-generator.js +48 -1
- package/dist/data-views/runtime.d.ts +27 -0
- package/dist/data-views/runtime.js +39 -1
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.d.ts +6 -0
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +17 -350
- package/dist/docs/index.d.ts +6 -0
- package/dist/docs/index.js +27 -1
- package/dist/docs/meta.docs.d.ts +6 -0
- package/dist/docs/meta.docs.js +18 -2
- package/dist/docs/presentations.d.ts +33 -0
- package/dist/docs/presentations.js +64 -1
- package/dist/docs/registry.d.ts +23 -0
- package/dist/docs/registry.js +51 -1
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.d.ts +6 -0
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +25 -2
- package/dist/docs/tech/contracts/README.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/README.docblock.js +21 -1
- package/dist/docs/tech/contracts/create-subscription.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/create-subscription.docblock.js +21 -1
- package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +21 -180
- package/dist/docs/tech/contracts/migrations.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/migrations.docblock.js +21 -1
- package/dist/docs/tech/contracts/openapi-export.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/openapi-export.docblock.js +25 -5
- package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +19 -60
- package/dist/docs/tech/contracts/overlays.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/overlays.docblock.js +21 -68
- package/dist/docs/tech/contracts/tests.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/tests.docblock.js +21 -132
- package/dist/docs/tech/contracts/themes.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/themes.docblock.js +21 -1
- package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +21 -106
- package/dist/docs/tech/lifecycle-stage-system.docblock.d.ts +6 -0
- package/dist/docs/tech/lifecycle-stage-system.docblock.js +17 -213
- package/dist/docs/tech/llm/llm-integration.docblock.d.ts +7 -0
- package/dist/docs/tech/llm/llm-integration.docblock.js +76 -7
- package/dist/docs/tech/mcp-endpoints.docblock.d.ts +6 -0
- package/dist/docs/tech/mcp-endpoints.docblock.js +38 -1
- package/dist/docs/tech/presentation-runtime.docblock.d.ts +6 -0
- package/dist/docs/tech/presentation-runtime.docblock.js +17 -1
- package/dist/docs/tech/schema/README.docblock.d.ts +6 -0
- package/dist/docs/tech/schema/README.docblock.js +21 -262
- package/dist/docs/tech/studio/learning-events.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/learning-events.docblock.js +49 -1
- package/dist/docs/tech/studio/learning-journeys.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/learning-journeys.docblock.js +25 -2
- package/dist/docs/tech/studio/platform-admin-panel.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/platform-admin-panel.docblock.js +24 -2
- package/dist/docs/tech/studio/project-access-teams.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/project-access-teams.docblock.js +26 -16
- package/dist/docs/tech/studio/project-routing.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/project-routing.docblock.js +68 -1
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +23 -2
- package/dist/docs/tech/studio/team-invitations.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/team-invitations.docblock.js +41 -36
- package/dist/docs/tech/studio/workspace-ops.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/workspace-ops.docblock.js +48 -1
- package/dist/docs/tech/studio/workspaces.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/workspaces.docblock.js +24 -2
- package/dist/docs/tech/telemetry-ingest.docblock.d.ts +6 -0
- package/dist/docs/tech/telemetry-ingest.docblock.js +37 -3
- package/dist/docs/tech/templates/runtime.docblock.d.ts +6 -0
- package/dist/docs/tech/templates/runtime.docblock.js +21 -1
- package/dist/docs/tech/vscode-extension.docblock.d.ts +6 -0
- package/dist/docs/tech/vscode-extension.docblock.js +37 -3
- package/dist/docs/tech/workflows/overview.docblock.d.ts +6 -0
- package/dist/docs/tech/workflows/overview.docblock.js +21 -1
- package/dist/docs/tech-contracts.docs.d.ts +6 -0
- package/dist/docs/tech-contracts.docs.js +27 -7
- package/dist/docs/types.d.ts +41 -0
- package/dist/events.d.ts +47 -0
- package/dist/events.js +19 -1
- package/dist/experiments/docs/experiments.docblock.d.ts +6 -0
- package/dist/experiments/docs/experiments.docblock.js +21 -128
- package/dist/experiments/evaluator.d.ts +37 -0
- package/dist/experiments/evaluator.js +101 -1
- package/dist/experiments/spec-resolver.d.ts +17 -0
- package/dist/experiments/spec.d.ts +82 -0
- package/dist/experiments/spec.js +33 -1
- package/dist/features.d.ts +104 -0
- package/dist/features.js +91 -1
- package/dist/forms/docs/forms.docblock.d.ts +6 -0
- package/dist/forms/docs/forms.docblock.js +21 -1
- package/dist/forms/forms.d.ts +266 -0
- package/dist/forms/forms.js +146 -0
- package/dist/forms/index.d.ts +2 -0
- package/dist/forms/index.js +3 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.js +119 -1
- package/dist/install.d.ts +77 -0
- package/dist/install.js +40 -1
- package/dist/integrations/binding.d.ts +17 -0
- package/dist/integrations/connection.d.ts +51 -0
- package/dist/integrations/docs/integrations.docblock.d.ts +6 -0
- package/dist/integrations/docs/integrations.docblock.js +94 -1
- package/dist/integrations/health.d.ts +21 -0
- package/dist/integrations/health.js +69 -1
- package/dist/integrations/index.d.ts +34 -0
- package/dist/integrations/index.js +23 -1
- package/dist/integrations/integrations.feature.d.ts +11 -0
- package/dist/integrations/integrations.feature.js +60 -0
- package/dist/integrations/openbanking/contracts/accounts.d.ts +289 -0
- package/dist/integrations/openbanking/contracts/accounts.js +236 -1
- package/dist/integrations/openbanking/contracts/balances.d.ts +165 -0
- package/dist/integrations/openbanking/contracts/balances.js +166 -1
- package/dist/integrations/openbanking/contracts/index.d.ts +10 -0
- package/dist/integrations/openbanking/contracts/index.js +12 -1
- package/dist/integrations/openbanking/contracts/transactions.d.ts +213 -0
- package/dist/integrations/openbanking/contracts/transactions.js +217 -1
- package/dist/integrations/openbanking/guards.d.ts +12 -0
- package/dist/integrations/openbanking/guards.js +33 -1
- package/dist/integrations/openbanking/models.d.ts +228 -0
- package/dist/integrations/openbanking/models.js +240 -1
- package/dist/integrations/openbanking/openbanking.feature.d.ts +11 -0
- package/dist/integrations/openbanking/openbanking.feature.js +69 -1
- package/dist/integrations/openbanking/telemetry.d.ts +15 -0
- package/dist/integrations/openbanking/telemetry.js +39 -1
- package/dist/integrations/operations.d.ts +437 -0
- package/dist/integrations/operations.js +392 -0
- package/dist/integrations/providers/calendar.d.ts +78 -0
- package/dist/integrations/providers/elevenlabs.d.ts +7 -0
- package/dist/integrations/providers/elevenlabs.js +55 -1
- package/dist/integrations/providers/email.d.ts +86 -0
- package/dist/integrations/providers/embedding.d.ts +24 -0
- package/dist/integrations/providers/gcs-storage.d.ts +7 -0
- package/dist/integrations/providers/gcs-storage.js +78 -1
- package/dist/integrations/providers/gmail.d.ts +7 -0
- package/dist/integrations/providers/gmail.js +90 -1
- package/dist/integrations/providers/google-calendar.d.ts +7 -0
- package/dist/integrations/providers/google-calendar.js +69 -1
- package/dist/integrations/providers/impls/elevenlabs-voice.d.ts +20 -0
- package/dist/integrations/providers/impls/elevenlabs-voice.js +95 -1
- package/dist/integrations/providers/impls/gcs-storage.d.ts +24 -0
- package/dist/integrations/providers/impls/gcs-storage.js +88 -1
- package/dist/integrations/providers/impls/gmail-inbound.d.ts +26 -0
- package/dist/integrations/providers/impls/gmail-inbound.js +200 -1
- package/dist/integrations/providers/impls/gmail-outbound.d.ts +18 -0
- package/dist/integrations/providers/impls/gmail-outbound.js +104 -5
- package/dist/integrations/providers/impls/google-calendar.d.ts +23 -0
- package/dist/integrations/providers/impls/google-calendar.js +154 -1
- package/dist/integrations/providers/impls/index.d.ts +15 -0
- package/dist/integrations/providers/impls/index.js +16 -1
- package/dist/integrations/providers/impls/mistral-embedding.d.ts +23 -0
- package/dist/integrations/providers/impls/mistral-embedding.js +41 -1
- package/dist/integrations/providers/impls/mistral-llm.d.ts +31 -0
- package/dist/integrations/providers/impls/mistral-llm.js +247 -1
- package/dist/integrations/providers/impls/postmark-email.d.ts +19 -0
- package/dist/integrations/providers/impls/postmark-email.js +55 -1
- package/dist/integrations/providers/impls/powens-client.d.ts +124 -0
- package/dist/integrations/providers/impls/powens-client.js +171 -1
- package/dist/integrations/providers/impls/powens-openbanking.d.ts +27 -0
- package/dist/integrations/providers/impls/powens-openbanking.js +218 -1
- package/dist/integrations/providers/impls/provider-factory.d.ts +26 -0
- package/dist/integrations/providers/impls/provider-factory.js +145 -1
- package/dist/integrations/providers/impls/qdrant-vector.d.ts +24 -0
- package/dist/integrations/providers/impls/qdrant-vector.js +69 -1
- package/dist/integrations/providers/impls/stripe-payments.d.ts +28 -0
- package/dist/integrations/providers/impls/stripe-payments.js +202 -1
- package/dist/integrations/providers/impls/twilio-sms.d.ts +20 -0
- package/dist/integrations/providers/impls/twilio-sms.js +58 -1
- package/dist/integrations/providers/index.d.ts +22 -0
- package/dist/integrations/providers/index.js +13 -1
- package/dist/integrations/providers/llm.d.ts +82 -0
- package/dist/integrations/providers/mistral.d.ts +7 -0
- package/dist/integrations/providers/mistral.js +71 -1
- package/dist/integrations/providers/openbanking.d.ts +128 -0
- package/dist/integrations/providers/payments.d.ts +109 -0
- package/dist/integrations/providers/postmark.d.ts +7 -0
- package/dist/integrations/providers/postmark.js +71 -1
- package/dist/integrations/providers/powens.d.ts +7 -0
- package/dist/integrations/providers/powens.js +119 -1
- package/dist/integrations/providers/qdrant.d.ts +7 -0
- package/dist/integrations/providers/qdrant.js +76 -1
- package/dist/integrations/providers/registry.d.ts +11 -0
- package/dist/integrations/providers/registry.js +34 -1
- package/dist/integrations/providers/sms.d.ts +34 -0
- package/dist/integrations/providers/storage.d.ts +60 -0
- package/dist/integrations/providers/stripe.d.ts +7 -0
- package/dist/integrations/providers/stripe.js +86 -1
- package/dist/integrations/providers/twilio-sms.d.ts +7 -0
- package/dist/integrations/providers/twilio-sms.js +64 -1
- package/dist/integrations/providers/vector-store.d.ts +43 -0
- package/dist/integrations/providers/voice.d.ts +34 -0
- package/dist/integrations/runtime.d.ts +99 -0
- package/dist/integrations/runtime.js +186 -1
- package/dist/integrations/secrets/aws-secret-manager.d.ts +31 -0
- package/dist/integrations/secrets/aws-secret-manager.js +231 -1
- package/dist/integrations/secrets/env-secret-provider.d.ts +31 -0
- package/dist/integrations/secrets/env-secret-provider.js +81 -1
- package/dist/integrations/secrets/gcp-secret-manager.d.ts +32 -0
- package/dist/integrations/secrets/gcp-secret-manager.js +229 -1
- package/dist/integrations/secrets/index.d.ts +7 -0
- package/dist/integrations/secrets/index.js +8 -1
- package/dist/integrations/secrets/manager.d.ts +47 -0
- package/dist/integrations/secrets/manager.js +103 -1
- package/dist/integrations/secrets/provider.d.ts +52 -0
- package/dist/integrations/secrets/provider.js +58 -1
- package/dist/integrations/secrets/scaleway-secret-manager.d.ts +38 -0
- package/dist/integrations/secrets/scaleway-secret-manager.js +247 -1
- package/dist/integrations/secrets-types.d.ts +17 -0
- package/dist/integrations/spec.d.ts +75 -0
- package/dist/integrations/spec.js +39 -1
- package/dist/jobs/define-job.d.ts +18 -0
- package/dist/jobs/define-job.js +16 -1
- package/dist/jobs/gcp-cloud-tasks.d.ts +41 -0
- package/dist/jobs/gcp-cloud-tasks.js +53 -1
- package/dist/jobs/gcp-pubsub.d.ts +25 -0
- package/dist/jobs/gcp-pubsub.js +39 -1
- package/dist/jobs/handlers/gmail-sync-handler.d.ts +9 -0
- package/dist/jobs/handlers/gmail-sync-handler.js +9 -1
- package/dist/jobs/handlers/index.d.ts +9 -0
- package/dist/jobs/handlers/index.js +12 -1
- package/dist/jobs/handlers/ping-handler.d.ts +10 -0
- package/dist/jobs/handlers/ping-handler.js +15 -1
- package/dist/jobs/handlers/storage-document-handler.d.ts +12 -0
- package/dist/jobs/handlers/storage-document-handler.js +14 -1
- package/dist/jobs/index.d.ts +3 -0
- package/dist/jobs/index.js +4 -1
- package/dist/jobs/memory-queue.d.ts +18 -0
- package/dist/jobs/memory-queue.js +71 -1
- package/dist/jobs/queue.d.ts +131 -0
- package/dist/jobs/queue.js +33 -1
- package/dist/jobs/scaleway-sqs-queue.d.ts +30 -0
- package/dist/jobs/scaleway-sqs-queue.js +153 -1
- package/dist/jsonschema.d.ts +28 -0
- package/dist/jsonschema.js +32 -1
- package/dist/knowledge/binding.d.ts +25 -0
- package/dist/knowledge/docs/knowledge.docblock.d.ts +6 -0
- package/dist/knowledge/docs/knowledge.docblock.js +21 -138
- package/dist/knowledge/index.d.ts +11 -0
- package/dist/knowledge/index.js +10 -1
- package/dist/knowledge/ingestion/document-processor.d.ts +24 -0
- package/dist/knowledge/ingestion/document-processor.js +54 -1
- package/dist/knowledge/ingestion/embedding-service.d.ts +12 -0
- package/dist/knowledge/ingestion/embedding-service.js +25 -1
- package/dist/knowledge/ingestion/gmail-adapter.d.ts +18 -0
- package/dist/knowledge/ingestion/gmail-adapter.js +50 -5
- package/dist/knowledge/ingestion/index.d.ts +6 -0
- package/dist/knowledge/ingestion/index.js +7 -1
- package/dist/knowledge/ingestion/storage-adapter.d.ts +15 -0
- package/dist/knowledge/ingestion/storage-adapter.js +26 -1
- package/dist/knowledge/ingestion/vector-indexer.d.ts +18 -0
- package/dist/knowledge/ingestion/vector-indexer.js +32 -1
- package/dist/knowledge/knowledge.feature.d.ts +11 -0
- package/dist/knowledge/knowledge.feature.js +61 -0
- package/dist/knowledge/operations.d.ts +318 -0
- package/dist/knowledge/operations.js +321 -0
- package/dist/knowledge/query/index.d.ts +2 -0
- package/dist/knowledge/query/index.js +3 -1
- package/dist/knowledge/query/service.d.ts +29 -0
- package/dist/knowledge/query/service.js +64 -2
- package/dist/knowledge/runtime.d.ts +32 -0
- package/dist/knowledge/runtime.js +49 -1
- package/dist/knowledge/source.d.ts +32 -0
- package/dist/knowledge/spaces/email-threads.d.ts +7 -0
- package/dist/knowledge/spaces/email-threads.js +37 -1
- package/dist/knowledge/spaces/financial-docs.d.ts +7 -0
- package/dist/knowledge/spaces/financial-docs.js +37 -1
- package/dist/knowledge/spaces/financial-overview.d.ts +7 -0
- package/dist/knowledge/spaces/financial-overview.js +41 -1
- package/dist/knowledge/spaces/index.d.ts +7 -0
- package/dist/knowledge/spaces/index.js +8 -1
- package/dist/knowledge/spaces/product-canon.d.ts +7 -0
- package/dist/knowledge/spaces/product-canon.js +37 -1
- package/dist/knowledge/spaces/support-faq.d.ts +7 -0
- package/dist/knowledge/spaces/support-faq.js +40 -1
- package/dist/knowledge/spaces/uploaded-docs.d.ts +7 -0
- package/dist/knowledge/spaces/uploaded-docs.js +37 -1
- package/dist/knowledge/spec.d.ts +48 -0
- package/dist/knowledge/spec.js +39 -1
- package/dist/llm/exporters.d.ts +69 -0
- package/dist/llm/exporters.js +542 -8
- package/dist/llm/index.d.ts +4 -0
- package/dist/llm/index.js +4 -1
- package/dist/llm/prompts.d.ts +52 -0
- package/dist/llm/prompts.js +246 -56
- package/dist/llm/types.d.ts +214 -0
- package/dist/markdown.d.ts +22 -0
- package/dist/markdown.js +119 -3
- package/dist/migrations.d.ts +52 -0
- package/dist/migrations.js +33 -1
- package/dist/onboarding-base.d.ts +138 -0
- package/dist/onboarding-base.js +195 -1
- package/dist/openapi.d.ts +31 -0
- package/dist/openapi.js +75 -1
- package/dist/operations/index.d.ts +3 -0
- package/dist/operations/index.js +4 -0
- package/dist/operations/operation.d.ts +180 -0
- package/dist/operations/operation.js +35 -0
- package/dist/operations/registry.d.ts +103 -0
- package/dist/operations/registry.js +252 -0
- package/dist/ownership.d.ts +84 -0
- package/dist/ownership.js +38 -1
- package/dist/policy/docs/policy.docblock.d.ts +6 -0
- package/dist/policy/docs/policy.docblock.js +21 -1
- package/dist/policy/engine.d.ts +40 -0
- package/dist/policy/engine.js +223 -1
- package/dist/policy/index.d.ts +5 -0
- package/dist/policy/index.js +5 -0
- package/dist/policy/opa-adapter.d.ts +45 -0
- package/dist/policy/opa-adapter.js +71 -1
- package/dist/policy/registry.d.ts +9 -0
- package/dist/policy/registry.js +11 -0
- package/dist/policy/spec.d.ts +103 -0
- package/dist/policy/spec.js +0 -1
- package/dist/presentations/docs/presentations-conventions.docblock.d.ts +6 -0
- package/dist/presentations/docs/presentations-conventions.docblock.js +20 -7
- package/dist/presentations/index.d.ts +4 -0
- package/dist/presentations/index.js +5 -0
- package/dist/presentations/presentations.d.ts +50 -0
- package/dist/presentations/presentations.js +7 -0
- package/dist/presentations/registry.d.ts +10 -0
- package/dist/presentations/registry.js +12 -0
- package/dist/presentations/transform-engine.d.ts +66 -0
- package/dist/presentations/transform-engine.js +282 -0
- package/dist/prompt.d.ts +60 -0
- package/dist/prompt.js +10 -1
- package/dist/promptRegistry.d.ts +15 -0
- package/dist/promptRegistry.js +34 -1
- package/dist/regenerator/adapters.d.ts +19 -0
- package/dist/regenerator/docs/regenerator.docblock.d.ts +6 -0
- package/dist/regenerator/docs/regenerator.docblock.js +21 -184
- package/dist/regenerator/executor.d.ts +70 -0
- package/dist/regenerator/executor.js +86 -1
- package/dist/regenerator/index.d.ts +7 -0
- package/dist/regenerator/index.js +6 -1
- package/dist/regenerator/service.d.ts +33 -0
- package/dist/regenerator/service.js +92 -1
- package/dist/regenerator/sinks.d.ts +26 -0
- package/dist/regenerator/sinks.js +32 -1
- package/dist/regenerator/types.d.ts +107 -0
- package/dist/regenerator/utils.d.ts +9 -0
- package/dist/regenerator/utils.js +51 -1
- package/dist/registry-utils.d.ts +106 -0
- package/dist/registry-utils.js +122 -0
- package/dist/registry.d.ts +30 -0
- package/dist/registry.js +58 -1
- package/dist/resources.d.ts +64 -0
- package/dist/resources.js +50 -1
- package/dist/schema-to-markdown.d.ts +54 -0
- package/dist/schema-to-markdown.js +214 -10
- package/dist/server/contracts-adapter-hydration.d.ts +15 -0
- package/dist/server/contracts-adapter-hydration.js +41 -0
- package/dist/server/contracts-adapter-input.d.ts +9 -0
- package/dist/server/contracts-adapter-input.js +77 -0
- package/dist/server/graphql-pothos.d.ts +31 -0
- package/dist/server/graphql-pothos.js +127 -1
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +10 -1
- package/dist/server/mcp/createMcpServer.d.ts +15 -0
- package/dist/server/mcp/createMcpServer.js +28 -1
- package/dist/server/mcp/mcpTypes.d.ts +30 -0
- package/dist/server/mcp/registerPresentations.d.ts +7 -0
- package/dist/server/mcp/registerPresentations.js +112 -1
- package/dist/server/mcp/registerPrompts.d.ts +8 -0
- package/dist/server/mcp/registerPrompts.js +36 -2
- package/dist/server/mcp/registerResources.d.ts +8 -0
- package/dist/server/mcp/registerResources.js +35 -1
- package/dist/server/mcp/registerTools.d.ts +8 -0
- package/dist/server/mcp/registerTools.js +22 -1
- package/dist/server/provider-mcp.d.ts +2 -0
- package/dist/server/provider-mcp.js +3 -1
- package/dist/server/rest-elysia.d.ts +40 -0
- package/dist/server/rest-elysia.js +20 -1
- package/dist/server/rest-express.d.ts +16 -0
- package/dist/server/rest-express.js +36 -1
- package/dist/server/rest-generic.d.ts +32 -0
- package/dist/server/rest-generic.js +124 -1
- package/dist/server/rest-next-app.d.ts +35 -0
- package/dist/server/rest-next-app.js +38 -1
- package/dist/server/rest-next-mcp.d.ts +11 -0
- package/dist/server/rest-next-mcp.js +45 -1
- package/dist/server/rest-next-pages.d.ts +9 -0
- package/dist/server/rest-next-pages.js +22 -1
- package/dist/telemetry/anomaly.d.ts +27 -0
- package/dist/telemetry/anomaly.js +48 -1
- package/dist/telemetry/docs/telemetry.docblock.d.ts +6 -0
- package/dist/telemetry/docs/telemetry.docblock.js +21 -139
- package/dist/telemetry/index.d.ts +4 -0
- package/dist/telemetry/index.js +5 -1
- package/dist/telemetry/spec.d.ts +91 -0
- package/dist/telemetry/spec.js +69 -1
- package/dist/telemetry/tracker.d.ts +51 -0
- package/dist/telemetry/tracker.js +76 -1
- package/dist/tests/index.d.ts +3 -0
- package/dist/tests/index.js +4 -1
- package/dist/tests/runner.d.ts +43 -0
- package/dist/tests/runner.js +150 -1
- package/dist/tests/spec.d.ts +89 -0
- package/dist/tests/spec.js +33 -1
- package/dist/themes.d.ts +53 -0
- package/dist/themes.js +39 -1
- package/dist/translations/catalog.d.ts +28 -0
- package/dist/translations/tenant.d.ts +15 -0
- package/dist/types.d.ts +92 -0
- package/dist/workflow/adapters/db-adapter.d.ts +46 -0
- package/dist/workflow/adapters/db-adapter.js +83 -1
- package/dist/workflow/adapters/file-adapter.d.ts +14 -0
- package/dist/workflow/adapters/file-adapter.js +11 -1
- package/dist/workflow/adapters/index.d.ts +4 -0
- package/dist/workflow/adapters/index.js +5 -1
- package/dist/workflow/adapters/memory-store.d.ts +18 -0
- package/dist/workflow/adapters/memory-store.js +58 -1
- package/dist/workflow/expression.d.ts +9 -0
- package/dist/workflow/expression.js +99 -1
- package/dist/workflow/index.d.ts +10 -0
- package/dist/workflow/index.js +9 -1
- package/dist/workflow/runner.d.ts +74 -0
- package/dist/workflow/runner.js +337 -1
- package/dist/workflow/sla-monitor.d.ts +20 -0
- package/dist/workflow/sla-monitor.js +47 -1
- package/dist/workflow/spec.d.ts +105 -0
- package/dist/workflow/spec.js +55 -1
- package/dist/workflow/state.d.ts +35 -0
- package/dist/workflow/validation.d.ts +29 -0
- package/dist/workflow/validation.js +176 -1
- package/dist/workspace-config/contractsrc-schema.d.ts +786 -0
- package/dist/workspace-config/contractsrc-schema.js +247 -0
- package/dist/workspace-config/index.d.ts +2 -0
- package/dist/workspace-config/index.js +3 -0
- package/package.json +286 -266
- package/dist/capabilities.js +0 -1
- package/dist/contracts-adapter-hydration.js +0 -1
- package/dist/contracts-adapter-input.js +0 -1
- package/dist/data-views.js +0 -1
- package/dist/docs/PUBLISHING.docblock.js +0 -76
- package/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -383
- package/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -68
- package/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -140
- package/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -86
- package/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -1
- package/dist/forms.js +0 -1
- package/dist/integrations/contracts.js +0 -1
- package/dist/knowledge/contracts.js +0 -1
- package/dist/openbanking/docs/openbanking.docblock.js +0 -109
- package/dist/presentations.backcompat.js +0 -1
- package/dist/presentations.js +0 -1
- package/dist/presentations.v2.js +0 -7
- package/dist/spec.js +0 -1
- /package/dist/{types/all.js → integrations/secrets-types.js} +0 -0
|
@@ -1,10 +1,214 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//#region src/schema-to-markdown.ts
|
|
2
|
+
/**
|
|
3
|
+
* Generate markdown from a SchemaModel and data.
|
|
4
|
+
* Automatically detects array vs object data and formats accordingly.
|
|
5
|
+
*/
|
|
6
|
+
function schemaToMarkdown(schema, data, options = {}) {
|
|
7
|
+
const { format = "auto", title, description, maxDepth = 2 } = options;
|
|
8
|
+
const lines = [];
|
|
9
|
+
if (title) lines.push(`# ${title}`, "");
|
|
10
|
+
if (description) lines.push(`> ${description}`, "");
|
|
11
|
+
const effectiveFormat = format === "auto" ? Array.isArray(data) ? "table" : "detail" : format;
|
|
12
|
+
if (effectiveFormat === "table" && Array.isArray(data)) lines.push(schemaToMarkdownTable(schema, data, options));
|
|
13
|
+
else if (effectiveFormat === "list" && Array.isArray(data)) lines.push(schemaToMarkdownList(schema, data, options));
|
|
14
|
+
else if (!Array.isArray(data) && data !== null && typeof data === "object") lines.push(schemaToMarkdownDetail(schema, data, {
|
|
15
|
+
...options,
|
|
16
|
+
maxDepth
|
|
17
|
+
}));
|
|
18
|
+
else lines.push(`**Data:** ${String(data)}`, "");
|
|
19
|
+
return lines.join("\n");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generate a markdown table from array data using schema fields as columns.
|
|
23
|
+
*/
|
|
24
|
+
function schemaToMarkdownTable(schema, items, options = {}) {
|
|
25
|
+
const { maxItems = 100, includeFields, excludeFields = [] } = options;
|
|
26
|
+
const fields = getFieldMeta(schema, includeFields, excludeFields);
|
|
27
|
+
if (fields.length === 0 || items.length === 0) return "_No data available_\n";
|
|
28
|
+
const limitedItems = items.slice(0, maxItems);
|
|
29
|
+
const lines = [];
|
|
30
|
+
const headers = fields.map((f) => f.label);
|
|
31
|
+
lines.push(`| ${headers.join(" | ")} |`);
|
|
32
|
+
lines.push(`| ${headers.map(() => "---").join(" | ")} |`);
|
|
33
|
+
for (const item of limitedItems) {
|
|
34
|
+
const row = fields.map((f) => formatCellValue(getFieldValue(item, f.name)));
|
|
35
|
+
lines.push(`| ${row.join(" | ")} |`);
|
|
36
|
+
}
|
|
37
|
+
if (items.length > maxItems) lines.push("", `_Showing ${maxItems} of ${items.length} items_`);
|
|
38
|
+
lines.push("");
|
|
39
|
+
return lines.join("\n");
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Generate a markdown list from array data.
|
|
43
|
+
* Uses summaryFields to create concise list items.
|
|
44
|
+
*/
|
|
45
|
+
function schemaToMarkdownList(schema, items, options = {}) {
|
|
46
|
+
const { maxItems = 50, summaryFields, includeFields, excludeFields = [] } = options;
|
|
47
|
+
const fields = getFieldMeta(schema, includeFields, excludeFields);
|
|
48
|
+
const displayFields = summaryFields ? fields.filter((f) => summaryFields.includes(f.name)) : fields.slice(0, 3);
|
|
49
|
+
if (displayFields.length === 0 || items.length === 0) return "_No data available_\n";
|
|
50
|
+
const limitedItems = items.slice(0, maxItems);
|
|
51
|
+
const lines = [];
|
|
52
|
+
for (const item of limitedItems) {
|
|
53
|
+
const primaryValue = formatCellValue(getFieldValue(item, displayFields[0]?.name ?? "id"));
|
|
54
|
+
const secondaryValues = displayFields.slice(1).map((f) => `${f.label}: ${formatCellValue(getFieldValue(item, f.name))}`).join(" · ");
|
|
55
|
+
const itemLine = secondaryValues ? `- **${primaryValue}** (${secondaryValues})` : `- **${primaryValue}**`;
|
|
56
|
+
lines.push(itemLine);
|
|
57
|
+
}
|
|
58
|
+
if (items.length > maxItems) lines.push("", `_Showing ${maxItems} of ${items.length} items_`);
|
|
59
|
+
lines.push("");
|
|
60
|
+
return lines.join("\n");
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Generate a markdown detail view (key-value pairs) from object data.
|
|
64
|
+
*/
|
|
65
|
+
function schemaToMarkdownDetail(schema, item, options = {}) {
|
|
66
|
+
const { includeFields, excludeFields = [], maxDepth = 2 } = options;
|
|
67
|
+
if (item === null || typeof item !== "object") return "_No data available_\n";
|
|
68
|
+
const fields = getFieldMeta(schema, includeFields, excludeFields);
|
|
69
|
+
if (fields.length === 0) return "_No fields to display_\n";
|
|
70
|
+
const lines = [];
|
|
71
|
+
for (const field of fields) {
|
|
72
|
+
const formattedValue = formatDetailValue(getFieldValue(item, field.name), maxDepth, 0);
|
|
73
|
+
lines.push(`**${field.label}:** ${formattedValue}`);
|
|
74
|
+
}
|
|
75
|
+
lines.push("");
|
|
76
|
+
return lines.join("\n");
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Generate markdown summary statistics for numeric fields in array data.
|
|
80
|
+
*/
|
|
81
|
+
function schemaToMarkdownSummary(items, options = {}) {
|
|
82
|
+
const { numericFields = [], countByField } = options;
|
|
83
|
+
const lines = [];
|
|
84
|
+
lines.push(`**Total Items:** ${items.length}`);
|
|
85
|
+
for (const fieldName of numericFields) {
|
|
86
|
+
const values = items.map((item) => getFieldValue(item, fieldName)).filter((v) => typeof v === "number");
|
|
87
|
+
if (values.length > 0) {
|
|
88
|
+
const sum = values.reduce((a, b) => a + b, 0);
|
|
89
|
+
const avg = sum / values.length;
|
|
90
|
+
const min = Math.min(...values);
|
|
91
|
+
const max = Math.max(...values);
|
|
92
|
+
lines.push(`**${formatFieldName(fieldName)}:** Sum: ${formatNumber(sum)}, Avg: ${formatNumber(avg)}, Min: ${formatNumber(min)}, Max: ${formatNumber(max)}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (countByField) {
|
|
96
|
+
const counts = {};
|
|
97
|
+
for (const item of items) {
|
|
98
|
+
const value = String(getFieldValue(item, countByField) ?? "Unknown");
|
|
99
|
+
counts[value] = (counts[value] ?? 0) + 1;
|
|
100
|
+
}
|
|
101
|
+
lines.push("", `**By ${formatFieldName(countByField)}:**`);
|
|
102
|
+
for (const [value, count] of Object.entries(counts)) lines.push(`- ${value}: ${count}`);
|
|
103
|
+
}
|
|
104
|
+
lines.push("");
|
|
105
|
+
return lines.join("\n");
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get field metadata from schema, applying include/exclude filters
|
|
109
|
+
*/
|
|
110
|
+
function getFieldMeta(schema, includeFields, excludeFields = []) {
|
|
111
|
+
const schemaFields = schema.config.fields;
|
|
112
|
+
return Object.keys(schemaFields).filter((name) => {
|
|
113
|
+
if (excludeFields.includes(name)) return false;
|
|
114
|
+
if (includeFields && !includeFields.includes(name)) return false;
|
|
115
|
+
return true;
|
|
116
|
+
}).map((name) => {
|
|
117
|
+
const fieldConfig = schemaFields[name];
|
|
118
|
+
const isNested = Boolean(fieldConfig?.type && typeof fieldConfig.type === "object" && "config" in fieldConfig.type && typeof fieldConfig.type.config?.fields === "object");
|
|
119
|
+
return {
|
|
120
|
+
name,
|
|
121
|
+
label: formatFieldName(name),
|
|
122
|
+
isOptional: fieldConfig?.isOptional ?? false,
|
|
123
|
+
isArray: fieldConfig?.isArray === true,
|
|
124
|
+
isNested
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get value from object by field name (supports nested paths)
|
|
130
|
+
*/
|
|
131
|
+
function getFieldValue(item, fieldName) {
|
|
132
|
+
if (item === null || typeof item !== "object") return void 0;
|
|
133
|
+
const obj = item;
|
|
134
|
+
if (fieldName.includes(".")) {
|
|
135
|
+
const parts = fieldName.split(".");
|
|
136
|
+
let current = obj;
|
|
137
|
+
for (const part of parts) {
|
|
138
|
+
if (current === null || typeof current !== "object") return void 0;
|
|
139
|
+
current = current[part];
|
|
140
|
+
}
|
|
141
|
+
return current;
|
|
142
|
+
}
|
|
143
|
+
return obj[fieldName];
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Format a value for table cell display
|
|
147
|
+
*/
|
|
148
|
+
function formatCellValue(value) {
|
|
149
|
+
if (value === null || value === void 0) return "-";
|
|
150
|
+
if (typeof value === "boolean") return value ? "✓" : "✗";
|
|
151
|
+
if (typeof value === "number") return formatNumber(value);
|
|
152
|
+
if (value instanceof Date) return formatDate(value);
|
|
153
|
+
if (typeof value === "string" && isISODate(value)) return formatDate(new Date(value));
|
|
154
|
+
if (Array.isArray(value)) return `[${value.length} items]`;
|
|
155
|
+
if (typeof value === "object") return "[Object]";
|
|
156
|
+
const str = String(value);
|
|
157
|
+
return str.length > 50 ? `${str.slice(0, 47)}...` : str.replace(/\|/g, "\\|");
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Format a value for detail view (allows more space)
|
|
161
|
+
*/
|
|
162
|
+
function formatDetailValue(value, maxDepth, currentDepth) {
|
|
163
|
+
if (value === null || value === void 0) return "_none_";
|
|
164
|
+
if (typeof value === "boolean") return value ? "Yes" : "No";
|
|
165
|
+
if (typeof value === "number") return formatNumber(value);
|
|
166
|
+
if (value instanceof Date) return formatDate(value);
|
|
167
|
+
if (typeof value === "string" && isISODate(value)) return formatDate(new Date(value));
|
|
168
|
+
if (Array.isArray(value)) {
|
|
169
|
+
if (value.length === 0) return "_empty list_";
|
|
170
|
+
if (currentDepth >= maxDepth) return `[${value.length} items]`;
|
|
171
|
+
if (value.length <= 5 && value.every((v) => typeof v !== "object")) return value.map((v) => formatCellValue(v)).join(", ");
|
|
172
|
+
return `[${value.length} items]`;
|
|
173
|
+
}
|
|
174
|
+
if (typeof value === "object") {
|
|
175
|
+
if (currentDepth >= maxDepth) return "[Object]";
|
|
176
|
+
return `{${Object.keys(value).length} fields}`;
|
|
177
|
+
}
|
|
178
|
+
return String(value);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Format field name to human-readable label
|
|
182
|
+
*/
|
|
183
|
+
function formatFieldName(name) {
|
|
184
|
+
return name.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/_/g, " ").replace(/^\w/, (c) => c.toUpperCase());
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Format number with locale-aware formatting
|
|
188
|
+
*/
|
|
189
|
+
function formatNumber(value) {
|
|
190
|
+
if (Math.abs(value) >= 1e3) return new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 }).format(value);
|
|
191
|
+
if (Number.isInteger(value)) return String(value);
|
|
192
|
+
return value.toFixed(2);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Format date to readable string
|
|
196
|
+
*/
|
|
197
|
+
function formatDate(date) {
|
|
198
|
+
return date.toLocaleDateString("en-US", {
|
|
199
|
+
year: "numeric",
|
|
200
|
+
month: "short",
|
|
201
|
+
day: "numeric"
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Check if string is ISO date format
|
|
206
|
+
*/
|
|
207
|
+
function isISODate(str) {
|
|
208
|
+
if (!/^\d{4}-\d{2}-\d{2}/.test(str)) return false;
|
|
209
|
+
const date = new Date(str);
|
|
210
|
+
return !isNaN(date.getTime());
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
//#endregion
|
|
214
|
+
export { schemaToMarkdown, schemaToMarkdownDetail, schemaToMarkdownList, schemaToMarkdownSummary, schemaToMarkdownTable };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ResourceRegistry } from "../resources.js";
|
|
2
|
+
|
|
3
|
+
//#region src/server/contracts-adapter-hydration.d.ts
|
|
4
|
+
interface ReturnsDecl {
|
|
5
|
+
isList: boolean;
|
|
6
|
+
inner: string;
|
|
7
|
+
}
|
|
8
|
+
declare function parseReturns(returnsLike: string): ReturnsDecl;
|
|
9
|
+
declare function hydrateResourceIfNeeded(resources: ResourceRegistry | undefined, result: unknown, opts: {
|
|
10
|
+
template?: string;
|
|
11
|
+
varName?: string;
|
|
12
|
+
returns: ReturnsDecl;
|
|
13
|
+
}): Promise<unknown>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { ReturnsDecl, hydrateResourceIfNeeded, parseReturns };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/server/contracts-adapter-hydration.ts
|
|
2
|
+
function parseReturns(returnsLike) {
|
|
3
|
+
if (!returnsLike) return {
|
|
4
|
+
isList: false,
|
|
5
|
+
inner: "JSON"
|
|
6
|
+
};
|
|
7
|
+
const trimmed = String(returnsLike).trim();
|
|
8
|
+
if (trimmed.startsWith("[") && trimmed.endsWith("]")) return {
|
|
9
|
+
isList: true,
|
|
10
|
+
inner: trimmed.slice(1, -1).trim()
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
isList: false,
|
|
14
|
+
inner: trimmed
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
async function hydrateResourceIfNeeded(resources, result, opts) {
|
|
18
|
+
if (!resources || !opts.template) return result;
|
|
19
|
+
const varName = opts.varName ?? "id";
|
|
20
|
+
const hydrateOne = async (item) => {
|
|
21
|
+
if (item && typeof item === "object" && varName in item) {
|
|
22
|
+
const key = String(item[varName]);
|
|
23
|
+
const uri = (opts.template ?? "").replace("{id}", key);
|
|
24
|
+
const match = resources.match(uri);
|
|
25
|
+
if (match) {
|
|
26
|
+
const resolved = await match.tmpl.resolve(match.params, {});
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(String(resolved.data || "null"));
|
|
29
|
+
} catch {
|
|
30
|
+
return resolved.data;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return item;
|
|
35
|
+
};
|
|
36
|
+
if (opts.returns.isList && Array.isArray(result)) return await Promise.all(result.map((x) => hydrateOne(x)));
|
|
37
|
+
return await hydrateOne(result);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { hydrateResourceIfNeeded, parseReturns };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AnySchemaModel } from "@lssm/lib.schema";
|
|
2
|
+
import { SchemaTypes } from "@pothos/core";
|
|
3
|
+
|
|
4
|
+
//#region src/server/contracts-adapter-input.d.ts
|
|
5
|
+
declare function createInputTypeBuilder<T extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<T>): {
|
|
6
|
+
buildInputFieldArgs: (model: AnySchemaModel | null) => null;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createInputTypeBuilder };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//#region src/server/contracts-adapter-input.ts
|
|
2
|
+
function isSchemaModel(x) {
|
|
3
|
+
return typeof x?.getPothosInput === "function" && typeof x?.getZod === "function";
|
|
4
|
+
}
|
|
5
|
+
function isFieldType(x) {
|
|
6
|
+
return typeof x?.getPothos === "function";
|
|
7
|
+
}
|
|
8
|
+
function isEnumType(x) {
|
|
9
|
+
return typeof x?.getEnumValues === "function" && typeof x?.getPothos === "function";
|
|
10
|
+
}
|
|
11
|
+
function mapScalarName(name) {
|
|
12
|
+
if (name === "Boolean_unsecure") return "Boolean";
|
|
13
|
+
if (name === "ID_unsecure") return "ID";
|
|
14
|
+
if (name === "String_unsecure") return "String";
|
|
15
|
+
if (name === "Int_unsecure") return "Int";
|
|
16
|
+
if (name === "Float_unsecure") return "Float";
|
|
17
|
+
return name;
|
|
18
|
+
}
|
|
19
|
+
function createInputTypeBuilder(builder) {
|
|
20
|
+
const inputTypeCache = /* @__PURE__ */ new Map();
|
|
21
|
+
const enumTypeCache = /* @__PURE__ */ new Set();
|
|
22
|
+
function registerEnumsForModel(model) {
|
|
23
|
+
const entries = Object.entries(model.config.fields);
|
|
24
|
+
for (const [, field] of entries) if (isSchemaModel(field.type)) registerEnumsForModel(field.type);
|
|
25
|
+
else if (isEnumType(field.type)) {
|
|
26
|
+
const enumObj = field.type;
|
|
27
|
+
const name = enumObj.getName?.() ?? enumObj.getPothos().name;
|
|
28
|
+
if (!enumTypeCache.has(name)) {
|
|
29
|
+
builder.enumType(name, { values: enumObj.getEnumValues() });
|
|
30
|
+
enumTypeCache.add(name);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function ensureInputTypeForModel(model) {
|
|
35
|
+
const typeName = String(model.config?.name ?? "Input");
|
|
36
|
+
const cached = inputTypeCache.get(typeName);
|
|
37
|
+
if (cached) return cached;
|
|
38
|
+
registerEnumsForModel(model);
|
|
39
|
+
const created = builder.inputType(model.getPothosInput(), { fields: (t) => {
|
|
40
|
+
const entries = Object.entries(model.config.fields);
|
|
41
|
+
const acc = {};
|
|
42
|
+
for (const [key, field] of entries) if (isSchemaModel(field.type)) {
|
|
43
|
+
const nested = ensureInputTypeForModel(field.type);
|
|
44
|
+
const typeRef = field.isArray ? [nested] : nested;
|
|
45
|
+
acc[key] = t.field({
|
|
46
|
+
type: typeRef,
|
|
47
|
+
required: !field.isOptional
|
|
48
|
+
});
|
|
49
|
+
} else if (isFieldType(field.type)) {
|
|
50
|
+
const typeName$1 = mapScalarName(String(field.type.getPothos().name));
|
|
51
|
+
const typeRef = field.isArray ? [typeName$1] : typeName$1;
|
|
52
|
+
acc[key] = t.field({
|
|
53
|
+
type: typeRef,
|
|
54
|
+
required: !field.isOptional
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
const typeRef = field.isArray ? ["JSON"] : "JSON";
|
|
58
|
+
acc[key] = t.field({
|
|
59
|
+
type: typeRef,
|
|
60
|
+
required: !field.isOptional
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return acc;
|
|
64
|
+
} });
|
|
65
|
+
inputTypeCache.set(typeName, created);
|
|
66
|
+
return created;
|
|
67
|
+
}
|
|
68
|
+
function buildInputFieldArgs(model) {
|
|
69
|
+
if (!model) return null;
|
|
70
|
+
if (!model.config?.fields || Object.keys(model.config.fields).length === 0) return null;
|
|
71
|
+
return ensureInputTypeForModel(model);
|
|
72
|
+
}
|
|
73
|
+
return { buildInputFieldArgs };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { createInputTypeBuilder };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ResourceRegistry } from "../resources.js";
|
|
2
|
+
import { OperationSpecRegistry } from "../operations/registry.js";
|
|
3
|
+
import "@pothos/plugin-prisma";
|
|
4
|
+
import "@pothos/plugin-complexity";
|
|
5
|
+
import "@pothos/plugin-relay";
|
|
6
|
+
import "@pothos/plugin-dataloader";
|
|
7
|
+
import "@pothos/plugin-tracing";
|
|
8
|
+
import { SchemaTypes } from "@pothos/core";
|
|
9
|
+
|
|
10
|
+
//#region src/server/graphql-pothos.d.ts
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Registers all ContractSpecs from a OperationSpecRegistry onto a Pothos SchemaBuilder.
|
|
14
|
+
*
|
|
15
|
+
* This adapter:
|
|
16
|
+
* 1. Discovers output types from specs and registers them as Pothos object types.
|
|
17
|
+
* 2. Maps `ContractSpec` (OperationSpec) inputs to Pothos input types.
|
|
18
|
+
* 3. Mounts `query` specs as `Query` fields and `command` specs as `Mutation` fields.
|
|
19
|
+
* 4. Wraps the resolver to:
|
|
20
|
+
* - Enforce auth policies (basic check).
|
|
21
|
+
* - Build a `HandlerCtx`.
|
|
22
|
+
* - Execute via `OperationSpecRegistry`.
|
|
23
|
+
* - Hydrate resource references if applicable.
|
|
24
|
+
*
|
|
25
|
+
* @param builder - The Pothos SchemaBuilder instance.
|
|
26
|
+
* @param reg - The OperationSpecRegistry containing operations.
|
|
27
|
+
* @param resources - (Optional) ResourceRegistry for hydrating resource references.
|
|
28
|
+
*/
|
|
29
|
+
declare function registerContractsOnBuilder<T extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<T>, reg: OperationSpecRegistry, resources?: ResourceRegistry): void;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { registerContractsOnBuilder };
|
|
@@ -1 +1,127 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { defaultGqlField } from "../jsonschema.js";
|
|
2
|
+
import { createInputTypeBuilder } from "./contracts-adapter-input.js";
|
|
3
|
+
import { hydrateResourceIfNeeded, parseReturns } from "./contracts-adapter-hydration.js";
|
|
4
|
+
import "@pothos/plugin-prisma";
|
|
5
|
+
import "@pothos/plugin-complexity";
|
|
6
|
+
import "@pothos/plugin-relay";
|
|
7
|
+
import "@pothos/plugin-dataloader";
|
|
8
|
+
import "@pothos/plugin-tracing";
|
|
9
|
+
|
|
10
|
+
//#region src/server/graphql-pothos.ts
|
|
11
|
+
/**
|
|
12
|
+
* Registers all ContractSpecs from a OperationSpecRegistry onto a Pothos SchemaBuilder.
|
|
13
|
+
*
|
|
14
|
+
* This adapter:
|
|
15
|
+
* 1. Discovers output types from specs and registers them as Pothos object types.
|
|
16
|
+
* 2. Maps `ContractSpec` (OperationSpec) inputs to Pothos input types.
|
|
17
|
+
* 3. Mounts `query` specs as `Query` fields and `command` specs as `Mutation` fields.
|
|
18
|
+
* 4. Wraps the resolver to:
|
|
19
|
+
* - Enforce auth policies (basic check).
|
|
20
|
+
* - Build a `HandlerCtx`.
|
|
21
|
+
* - Execute via `OperationSpecRegistry`.
|
|
22
|
+
* - Hydrate resource references if applicable.
|
|
23
|
+
*
|
|
24
|
+
* @param builder - The Pothos SchemaBuilder instance.
|
|
25
|
+
* @param reg - The OperationSpecRegistry containing operations.
|
|
26
|
+
* @param resources - (Optional) ResourceRegistry for hydrating resource references.
|
|
27
|
+
*/
|
|
28
|
+
function registerContractsOnBuilder(builder, reg, resources) {
|
|
29
|
+
const { buildInputFieldArgs } = createInputTypeBuilder(builder);
|
|
30
|
+
const outputTypeCache = /* @__PURE__ */ new Map();
|
|
31
|
+
for (const spec of reg.listSpecs()) {
|
|
32
|
+
const out = spec.io.output;
|
|
33
|
+
if (out && "getZod" in out && typeof out.getZod === "function") {
|
|
34
|
+
const model = out;
|
|
35
|
+
const typeName = model.config?.name ?? "UnknownOutput";
|
|
36
|
+
if (!outputTypeCache.has(typeName)) outputTypeCache.set(typeName, model);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const [typeName, model] of outputTypeCache.entries()) builder.objectType(typeName, { fields: (t) => {
|
|
40
|
+
const entries = Object.entries(model.config.fields);
|
|
41
|
+
const acc = {};
|
|
42
|
+
for (const [key, field] of entries) {
|
|
43
|
+
const fieldType = field.type;
|
|
44
|
+
let gqlType = "JSON";
|
|
45
|
+
if (fieldType && typeof fieldType.getPothos === "function") {
|
|
46
|
+
gqlType = fieldType.getPothos().name || "JSON";
|
|
47
|
+
if (gqlType === "String_unsecure") gqlType = "String";
|
|
48
|
+
if (gqlType === "Int_unsecure") gqlType = "Int";
|
|
49
|
+
if (gqlType === "Float_unsecure") gqlType = "Float";
|
|
50
|
+
if (gqlType === "Boolean_unsecure") gqlType = "Boolean";
|
|
51
|
+
if (gqlType === "ID_unsecure") gqlType = "ID";
|
|
52
|
+
}
|
|
53
|
+
const typeRef = field.isArray ? [gqlType] : gqlType;
|
|
54
|
+
acc[key] = t.field({
|
|
55
|
+
type: typeRef,
|
|
56
|
+
nullable: field.isOptional,
|
|
57
|
+
resolve: (parent) => parent[key]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return acc;
|
|
61
|
+
} });
|
|
62
|
+
function resolveGraphQLTypeName(contractSpec) {
|
|
63
|
+
const returnsName = contractSpec.transport?.gql?.returns;
|
|
64
|
+
if (returnsName) return returnsName;
|
|
65
|
+
const out = contractSpec.io.output ?? {};
|
|
66
|
+
if (out && "kind" in out && out.kind === "resource_ref" && "graphQLType" in out && out.graphQLType) return String(out.graphQLType);
|
|
67
|
+
if (out && "getZod" in out && typeof out.getZod === "function") {
|
|
68
|
+
const typeName = out.config?.name;
|
|
69
|
+
if (typeName && outputTypeCache.has(typeName)) return typeName;
|
|
70
|
+
}
|
|
71
|
+
return "JSON";
|
|
72
|
+
}
|
|
73
|
+
for (const spec of reg.listSpecs()) {
|
|
74
|
+
const fieldName = spec.transport?.gql?.field ?? defaultGqlField(spec.meta.key, spec.meta.version);
|
|
75
|
+
const byIdField = spec.transport?.gql?.byIdField ?? "id";
|
|
76
|
+
const returnsResource = spec.transport?.gql?.resource;
|
|
77
|
+
const isQuery = spec.meta.kind === "query";
|
|
78
|
+
const graphQLTypeName = resolveGraphQLTypeName(spec);
|
|
79
|
+
const returnsDecl = spec.transport?.gql?.returns;
|
|
80
|
+
const parsed = parseReturns(returnsDecl ?? graphQLTypeName);
|
|
81
|
+
const resolveFieldFn = async (_root, args, ctx) => {
|
|
82
|
+
if (spec.policy.auth !== "anonymous" && !ctx.user) throw new Error("Unauthorized");
|
|
83
|
+
const handlerCtx = {
|
|
84
|
+
traceId: ctx.logger?.getTraceId?.() ?? void 0,
|
|
85
|
+
userId: ctx.user?.id ?? null,
|
|
86
|
+
organizationId: ctx.session?.activeOrganizationId ?? null,
|
|
87
|
+
actor: ctx.user ? "user" : "anonymous",
|
|
88
|
+
channel: "web",
|
|
89
|
+
eventPublisher: ctx.eventPublisher
|
|
90
|
+
};
|
|
91
|
+
const parsedInput = spec.io.input?.getZod().parse(args.input ?? {});
|
|
92
|
+
const result = await reg.execute(spec.meta.key, spec.meta.version, parsedInput, handlerCtx);
|
|
93
|
+
const out = spec.io.output;
|
|
94
|
+
if (resources && (returnsResource || out?.kind === "resource_ref")) {
|
|
95
|
+
const varName = byIdField ?? out?.varName ?? "id";
|
|
96
|
+
const hydrated = await hydrateResourceIfNeeded(resources, result, {
|
|
97
|
+
template: returnsResource ?? out?.uriTemplate,
|
|
98
|
+
varName,
|
|
99
|
+
returns: parsed
|
|
100
|
+
});
|
|
101
|
+
if (hydrated !== result) return hydrated;
|
|
102
|
+
}
|
|
103
|
+
if (graphQLTypeName) {
|
|
104
|
+
if (parsed.inner === "Boolean" && !parsed.isList) return Boolean(result?.ok ?? result);
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
return spec.io.output.getZod().parse(result);
|
|
108
|
+
};
|
|
109
|
+
const fieldSettingsFn = (t) => {
|
|
110
|
+
const inputType = buildInputFieldArgs(spec.io.input);
|
|
111
|
+
return t.field({
|
|
112
|
+
type: parsed.isList ? [parsed.inner] : parsed.inner,
|
|
113
|
+
complexity: () => 10,
|
|
114
|
+
resolve: resolveFieldFn,
|
|
115
|
+
args: inputType ? { input: t.arg({
|
|
116
|
+
type: inputType,
|
|
117
|
+
required: true
|
|
118
|
+
}) } : void 0
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
if (isQuery) builder.queryField(fieldName, fieldSettingsFn);
|
|
122
|
+
else builder.mutationField(fieldName, fieldSettingsFn);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
export { registerContractsOnBuilder };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { registerContractsOnBuilder } from "./graphql-pothos.js";
|
|
2
|
+
import { createMcpServer } from "./mcp/createMcpServer.js";
|
|
3
|
+
import "./provider-mcp.js";
|
|
4
|
+
import { RestOptions, createFetchHandler } from "./rest-generic.js";
|
|
5
|
+
import { elysiaPlugin } from "./rest-elysia.js";
|
|
6
|
+
import { expressRouter } from "./rest-express.js";
|
|
7
|
+
import { makeNextAppHandler } from "./rest-next-app.js";
|
|
8
|
+
import { makeNextPagesHandler } from "./rest-next-pages.js";
|
|
9
|
+
export { RestOptions, createFetchHandler, createMcpServer, elysiaPlugin, expressRouter, makeNextAppHandler, makeNextPagesHandler, registerContractsOnBuilder };
|
package/dist/server/index.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { registerContractsOnBuilder } from "./graphql-pothos.js";
|
|
2
|
+
import { createMcpServer } from "./mcp/createMcpServer.js";
|
|
3
|
+
import "./provider-mcp.js";
|
|
4
|
+
import { createFetchHandler } from "./rest-generic.js";
|
|
5
|
+
import { elysiaPlugin } from "./rest-elysia.js";
|
|
6
|
+
import { expressRouter } from "./rest-express.js";
|
|
7
|
+
import { makeNextAppHandler } from "./rest-next-app.js";
|
|
8
|
+
import { makeNextPagesHandler } from "./rest-next-pages.js";
|
|
9
|
+
|
|
10
|
+
export { createFetchHandler, createMcpServer, elysiaPlugin, expressRouter, makeNextAppHandler, makeNextPagesHandler, registerContractsOnBuilder };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ResourceRegistry } from "../../resources.js";
|
|
2
|
+
import { OperationSpecRegistry } from "../../operations/registry.js";
|
|
3
|
+
import { PromptRegistry } from "../../promptRegistry.js";
|
|
4
|
+
import { McpCtxFactories } from "./mcpTypes.js";
|
|
5
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
+
|
|
7
|
+
//#region src/server/mcp/createMcpServer.d.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates a unified Model Context Protocol (MCP) server exposing operations, resources, prompts,
|
|
11
|
+
* and (optionally) presentations.\n+ *
|
|
12
|
+
* ContractSpec exposes:\n+ * - Tools: `command` operations from `OperationSpecRegistry`.\n+ * - Resources: templates from `ResourceRegistry`.\n+ * - Prompts: templates from `PromptRegistry`.\n+ * - Presentations: V1 registry and/or V2 descriptors as read-only resources.\n+ */
|
|
13
|
+
declare function createMcpServer(server: McpServer, ops: OperationSpecRegistry, resources: ResourceRegistry, prompts: PromptRegistry, ctxFactories: McpCtxFactories): McpServer;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { createMcpServer };
|
|
@@ -1 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { registerMcpTools } from "./registerTools.js";
|
|
2
|
+
import { registerMcpResources } from "./registerResources.js";
|
|
3
|
+
import { registerMcpPrompts } from "./registerPrompts.js";
|
|
4
|
+
import { registerMcpPresentations } from "./registerPresentations.js";
|
|
5
|
+
|
|
6
|
+
//#region src/server/mcp/createMcpServer.ts
|
|
7
|
+
/**
|
|
8
|
+
* Creates a unified Model Context Protocol (MCP) server exposing operations, resources, prompts,
|
|
9
|
+
* and (optionally) presentations.\n+ *
|
|
10
|
+
* ContractSpec exposes:\n+ * - Tools: `command` operations from `OperationSpecRegistry`.\n+ * - Resources: templates from `ResourceRegistry`.\n+ * - Prompts: templates from `PromptRegistry`.\n+ * - Presentations: V1 registry and/or V2 descriptors as read-only resources.\n+ */
|
|
11
|
+
function createMcpServer(server, ops, resources, prompts, ctxFactories) {
|
|
12
|
+
ctxFactories.logger.info("Creating MCP server");
|
|
13
|
+
registerMcpTools(server, ops, { toolCtx: ctxFactories.toolCtx });
|
|
14
|
+
registerMcpResources(server, resources, {
|
|
15
|
+
logger: ctxFactories.logger,
|
|
16
|
+
resourceCtx: ctxFactories.resourceCtx
|
|
17
|
+
});
|
|
18
|
+
registerMcpPresentations(server, {
|
|
19
|
+
logger: ctxFactories.logger,
|
|
20
|
+
presentations: ctxFactories.presentations,
|
|
21
|
+
presentationsV2: ctxFactories.presentationsV2
|
|
22
|
+
});
|
|
23
|
+
registerMcpPrompts(server, prompts, { promptCtx: ctxFactories.promptCtx });
|
|
24
|
+
return server;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { createMcpServer };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PresentationSpec } from "../../presentations/presentations.js";
|
|
2
|
+
import { HandlerCtx } from "../../types.js";
|
|
3
|
+
import { PresentationRegistry } from "../../presentations/registry.js";
|
|
4
|
+
import "../../presentations/index.js";
|
|
5
|
+
import { Logger } from "@lssm/lib.logger";
|
|
6
|
+
|
|
7
|
+
//#region src/server/mcp/mcpTypes.d.ts
|
|
8
|
+
interface McpCtxFactories {
|
|
9
|
+
logger: Logger;
|
|
10
|
+
/** Factory for tool execution context (e.g., system actor) */
|
|
11
|
+
toolCtx: () => HandlerCtx;
|
|
12
|
+
/** Factory for prompt rendering context */
|
|
13
|
+
promptCtx: () => {
|
|
14
|
+
userId?: string | null;
|
|
15
|
+
orgId?: string | null;
|
|
16
|
+
locale?: string;
|
|
17
|
+
};
|
|
18
|
+
/** Factory for resource resolution context */
|
|
19
|
+
resourceCtx: () => {
|
|
20
|
+
userId?: string | null;
|
|
21
|
+
orgId?: string | null;
|
|
22
|
+
locale?: string;
|
|
23
|
+
};
|
|
24
|
+
/** Optional registry for presentations */
|
|
25
|
+
presentations?: PresentationRegistry;
|
|
26
|
+
/** Optional list of presentation specs */
|
|
27
|
+
presentationsV2?: PresentationSpec[];
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { McpCtxFactories };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { McpCtxFactories } from "./mcpTypes.js";
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
|
|
4
|
+
//#region src/server/mcp/registerPresentations.d.ts
|
|
5
|
+
declare function registerMcpPresentations(server: McpServer, ctx: Pick<McpCtxFactories, 'logger' | 'presentations' | 'presentationsV2'>): void;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { registerMcpPresentations };
|