@contractspec/lib.contracts-integrations 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +3676 -0
- package/dist/integrations/binding.d.ts +14 -0
- package/dist/integrations/binding.js +1 -0
- package/dist/integrations/connection.d.ts +47 -0
- package/dist/integrations/connection.js +1 -0
- package/dist/integrations/docs/integrations.docblock.d.ts +2 -0
- package/dist/integrations/docs/integrations.docblock.js +110 -0
- package/dist/integrations/health.d.ts +17 -0
- package/dist/integrations/health.js +73 -0
- package/dist/integrations/health.test.d.ts +1 -0
- package/dist/integrations/index.d.ts +11 -0
- package/dist/integrations/index.js +3264 -0
- package/dist/integrations/integrations.capability.d.ts +1 -0
- package/dist/integrations/integrations.capability.js +18 -0
- package/dist/integrations/integrations.feature.d.ts +5 -0
- package/dist/integrations/integrations.feature.js +33 -0
- package/dist/integrations/meeting-recorder/contracts/index.d.ts +7 -0
- package/dist/integrations/meeting-recorder/contracts/index.js +474 -0
- package/dist/integrations/meeting-recorder/contracts/meetings.d.ts +451 -0
- package/dist/integrations/meeting-recorder/contracts/meetings.js +219 -0
- package/dist/integrations/meeting-recorder/contracts/transcripts.d.ts +166 -0
- package/dist/integrations/meeting-recorder/contracts/transcripts.js +287 -0
- package/dist/integrations/meeting-recorder/contracts/webhooks.d.ts +85 -0
- package/dist/integrations/meeting-recorder/contracts/webhooks.js +172 -0
- package/dist/integrations/meeting-recorder/meeting-recorder.capability.d.ts +1 -0
- package/dist/integrations/meeting-recorder/meeting-recorder.capability.js +18 -0
- package/dist/integrations/meeting-recorder/meeting-recorder.feature.d.ts +5 -0
- package/dist/integrations/meeting-recorder/meeting-recorder.feature.js +33 -0
- package/dist/integrations/meeting-recorder/models.d.ts +402 -0
- package/dist/integrations/meeting-recorder/models.js +122 -0
- package/dist/integrations/meeting-recorder/telemetry.d.ts +13 -0
- package/dist/integrations/meeting-recorder/telemetry.js +54 -0
- package/dist/integrations/openbanking/contracts/accounts.d.ts +282 -0
- package/dist/integrations/openbanking/contracts/accounts.js +328 -0
- package/dist/integrations/openbanking/contracts/balances.d.ts +158 -0
- package/dist/integrations/openbanking/contracts/balances.js +292 -0
- package/dist/integrations/openbanking/contracts/index.d.ts +7 -0
- package/dist/integrations/openbanking/contracts/index.js +644 -0
- package/dist/integrations/openbanking/contracts/transactions.d.ts +206 -0
- package/dist/integrations/openbanking/contracts/transactions.js +298 -0
- package/dist/integrations/openbanking/guards.d.ts +8 -0
- package/dist/integrations/openbanking/guards.js +42 -0
- package/dist/integrations/openbanking/guards.test.d.ts +1 -0
- package/dist/integrations/openbanking/models.d.ts +223 -0
- package/dist/integrations/openbanking/models.js +110 -0
- package/dist/integrations/openbanking/openbanking.capability.d.ts +1 -0
- package/dist/integrations/openbanking/openbanking.capability.js +18 -0
- package/dist/integrations/openbanking/openbanking.feature.d.ts +5 -0
- package/dist/integrations/openbanking/openbanking.feature.js +35 -0
- package/dist/integrations/openbanking/telemetry.d.ts +12 -0
- package/dist/integrations/openbanking/telemetry.js +51 -0
- package/dist/integrations/operations.d.ts +430 -0
- package/dist/integrations/operations.js +297 -0
- package/dist/integrations/operations.test.d.ts +1 -0
- package/dist/integrations/providers/analytics-reader.d.ts +103 -0
- package/dist/integrations/providers/analytics-reader.js +1 -0
- package/dist/integrations/providers/analytics-writer.d.ts +6 -0
- package/dist/integrations/providers/analytics-writer.js +1 -0
- package/dist/integrations/providers/analytics.d.ts +47 -0
- package/dist/integrations/providers/analytics.js +1 -0
- package/dist/integrations/providers/calendar.d.ts +75 -0
- package/dist/integrations/providers/calendar.js +1 -0
- package/dist/integrations/providers/database.d.ts +12 -0
- package/dist/integrations/providers/database.js +1 -0
- package/dist/integrations/providers/elevenlabs.d.ts +3 -0
- package/dist/integrations/providers/elevenlabs.js +86 -0
- package/dist/integrations/providers/email.d.ts +83 -0
- package/dist/integrations/providers/email.js +1 -0
- package/dist/integrations/providers/embedding.d.ts +21 -0
- package/dist/integrations/providers/embedding.js +1 -0
- package/dist/integrations/providers/fal.d.ts +3 -0
- package/dist/integrations/providers/fal.js +112 -0
- package/dist/integrations/providers/fathom.d.ts +3 -0
- package/dist/integrations/providers/fathom.js +126 -0
- package/dist/integrations/providers/fireflies.d.ts +3 -0
- package/dist/integrations/providers/fireflies.js +106 -0
- package/dist/integrations/providers/gcs-storage.d.ts +3 -0
- package/dist/integrations/providers/gcs-storage.js +97 -0
- package/dist/integrations/providers/gmail.d.ts +3 -0
- package/dist/integrations/providers/gmail.js +109 -0
- package/dist/integrations/providers/google-calendar.d.ts +3 -0
- package/dist/integrations/providers/google-calendar.js +92 -0
- package/dist/integrations/providers/gradium.d.ts +3 -0
- package/dist/integrations/providers/gradium.js +110 -0
- package/dist/integrations/providers/granola.d.ts +3 -0
- package/dist/integrations/providers/granola.js +107 -0
- package/dist/integrations/providers/index.d.ts +38 -0
- package/dist/integrations/providers/index.js +2094 -0
- package/dist/integrations/providers/jira.d.ts +3 -0
- package/dist/integrations/providers/jira.js +108 -0
- package/dist/integrations/providers/linear.d.ts +3 -0
- package/dist/integrations/providers/linear.js +107 -0
- package/dist/integrations/providers/llm.d.ts +79 -0
- package/dist/integrations/providers/llm.js +1 -0
- package/dist/integrations/providers/meeting-recorder.d.ts +129 -0
- package/dist/integrations/providers/meeting-recorder.js +1 -0
- package/dist/integrations/providers/mistral.d.ts +3 -0
- package/dist/integrations/providers/mistral.js +94 -0
- package/dist/integrations/providers/notion.d.ts +3 -0
- package/dist/integrations/providers/notion.js +113 -0
- package/dist/integrations/providers/openbanking.d.ts +125 -0
- package/dist/integrations/providers/openbanking.js +1 -0
- package/dist/integrations/providers/payments.d.ts +106 -0
- package/dist/integrations/providers/payments.js +1 -0
- package/dist/integrations/providers/posthog-llm-telemetry.d.ts +51 -0
- package/dist/integrations/providers/posthog-llm-telemetry.js +176 -0
- package/dist/integrations/providers/posthog.d.ts +3 -0
- package/dist/integrations/providers/posthog.js +106 -0
- package/dist/integrations/providers/postmark.d.ts +3 -0
- package/dist/integrations/providers/postmark.js +98 -0
- package/dist/integrations/providers/powens.d.ts +3 -0
- package/dist/integrations/providers/powens.js +124 -0
- package/dist/integrations/providers/project-management.d.ts +32 -0
- package/dist/integrations/providers/project-management.js +1 -0
- package/dist/integrations/providers/providers.test.d.ts +1 -0
- package/dist/integrations/providers/qdrant.d.ts +3 -0
- package/dist/integrations/providers/qdrant.js +101 -0
- package/dist/integrations/providers/registry.d.ts +6 -0
- package/dist/integrations/providers/registry.js +1878 -0
- package/dist/integrations/providers/sms.d.ts +31 -0
- package/dist/integrations/providers/sms.js +1 -0
- package/dist/integrations/providers/storage.d.ts +57 -0
- package/dist/integrations/providers/storage.js +1 -0
- package/dist/integrations/providers/stripe.d.ts +3 -0
- package/dist/integrations/providers/stripe.js +105 -0
- package/dist/integrations/providers/supabase-postgres.d.ts +3 -0
- package/dist/integrations/providers/supabase-postgres.js +87 -0
- package/dist/integrations/providers/supabase-vector.d.ts +3 -0
- package/dist/integrations/providers/supabase-vector.js +107 -0
- package/dist/integrations/providers/tldv.d.ts +3 -0
- package/dist/integrations/providers/tldv.js +106 -0
- package/dist/integrations/providers/twilio-sms.d.ts +3 -0
- package/dist/integrations/providers/twilio-sms.js +91 -0
- package/dist/integrations/providers/vector-store.d.ts +39 -0
- package/dist/integrations/providers/vector-store.js +1 -0
- package/dist/integrations/providers/voice.d.ts +31 -0
- package/dist/integrations/providers/voice.js +1 -0
- package/dist/integrations/runtime.d.ts +95 -0
- package/dist/integrations/runtime.js +209 -0
- package/dist/integrations/runtime.test.d.ts +1 -0
- package/dist/integrations/secrets/aws-secret-manager.d.ts +28 -0
- package/dist/integrations/secrets/aws-secret-manager.js +346 -0
- package/dist/integrations/secrets/env-secret-provider.d.ts +28 -0
- package/dist/integrations/secrets/env-secret-provider.js +159 -0
- package/dist/integrations/secrets/gcp-secret-manager.d.ts +29 -0
- package/dist/integrations/secrets/gcp-secret-manager.js +347 -0
- package/dist/integrations/secrets/index.d.ts +6 -0
- package/dist/integrations/secrets/index.js +1129 -0
- package/dist/integrations/secrets/manager.d.ts +44 -0
- package/dist/integrations/secrets/manager.js +183 -0
- package/dist/integrations/secrets/provider.d.ts +49 -0
- package/dist/integrations/secrets/provider.js +74 -0
- package/dist/integrations/secrets/provider.test.d.ts +1 -0
- package/dist/integrations/secrets/scaleway-secret-manager.d.ts +35 -0
- package/dist/integrations/secrets/scaleway-secret-manager.js +375 -0
- package/dist/integrations/secrets-types.d.ts +14 -0
- package/dist/integrations/secrets-types.js +1 -0
- package/dist/integrations/spec.d.ts +72 -0
- package/dist/integrations/spec.js +22 -0
- package/dist/integrations/spec.test.d.ts +1 -0
- package/dist/node/index.js +3675 -0
- package/dist/node/integrations/binding.js +0 -0
- package/dist/node/integrations/connection.js +0 -0
- package/dist/node/integrations/docs/integrations.docblock.js +109 -0
- package/dist/node/integrations/health.js +72 -0
- package/dist/node/integrations/index.js +3263 -0
- package/dist/node/integrations/integrations.capability.js +17 -0
- package/dist/node/integrations/integrations.feature.js +32 -0
- package/dist/node/integrations/meeting-recorder/contracts/index.js +473 -0
- package/dist/node/integrations/meeting-recorder/contracts/meetings.js +218 -0
- package/dist/node/integrations/meeting-recorder/contracts/transcripts.js +286 -0
- package/dist/node/integrations/meeting-recorder/contracts/webhooks.js +171 -0
- package/dist/node/integrations/meeting-recorder/meeting-recorder.capability.js +17 -0
- package/dist/node/integrations/meeting-recorder/meeting-recorder.feature.js +32 -0
- package/dist/node/integrations/meeting-recorder/models.js +121 -0
- package/dist/node/integrations/meeting-recorder/telemetry.js +53 -0
- package/dist/node/integrations/openbanking/contracts/accounts.js +327 -0
- package/dist/node/integrations/openbanking/contracts/balances.js +291 -0
- package/dist/node/integrations/openbanking/contracts/index.js +643 -0
- package/dist/node/integrations/openbanking/contracts/transactions.js +297 -0
- package/dist/node/integrations/openbanking/guards.js +41 -0
- package/dist/node/integrations/openbanking/models.js +109 -0
- package/dist/node/integrations/openbanking/openbanking.capability.js +17 -0
- package/dist/node/integrations/openbanking/openbanking.feature.js +34 -0
- package/dist/node/integrations/openbanking/telemetry.js +50 -0
- package/dist/node/integrations/operations.js +296 -0
- package/dist/node/integrations/providers/analytics-reader.js +0 -0
- package/dist/node/integrations/providers/analytics-writer.js +0 -0
- package/dist/node/integrations/providers/analytics.js +0 -0
- package/dist/node/integrations/providers/calendar.js +0 -0
- package/dist/node/integrations/providers/database.js +0 -0
- package/dist/node/integrations/providers/elevenlabs.js +85 -0
- package/dist/node/integrations/providers/email.js +0 -0
- package/dist/node/integrations/providers/embedding.js +0 -0
- package/dist/node/integrations/providers/fal.js +111 -0
- package/dist/node/integrations/providers/fathom.js +125 -0
- package/dist/node/integrations/providers/fireflies.js +105 -0
- package/dist/node/integrations/providers/gcs-storage.js +96 -0
- package/dist/node/integrations/providers/gmail.js +108 -0
- package/dist/node/integrations/providers/google-calendar.js +91 -0
- package/dist/node/integrations/providers/gradium.js +109 -0
- package/dist/node/integrations/providers/granola.js +106 -0
- package/dist/node/integrations/providers/index.js +2093 -0
- package/dist/node/integrations/providers/jira.js +107 -0
- package/dist/node/integrations/providers/linear.js +106 -0
- package/dist/node/integrations/providers/llm.js +0 -0
- package/dist/node/integrations/providers/meeting-recorder.js +0 -0
- package/dist/node/integrations/providers/mistral.js +93 -0
- package/dist/node/integrations/providers/notion.js +112 -0
- package/dist/node/integrations/providers/openbanking.js +0 -0
- package/dist/node/integrations/providers/payments.js +0 -0
- package/dist/node/integrations/providers/posthog-llm-telemetry.js +175 -0
- package/dist/node/integrations/providers/posthog.js +105 -0
- package/dist/node/integrations/providers/postmark.js +97 -0
- package/dist/node/integrations/providers/powens.js +123 -0
- package/dist/node/integrations/providers/project-management.js +0 -0
- package/dist/node/integrations/providers/qdrant.js +100 -0
- package/dist/node/integrations/providers/registry.js +1877 -0
- package/dist/node/integrations/providers/sms.js +0 -0
- package/dist/node/integrations/providers/storage.js +0 -0
- package/dist/node/integrations/providers/stripe.js +104 -0
- package/dist/node/integrations/providers/supabase-postgres.js +86 -0
- package/dist/node/integrations/providers/supabase-vector.js +106 -0
- package/dist/node/integrations/providers/tldv.js +105 -0
- package/dist/node/integrations/providers/twilio-sms.js +90 -0
- package/dist/node/integrations/providers/vector-store.js +0 -0
- package/dist/node/integrations/providers/voice.js +0 -0
- package/dist/node/integrations/runtime.js +208 -0
- package/dist/node/integrations/secrets/aws-secret-manager.js +345 -0
- package/dist/node/integrations/secrets/env-secret-provider.js +158 -0
- package/dist/node/integrations/secrets/gcp-secret-manager.js +346 -0
- package/dist/node/integrations/secrets/index.js +1128 -0
- package/dist/node/integrations/secrets/manager.js +182 -0
- package/dist/node/integrations/secrets/provider.js +73 -0
- package/dist/node/integrations/secrets/scaleway-secret-manager.js +374 -0
- package/dist/node/integrations/secrets-types.js +0 -0
- package/dist/node/integrations/spec.js +21 -0
- package/package.json +1029 -0
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// src/integrations/docs/integrations.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs/registry";
|
|
3
|
+
var tech_contracts_integrations_DocBlocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.tech.contracts.integrations",
|
|
6
|
+
title: "ContractSpec Integrations",
|
|
7
|
+
summary: "Provider-agnostic integration contracts: specs, connections, secrets, health checks, and runtime guards.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/tech/contracts/integrations",
|
|
11
|
+
tags: ["tech", "contracts", "integrations"],
|
|
12
|
+
body: `# ContractSpec Integrations
|
|
13
|
+
|
|
14
|
+
This document describes the integration architecture that powers ContractSpec-based apps. It focuses on provider-agnostic contracts, secret management, health checks, and runtime guards.
|
|
15
|
+
|
|
16
|
+
## Core Concepts
|
|
17
|
+
|
|
18
|
+
- **IntegrationSpec** – declarative description of a provider that lists supported ownership modes, capability mappings, configuration schema, secret schema, health check policy, and documentation metadata.
|
|
19
|
+
- **IntegrationConnection** – tenant/environment binding to a provider (\`meta\` + ownership mode + config + \`secretRef\`). Secrets are never embedded in specs or configs.
|
|
20
|
+
- **AppIntegrationSlot** – blueprint-level requirement that declares which integration categories/capabilities must be satisfied at runtime (e.g. \`primaryLLM\`, \`primaryVectorDb\`).
|
|
21
|
+
- **AppIntegrationBinding** – tenant-level slot → connection mapping.
|
|
22
|
+
- **ResolvedIntegration** – runtime view containing slot metadata, connection details, and the resolved IntegrationSpec.
|
|
23
|
+
|
|
24
|
+
## Registered Providers
|
|
25
|
+
|
|
26
|
+
The contracts library ships twenty-two priority providers in \`packages/libs/contracts/src/integrations/providers\`:
|
|
27
|
+
|
|
28
|
+
| Category | Provider | Key | Notes |
|
|
29
|
+
| ------------- | ---------------- | --------------------------- | ------------------------------------------------- |
|
|
30
|
+
| payments | Stripe | \`payments.stripe\` | Card + invoice flows, managed or BYOK credentials |
|
|
31
|
+
| email (out) | Postmark | \`email.postmark\` | Transactional email delivery |
|
|
32
|
+
| email (in) | Gmail API | \`email.gmail\` | Thread ingestion (OAuth BYOK or service account) |
|
|
33
|
+
| calendar | Google Calendar | \`calendar.google\` | Event scheduling via service account |
|
|
34
|
+
| analytics | PostHog | \`analytics.posthog\` | Product analytics, flags, and HogQL queries |
|
|
35
|
+
| vector-db | Qdrant | \`vectordb.qdrant\` | Embedding storage & search |
|
|
36
|
+
| vector-db | Supabase pgvector| \`vectordb.supabase\` | Embedding storage & search on Supabase Postgres |
|
|
37
|
+
| database | Supabase Postgres| \`database.supabase\` | SQL queries and transactions on Supabase Postgres |
|
|
38
|
+
| storage | Google Cloud | \`storage.gcs\` | Object storage |
|
|
39
|
+
| ai-llm | Mistral | \`ai-llm.mistral\` | Primary chat + embedding provider |
|
|
40
|
+
| ai-voice | ElevenLabs | \`ai-voice.elevenlabs\` | Text-to-speech synthesis |
|
|
41
|
+
| ai-voice | Gradium | \`ai-voice.gradium\` | Low-latency text-to-speech synthesis |
|
|
42
|
+
| ai-voice | Fal Chatterbox | \`ai-voice.fal\` | Chatterbox text-to-speech via queue API |
|
|
43
|
+
| sms | Twilio SMS | \`sms.twilio\` | Urgent and fallback reminders |
|
|
44
|
+
| open-banking | Powens | \`openbanking.powens\` | Read-only account, transaction, and balance sync |
|
|
45
|
+
| project-management | Linear | \`project-management.linear\` | Issues, project tracking, and team tasks |
|
|
46
|
+
| project-management | Jira Cloud | \`project-management.jira\` | Work item sync for Jira Cloud |
|
|
47
|
+
| project-management | Notion | \`project-management.notion\` | Shared summaries and task databases |
|
|
48
|
+
| meeting-recorder | Granola | \`meeting-recorder.granola\` | Meeting notes + transcripts via API or MCP |
|
|
49
|
+
| meeting-recorder | tl;dv | \`meeting-recorder.tldv\` | Meeting recordings, transcripts, and webhooks |
|
|
50
|
+
| meeting-recorder | Fireflies | \`meeting-recorder.fireflies\` | GraphQL transcripts + webhook events |
|
|
51
|
+
| meeting-recorder | Fathom | \`meeting-recorder.fathom\` | External API meetings + webhook registration |
|
|
52
|
+
|
|
53
|
+
PostHog adapters also support read access (events, persons, insights, cohorts, annotations) via analytics providers.
|
|
54
|
+
|
|
55
|
+
Each provider ships with:
|
|
56
|
+
|
|
57
|
+
- Strongly typed adapter interfaces (\`payments.ts\`, \`llm.ts\`, etc.)
|
|
58
|
+
- A concrete SDK-backed implementation under \`providers/impls\`
|
|
59
|
+
- Unit tests validating adapter behaviour and health checks
|
|
60
|
+
|
|
61
|
+
### Example package
|
|
62
|
+
|
|
63
|
+
- Supabase dual-store example (vector + SQL): \`@contractspec/example.integration-supabase\`
|
|
64
|
+
|
|
65
|
+
### Canonical registry builder
|
|
66
|
+
|
|
67
|
+
To list all shipped specs at runtime, use:
|
|
68
|
+
|
|
69
|
+
- \`createDefaultIntegrationSpecRegistry()\` from \`@contractspec/lib.contracts-integrations\`
|
|
70
|
+
|
|
71
|
+
## Secret Management
|
|
72
|
+
|
|
73
|
+
All integrations rely on the \`SecretProvider\` abstraction defined in \`integrations/secrets\`. Providers ship with the contracts library and are orchestrated by the \`SecretProviderManager\` composite:
|
|
74
|
+
|
|
75
|
+
- **EnvSecretProvider** (\`env-secret-provider.ts\`) – high-priority, read-only overrides backed by environment variables.
|
|
76
|
+
- Supports the \`env://VARIABLE_NAME\` scheme
|
|
77
|
+
- Supports overrides for other schemes via \`?env=ALIAS\` or derived uppercase keys
|
|
78
|
+
- **GcpSecretManagerProvider** (\`gcp-secret-manager.ts\`) – versioned secrets stored in Google Cloud Secret Manager.
|
|
79
|
+
- Example: \`gcp://projects/demo/secrets/stripe-key/versions/latest\`
|
|
80
|
+
- **AwsSecretsManagerProvider** (\`aws-secret-manager.ts\`) – AWS Secrets Manager backend.
|
|
81
|
+
- Example: \`aws://secretsmanager/eu-west-1/my-secret?version=AWSCURRENT\`
|
|
82
|
+
- Region may be in the reference or provided via \`AWS_REGION\` / \`AWS_DEFAULT_REGION\`
|
|
83
|
+
- **ScalewaySecretManagerProvider** (\`scaleway-secret-manager.ts\`) – Scaleway Secret Manager backend.
|
|
84
|
+
- Example (id): \`scw://secret-manager/fr-par/1234...-uuid?version=latest\`
|
|
85
|
+
- Example (name, create+write): \`scw://secret-manager/fr-par/my-secret-name\`
|
|
86
|
+
- Requires \`SCW_SECRET_KEY\` (token) and \`SCW_DEFAULT_PROJECT_ID\` when creating secrets by name
|
|
87
|
+
|
|
88
|
+
The manager attempts providers in priority order (environment first, then cloud providers). Key points:
|
|
89
|
+
|
|
90
|
+
- \`secretRef\` is a URI-like reference; raw secrets are never returned.
|
|
91
|
+
- \`IntegrationCallGuard\` fetches and parses secrets before executing a provider adapter.
|
|
92
|
+
- Local development can rely on \`.env\` files, while staging/production reference cloud secret stores.
|
|
93
|
+
|
|
94
|
+
## Health Checks & Telemetry
|
|
95
|
+
|
|
96
|
+
- Each IntegrationSpec optionally declares \`healthCheck.method\` and timeouts.
|
|
97
|
+
- \`IntegrationCallGuard\` enforces connection status, wraps retries with exponential back-off, and emits telemetry events tagged with tenant/app/slot metadata.
|
|
98
|
+
- Validation rules (\`app-config/validation.ts\`) surface issues at publish time (slot mismatch, unsupported ownership modes, missing capabilities, etc.).
|
|
99
|
+
|
|
100
|
+
## Studio persistence (ContractSpec Studio)
|
|
101
|
+
|
|
102
|
+
ContractSpec Studio persists tenant \`IntegrationConnection\` records in Postgres (Prisma model \`IntegrationConnection\` in \`@contractspec/lib.database-studio\`) and exposes a platform-admin management surface (see the Studio platform admin panel).
|
|
103
|
+
`
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
registerDocBlocks(tech_contracts_integrations_DocBlocks);
|
|
107
|
+
export {
|
|
108
|
+
tech_contracts_integrations_DocBlocks
|
|
109
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// src/integrations/health.ts
|
|
2
|
+
class IntegrationHealthService {
|
|
3
|
+
telemetry;
|
|
4
|
+
nowFn;
|
|
5
|
+
constructor(options = {}) {
|
|
6
|
+
this.telemetry = options.telemetry;
|
|
7
|
+
this.nowFn = options.now ?? (() => new Date);
|
|
8
|
+
}
|
|
9
|
+
async check(context, executor) {
|
|
10
|
+
const start = this.nowFn();
|
|
11
|
+
try {
|
|
12
|
+
await executor(context);
|
|
13
|
+
const end = this.nowFn();
|
|
14
|
+
const result = {
|
|
15
|
+
status: "connected",
|
|
16
|
+
checkedAt: end,
|
|
17
|
+
latencyMs: end.getTime() - start.getTime()
|
|
18
|
+
};
|
|
19
|
+
this.emitTelemetry(context, result, "success");
|
|
20
|
+
return result;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
const end = this.nowFn();
|
|
23
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
24
|
+
const code = extractErrorCode(error);
|
|
25
|
+
const result = {
|
|
26
|
+
status: "error",
|
|
27
|
+
checkedAt: end,
|
|
28
|
+
latencyMs: end.getTime() - start.getTime(),
|
|
29
|
+
errorMessage: message,
|
|
30
|
+
errorCode: code
|
|
31
|
+
};
|
|
32
|
+
this.emitTelemetry(context, result, "error", code, message);
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
emitTelemetry(context, result, status, errorCode, errorMessage) {
|
|
37
|
+
if (!this.telemetry)
|
|
38
|
+
return;
|
|
39
|
+
this.telemetry.record({
|
|
40
|
+
tenantId: context.tenantId,
|
|
41
|
+
appId: context.appId,
|
|
42
|
+
environment: context.environment,
|
|
43
|
+
slotId: context.slotId,
|
|
44
|
+
integrationKey: context.spec.meta.key,
|
|
45
|
+
integrationVersion: context.spec.meta.version,
|
|
46
|
+
connectionId: context.connection.meta.id,
|
|
47
|
+
status,
|
|
48
|
+
durationMs: result.latencyMs,
|
|
49
|
+
errorCode,
|
|
50
|
+
errorMessage,
|
|
51
|
+
occurredAt: result.checkedAt ?? this.nowFn(),
|
|
52
|
+
metadata: {
|
|
53
|
+
...context.trace ? {
|
|
54
|
+
blueprint: `${context.trace.blueprintName}.v${context.trace.blueprintVersion}`,
|
|
55
|
+
configVersion: context.trace.configVersion
|
|
56
|
+
} : {},
|
|
57
|
+
status: result.status
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function extractErrorCode(error) {
|
|
63
|
+
if (!error || typeof error !== "object")
|
|
64
|
+
return;
|
|
65
|
+
const candidate = error;
|
|
66
|
+
if (candidate.code == null)
|
|
67
|
+
return;
|
|
68
|
+
return String(candidate.code);
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
IntegrationHealthService
|
|
72
|
+
};
|