@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
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { StabilityEnum } from "../../ownership.js";
|
|
2
|
+
|
|
3
|
+
//#region src/integrations/providers/twilio-sms.ts
|
|
4
|
+
const twilioSmsIntegrationSpec = {
|
|
5
|
+
meta: {
|
|
6
|
+
key: "sms.twilio",
|
|
7
|
+
version: 1,
|
|
8
|
+
category: "sms",
|
|
9
|
+
title: "Twilio Messaging",
|
|
10
|
+
description: "Twilio SMS integration for transactional and notification messaging.",
|
|
11
|
+
domain: "communications",
|
|
12
|
+
owners: ["platform.messaging"],
|
|
13
|
+
tags: ["sms", "messaging"],
|
|
14
|
+
stability: StabilityEnum.Stable
|
|
15
|
+
},
|
|
16
|
+
supportedModes: ["managed", "byok"],
|
|
17
|
+
capabilities: { provides: [{
|
|
18
|
+
key: "sms.outbound",
|
|
19
|
+
version: 1
|
|
20
|
+
}] },
|
|
21
|
+
configSchema: {
|
|
22
|
+
schema: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: { fromNumber: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "Default Twilio phone number used as sender."
|
|
27
|
+
} }
|
|
28
|
+
},
|
|
29
|
+
example: { fromNumber: "+15551234567" }
|
|
30
|
+
},
|
|
31
|
+
secretSchema: {
|
|
32
|
+
schema: {
|
|
33
|
+
type: "object",
|
|
34
|
+
required: ["accountSid", "authToken"],
|
|
35
|
+
properties: {
|
|
36
|
+
accountSid: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "Twilio Account SID."
|
|
39
|
+
},
|
|
40
|
+
authToken: {
|
|
41
|
+
type: "string",
|
|
42
|
+
description: "Twilio Auth Token."
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
example: {
|
|
47
|
+
accountSid: "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
48
|
+
authToken: "auth-token"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
healthCheck: {
|
|
52
|
+
method: "custom",
|
|
53
|
+
timeoutMs: 3e3
|
|
54
|
+
},
|
|
55
|
+
docsUrl: "https://www.twilio.com/docs/sms/api",
|
|
56
|
+
constraints: { rateLimit: { rpm: 200 } },
|
|
57
|
+
byokSetup: { setupInstructions: "Provide a Twilio account SID, auth token, and verify the outbound sending numbers used by the integration." }
|
|
58
|
+
};
|
|
59
|
+
function registerTwilioSmsIntegration(registry) {
|
|
60
|
+
return registry.register(twilioSmsIntegrationSpec);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { registerTwilioSmsIntegration, twilioSmsIntegrationSpec };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EmbeddingVector } from "./embedding.js";
|
|
2
|
+
|
|
3
|
+
//#region src/integrations/providers/vector-store.d.ts
|
|
4
|
+
interface VectorDocument {
|
|
5
|
+
id: string;
|
|
6
|
+
vector: EmbeddingVector;
|
|
7
|
+
payload?: Record<string, unknown>;
|
|
8
|
+
namespace?: string;
|
|
9
|
+
expiresAt?: Date;
|
|
10
|
+
}
|
|
11
|
+
interface VectorUpsertRequest {
|
|
12
|
+
collection: string;
|
|
13
|
+
documents: VectorDocument[];
|
|
14
|
+
waitForSync?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface VectorDeleteRequest {
|
|
17
|
+
collection: string;
|
|
18
|
+
ids: string[];
|
|
19
|
+
namespace?: string;
|
|
20
|
+
}
|
|
21
|
+
interface VectorSearchQuery {
|
|
22
|
+
collection: string;
|
|
23
|
+
vector: EmbeddingVector;
|
|
24
|
+
topK: number;
|
|
25
|
+
namespace?: string;
|
|
26
|
+
filter?: Record<string, unknown>;
|
|
27
|
+
scoreThreshold?: number;
|
|
28
|
+
consistent?: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface VectorSearchResult {
|
|
31
|
+
id: string;
|
|
32
|
+
score: number;
|
|
33
|
+
payload?: Record<string, unknown>;
|
|
34
|
+
vector?: EmbeddingVector;
|
|
35
|
+
namespace?: string;
|
|
36
|
+
}
|
|
37
|
+
interface VectorStoreProvider {
|
|
38
|
+
upsert(request: VectorUpsertRequest): Promise<void>;
|
|
39
|
+
search(query: VectorSearchQuery): Promise<VectorSearchResult[]>;
|
|
40
|
+
delete(request: VectorDeleteRequest): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { VectorDeleteRequest, VectorDocument, VectorSearchQuery, VectorSearchResult, VectorStoreProvider, VectorUpsertRequest };
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/integrations/providers/voice.d.ts
|
|
2
|
+
interface Voice {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
language?: string;
|
|
7
|
+
gender?: 'male' | 'female' | 'neutral';
|
|
8
|
+
previewUrl?: string;
|
|
9
|
+
metadata?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
interface VoiceSynthesisInput {
|
|
12
|
+
text: string;
|
|
13
|
+
voiceId?: string;
|
|
14
|
+
language?: string;
|
|
15
|
+
style?: number;
|
|
16
|
+
stability?: number;
|
|
17
|
+
similarityBoost?: number;
|
|
18
|
+
format?: 'mp3' | 'wav' | 'ogg' | 'pcm';
|
|
19
|
+
sampleRateHz?: number;
|
|
20
|
+
metadata?: Record<string, string>;
|
|
21
|
+
}
|
|
22
|
+
interface VoiceSynthesisResult {
|
|
23
|
+
audio: Uint8Array;
|
|
24
|
+
format: string;
|
|
25
|
+
sampleRateHz: number;
|
|
26
|
+
durationSeconds?: number;
|
|
27
|
+
url?: string;
|
|
28
|
+
}
|
|
29
|
+
interface VoiceProvider {
|
|
30
|
+
listVoices(): Promise<Voice[]>;
|
|
31
|
+
synthesize(input: VoiceSynthesisInput): Promise<VoiceSynthesisResult>;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { Voice, VoiceProvider, VoiceSynthesisInput, VoiceSynthesisResult };
|
|
File without changes
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { IntegrationSpec } from "./spec.js";
|
|
2
|
+
import { ConnectionStatus, IntegrationConnection } from "./connection.js";
|
|
3
|
+
import { ResolvedAppConfig, ResolvedIntegration } from "../app-config/runtime.js";
|
|
4
|
+
import { SecretProvider } from "./secrets/provider.js";
|
|
5
|
+
|
|
6
|
+
//#region src/integrations/runtime.d.ts
|
|
7
|
+
interface IntegrationTraceMetadata {
|
|
8
|
+
blueprintName: string;
|
|
9
|
+
blueprintVersion: number;
|
|
10
|
+
configVersion: number;
|
|
11
|
+
}
|
|
12
|
+
interface IntegrationTelemetryEvent {
|
|
13
|
+
tenantId: string;
|
|
14
|
+
appId: string;
|
|
15
|
+
environment?: string;
|
|
16
|
+
slotId?: string;
|
|
17
|
+
integrationKey: string;
|
|
18
|
+
integrationVersion: number;
|
|
19
|
+
connectionId: string;
|
|
20
|
+
status: 'success' | 'error';
|
|
21
|
+
durationMs?: number;
|
|
22
|
+
errorCode?: string;
|
|
23
|
+
errorMessage?: string;
|
|
24
|
+
occurredAt: Date;
|
|
25
|
+
metadata?: Record<string, string | number | boolean>;
|
|
26
|
+
}
|
|
27
|
+
interface IntegrationTelemetryEmitter {
|
|
28
|
+
record(event: IntegrationTelemetryEvent): Promise<void> | void;
|
|
29
|
+
}
|
|
30
|
+
type IntegrationInvocationStatus = 'success' | 'error';
|
|
31
|
+
interface IntegrationContext {
|
|
32
|
+
tenantId: string;
|
|
33
|
+
appId: string;
|
|
34
|
+
environment?: string;
|
|
35
|
+
slotId?: string;
|
|
36
|
+
spec: IntegrationSpec;
|
|
37
|
+
connection: IntegrationConnection;
|
|
38
|
+
secretProvider: SecretProvider;
|
|
39
|
+
secretReference: string;
|
|
40
|
+
trace: IntegrationTraceMetadata;
|
|
41
|
+
config?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
interface IntegrationCallContext {
|
|
44
|
+
tenantId: string;
|
|
45
|
+
appId: string;
|
|
46
|
+
environment?: string;
|
|
47
|
+
blueprintName: string;
|
|
48
|
+
blueprintVersion: number;
|
|
49
|
+
configVersion: number;
|
|
50
|
+
slotId: string;
|
|
51
|
+
operation: string;
|
|
52
|
+
}
|
|
53
|
+
interface IntegrationCallError {
|
|
54
|
+
code: string;
|
|
55
|
+
message: string;
|
|
56
|
+
retryable: boolean;
|
|
57
|
+
cause?: unknown;
|
|
58
|
+
}
|
|
59
|
+
interface IntegrationCallResult<T> {
|
|
60
|
+
success: boolean;
|
|
61
|
+
data?: T;
|
|
62
|
+
error?: IntegrationCallError;
|
|
63
|
+
metadata: {
|
|
64
|
+
latencyMs: number;
|
|
65
|
+
connectionId: string;
|
|
66
|
+
ownershipMode: IntegrationConnection['ownershipMode'];
|
|
67
|
+
attempts: number;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
interface IntegrationCallGuardOptions {
|
|
71
|
+
telemetry?: IntegrationTelemetryEmitter;
|
|
72
|
+
maxAttempts?: number;
|
|
73
|
+
backoffMs?: number;
|
|
74
|
+
shouldRetry?: (error: unknown, attempt: number) => boolean;
|
|
75
|
+
sleep?: (ms: number) => Promise<void>;
|
|
76
|
+
now?: () => Date;
|
|
77
|
+
}
|
|
78
|
+
declare class IntegrationCallGuard {
|
|
79
|
+
private readonly secretProvider;
|
|
80
|
+
private readonly telemetry?;
|
|
81
|
+
private readonly maxAttempts;
|
|
82
|
+
private readonly backoffMs;
|
|
83
|
+
private readonly shouldRetry;
|
|
84
|
+
private readonly sleep;
|
|
85
|
+
private readonly now;
|
|
86
|
+
constructor(secretProvider: SecretProvider, options?: IntegrationCallGuardOptions);
|
|
87
|
+
executeWithGuards<T>(slotId: string, operation: string, _input: unknown, resolvedConfig: ResolvedAppConfig, executor: (connection: IntegrationConnection, secrets: Record<string, string>) => Promise<T>): Promise<IntegrationCallResult<T>>;
|
|
88
|
+
private findIntegration;
|
|
89
|
+
private fetchSecrets;
|
|
90
|
+
private parseSecret;
|
|
91
|
+
private emitTelemetry;
|
|
92
|
+
private failure;
|
|
93
|
+
private makeContext;
|
|
94
|
+
private errorCodeFor;
|
|
95
|
+
}
|
|
96
|
+
declare function ensureConnectionReady(integration: ResolvedIntegration): void;
|
|
97
|
+
declare function connectionStatusLabel(status: ConnectionStatus): string;
|
|
98
|
+
//#endregion
|
|
99
|
+
export { IntegrationCallContext, IntegrationCallError, IntegrationCallGuard, IntegrationCallGuardOptions, IntegrationCallResult, IntegrationContext, IntegrationInvocationStatus, IntegrationTelemetryEmitter, IntegrationTelemetryEvent, IntegrationTraceMetadata, connectionStatusLabel, ensureConnectionReady };
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { performance } from "node:perf_hooks";
|
|
2
|
+
|
|
3
|
+
//#region src/integrations/runtime.ts
|
|
4
|
+
const DEFAULT_MAX_ATTEMPTS = 3;
|
|
5
|
+
const DEFAULT_BACKOFF_MS = 250;
|
|
6
|
+
var IntegrationCallGuard = class {
|
|
7
|
+
telemetry;
|
|
8
|
+
maxAttempts;
|
|
9
|
+
backoffMs;
|
|
10
|
+
shouldRetry;
|
|
11
|
+
sleep;
|
|
12
|
+
now;
|
|
13
|
+
constructor(secretProvider, options = {}) {
|
|
14
|
+
this.secretProvider = secretProvider;
|
|
15
|
+
this.telemetry = options.telemetry;
|
|
16
|
+
this.maxAttempts = Math.max(1, options.maxAttempts ?? DEFAULT_MAX_ATTEMPTS);
|
|
17
|
+
this.backoffMs = options.backoffMs ?? DEFAULT_BACKOFF_MS;
|
|
18
|
+
this.shouldRetry = options.shouldRetry ?? ((error) => typeof error === "object" && error !== null && "retryable" in error && Boolean(error.retryable));
|
|
19
|
+
this.sleep = options.sleep ?? ((ms) => ms <= 0 ? Promise.resolve() : new Promise((resolve) => setTimeout(resolve, ms)));
|
|
20
|
+
this.now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
21
|
+
}
|
|
22
|
+
async executeWithGuards(slotId, operation, _input, resolvedConfig, executor) {
|
|
23
|
+
const integration = this.findIntegration(slotId, resolvedConfig);
|
|
24
|
+
if (!integration) return this.failure({
|
|
25
|
+
tenantId: resolvedConfig.tenantId,
|
|
26
|
+
appId: resolvedConfig.appId,
|
|
27
|
+
environment: resolvedConfig.environment,
|
|
28
|
+
blueprintName: resolvedConfig.blueprintName,
|
|
29
|
+
blueprintVersion: resolvedConfig.blueprintVersion,
|
|
30
|
+
configVersion: resolvedConfig.configVersion,
|
|
31
|
+
slotId,
|
|
32
|
+
operation
|
|
33
|
+
}, void 0, {
|
|
34
|
+
code: "SLOT_NOT_BOUND",
|
|
35
|
+
message: `Integration slot "${slotId}" is not bound for tenant "${resolvedConfig.tenantId}".`,
|
|
36
|
+
retryable: false
|
|
37
|
+
}, 0);
|
|
38
|
+
const status = integration.connection.status;
|
|
39
|
+
if (status === "disconnected" || status === "error") return this.failure(this.makeContext(slotId, operation, resolvedConfig), integration, {
|
|
40
|
+
code: "CONNECTION_NOT_READY",
|
|
41
|
+
message: `Integration connection "${integration.connection.meta.label}" is in status "${status}".`,
|
|
42
|
+
retryable: false
|
|
43
|
+
}, 0);
|
|
44
|
+
const secrets = await this.fetchSecrets(integration.connection);
|
|
45
|
+
let attempt = 0;
|
|
46
|
+
const started = performance.now();
|
|
47
|
+
while (attempt < this.maxAttempts) {
|
|
48
|
+
attempt += 1;
|
|
49
|
+
try {
|
|
50
|
+
const data = await executor(integration.connection, secrets);
|
|
51
|
+
const duration = performance.now() - started;
|
|
52
|
+
this.emitTelemetry(this.makeContext(slotId, operation, resolvedConfig), integration, "success", duration);
|
|
53
|
+
return {
|
|
54
|
+
success: true,
|
|
55
|
+
data,
|
|
56
|
+
metadata: {
|
|
57
|
+
latencyMs: duration,
|
|
58
|
+
connectionId: integration.connection.meta.id,
|
|
59
|
+
ownershipMode: integration.connection.ownershipMode,
|
|
60
|
+
attempts: attempt
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
} catch (error) {
|
|
64
|
+
const duration = performance.now() - started;
|
|
65
|
+
this.emitTelemetry(this.makeContext(slotId, operation, resolvedConfig), integration, "error", duration, this.errorCodeFor(error), error instanceof Error ? error.message : String(error));
|
|
66
|
+
const retryable = this.shouldRetry(error, attempt);
|
|
67
|
+
if (!retryable || attempt >= this.maxAttempts) return {
|
|
68
|
+
success: false,
|
|
69
|
+
error: {
|
|
70
|
+
code: this.errorCodeFor(error),
|
|
71
|
+
message: error instanceof Error ? error.message : String(error),
|
|
72
|
+
retryable,
|
|
73
|
+
cause: error
|
|
74
|
+
},
|
|
75
|
+
metadata: {
|
|
76
|
+
latencyMs: duration,
|
|
77
|
+
connectionId: integration.connection.meta.id,
|
|
78
|
+
ownershipMode: integration.connection.ownershipMode,
|
|
79
|
+
attempts: attempt
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
await this.sleep(this.backoffMs);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
success: false,
|
|
87
|
+
error: {
|
|
88
|
+
code: "UNKNOWN_ERROR",
|
|
89
|
+
message: "Integration call failed after retries.",
|
|
90
|
+
retryable: false
|
|
91
|
+
},
|
|
92
|
+
metadata: {
|
|
93
|
+
latencyMs: performance.now() - started,
|
|
94
|
+
connectionId: integration.connection.meta.id,
|
|
95
|
+
ownershipMode: integration.connection.ownershipMode,
|
|
96
|
+
attempts: this.maxAttempts
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
findIntegration(slotId, config) {
|
|
101
|
+
return config.integrations.find((integration) => integration.slot.slotId === slotId);
|
|
102
|
+
}
|
|
103
|
+
async fetchSecrets(connection) {
|
|
104
|
+
if (!this.secretProvider.canHandle(connection.secretRef)) throw new Error(`Secret provider "${this.secretProvider.id}" cannot handle reference "${connection.secretRef}".`);
|
|
105
|
+
const secret = await this.secretProvider.getSecret(connection.secretRef);
|
|
106
|
+
return this.parseSecret(secret);
|
|
107
|
+
}
|
|
108
|
+
parseSecret(secret) {
|
|
109
|
+
const text = new TextDecoder().decode(secret.data);
|
|
110
|
+
try {
|
|
111
|
+
const parsed = JSON.parse(text);
|
|
112
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
113
|
+
const entries = Object.entries(parsed).filter(([, value]) => typeof value === "string" || typeof value === "number" || typeof value === "boolean");
|
|
114
|
+
return Object.fromEntries(entries.map(([key, value]) => [key, String(value)]));
|
|
115
|
+
}
|
|
116
|
+
} catch {}
|
|
117
|
+
return { secret: text };
|
|
118
|
+
}
|
|
119
|
+
emitTelemetry(context, integration, status, durationMs, errorCode, errorMessage) {
|
|
120
|
+
if (!this.telemetry || !integration) return;
|
|
121
|
+
this.telemetry.record({
|
|
122
|
+
tenantId: context.tenantId,
|
|
123
|
+
appId: context.appId,
|
|
124
|
+
environment: context.environment,
|
|
125
|
+
slotId: context.slotId,
|
|
126
|
+
integrationKey: integration.connection.meta.integrationKey,
|
|
127
|
+
integrationVersion: integration.connection.meta.integrationVersion,
|
|
128
|
+
connectionId: integration.connection.meta.id,
|
|
129
|
+
status,
|
|
130
|
+
durationMs,
|
|
131
|
+
errorCode,
|
|
132
|
+
errorMessage,
|
|
133
|
+
occurredAt: this.now(),
|
|
134
|
+
metadata: {
|
|
135
|
+
blueprint: `${context.blueprintName}.v${context.blueprintVersion}`,
|
|
136
|
+
configVersion: context.configVersion,
|
|
137
|
+
operation: context.operation
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
failure(context, integration, error, attempts) {
|
|
142
|
+
if (integration) this.emitTelemetry(context, integration, "error", 0, error.code, error.message);
|
|
143
|
+
return {
|
|
144
|
+
success: false,
|
|
145
|
+
error,
|
|
146
|
+
metadata: {
|
|
147
|
+
latencyMs: 0,
|
|
148
|
+
connectionId: integration?.connection.meta.id ?? "unknown",
|
|
149
|
+
ownershipMode: integration?.connection.ownershipMode ?? "managed",
|
|
150
|
+
attempts
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
makeContext(slotId, operation, config) {
|
|
155
|
+
return {
|
|
156
|
+
tenantId: config.tenantId,
|
|
157
|
+
appId: config.appId,
|
|
158
|
+
environment: config.environment,
|
|
159
|
+
blueprintName: config.blueprintName,
|
|
160
|
+
blueprintVersion: config.blueprintVersion,
|
|
161
|
+
configVersion: config.configVersion,
|
|
162
|
+
slotId,
|
|
163
|
+
operation
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
errorCodeFor(error) {
|
|
167
|
+
if (typeof error === "object" && error !== null && "code" in error && typeof error.code === "string") return error.code;
|
|
168
|
+
return "PROVIDER_ERROR";
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
function ensureConnectionReady(integration) {
|
|
172
|
+
const status = integration.connection.status;
|
|
173
|
+
if (status === "disconnected" || status === "error") throw new Error(`Integration connection "${integration.connection.meta.label}" is in status "${status}".`);
|
|
174
|
+
}
|
|
175
|
+
function connectionStatusLabel(status) {
|
|
176
|
+
switch (status) {
|
|
177
|
+
case "connected": return "connected";
|
|
178
|
+
case "disconnected": return "disconnected";
|
|
179
|
+
case "error": return "error";
|
|
180
|
+
case "unknown":
|
|
181
|
+
default: return "unknown";
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
//#endregion
|
|
186
|
+
export { IntegrationCallGuard, connectionStatusLabel, ensureConnectionReady };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SecretFetchOptions, SecretProvider, SecretReference, SecretRotationResult, SecretValue, SecretWritePayload } from "./provider.js";
|
|
2
|
+
import { SecretsManagerClient } from "@aws-sdk/client-secrets-manager";
|
|
3
|
+
|
|
4
|
+
//#region src/integrations/secrets/aws-secret-manager.d.ts
|
|
5
|
+
type AwsSecretsManagerClient = Pick<SecretsManagerClient, 'send'>;
|
|
6
|
+
type AwsSecretsManagerClientConfig = ConstructorParameters<typeof SecretsManagerClient>[0];
|
|
7
|
+
interface AwsSecretsManagerProviderOptions {
|
|
8
|
+
region?: string;
|
|
9
|
+
client?: AwsSecretsManagerClient;
|
|
10
|
+
clientConfig?: AwsSecretsManagerClientConfig;
|
|
11
|
+
}
|
|
12
|
+
declare class AwsSecretsManagerProvider implements SecretProvider {
|
|
13
|
+
readonly id = "aws-secrets-manager";
|
|
14
|
+
private readonly explicitRegion?;
|
|
15
|
+
private readonly injectedClient?;
|
|
16
|
+
private readonly clientConfig?;
|
|
17
|
+
private readonly clientsByRegion;
|
|
18
|
+
constructor(options?: AwsSecretsManagerProviderOptions);
|
|
19
|
+
canHandle(reference: SecretReference): boolean;
|
|
20
|
+
getSecret(reference: SecretReference, options?: SecretFetchOptions): Promise<SecretValue>;
|
|
21
|
+
setSecret(reference: SecretReference, payload: SecretWritePayload): Promise<SecretRotationResult>;
|
|
22
|
+
rotateSecret(reference: SecretReference, payload: SecretWritePayload): Promise<SecretRotationResult>;
|
|
23
|
+
deleteSecret(reference: SecretReference): Promise<void>;
|
|
24
|
+
private getClient;
|
|
25
|
+
private parseReference;
|
|
26
|
+
private resolveRegion;
|
|
27
|
+
private buildVersionSelector;
|
|
28
|
+
private buildReference;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { AwsSecretsManagerProvider };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { SecretProviderError, normalizeSecretPayload, parseSecretUri } from "./provider.js";
|
|
2
|
+
import { Buffer } from "node:buffer";
|
|
3
|
+
import { CreateSecretCommand, DeleteSecretCommand, GetSecretValueCommand, PutSecretValueCommand, SecretsManagerClient } from "@aws-sdk/client-secrets-manager";
|
|
4
|
+
|
|
5
|
+
//#region src/integrations/secrets/aws-secret-manager.ts
|
|
6
|
+
const DEFAULT_DELETE_RECOVERY_DAYS = 7;
|
|
7
|
+
var AwsSecretsManagerProvider = class {
|
|
8
|
+
id = "aws-secrets-manager";
|
|
9
|
+
explicitRegion;
|
|
10
|
+
injectedClient;
|
|
11
|
+
clientConfig;
|
|
12
|
+
clientsByRegion = /* @__PURE__ */ new Map();
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
this.explicitRegion = options.region;
|
|
15
|
+
this.injectedClient = options.client;
|
|
16
|
+
this.clientConfig = options.clientConfig;
|
|
17
|
+
}
|
|
18
|
+
canHandle(reference) {
|
|
19
|
+
try {
|
|
20
|
+
const parsed = parseSecretUri(reference);
|
|
21
|
+
return parsed.provider === "aws" && (parsed.path === "secretsmanager" || parsed.path.startsWith("secretsmanager/"));
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async getSecret(reference, options) {
|
|
27
|
+
const location = this.parseReference(reference);
|
|
28
|
+
const client = this.getClient(location.region);
|
|
29
|
+
const requestedVersion = options?.version ?? location.stage ?? location.version;
|
|
30
|
+
const input = {
|
|
31
|
+
SecretId: location.secretId,
|
|
32
|
+
...this.buildVersionSelector(requestedVersion)
|
|
33
|
+
};
|
|
34
|
+
try {
|
|
35
|
+
const result = await client.send(new GetSecretValueCommand(input));
|
|
36
|
+
return {
|
|
37
|
+
data: extractAwsSecretBytes(result, reference, this.id),
|
|
38
|
+
version: typeof result.VersionId === "string" && result.VersionId ? result.VersionId : requestedVersion,
|
|
39
|
+
metadata: {
|
|
40
|
+
region: location.region,
|
|
41
|
+
secretId: location.secretId,
|
|
42
|
+
...requestedVersion ? { requestedVersion } : {}
|
|
43
|
+
},
|
|
44
|
+
retrievedAt: /* @__PURE__ */ new Date()
|
|
45
|
+
};
|
|
46
|
+
} catch (error) {
|
|
47
|
+
throw toAwsSecretProviderError({
|
|
48
|
+
error,
|
|
49
|
+
provider: this.id,
|
|
50
|
+
reference,
|
|
51
|
+
operation: "getSecret"
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async setSecret(reference, payload) {
|
|
56
|
+
const location = this.parseReference(reference);
|
|
57
|
+
const client = this.getClient(location.region);
|
|
58
|
+
const bytes = normalizeSecretPayload(payload);
|
|
59
|
+
try {
|
|
60
|
+
const result = await client.send(new PutSecretValueCommand({
|
|
61
|
+
SecretId: location.secretId,
|
|
62
|
+
SecretBinary: bytes
|
|
63
|
+
}));
|
|
64
|
+
const versionId = typeof result.VersionId === "string" && result.VersionId ? result.VersionId : "latest";
|
|
65
|
+
return {
|
|
66
|
+
reference: this.buildReference(location.region, location.secretId, { version: versionId }),
|
|
67
|
+
version: versionId
|
|
68
|
+
};
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (!isAwsNotFound(error)) throw toAwsSecretProviderError({
|
|
71
|
+
error,
|
|
72
|
+
provider: this.id,
|
|
73
|
+
reference,
|
|
74
|
+
operation: "putSecretValue"
|
|
75
|
+
});
|
|
76
|
+
if (looksLikeAwsArn(location.secretId)) throw new SecretProviderError({
|
|
77
|
+
message: `Secret not found: ${location.secretId}`,
|
|
78
|
+
provider: this.id,
|
|
79
|
+
reference,
|
|
80
|
+
code: "NOT_FOUND",
|
|
81
|
+
cause: error
|
|
82
|
+
});
|
|
83
|
+
try {
|
|
84
|
+
const created = await client.send(new CreateSecretCommand({
|
|
85
|
+
Name: location.secretId,
|
|
86
|
+
SecretBinary: bytes
|
|
87
|
+
}));
|
|
88
|
+
const versionId = typeof created.VersionId === "string" && created.VersionId ? created.VersionId : "latest";
|
|
89
|
+
return {
|
|
90
|
+
reference: this.buildReference(location.region, location.secretId, { version: versionId }),
|
|
91
|
+
version: versionId
|
|
92
|
+
};
|
|
93
|
+
} catch (creationError) {
|
|
94
|
+
throw toAwsSecretProviderError({
|
|
95
|
+
error: creationError,
|
|
96
|
+
provider: this.id,
|
|
97
|
+
reference,
|
|
98
|
+
operation: "createSecret"
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async rotateSecret(reference, payload) {
|
|
104
|
+
return this.setSecret(reference, payload);
|
|
105
|
+
}
|
|
106
|
+
async deleteSecret(reference) {
|
|
107
|
+
const location = this.parseReference(reference);
|
|
108
|
+
const client = this.getClient(location.region);
|
|
109
|
+
try {
|
|
110
|
+
await client.send(new DeleteSecretCommand({
|
|
111
|
+
SecretId: location.secretId,
|
|
112
|
+
RecoveryWindowInDays: DEFAULT_DELETE_RECOVERY_DAYS
|
|
113
|
+
}));
|
|
114
|
+
} catch (error) {
|
|
115
|
+
throw toAwsSecretProviderError({
|
|
116
|
+
error,
|
|
117
|
+
provider: this.id,
|
|
118
|
+
reference,
|
|
119
|
+
operation: "deleteSecret"
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
getClient(region) {
|
|
124
|
+
if (this.injectedClient) return this.injectedClient;
|
|
125
|
+
const cached = this.clientsByRegion.get(region);
|
|
126
|
+
if (cached) return cached;
|
|
127
|
+
const client = new SecretsManagerClient({
|
|
128
|
+
...this.clientConfig ?? {},
|
|
129
|
+
region
|
|
130
|
+
});
|
|
131
|
+
this.clientsByRegion.set(region, client);
|
|
132
|
+
return client;
|
|
133
|
+
}
|
|
134
|
+
parseReference(reference) {
|
|
135
|
+
const parsed = parseSecretUri(reference);
|
|
136
|
+
if (parsed.provider !== "aws") throw new SecretProviderError({
|
|
137
|
+
message: `Unsupported secret provider: ${parsed.provider}`,
|
|
138
|
+
provider: this.id,
|
|
139
|
+
reference,
|
|
140
|
+
code: "INVALID"
|
|
141
|
+
});
|
|
142
|
+
const segments = parsed.path.split("/").filter(Boolean);
|
|
143
|
+
if (segments.length < 3 || segments[0] !== "secretsmanager") throw new SecretProviderError({
|
|
144
|
+
message: "Expected secret reference format aws://secretsmanager/{region}/{secretIdOrArn}[?version=...]",
|
|
145
|
+
provider: this.id,
|
|
146
|
+
reference,
|
|
147
|
+
code: "INVALID"
|
|
148
|
+
});
|
|
149
|
+
const regionCandidate = segments[1];
|
|
150
|
+
const region = this.resolveRegion(regionCandidate);
|
|
151
|
+
const secretId = segments.slice(2).join("/");
|
|
152
|
+
if (!secretId) throw new SecretProviderError({
|
|
153
|
+
message: `Unable to resolve secret id from reference "${parsed.path}"`,
|
|
154
|
+
provider: this.id,
|
|
155
|
+
reference,
|
|
156
|
+
code: "INVALID"
|
|
157
|
+
});
|
|
158
|
+
return {
|
|
159
|
+
region,
|
|
160
|
+
secretId,
|
|
161
|
+
version: parsed.extras?.version,
|
|
162
|
+
stage: parsed.extras?.stage
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
resolveRegion(regionCandidate) {
|
|
166
|
+
const region = regionCandidate ?? this.explicitRegion ?? process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION;
|
|
167
|
+
if (!region) throw new SecretProviderError({
|
|
168
|
+
message: "AWS region must be provided either in reference (aws://secretsmanager/{region}/...) or via AWS_REGION/AWS_DEFAULT_REGION.",
|
|
169
|
+
provider: this.id,
|
|
170
|
+
reference: "aws://secretsmanager//",
|
|
171
|
+
code: "INVALID"
|
|
172
|
+
});
|
|
173
|
+
return region;
|
|
174
|
+
}
|
|
175
|
+
buildVersionSelector(version) {
|
|
176
|
+
if (!version) return {};
|
|
177
|
+
if (version === "latest" || version === "current") return { VersionStage: "AWSCURRENT" };
|
|
178
|
+
if (version.startsWith("AWS")) return { VersionStage: version };
|
|
179
|
+
return { VersionId: version };
|
|
180
|
+
}
|
|
181
|
+
buildReference(region, secretId, extras) {
|
|
182
|
+
const base = `aws://secretsmanager/${region}/${secretId}`;
|
|
183
|
+
const query = extras ? Object.entries(extras).filter(([, value]) => Boolean(value)).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&") : "";
|
|
184
|
+
return query ? `${base}?${query}` : base;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
function extractAwsSecretBytes(result, reference, provider) {
|
|
188
|
+
if (!result || typeof result !== "object") throw new SecretProviderError({
|
|
189
|
+
message: "Invalid AWS Secrets Manager response",
|
|
190
|
+
provider,
|
|
191
|
+
reference,
|
|
192
|
+
code: "UNKNOWN",
|
|
193
|
+
cause: result
|
|
194
|
+
});
|
|
195
|
+
const record = result;
|
|
196
|
+
if (record.SecretBinary instanceof Uint8Array) return record.SecretBinary;
|
|
197
|
+
if (typeof record.SecretBinary === "string") return Buffer.from(record.SecretBinary, "base64");
|
|
198
|
+
if (typeof record.SecretString === "string") return Buffer.from(record.SecretString, "utf-8");
|
|
199
|
+
throw new SecretProviderError({
|
|
200
|
+
message: "AWS secret value is empty",
|
|
201
|
+
provider,
|
|
202
|
+
reference,
|
|
203
|
+
code: "NOT_FOUND",
|
|
204
|
+
cause: result
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function looksLikeAwsArn(secretId) {
|
|
208
|
+
return secretId.startsWith("arn:aws:secretsmanager:");
|
|
209
|
+
}
|
|
210
|
+
function isAwsNotFound(error) {
|
|
211
|
+
if (!error || typeof error !== "object") return false;
|
|
212
|
+
const err = error;
|
|
213
|
+
if (typeof err.$metadata?.httpStatusCode === "number") return err.$metadata.httpStatusCode === 404;
|
|
214
|
+
return err.name === "ResourceNotFoundException";
|
|
215
|
+
}
|
|
216
|
+
function toAwsSecretProviderError(params) {
|
|
217
|
+
const { error, provider, reference, operation } = params;
|
|
218
|
+
if (error instanceof SecretProviderError) return error;
|
|
219
|
+
const httpStatusCode = typeof error === "object" && error !== null && "$metadata" in error && typeof error.$metadata === "object" && error.$metadata?.httpStatusCode;
|
|
220
|
+
const code = httpStatusCode === 404 ? "NOT_FOUND" : httpStatusCode === 401 || httpStatusCode === 403 ? "FORBIDDEN" : httpStatusCode === 400 ? "INVALID" : "UNKNOWN";
|
|
221
|
+
return new SecretProviderError({
|
|
222
|
+
message: error instanceof Error ? error.message : `Unknown error during ${operation}`,
|
|
223
|
+
provider,
|
|
224
|
+
reference,
|
|
225
|
+
code,
|
|
226
|
+
cause: error
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
//#endregion
|
|
231
|
+
export { AwsSecretsManagerProvider };
|