@contractspec/lib.contracts 1.44.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/LICENSE +21 -0
- package/README.md +109 -0
- package/dist/_virtual/rolldown_runtime.js +37 -0
- package/dist/app-config/app-config.feature.d.ts +12 -0
- package/dist/app-config/app-config.feature.js +54 -0
- package/dist/app-config/branding.d.ts +55 -0
- package/dist/app-config/branding.js +0 -0
- package/dist/app-config/contracts.d.ts +245 -0
- package/dist/app-config/contracts.js +395 -0
- package/dist/app-config/docs/app-config.docblock.d.ts +6 -0
- package/dist/app-config/docs/app-config.docblock.js +21 -0
- package/dist/app-config/events.d.ts +122 -0
- package/dist/app-config/events.js +174 -0
- package/dist/app-config/index.d.ts +9 -0
- package/dist/app-config/index.js +8 -0
- package/dist/app-config/lifecycle-contracts.d.ts +273 -0
- package/dist/app-config/lifecycle-contracts.js +440 -0
- package/dist/app-config/lifecycle.d.ts +27 -0
- package/dist/app-config/lifecycle.js +0 -0
- package/dist/app-config/runtime.d.ts +120 -0
- package/dist/app-config/runtime.js +617 -0
- package/dist/app-config/spec.d.ts +173 -0
- package/dist/app-config/spec.js +36 -0
- package/dist/app-config/validation.d.ts +49 -0
- package/dist/app-config/validation.js +538 -0
- 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 -0
- 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 -0
- package/dist/client/index.d.ts +6 -0
- package/dist/client/index.js +9 -0
- package/dist/client/react/drivers/rn-reusables.d.ts +22 -0
- package/dist/client/react/drivers/rn-reusables.js +21 -0
- package/dist/client/react/drivers/shadcn.d.ts +12 -0
- package/dist/client/react/drivers/shadcn.js +11 -0
- package/dist/client/react/feature-render.d.ts +23 -0
- package/dist/client/react/feature-render.js +44 -0
- package/dist/client/react/form-render.d.ts +92 -0
- package/dist/client/react/form-render.js +298 -0
- package/dist/client/react/index.d.ts +5 -0
- package/dist/client/react/index.js +8 -0
- package/dist/contract-registry/index.d.ts +3 -0
- package/dist/contract-registry/index.js +3 -0
- package/dist/contract-registry/schemas.d.ts +124 -0
- package/dist/contract-registry/schemas.js +61 -0
- package/dist/contract-registry/types.d.ts +46 -0
- package/dist/contract-registry/types.js +0 -0
- package/dist/data-views/data-views.d.ts +5 -0
- package/dist/data-views/data-views.js +4 -0
- package/dist/data-views/docs/data-views.docblock.d.ts +6 -0
- package/dist/data-views/docs/data-views.docblock.js +21 -0
- package/dist/data-views/index.d.ts +4 -0
- package/dist/data-views/index.js +4 -0
- package/dist/data-views/query-generator.d.ts +40 -0
- package/dist/data-views/query-generator.js +48 -0
- package/dist/data-views/registry.d.ts +51 -0
- package/dist/data-views/registry.js +82 -0
- package/dist/data-views/runtime.d.ts +28 -0
- package/dist/data-views/runtime.js +39 -0
- package/dist/data-views/spec.d.ts +32 -0
- package/dist/data-views/spec.js +10 -0
- package/dist/data-views/types.d.ts +157 -0
- package/dist/data-views/types.js +0 -0
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.d.ts +6 -0
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +17 -0
- package/dist/docs/index.d.ts +6 -0
- package/dist/docs/index.js +29 -0
- package/dist/docs/meta.docs.d.ts +6 -0
- package/dist/docs/meta.docs.js +29 -0
- package/dist/docs/presentations.d.ts +33 -0
- package/dist/docs/presentations.js +64 -0
- package/dist/docs/registry.d.ts +23 -0
- package/dist/docs/registry.js +51 -0
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.d.ts +6 -0
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +81 -0
- package/dist/docs/tech/contracts/README.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/README.docblock.js +21 -0
- package/dist/docs/tech/contracts/create-subscription.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/create-subscription.docblock.js +21 -0
- package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +21 -0
- package/dist/docs/tech/contracts/migrations.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/migrations.docblock.js +21 -0
- package/dist/docs/tech/contracts/openapi-export.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/openapi-export.docblock.js +58 -0
- package/dist/docs/tech/contracts/openapi-import.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/openapi-import.docblock.js +65 -0
- 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 +21 -0
- package/dist/docs/tech/contracts/overlays.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/overlays.docblock.js +21 -0
- package/dist/docs/tech/contracts/tests.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/tests.docblock.js +21 -0
- package/dist/docs/tech/contracts/themes.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/themes.docblock.js +21 -0
- 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 -0
- package/dist/docs/tech/lifecycle-stage-system.docblock.d.ts +6 -0
- package/dist/docs/tech/lifecycle-stage-system.docblock.js +17 -0
- package/dist/docs/tech/llm/llm-integration.docblock.d.ts +7 -0
- package/dist/docs/tech/llm/llm-integration.docblock.js +358 -0
- package/dist/docs/tech/mcp-endpoints.docblock.d.ts +6 -0
- package/dist/docs/tech/mcp-endpoints.docblock.js +38 -0
- package/dist/docs/tech/presentation-runtime.docblock.d.ts +6 -0
- package/dist/docs/tech/presentation-runtime.docblock.js +17 -0
- package/dist/docs/tech/schema/README.docblock.d.ts +6 -0
- package/dist/docs/tech/schema/README.docblock.js +21 -0
- package/dist/docs/tech/studio/learning-events.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/learning-events.docblock.js +49 -0
- package/dist/docs/tech/studio/learning-journeys.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/learning-journeys.docblock.js +80 -0
- package/dist/docs/tech/studio/platform-admin-panel.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/platform-admin-panel.docblock.js +85 -0
- package/dist/docs/tech/studio/project-access-teams.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/project-access-teams.docblock.js +46 -0
- package/dist/docs/tech/studio/project-routing.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/project-routing.docblock.js +68 -0
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +41 -0
- package/dist/docs/tech/studio/team-invitations.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/team-invitations.docblock.js +70 -0
- package/dist/docs/tech/studio/workspace-ops.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/workspace-ops.docblock.js +48 -0
- package/dist/docs/tech/studio/workspaces.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/workspaces.docblock.js +63 -0
- package/dist/docs/tech/telemetry-ingest.docblock.d.ts +6 -0
- package/dist/docs/tech/telemetry-ingest.docblock.js +156 -0
- package/dist/docs/tech/templates/runtime.docblock.d.ts +6 -0
- package/dist/docs/tech/templates/runtime.docblock.js +21 -0
- package/dist/docs/tech/vscode-extension.docblock.d.ts +6 -0
- package/dist/docs/tech/vscode-extension.docblock.js +102 -0
- package/dist/docs/tech-contracts.docs.d.ts +6 -0
- package/dist/docs/tech-contracts.docs.js +96 -0
- package/dist/docs/types.d.ts +41 -0
- package/dist/docs/types.js +0 -0
- package/dist/events.d.ts +47 -0
- package/dist/events.js +19 -0
- package/dist/experiments/docs/experiments.docblock.d.ts +6 -0
- package/dist/experiments/docs/experiments.docblock.js +21 -0
- package/dist/experiments/evaluator.d.ts +37 -0
- package/dist/experiments/evaluator.js +101 -0
- package/dist/experiments/spec-resolver.d.ts +17 -0
- package/dist/experiments/spec-resolver.js +0 -0
- package/dist/experiments/spec.d.ts +82 -0
- package/dist/experiments/spec.js +33 -0
- package/dist/features/index.d.ts +5 -0
- package/dist/features/index.js +5 -0
- package/dist/features/install.d.ts +22 -0
- package/dist/features/install.js +36 -0
- package/dist/features/registry.d.ts +26 -0
- package/dist/features/registry.js +49 -0
- package/dist/features/types.d.ts +88 -0
- package/dist/features/types.js +0 -0
- package/dist/features/validation.d.ts +8 -0
- package/dist/features/validation.js +14 -0
- package/dist/forms/docs/forms.docblock.d.ts +6 -0
- package/dist/forms/docs/forms.docblock.js +21 -0
- 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 +147 -0
- package/dist/index.js +121 -0
- package/dist/install.d.ts +77 -0
- package/dist/install.js +40 -0
- package/dist/integrations/binding.d.ts +17 -0
- package/dist/integrations/binding.js +0 -0
- package/dist/integrations/connection.d.ts +51 -0
- package/dist/integrations/connection.js +0 -0
- package/dist/integrations/docs/integrations.docblock.d.ts +6 -0
- package/dist/integrations/docs/integrations.docblock.js +94 -0
- package/dist/integrations/health.d.ts +21 -0
- package/dist/integrations/health.js +69 -0
- package/dist/integrations/index.d.ts +34 -0
- package/dist/integrations/index.js +23 -0
- package/dist/integrations/integrations.feature.d.ts +12 -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 -0
- package/dist/integrations/openbanking/contracts/balances.d.ts +165 -0
- package/dist/integrations/openbanking/contracts/balances.js +166 -0
- package/dist/integrations/openbanking/contracts/index.d.ts +10 -0
- package/dist/integrations/openbanking/contracts/index.js +12 -0
- package/dist/integrations/openbanking/contracts/transactions.d.ts +213 -0
- package/dist/integrations/openbanking/contracts/transactions.js +217 -0
- package/dist/integrations/openbanking/guards.d.ts +12 -0
- package/dist/integrations/openbanking/guards.js +33 -0
- package/dist/integrations/openbanking/models.d.ts +228 -0
- package/dist/integrations/openbanking/models.js +240 -0
- package/dist/integrations/openbanking/openbanking.feature.d.ts +12 -0
- package/dist/integrations/openbanking/openbanking.feature.js +69 -0
- package/dist/integrations/openbanking/telemetry.d.ts +15 -0
- package/dist/integrations/openbanking/telemetry.js +39 -0
- 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/calendar.js +0 -0
- package/dist/integrations/providers/elevenlabs.d.ts +7 -0
- package/dist/integrations/providers/elevenlabs.js +55 -0
- package/dist/integrations/providers/email.d.ts +86 -0
- package/dist/integrations/providers/email.js +0 -0
- package/dist/integrations/providers/embedding.d.ts +24 -0
- package/dist/integrations/providers/embedding.js +0 -0
- package/dist/integrations/providers/gcs-storage.d.ts +7 -0
- package/dist/integrations/providers/gcs-storage.js +78 -0
- package/dist/integrations/providers/gmail.d.ts +7 -0
- package/dist/integrations/providers/gmail.js +90 -0
- package/dist/integrations/providers/google-calendar.d.ts +7 -0
- package/dist/integrations/providers/google-calendar.js +69 -0
- package/dist/integrations/providers/impls/elevenlabs-voice.d.ts +20 -0
- package/dist/integrations/providers/impls/elevenlabs-voice.js +95 -0
- package/dist/integrations/providers/impls/gcs-storage.d.ts +24 -0
- package/dist/integrations/providers/impls/gcs-storage.js +88 -0
- package/dist/integrations/providers/impls/gmail-inbound.d.ts +26 -0
- package/dist/integrations/providers/impls/gmail-inbound.js +200 -0
- package/dist/integrations/providers/impls/gmail-outbound.d.ts +18 -0
- package/dist/integrations/providers/impls/gmail-outbound.js +105 -0
- package/dist/integrations/providers/impls/google-calendar.d.ts +23 -0
- package/dist/integrations/providers/impls/google-calendar.js +154 -0
- package/dist/integrations/providers/impls/index.d.ts +15 -0
- package/dist/integrations/providers/impls/index.js +16 -0
- package/dist/integrations/providers/impls/mistral-embedding.d.ts +23 -0
- package/dist/integrations/providers/impls/mistral-embedding.js +41 -0
- package/dist/integrations/providers/impls/mistral-llm.d.ts +31 -0
- package/dist/integrations/providers/impls/mistral-llm.js +247 -0
- package/dist/integrations/providers/impls/postmark-email.d.ts +19 -0
- package/dist/integrations/providers/impls/postmark-email.js +55 -0
- package/dist/integrations/providers/impls/powens-client.d.ts +124 -0
- package/dist/integrations/providers/impls/powens-client.js +171 -0
- package/dist/integrations/providers/impls/powens-openbanking.d.ts +27 -0
- package/dist/integrations/providers/impls/powens-openbanking.js +218 -0
- package/dist/integrations/providers/impls/provider-factory.d.ts +26 -0
- package/dist/integrations/providers/impls/provider-factory.js +145 -0
- package/dist/integrations/providers/impls/qdrant-vector.d.ts +24 -0
- package/dist/integrations/providers/impls/qdrant-vector.js +69 -0
- package/dist/integrations/providers/impls/stripe-payments.d.ts +28 -0
- package/dist/integrations/providers/impls/stripe-payments.js +202 -0
- package/dist/integrations/providers/impls/twilio-sms.d.ts +20 -0
- package/dist/integrations/providers/impls/twilio-sms.js +58 -0
- package/dist/integrations/providers/index.d.ts +22 -0
- package/dist/integrations/providers/index.js +13 -0
- package/dist/integrations/providers/llm.d.ts +82 -0
- package/dist/integrations/providers/llm.js +0 -0
- package/dist/integrations/providers/mistral.d.ts +7 -0
- package/dist/integrations/providers/mistral.js +71 -0
- package/dist/integrations/providers/openbanking.d.ts +128 -0
- package/dist/integrations/providers/openbanking.js +0 -0
- package/dist/integrations/providers/payments.d.ts +109 -0
- package/dist/integrations/providers/payments.js +0 -0
- package/dist/integrations/providers/postmark.d.ts +7 -0
- package/dist/integrations/providers/postmark.js +71 -0
- package/dist/integrations/providers/powens.d.ts +7 -0
- package/dist/integrations/providers/powens.js +119 -0
- package/dist/integrations/providers/qdrant.d.ts +7 -0
- package/dist/integrations/providers/qdrant.js +76 -0
- package/dist/integrations/providers/registry.d.ts +11 -0
- package/dist/integrations/providers/registry.js +34 -0
- package/dist/integrations/providers/sms.d.ts +34 -0
- package/dist/integrations/providers/sms.js +0 -0
- package/dist/integrations/providers/storage.d.ts +60 -0
- package/dist/integrations/providers/storage.js +0 -0
- package/dist/integrations/providers/stripe.d.ts +7 -0
- package/dist/integrations/providers/stripe.js +86 -0
- package/dist/integrations/providers/twilio-sms.d.ts +7 -0
- package/dist/integrations/providers/twilio-sms.js +64 -0
- package/dist/integrations/providers/vector-store.d.ts +43 -0
- package/dist/integrations/providers/vector-store.js +0 -0
- package/dist/integrations/providers/voice.d.ts +34 -0
- package/dist/integrations/providers/voice.js +0 -0
- package/dist/integrations/runtime.d.ts +99 -0
- package/dist/integrations/runtime.js +186 -0
- package/dist/integrations/secrets/aws-secret-manager.d.ts +31 -0
- package/dist/integrations/secrets/aws-secret-manager.js +231 -0
- package/dist/integrations/secrets/env-secret-provider.d.ts +31 -0
- package/dist/integrations/secrets/env-secret-provider.js +81 -0
- package/dist/integrations/secrets/gcp-secret-manager.d.ts +32 -0
- package/dist/integrations/secrets/gcp-secret-manager.js +229 -0
- package/dist/integrations/secrets/index.d.ts +7 -0
- package/dist/integrations/secrets/index.js +8 -0
- package/dist/integrations/secrets/manager.d.ts +47 -0
- package/dist/integrations/secrets/manager.js +103 -0
- package/dist/integrations/secrets/provider.d.ts +52 -0
- package/dist/integrations/secrets/provider.js +58 -0
- package/dist/integrations/secrets/scaleway-secret-manager.d.ts +38 -0
- package/dist/integrations/secrets/scaleway-secret-manager.js +247 -0
- package/dist/integrations/secrets-types.d.ts +17 -0
- package/dist/integrations/secrets-types.js +0 -0
- package/dist/integrations/spec.d.ts +75 -0
- package/dist/integrations/spec.js +39 -0
- package/dist/jobs/define-job.d.ts +18 -0
- package/dist/jobs/define-job.js +16 -0
- package/dist/jobs/gcp-cloud-tasks.d.ts +41 -0
- package/dist/jobs/gcp-cloud-tasks.js +53 -0
- package/dist/jobs/gcp-pubsub.d.ts +25 -0
- package/dist/jobs/gcp-pubsub.js +39 -0
- package/dist/jobs/handlers/gmail-sync-handler.d.ts +9 -0
- package/dist/jobs/handlers/gmail-sync-handler.js +9 -0
- package/dist/jobs/handlers/index.d.ts +9 -0
- package/dist/jobs/handlers/index.js +12 -0
- package/dist/jobs/handlers/ping-handler.d.ts +10 -0
- package/dist/jobs/handlers/ping-handler.js +15 -0
- package/dist/jobs/handlers/storage-document-handler.d.ts +12 -0
- package/dist/jobs/handlers/storage-document-handler.js +14 -0
- package/dist/jobs/index.d.ts +3 -0
- package/dist/jobs/index.js +4 -0
- package/dist/jobs/memory-queue.d.ts +18 -0
- package/dist/jobs/memory-queue.js +71 -0
- package/dist/jobs/queue.d.ts +131 -0
- package/dist/jobs/queue.js +33 -0
- package/dist/jobs/scaleway-sqs-queue.d.ts +30 -0
- package/dist/jobs/scaleway-sqs-queue.js +153 -0
- package/dist/jsonschema.d.ts +27 -0
- package/dist/jsonschema.js +32 -0
- package/dist/knowledge/binding.d.ts +25 -0
- package/dist/knowledge/binding.js +0 -0
- package/dist/knowledge/docs/knowledge.docblock.d.ts +6 -0
- package/dist/knowledge/docs/knowledge.docblock.js +21 -0
- package/dist/knowledge/index.d.ts +11 -0
- package/dist/knowledge/index.js +10 -0
- package/dist/knowledge/ingestion/document-processor.d.ts +24 -0
- package/dist/knowledge/ingestion/document-processor.js +54 -0
- package/dist/knowledge/ingestion/embedding-service.d.ts +12 -0
- package/dist/knowledge/ingestion/embedding-service.js +25 -0
- package/dist/knowledge/ingestion/gmail-adapter.d.ts +18 -0
- package/dist/knowledge/ingestion/gmail-adapter.js +51 -0
- package/dist/knowledge/ingestion/index.d.ts +6 -0
- package/dist/knowledge/ingestion/index.js +7 -0
- package/dist/knowledge/ingestion/storage-adapter.d.ts +15 -0
- package/dist/knowledge/ingestion/storage-adapter.js +26 -0
- package/dist/knowledge/ingestion/vector-indexer.d.ts +18 -0
- package/dist/knowledge/ingestion/vector-indexer.js +32 -0
- package/dist/knowledge/knowledge.feature.d.ts +12 -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 -0
- package/dist/knowledge/query/service.d.ts +29 -0
- package/dist/knowledge/query/service.js +65 -0
- package/dist/knowledge/runtime.d.ts +32 -0
- package/dist/knowledge/runtime.js +49 -0
- package/dist/knowledge/source.d.ts +32 -0
- package/dist/knowledge/source.js +0 -0
- package/dist/knowledge/spaces/email-threads.d.ts +7 -0
- package/dist/knowledge/spaces/email-threads.js +37 -0
- package/dist/knowledge/spaces/financial-docs.d.ts +7 -0
- package/dist/knowledge/spaces/financial-docs.js +37 -0
- package/dist/knowledge/spaces/financial-overview.d.ts +7 -0
- package/dist/knowledge/spaces/financial-overview.js +41 -0
- package/dist/knowledge/spaces/index.d.ts +7 -0
- package/dist/knowledge/spaces/index.js +8 -0
- package/dist/knowledge/spaces/product-canon.d.ts +7 -0
- package/dist/knowledge/spaces/product-canon.js +37 -0
- package/dist/knowledge/spaces/support-faq.d.ts +7 -0
- package/dist/knowledge/spaces/support-faq.js +40 -0
- package/dist/knowledge/spaces/uploaded-docs.d.ts +7 -0
- package/dist/knowledge/spaces/uploaded-docs.js +37 -0
- package/dist/knowledge/spec.d.ts +48 -0
- package/dist/knowledge/spec.js +39 -0
- package/dist/llm/exporters.d.ts +70 -0
- package/dist/llm/exporters.js +542 -0
- package/dist/llm/index.d.ts +4 -0
- package/dist/llm/index.js +4 -0
- package/dist/llm/prompts.d.ts +52 -0
- package/dist/llm/prompts.js +410 -0
- package/dist/llm/types.d.ts +215 -0
- package/dist/llm/types.js +0 -0
- package/dist/markdown.d.ts +22 -0
- package/dist/markdown.js +119 -0
- package/dist/migrations.d.ts +52 -0
- package/dist/migrations.js +33 -0
- package/dist/model-registry.d.ts +13 -0
- package/dist/model-registry.js +33 -0
- package/dist/onboarding-base.d.ts +138 -0
- package/dist/onboarding-base.js +195 -0
- package/dist/openapi.d.ts +31 -0
- package/dist/openapi.js +75 -0
- package/dist/operations/index.d.ts +3 -0
- package/dist/operations/index.js +4 -0
- package/dist/operations/operation.d.ts +186 -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 -0
- package/dist/policy/docs/policy.docblock.d.ts +6 -0
- package/dist/policy/docs/policy.docblock.js +21 -0
- package/dist/policy/engine.d.ts +40 -0
- package/dist/policy/engine.js +223 -0
- 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 -0
- 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 -0
- package/dist/presentations/docs/presentations-conventions.docblock.d.ts +6 -0
- package/dist/presentations/docs/presentations-conventions.docblock.js +21 -0
- 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 -0
- package/dist/promptRegistry.d.ts +15 -0
- package/dist/promptRegistry.js +34 -0
- package/dist/regenerator/adapters.d.ts +19 -0
- package/dist/regenerator/adapters.js +0 -0
- package/dist/regenerator/docs/regenerator.docblock.d.ts +6 -0
- package/dist/regenerator/docs/regenerator.docblock.js +21 -0
- package/dist/regenerator/executor.d.ts +70 -0
- package/dist/regenerator/executor.js +86 -0
- package/dist/regenerator/index.d.ts +7 -0
- package/dist/regenerator/index.js +6 -0
- package/dist/regenerator/service.d.ts +33 -0
- package/dist/regenerator/service.js +93 -0
- package/dist/regenerator/sinks.d.ts +26 -0
- package/dist/regenerator/sinks.js +32 -0
- package/dist/regenerator/types.d.ts +107 -0
- package/dist/regenerator/types.js +0 -0
- package/dist/regenerator/utils.d.ts +9 -0
- package/dist/regenerator/utils.js +51 -0
- package/dist/registry-utils.d.ts +106 -0
- package/dist/registry-utils.js +122 -0
- package/dist/registry.d.ts +31 -0
- package/dist/registry.js +61 -0
- package/dist/resources.d.ts +64 -0
- package/dist/resources.js +50 -0
- package/dist/schema-to-markdown.d.ts +54 -0
- package/dist/schema-to-markdown.js +217 -0
- 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 +83 -0
- package/dist/server/graphql-pothos.d.ts +31 -0
- package/dist/server/graphql-pothos.js +134 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +10 -0
- package/dist/server/mcp/createMcpServer.d.ts +15 -0
- package/dist/server/mcp/createMcpServer.js +27 -0
- package/dist/server/mcp/mcpTypes.d.ts +27 -0
- package/dist/server/mcp/mcpTypes.js +0 -0
- package/dist/server/mcp/registerPresentations.d.ts +7 -0
- package/dist/server/mcp/registerPresentations.js +63 -0
- package/dist/server/mcp/registerPrompts.d.ts +8 -0
- package/dist/server/mcp/registerPrompts.js +37 -0
- package/dist/server/mcp/registerResources.d.ts +8 -0
- package/dist/server/mcp/registerResources.js +35 -0
- package/dist/server/mcp/registerTools.d.ts +8 -0
- package/dist/server/mcp/registerTools.js +22 -0
- package/dist/server/provider-mcp.d.ts +2 -0
- package/dist/server/provider-mcp.js +3 -0
- package/dist/server/rest-elysia.d.ts +40 -0
- package/dist/server/rest-elysia.js +20 -0
- package/dist/server/rest-express.d.ts +16 -0
- package/dist/server/rest-express.js +36 -0
- package/dist/server/rest-generic.d.ts +32 -0
- package/dist/server/rest-generic.js +124 -0
- package/dist/server/rest-next-app.d.ts +35 -0
- package/dist/server/rest-next-app.js +38 -0
- package/dist/server/rest-next-mcp.d.ts +11 -0
- package/dist/server/rest-next-mcp.js +45 -0
- package/dist/server/rest-next-pages.d.ts +9 -0
- package/dist/server/rest-next-pages.js +22 -0
- package/dist/telemetry/anomaly.d.ts +27 -0
- package/dist/telemetry/anomaly.js +48 -0
- package/dist/telemetry/docs/telemetry.docblock.d.ts +6 -0
- package/dist/telemetry/docs/telemetry.docblock.js +21 -0
- package/dist/telemetry/index.d.ts +4 -0
- package/dist/telemetry/index.js +5 -0
- package/dist/telemetry/spec.d.ts +91 -0
- package/dist/telemetry/spec.js +69 -0
- package/dist/telemetry/tracker.d.ts +51 -0
- package/dist/telemetry/tracker.js +76 -0
- package/dist/tests/index.d.ts +3 -0
- package/dist/tests/index.js +4 -0
- package/dist/tests/runner.d.ts +43 -0
- package/dist/tests/runner.js +150 -0
- package/dist/tests/spec.d.ts +81 -0
- package/dist/tests/spec.js +33 -0
- package/dist/themes.d.ts +53 -0
- package/dist/themes.js +39 -0
- package/dist/translations/catalog.d.ts +28 -0
- package/dist/translations/catalog.js +0 -0
- package/dist/translations/tenant.d.ts +15 -0
- package/dist/translations/tenant.js +0 -0
- package/dist/types.d.ts +92 -0
- package/dist/types.js +0 -0
- package/dist/workflow/adapters/db-adapter.d.ts +46 -0
- package/dist/workflow/adapters/db-adapter.js +83 -0
- package/dist/workflow/adapters/file-adapter.d.ts +14 -0
- package/dist/workflow/adapters/file-adapter.js +11 -0
- package/dist/workflow/adapters/index.d.ts +4 -0
- package/dist/workflow/adapters/index.js +5 -0
- package/dist/workflow/adapters/memory-store.d.ts +18 -0
- package/dist/workflow/adapters/memory-store.js +58 -0
- package/dist/workflow/expression.d.ts +9 -0
- package/dist/workflow/expression.js +99 -0
- package/dist/workflow/index.d.ts +10 -0
- package/dist/workflow/index.js +9 -0
- package/dist/workflow/overview.docblock.d.ts +6 -0
- package/dist/workflow/overview.docblock.js +21 -0
- package/dist/workflow/runner.d.ts +75 -0
- package/dist/workflow/runner.js +337 -0
- package/dist/workflow/sla-monitor.d.ts +20 -0
- package/dist/workflow/sla-monitor.js +47 -0
- package/dist/workflow/spec.d.ts +106 -0
- package/dist/workflow/spec.js +55 -0
- package/dist/workflow/state.d.ts +35 -0
- package/dist/workflow/state.js +0 -0
- package/dist/workflow/validation.d.ts +29 -0
- package/dist/workflow/validation.js +176 -0
- package/dist/workspace-config/contractsrc-schema.d.ts +862 -0
- package/dist/workspace-config/contractsrc-schema.js +281 -0
- package/dist/workspace-config/index.d.ts +2 -0
- package/dist/workspace-config/index.js +3 -0
- package/dist/workspace-config/workspace-config.docblock.d.ts +6 -0
- package/dist/workspace-config/workspace-config.docblock.js +45 -0
- package/package.json +598 -0
package/dist/markdown.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { isEmitDeclRef } from "./operations/operation.js";
|
|
2
|
+
import "./operations/index.js";
|
|
3
|
+
|
|
4
|
+
//#region src/markdown.ts
|
|
5
|
+
/**
|
|
6
|
+
* Render simple Markdown docs for each spec.
|
|
7
|
+
* Useful for dev portals and repo docs generation.
|
|
8
|
+
*/
|
|
9
|
+
function operationsToMarkdown(registry, _extras) {
|
|
10
|
+
const lines = [];
|
|
11
|
+
for (const spec of registry.listSpecs()) {
|
|
12
|
+
const m = spec.meta;
|
|
13
|
+
lines.push(`# ${m.key}.v${m.version}`);
|
|
14
|
+
lines.push("");
|
|
15
|
+
lines.push(`**Kind:** ${m.kind} | **Stability:** ${m.stability} | **Owners:** ${m.owners.join(", ")}`);
|
|
16
|
+
lines.push("");
|
|
17
|
+
lines.push(`**Description:** ${m.description}`);
|
|
18
|
+
lines.push("");
|
|
19
|
+
lines.push(`## Goal`);
|
|
20
|
+
lines.push(m.goal);
|
|
21
|
+
lines.push("");
|
|
22
|
+
lines.push(`## Context`);
|
|
23
|
+
lines.push(m.context);
|
|
24
|
+
lines.push("");
|
|
25
|
+
lines.push(`## Policy`);
|
|
26
|
+
lines.push(`- Auth: ${spec.policy.auth}`);
|
|
27
|
+
lines.push(`- Idempotent: ${!!spec.policy.idempotent}`);
|
|
28
|
+
if (spec.policy.rateLimit) lines.push(`- Rate Limit: ${spec.policy.rateLimit.rpm}/min by ${spec.policy.rateLimit.key}`);
|
|
29
|
+
if (spec.policy.flags?.length) lines.push(`- Flags: ${spec.policy.flags.join(", ")}`);
|
|
30
|
+
if (spec.policy.pii?.length) lines.push(`- PII: ${spec.policy.pii.join(", ")}`);
|
|
31
|
+
lines.push("");
|
|
32
|
+
if (spec.sideEffects?.emits?.length) {
|
|
33
|
+
lines.push(`## Emits Events`);
|
|
34
|
+
for (const e of spec.sideEffects.emits) if (isEmitDeclRef(e)) lines.push(`- \`${e.ref.key}.v${e.ref.version}\` — ${e.when}`);
|
|
35
|
+
else lines.push(`- \`${e.key}.v${e.version}\` — ${e.when}`);
|
|
36
|
+
lines.push("");
|
|
37
|
+
}
|
|
38
|
+
if (spec.io.errors && Object.keys(spec.io.errors).length) {
|
|
39
|
+
lines.push(`## Errors`);
|
|
40
|
+
for (const [code, err] of Object.entries(spec.io.errors)) lines.push(`- \`${code}\` (${err.http ?? 400}) — ${err.description} (when: ${err.when})`);
|
|
41
|
+
lines.push("");
|
|
42
|
+
}
|
|
43
|
+
if (spec.acceptance?.scenarios?.length) {
|
|
44
|
+
lines.push(`## Acceptance Scenarios`);
|
|
45
|
+
for (const s of spec.acceptance.scenarios) {
|
|
46
|
+
lines.push(`### ${s.key}`);
|
|
47
|
+
lines.push(`- **Given:** ${s.given.join("; ")}`);
|
|
48
|
+
lines.push(`- **When:** ${s.when.join("; ")}`);
|
|
49
|
+
lines.push(`- **Then:** ${s.then.join("; ")}`);
|
|
50
|
+
lines.push("");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (spec.acceptance?.examples?.length) {
|
|
54
|
+
lines.push(`## Examples`);
|
|
55
|
+
for (const ex of spec.acceptance.examples) {
|
|
56
|
+
lines.push(`- **${ex.key}**`);
|
|
57
|
+
lines.push(" - Input:");
|
|
58
|
+
lines.push(" ```json");
|
|
59
|
+
lines.push(JSON.stringify(ex.input, null, 2));
|
|
60
|
+
lines.push(" ```");
|
|
61
|
+
lines.push(" - Output:");
|
|
62
|
+
lines.push(" ```json");
|
|
63
|
+
lines.push(JSON.stringify(ex.output, null, 2));
|
|
64
|
+
lines.push(" ```");
|
|
65
|
+
lines.push("");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
lines.push("---");
|
|
69
|
+
lines.push("");
|
|
70
|
+
}
|
|
71
|
+
return lines.join("\n");
|
|
72
|
+
}
|
|
73
|
+
/** Render presentations and features as additional sections. */
|
|
74
|
+
function docsToMarkdown(reg, extras) {
|
|
75
|
+
const parts = [];
|
|
76
|
+
parts.push(operationsToMarkdown(reg, extras));
|
|
77
|
+
if (extras.presentations) {
|
|
78
|
+
parts.push("# Presentations");
|
|
79
|
+
parts.push("");
|
|
80
|
+
for (const p of extras.presentations.list()) {
|
|
81
|
+
parts.push(`## ${p.meta.key}.v${p.meta.version}`);
|
|
82
|
+
parts.push("");
|
|
83
|
+
parts.push(`- Type: ${p.source.type}`);
|
|
84
|
+
if (p.source.type === "component") {
|
|
85
|
+
parts.push(`- Framework: ${p.source.framework}`);
|
|
86
|
+
parts.push(`- Component Key: ${p.source.componentKey}`);
|
|
87
|
+
}
|
|
88
|
+
parts.push(`- Targets: ${p.targets.join(", ")}`);
|
|
89
|
+
parts.push("");
|
|
90
|
+
}
|
|
91
|
+
parts.push("");
|
|
92
|
+
}
|
|
93
|
+
if (extras.features) {
|
|
94
|
+
parts.push("# Features");
|
|
95
|
+
parts.push("");
|
|
96
|
+
for (const f of extras.features.list()) {
|
|
97
|
+
parts.push(`## ${f.meta.title} (${f.meta.key})`);
|
|
98
|
+
if (f.meta.description) parts.push(f.meta.description);
|
|
99
|
+
parts.push("");
|
|
100
|
+
if (f.operations?.length) {
|
|
101
|
+
parts.push("- Operations:");
|
|
102
|
+
for (const o of f.operations) parts.push(` - ${o.key}.v${o.version}`);
|
|
103
|
+
}
|
|
104
|
+
if (f.events?.length) {
|
|
105
|
+
parts.push("- Events:");
|
|
106
|
+
for (const e of f.events) parts.push(` - ${e.key}.v${e.version}`);
|
|
107
|
+
}
|
|
108
|
+
if (f.presentations?.length) {
|
|
109
|
+
parts.push("- Presentations:");
|
|
110
|
+
for (const pres of f.presentations) parts.push(` - ${pres.key}.v${pres.version}`);
|
|
111
|
+
}
|
|
112
|
+
parts.push("");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return parts.join("\n");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
//#endregion
|
|
119
|
+
export { docsToMarkdown, operationsToMarkdown };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { OwnerShipMeta } from "./ownership.js";
|
|
2
|
+
|
|
3
|
+
//#region src/migrations.d.ts
|
|
4
|
+
type MigrationStepKind = 'schema' | 'data' | 'validation';
|
|
5
|
+
interface MigrationCheck {
|
|
6
|
+
description: string;
|
|
7
|
+
expression: string;
|
|
8
|
+
}
|
|
9
|
+
interface MigrationStepBase {
|
|
10
|
+
kind: MigrationStepKind;
|
|
11
|
+
description?: string;
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
retries?: number;
|
|
14
|
+
preChecks?: MigrationCheck[];
|
|
15
|
+
postChecks?: MigrationCheck[];
|
|
16
|
+
}
|
|
17
|
+
interface SchemaMigrationStep extends MigrationStepBase {
|
|
18
|
+
kind: 'schema';
|
|
19
|
+
sql: string;
|
|
20
|
+
}
|
|
21
|
+
interface DataMigrationStep extends MigrationStepBase {
|
|
22
|
+
kind: 'data';
|
|
23
|
+
script: string;
|
|
24
|
+
}
|
|
25
|
+
interface ValidationMigrationStep extends MigrationStepBase {
|
|
26
|
+
kind: 'validation';
|
|
27
|
+
assertion: string;
|
|
28
|
+
}
|
|
29
|
+
type MigrationStep = SchemaMigrationStep | DataMigrationStep | ValidationMigrationStep;
|
|
30
|
+
interface MigrationMeta extends OwnerShipMeta {
|
|
31
|
+
/** Fully qualified migration name (e.g., "sigil.db.2025_01_add_users"). */
|
|
32
|
+
key: string;
|
|
33
|
+
/** Increment when the migration changes. */
|
|
34
|
+
version: number;
|
|
35
|
+
}
|
|
36
|
+
interface MigrationPlan {
|
|
37
|
+
up: MigrationStep[];
|
|
38
|
+
down?: MigrationStep[];
|
|
39
|
+
}
|
|
40
|
+
interface MigrationSpec {
|
|
41
|
+
meta: MigrationMeta;
|
|
42
|
+
plan: MigrationPlan;
|
|
43
|
+
dependencies?: string[];
|
|
44
|
+
}
|
|
45
|
+
declare class MigrationRegistry {
|
|
46
|
+
private readonly items;
|
|
47
|
+
register(spec: MigrationSpec): this;
|
|
48
|
+
list(): MigrationSpec[];
|
|
49
|
+
get(name: string, version?: number): MigrationSpec | undefined;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { DataMigrationStep, MigrationCheck, MigrationMeta, MigrationPlan, MigrationRegistry, MigrationSpec, MigrationStep, MigrationStepBase, MigrationStepKind, SchemaMigrationStep, ValidationMigrationStep };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/migrations.ts
|
|
2
|
+
const migrationKey = (name, version) => `${name}.v${version}`;
|
|
3
|
+
var MigrationRegistry = class {
|
|
4
|
+
items = /* @__PURE__ */ new Map();
|
|
5
|
+
register(spec) {
|
|
6
|
+
const key = migrationKey(spec.meta.key, spec.meta.version);
|
|
7
|
+
if (this.items.has(key)) throw new Error(`Duplicate migration ${key}`);
|
|
8
|
+
this.items.set(key, spec);
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
list() {
|
|
12
|
+
return [...this.items.values()].sort((a, b) => compareKey(migrationKey(a.meta.key, a.meta.version), migrationKey(b.meta.key, b.meta.version)));
|
|
13
|
+
}
|
|
14
|
+
get(name, version) {
|
|
15
|
+
if (version != null) return this.items.get(migrationKey(name, version));
|
|
16
|
+
let candidate;
|
|
17
|
+
let max = -Infinity;
|
|
18
|
+
for (const spec of this.items.values()) {
|
|
19
|
+
if (spec.meta.key !== name) continue;
|
|
20
|
+
if (spec.meta.version > max) {
|
|
21
|
+
max = spec.meta.version;
|
|
22
|
+
candidate = spec;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return candidate;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function compareKey(a, b) {
|
|
29
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { MigrationRegistry };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AnySchemaModel } from "@contractspec/lib.schema";
|
|
2
|
+
|
|
3
|
+
//#region src/model-registry.d.ts
|
|
4
|
+
/** In-memory registry for SchemaModel and SchemaType instances. */
|
|
5
|
+
declare class ModelRegistry {
|
|
6
|
+
private items;
|
|
7
|
+
constructor(items?: AnySchemaModel[]);
|
|
8
|
+
register(p: AnySchemaModel): this;
|
|
9
|
+
list(): AnySchemaModel[];
|
|
10
|
+
get(name: string): AnySchemaModel | undefined;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ModelRegistry };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { isSchemaModel } from "@contractspec/lib.schema";
|
|
2
|
+
|
|
3
|
+
//#region src/model-registry.ts
|
|
4
|
+
/**
|
|
5
|
+
* Get a name for any schema model type.
|
|
6
|
+
* For SchemaModel, uses config.name. For other SchemaType, generates a default.
|
|
7
|
+
*/
|
|
8
|
+
function getModelName(model) {
|
|
9
|
+
if (isSchemaModel(model)) return model.config.name;
|
|
10
|
+
return "AnonymousSchema_" + Math.random().toString(36).substring(7);
|
|
11
|
+
}
|
|
12
|
+
/** In-memory registry for SchemaModel and SchemaType instances. */
|
|
13
|
+
var ModelRegistry = class {
|
|
14
|
+
items = /* @__PURE__ */ new Map();
|
|
15
|
+
constructor(items) {
|
|
16
|
+
if (items) items.forEach((p) => this.register(p));
|
|
17
|
+
}
|
|
18
|
+
register(p) {
|
|
19
|
+
const name = getModelName(p);
|
|
20
|
+
if (this.items.has(name)) throw new Error(`Duplicate contract \`model\` ${name}`);
|
|
21
|
+
this.items.set(name, p);
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
list() {
|
|
25
|
+
return [...this.items.values()];
|
|
26
|
+
}
|
|
27
|
+
get(name) {
|
|
28
|
+
return this.items.get(name);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ModelRegistry };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { OperationSpec } from "./operations/operation.js";
|
|
2
|
+
import "./index.js";
|
|
3
|
+
import * as _contractspec_lib_schema53 from "@contractspec/lib.schema";
|
|
4
|
+
import { SchemaModel } from "@contractspec/lib.schema";
|
|
5
|
+
|
|
6
|
+
//#region src/onboarding-base.d.ts
|
|
7
|
+
/** Save/update onboarding draft (auto-save during flow) */
|
|
8
|
+
declare const SaveOnboardingDraftInput: SchemaModel<{
|
|
9
|
+
data: {
|
|
10
|
+
type: _contractspec_lib_schema53.FieldType<unknown, unknown>;
|
|
11
|
+
isOptional: false;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
declare const SaveOnboardingDraftOutput: SchemaModel<{
|
|
15
|
+
id: {
|
|
16
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
17
|
+
isOptional: false;
|
|
18
|
+
};
|
|
19
|
+
organizationId: {
|
|
20
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
21
|
+
isOptional: false;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
declare const SaveOnboardingDraftBaseSpec: OperationSpec<SchemaModel<{
|
|
25
|
+
data: {
|
|
26
|
+
type: _contractspec_lib_schema53.FieldType<unknown, unknown>;
|
|
27
|
+
isOptional: false;
|
|
28
|
+
};
|
|
29
|
+
}>, SchemaModel<{
|
|
30
|
+
id: {
|
|
31
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
32
|
+
isOptional: false;
|
|
33
|
+
};
|
|
34
|
+
organizationId: {
|
|
35
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
36
|
+
isOptional: false;
|
|
37
|
+
};
|
|
38
|
+
}>, undefined>;
|
|
39
|
+
/** Get current onboarding draft (on mount/restore) */
|
|
40
|
+
declare const GetOnboardingDraftOutput: SchemaModel<{
|
|
41
|
+
id: {
|
|
42
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
43
|
+
isOptional: true;
|
|
44
|
+
};
|
|
45
|
+
organizationId: {
|
|
46
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
47
|
+
isOptional: true;
|
|
48
|
+
};
|
|
49
|
+
data: {
|
|
50
|
+
type: _contractspec_lib_schema53.FieldType<unknown, unknown>;
|
|
51
|
+
isOptional: true;
|
|
52
|
+
};
|
|
53
|
+
createdAt: {
|
|
54
|
+
type: _contractspec_lib_schema53.FieldType<Date, string>;
|
|
55
|
+
isOptional: true;
|
|
56
|
+
};
|
|
57
|
+
updatedAt: {
|
|
58
|
+
type: _contractspec_lib_schema53.FieldType<Date, string>;
|
|
59
|
+
isOptional: true;
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
62
|
+
declare const GetOnboardingDraftBaseSpec: OperationSpec<_contractspec_lib_schema53.AnySchemaModel, SchemaModel<{
|
|
63
|
+
id: {
|
|
64
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
65
|
+
isOptional: true;
|
|
66
|
+
};
|
|
67
|
+
organizationId: {
|
|
68
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
69
|
+
isOptional: true;
|
|
70
|
+
};
|
|
71
|
+
data: {
|
|
72
|
+
type: _contractspec_lib_schema53.FieldType<unknown, unknown>;
|
|
73
|
+
isOptional: true;
|
|
74
|
+
};
|
|
75
|
+
createdAt: {
|
|
76
|
+
type: _contractspec_lib_schema53.FieldType<Date, string>;
|
|
77
|
+
isOptional: true;
|
|
78
|
+
};
|
|
79
|
+
updatedAt: {
|
|
80
|
+
type: _contractspec_lib_schema53.FieldType<Date, string>;
|
|
81
|
+
isOptional: true;
|
|
82
|
+
};
|
|
83
|
+
}>, undefined>;
|
|
84
|
+
/** Delete onboarding draft (cleanup after completion or cancel) */
|
|
85
|
+
declare const DeleteOnboardingDraftOutput: SchemaModel<{
|
|
86
|
+
ok: {
|
|
87
|
+
type: _contractspec_lib_schema53.FieldType<boolean, boolean>;
|
|
88
|
+
isOptional: false;
|
|
89
|
+
};
|
|
90
|
+
}>;
|
|
91
|
+
declare const DeleteOnboardingDraftBaseSpec: OperationSpec<_contractspec_lib_schema53.AnySchemaModel, SchemaModel<{
|
|
92
|
+
ok: {
|
|
93
|
+
type: _contractspec_lib_schema53.FieldType<boolean, boolean>;
|
|
94
|
+
isOptional: false;
|
|
95
|
+
};
|
|
96
|
+
}>, undefined>;
|
|
97
|
+
/** Complete onboarding (final submit, creates entities) */
|
|
98
|
+
declare const CompleteOnboardingBaseInput: SchemaModel<{
|
|
99
|
+
data: {
|
|
100
|
+
type: _contractspec_lib_schema53.FieldType<unknown, unknown>;
|
|
101
|
+
isOptional: false;
|
|
102
|
+
};
|
|
103
|
+
}>;
|
|
104
|
+
declare const CompleteOnboardingBaseOutput: SchemaModel<{
|
|
105
|
+
success: {
|
|
106
|
+
type: _contractspec_lib_schema53.FieldType<boolean, boolean>;
|
|
107
|
+
isOptional: false;
|
|
108
|
+
};
|
|
109
|
+
userId: {
|
|
110
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
111
|
+
isOptional: true;
|
|
112
|
+
};
|
|
113
|
+
organizationId: {
|
|
114
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
115
|
+
isOptional: true;
|
|
116
|
+
};
|
|
117
|
+
}>;
|
|
118
|
+
declare const CompleteOnboardingBaseSpec: OperationSpec<SchemaModel<{
|
|
119
|
+
data: {
|
|
120
|
+
type: _contractspec_lib_schema53.FieldType<unknown, unknown>;
|
|
121
|
+
isOptional: false;
|
|
122
|
+
};
|
|
123
|
+
}>, SchemaModel<{
|
|
124
|
+
success: {
|
|
125
|
+
type: _contractspec_lib_schema53.FieldType<boolean, boolean>;
|
|
126
|
+
isOptional: false;
|
|
127
|
+
};
|
|
128
|
+
userId: {
|
|
129
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
130
|
+
isOptional: true;
|
|
131
|
+
};
|
|
132
|
+
organizationId: {
|
|
133
|
+
type: _contractspec_lib_schema53.FieldType<string, string>;
|
|
134
|
+
isOptional: true;
|
|
135
|
+
};
|
|
136
|
+
}>, undefined>;
|
|
137
|
+
//#endregion
|
|
138
|
+
export { CompleteOnboardingBaseInput, CompleteOnboardingBaseOutput, CompleteOnboardingBaseSpec, DeleteOnboardingDraftBaseSpec, DeleteOnboardingDraftOutput, GetOnboardingDraftBaseSpec, GetOnboardingDraftOutput, SaveOnboardingDraftBaseSpec, SaveOnboardingDraftInput, SaveOnboardingDraftOutput };
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { OwnersEnum, StabilityEnum } from "./ownership.js";
|
|
2
|
+
import { defineCommand, defineQuery } from "./operations/operation.js";
|
|
3
|
+
import "./operations/index.js";
|
|
4
|
+
import { ScalarTypeEnum, SchemaModel } from "@contractspec/lib.schema";
|
|
5
|
+
|
|
6
|
+
//#region src/onboarding-base.ts
|
|
7
|
+
/**
|
|
8
|
+
* Shared base contracts for onboarding flows across verticals.
|
|
9
|
+
* These operations are reusable for any app that needs multi-step onboarding with draft persistence.
|
|
10
|
+
*/
|
|
11
|
+
/** Save/update onboarding draft (auto-save during flow) */
|
|
12
|
+
const SaveOnboardingDraftInput = new SchemaModel({
|
|
13
|
+
name: "SaveOnboardingDraftInput",
|
|
14
|
+
description: "Input for saving onboarding draft",
|
|
15
|
+
fields: { data: {
|
|
16
|
+
type: ScalarTypeEnum.JSON(),
|
|
17
|
+
isOptional: false
|
|
18
|
+
} }
|
|
19
|
+
});
|
|
20
|
+
const SaveOnboardingDraftOutput = new SchemaModel({
|
|
21
|
+
name: "SaveOnboardingDraftOutput",
|
|
22
|
+
description: "Output for saving onboarding draft",
|
|
23
|
+
fields: {
|
|
24
|
+
id: {
|
|
25
|
+
type: ScalarTypeEnum.ID(),
|
|
26
|
+
isOptional: false
|
|
27
|
+
},
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: ScalarTypeEnum.ID(),
|
|
30
|
+
isOptional: false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const SaveOnboardingDraftBaseSpec = defineCommand({
|
|
35
|
+
meta: {
|
|
36
|
+
key: "base.onboarding.saveDraft",
|
|
37
|
+
version: 1,
|
|
38
|
+
stability: StabilityEnum.Beta,
|
|
39
|
+
owners: [OwnersEnum.PlatformSigil],
|
|
40
|
+
tags: ["onboarding", "draft"],
|
|
41
|
+
description: "Save or update onboarding draft for active organization",
|
|
42
|
+
goal: "Persist onboarding progress incrementally for resumption and safety",
|
|
43
|
+
context: "Auto-saves every few seconds during onboarding; enables users to leave and resume"
|
|
44
|
+
},
|
|
45
|
+
io: {
|
|
46
|
+
input: SaveOnboardingDraftInput,
|
|
47
|
+
output: SaveOnboardingDraftOutput
|
|
48
|
+
},
|
|
49
|
+
policy: {
|
|
50
|
+
auth: "user",
|
|
51
|
+
escalate: null
|
|
52
|
+
},
|
|
53
|
+
transport: {
|
|
54
|
+
gql: { field: "saveOnboardingDraft" },
|
|
55
|
+
rest: { method: "POST" }
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
/** Get current onboarding draft (on mount/restore) */
|
|
59
|
+
const GetOnboardingDraftOutput = new SchemaModel({
|
|
60
|
+
name: "GetOnboardingDraftOutput",
|
|
61
|
+
description: "Onboarding draft payload",
|
|
62
|
+
fields: {
|
|
63
|
+
id: {
|
|
64
|
+
type: ScalarTypeEnum.ID(),
|
|
65
|
+
isOptional: true
|
|
66
|
+
},
|
|
67
|
+
organizationId: {
|
|
68
|
+
type: ScalarTypeEnum.ID(),
|
|
69
|
+
isOptional: true
|
|
70
|
+
},
|
|
71
|
+
data: {
|
|
72
|
+
type: ScalarTypeEnum.JSON(),
|
|
73
|
+
isOptional: true
|
|
74
|
+
},
|
|
75
|
+
createdAt: {
|
|
76
|
+
type: ScalarTypeEnum.DateTime(),
|
|
77
|
+
isOptional: true
|
|
78
|
+
},
|
|
79
|
+
updatedAt: {
|
|
80
|
+
type: ScalarTypeEnum.DateTime(),
|
|
81
|
+
isOptional: true
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const GetOnboardingDraftBaseSpec = defineQuery({
|
|
86
|
+
meta: {
|
|
87
|
+
key: "base.onboarding.getDraft",
|
|
88
|
+
version: 1,
|
|
89
|
+
stability: StabilityEnum.Beta,
|
|
90
|
+
owners: [OwnersEnum.PlatformSigil],
|
|
91
|
+
tags: ["onboarding", "draft"],
|
|
92
|
+
description: "Get onboarding draft for active organization",
|
|
93
|
+
goal: "Retrieve saved onboarding progress",
|
|
94
|
+
context: "Called on mount to restore in-progress onboarding"
|
|
95
|
+
},
|
|
96
|
+
io: {
|
|
97
|
+
input: null,
|
|
98
|
+
output: GetOnboardingDraftOutput
|
|
99
|
+
},
|
|
100
|
+
policy: {
|
|
101
|
+
auth: "user",
|
|
102
|
+
escalate: null
|
|
103
|
+
},
|
|
104
|
+
transport: {
|
|
105
|
+
gql: { field: "getOnboardingDraft" },
|
|
106
|
+
rest: { method: "GET" }
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
/** Delete onboarding draft (cleanup after completion or cancel) */
|
|
110
|
+
const DeleteOnboardingDraftOutput = new SchemaModel({
|
|
111
|
+
name: "DeleteOnboardingDraftOutput",
|
|
112
|
+
description: "Result of delete operation",
|
|
113
|
+
fields: { ok: {
|
|
114
|
+
type: ScalarTypeEnum.Boolean(),
|
|
115
|
+
isOptional: false
|
|
116
|
+
} }
|
|
117
|
+
});
|
|
118
|
+
const DeleteOnboardingDraftBaseSpec = defineCommand({
|
|
119
|
+
meta: {
|
|
120
|
+
key: "base.onboarding.deleteDraft",
|
|
121
|
+
version: 1,
|
|
122
|
+
stability: StabilityEnum.Beta,
|
|
123
|
+
owners: [OwnersEnum.PlatformSigil],
|
|
124
|
+
tags: ["onboarding", "draft"],
|
|
125
|
+
description: "Delete onboarding draft for active organization",
|
|
126
|
+
goal: "Clear draft after completion or if user wants to restart",
|
|
127
|
+
context: "Called after successful onboarding or explicit user reset"
|
|
128
|
+
},
|
|
129
|
+
io: {
|
|
130
|
+
input: null,
|
|
131
|
+
output: DeleteOnboardingDraftOutput
|
|
132
|
+
},
|
|
133
|
+
policy: {
|
|
134
|
+
auth: "user",
|
|
135
|
+
escalate: null
|
|
136
|
+
},
|
|
137
|
+
transport: {
|
|
138
|
+
gql: { field: "deleteOnboardingDraft" },
|
|
139
|
+
rest: { method: "POST" }
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
/** Complete onboarding (final submit, creates entities) */
|
|
143
|
+
const CompleteOnboardingBaseInput = new SchemaModel({
|
|
144
|
+
name: "CompleteOnboardingBaseInput",
|
|
145
|
+
description: "Input for completing onboarding",
|
|
146
|
+
fields: { data: {
|
|
147
|
+
type: ScalarTypeEnum.JSON(),
|
|
148
|
+
isOptional: false
|
|
149
|
+
} }
|
|
150
|
+
});
|
|
151
|
+
const CompleteOnboardingBaseOutput = new SchemaModel({
|
|
152
|
+
name: "CompleteOnboardingBaseOutput",
|
|
153
|
+
description: "Result of onboarding completion",
|
|
154
|
+
fields: {
|
|
155
|
+
success: {
|
|
156
|
+
type: ScalarTypeEnum.Boolean(),
|
|
157
|
+
isOptional: false
|
|
158
|
+
},
|
|
159
|
+
userId: {
|
|
160
|
+
type: ScalarTypeEnum.ID(),
|
|
161
|
+
isOptional: true
|
|
162
|
+
},
|
|
163
|
+
organizationId: {
|
|
164
|
+
type: ScalarTypeEnum.ID(),
|
|
165
|
+
isOptional: true
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
const CompleteOnboardingBaseSpec = defineCommand({
|
|
170
|
+
meta: {
|
|
171
|
+
key: "base.onboarding.complete",
|
|
172
|
+
version: 1,
|
|
173
|
+
stability: StabilityEnum.Beta,
|
|
174
|
+
owners: [OwnersEnum.PlatformSigil],
|
|
175
|
+
tags: ["onboarding"],
|
|
176
|
+
description: "Complete onboarding and finalize user/organization setup",
|
|
177
|
+
goal: "Transition from draft to active profile",
|
|
178
|
+
context: "Validates all required fields, creates/updates entities, marks onboarding complete"
|
|
179
|
+
},
|
|
180
|
+
io: {
|
|
181
|
+
input: CompleteOnboardingBaseInput,
|
|
182
|
+
output: CompleteOnboardingBaseOutput
|
|
183
|
+
},
|
|
184
|
+
policy: {
|
|
185
|
+
auth: "user",
|
|
186
|
+
escalate: null
|
|
187
|
+
},
|
|
188
|
+
transport: {
|
|
189
|
+
gql: { field: "completeOnboarding" },
|
|
190
|
+
rest: { method: "POST" }
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
//#endregion
|
|
195
|
+
export { CompleteOnboardingBaseInput, CompleteOnboardingBaseOutput, CompleteOnboardingBaseSpec, DeleteOnboardingDraftBaseSpec, DeleteOnboardingDraftOutput, GetOnboardingDraftBaseSpec, GetOnboardingDraftOutput, SaveOnboardingDraftBaseSpec, SaveOnboardingDraftInput, SaveOnboardingDraftOutput };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OperationSpecRegistry } from "./operations/registry.js";
|
|
2
|
+
|
|
3
|
+
//#region src/openapi.d.ts
|
|
4
|
+
|
|
5
|
+
interface OpenApiServer {
|
|
6
|
+
url: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
interface OpenApiExportOptions {
|
|
10
|
+
title?: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
servers?: OpenApiServer[];
|
|
14
|
+
}
|
|
15
|
+
type OpenApiSchemaObject = Record<string, unknown>;
|
|
16
|
+
interface OpenApiDocument {
|
|
17
|
+
openapi: '3.1.0';
|
|
18
|
+
info: {
|
|
19
|
+
title: string;
|
|
20
|
+
version: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
};
|
|
23
|
+
servers?: OpenApiServer[];
|
|
24
|
+
paths: Record<string, Record<string, unknown>>;
|
|
25
|
+
components: {
|
|
26
|
+
schemas: Record<string, OpenApiSchemaObject>;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
declare function openApiForRegistry(registry: OperationSpecRegistry, options?: OpenApiExportOptions): OpenApiDocument;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { OpenApiDocument, OpenApiExportOptions, OpenApiServer, openApiForRegistry };
|
package/dist/openapi.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { defaultRestPath, jsonSchemaForSpec } from "./jsonschema.js";
|
|
2
|
+
|
|
3
|
+
//#region src/openapi.ts
|
|
4
|
+
function toOperationId(name, version) {
|
|
5
|
+
return `${name.replace(/\./g, "_")}_v${version}`;
|
|
6
|
+
}
|
|
7
|
+
function toSchemaName(prefix, name, version) {
|
|
8
|
+
return `${prefix}_${toOperationId(name, version)}`;
|
|
9
|
+
}
|
|
10
|
+
function toHttpMethod(kind, override) {
|
|
11
|
+
return (override ?? (kind === "query" ? "GET" : "POST")).toLowerCase();
|
|
12
|
+
}
|
|
13
|
+
function toRestPath(spec) {
|
|
14
|
+
const path = spec.transport?.rest?.path ?? defaultRestPath(spec.meta.key, spec.meta.version);
|
|
15
|
+
return path.startsWith("/") ? path : `/${path}`;
|
|
16
|
+
}
|
|
17
|
+
function openApiForRegistry(registry, options = {}) {
|
|
18
|
+
const specs = registry.listSpecs().filter((s) => s.meta.kind === "command" || s.meta.kind === "query").slice().sort((a, b) => {
|
|
19
|
+
const byName = a.meta.key.localeCompare(b.meta.key);
|
|
20
|
+
return byName !== 0 ? byName : a.meta.version - b.meta.version;
|
|
21
|
+
});
|
|
22
|
+
const doc = {
|
|
23
|
+
openapi: "3.1.0",
|
|
24
|
+
info: {
|
|
25
|
+
title: options.title ?? "ContractSpec API",
|
|
26
|
+
version: options.version ?? "0.0.0",
|
|
27
|
+
...options.description ? { description: options.description } : {}
|
|
28
|
+
},
|
|
29
|
+
...options.servers ? { servers: options.servers } : {},
|
|
30
|
+
paths: {},
|
|
31
|
+
components: { schemas: {} }
|
|
32
|
+
};
|
|
33
|
+
for (const spec of specs) {
|
|
34
|
+
const schema = jsonSchemaForSpec(spec);
|
|
35
|
+
const method = toHttpMethod(spec.meta.kind, spec.transport?.rest?.method);
|
|
36
|
+
const path = toRestPath(spec);
|
|
37
|
+
const operationId = toOperationId(spec.meta.key, spec.meta.version);
|
|
38
|
+
const pathItem = doc.paths[path] ??= {};
|
|
39
|
+
const op = {
|
|
40
|
+
operationId,
|
|
41
|
+
summary: spec.meta.description ?? spec.meta.key,
|
|
42
|
+
description: spec.meta.description,
|
|
43
|
+
tags: spec.meta.tags ?? [],
|
|
44
|
+
"x-contractspec": {
|
|
45
|
+
name: spec.meta.key,
|
|
46
|
+
version: spec.meta.version,
|
|
47
|
+
kind: spec.meta.kind
|
|
48
|
+
},
|
|
49
|
+
responses: {}
|
|
50
|
+
};
|
|
51
|
+
if (schema.input) {
|
|
52
|
+
const inputName = toSchemaName("Input", spec.meta.key, spec.meta.version);
|
|
53
|
+
doc.components.schemas[inputName] = schema.input;
|
|
54
|
+
op["requestBody"] = {
|
|
55
|
+
required: true,
|
|
56
|
+
content: { "application/json": { schema: { $ref: `#/components/schemas/${inputName}` } } }
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const responses = {};
|
|
60
|
+
if (schema.output) {
|
|
61
|
+
const outputName = toSchemaName("Output", spec.meta.key, spec.meta.version);
|
|
62
|
+
doc.components.schemas[outputName] = schema.output;
|
|
63
|
+
responses["200"] = {
|
|
64
|
+
description: "OK",
|
|
65
|
+
content: { "application/json": { schema: { $ref: `#/components/schemas/${outputName}` } } }
|
|
66
|
+
};
|
|
67
|
+
} else responses["200"] = { description: "OK" };
|
|
68
|
+
op["responses"] = responses;
|
|
69
|
+
pathItem[method] = op;
|
|
70
|
+
}
|
|
71
|
+
return doc;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { openApiForRegistry };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AnyOperationSpec, EmitDecl, EmitDeclInline, EmitDeclRef, ImplementationRef, ImplementationType, OpKind, OperationSpec, OperationSpecMeta, TelemetryTrigger, defineCommand, defineQuery, isEmitDeclRef } from "./operation.js";
|
|
2
|
+
import { OperationKey, OperationSpecRegistry, opKey } from "./registry.js";
|
|
3
|
+
export { AnyOperationSpec, EmitDecl, EmitDeclInline, EmitDeclRef, ImplementationRef, ImplementationType, OpKind, OperationKey, OperationSpec, OperationSpecMeta, OperationSpecRegistry, TelemetryTrigger, defineCommand, defineQuery, isEmitDeclRef, opKey };
|