@contractspec/example.integration-hub 3.7.6 → 3.8.2

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.
Files changed (57) hide show
  1. package/README.md +73 -183
  2. package/dist/connection/index.d.ts +1 -1
  3. package/dist/docs/index.js +2 -1
  4. package/dist/docs/integration-hub.docblock.js +2 -1
  5. package/dist/events.js +1 -1
  6. package/dist/index.d.ts +5 -4
  7. package/dist/index.js +1243 -749
  8. package/dist/integration/index.d.ts +1 -1
  9. package/dist/integration-hub.feature.js +202 -0
  10. package/dist/node/docs/index.js +2 -1
  11. package/dist/node/docs/integration-hub.docblock.js +2 -1
  12. package/dist/node/events.js +1 -1
  13. package/dist/node/index.js +1243 -749
  14. package/dist/node/integration-hub.feature.js +202 -0
  15. package/dist/node/ui/IntegrationDashboard.js +654 -180
  16. package/dist/node/ui/IntegrationDashboard.visualizations.js +250 -0
  17. package/dist/node/ui/hooks/index.js +1 -1
  18. package/dist/node/ui/hooks/useIntegrationData.js +1 -1
  19. package/dist/node/ui/index.js +970 -485
  20. package/dist/node/ui/renderers/index.js +216 -5
  21. package/dist/node/ui/renderers/integration.markdown.js +216 -5
  22. package/dist/node/ui/tables/ConnectionsTable.js +211 -0
  23. package/dist/node/ui/tables/IntegrationTables.js +361 -0
  24. package/dist/node/ui/tables/SyncConfigsTable.js +230 -0
  25. package/dist/node/ui/tables/integration-table.shared.js +84 -0
  26. package/dist/node/visualizations/catalog.js +137 -0
  27. package/dist/node/visualizations/index.js +211 -0
  28. package/dist/node/visualizations/selectors.js +204 -0
  29. package/dist/sync/index.d.ts +3 -3
  30. package/dist/ui/IntegrationDashboard.js +654 -180
  31. package/dist/ui/IntegrationDashboard.visualizations.d.ts +6 -0
  32. package/dist/ui/IntegrationDashboard.visualizations.js +251 -0
  33. package/dist/ui/hooks/index.d.ts +1 -1
  34. package/dist/ui/hooks/index.js +1 -1
  35. package/dist/ui/hooks/useIntegrationData.js +1 -1
  36. package/dist/ui/index.d.ts +2 -2
  37. package/dist/ui/index.js +970 -485
  38. package/dist/ui/renderers/index.d.ts +1 -1
  39. package/dist/ui/renderers/index.js +216 -5
  40. package/dist/ui/renderers/integration.markdown.js +216 -5
  41. package/dist/ui/tables/ConnectionsTable.d.ts +4 -0
  42. package/dist/ui/tables/ConnectionsTable.js +212 -0
  43. package/dist/ui/tables/IntegrationTables.d.ts +2 -0
  44. package/dist/ui/tables/IntegrationTables.js +362 -0
  45. package/dist/ui/tables/IntegrationTables.smoke.test.d.ts +1 -0
  46. package/dist/ui/tables/SyncConfigsTable.d.ts +4 -0
  47. package/dist/ui/tables/SyncConfigsTable.js +231 -0
  48. package/dist/ui/tables/integration-table.shared.d.ts +18 -0
  49. package/dist/ui/tables/integration-table.shared.js +85 -0
  50. package/dist/visualizations/catalog.d.ts +11 -0
  51. package/dist/visualizations/catalog.js +138 -0
  52. package/dist/visualizations/index.d.ts +2 -0
  53. package/dist/visualizations/index.js +212 -0
  54. package/dist/visualizations/selectors.d.ts +10 -0
  55. package/dist/visualizations/selectors.js +205 -0
  56. package/dist/visualizations/selectors.test.d.ts +1 -0
  57. package/package.json +110 -12
package/README.md CHANGED
@@ -1,193 +1,83 @@
1
1
  # @contractspec/example.integration-hub
2
2
 
3
- Website: https://contractspec.io/
3
+ Website: https://contractspec.io
4
4
 
5
- A comprehensive integration hub example demonstrating ContractSpec principles for data synchronization.
5
+ **Integration Hub example with sync engine and field mappings for ContractSpec.**
6
6
 
7
- ## Features
7
+ ## What This Demonstrates
8
8
 
9
- - **Multi-Provider Support**: Connect to various external systems (Salesforce, HubSpot, etc.)
10
- - **Voice Provider Coverage**: Includes seeded examples for `ai-voice.gradium` and `ai-voice.fal`
11
- - **Analytics Coverage**: Includes seeded examples for PostHog analytics
12
- - **Bidirectional Sync**: INBOUND, OUTBOUND, or BIDIRECTIONAL data flow
13
- - **Field Mapping**: Configurable field mappings with transforms
14
- - **Sync Engine**: Change detection, deduplication, and error handling
15
- - **Scheduled Sync**: Cron-based scheduled synchronization
16
- - **Feature Flag Integration**: Control integration availability
17
- - **Full Audit Trail**: Track all sync operations
18
- - **MCP-Ready Providers**: Supports provider configs that call remote MCP tools
19
- - **Health Strategy Routing**: Supports `health.*` providers with official, aggregator, and gated unofficial fallback transports
9
+ - Connection management with typed schemas and enums.
10
+ - Integration lifecycle (create, configure, sync).
11
+ - Sync engine with field mapping and status tracking.
12
+ - MCP server example for tool integration.
13
+ - Capability and feature definition patterns.
14
+ - React UI with dashboard, hooks, markdown renderers, and shared ContractSpec tables for connections and sync configs.
15
+ - Contract-backed visualizations for integration mix, connection health, and sync-state comparison.
16
+ - Client-mode table capabilities including sorting, pagination, column visibility, pinning, resizing, and expanded operational details.
17
+ - Event definitions and operation test-specs.
20
18
 
21
- ## Entities
19
+ ## Running Locally
22
20
 
23
- ### Core
24
-
25
- - `Integration` - Integration definition
26
- - `Connection` - Authenticated connection to external system
27
- - `SyncConfig` - Sync configuration for object pairs
28
- - `FieldMapping` - Field-level mapping configuration
29
-
30
- ### Sync Execution
31
-
32
- - `SyncRun` - A single sync execution
33
- - `SyncLog` - Log entries for a sync run
34
- - `SyncRecord` - Tracks synced records for deduplication
35
-
36
- ## Contracts
37
-
38
- ### Integration Management
39
-
40
- - `integration.create` - Create a new integration
41
- - `integration.connection.create` - Create a connection
42
-
43
- ### Sync Configuration
44
-
45
- - `integration.syncConfig.create` - Create sync config
46
- - `integration.fieldMapping.add` - Add field mapping
47
-
48
- ### Sync Execution
49
-
50
- - `integration.sync.trigger` - Trigger manual sync
51
- - `integration.syncRun.list` - List sync history
52
-
53
- ## Field Mapping Types
54
-
55
- - **DIRECT**: Direct field copy
56
- - **TRANSFORM**: Apply transformation expression
57
- - **LOOKUP**: Lookup from another object
58
- - **CONSTANT**: Fixed value
59
- - **COMPUTED**: Computed from multiple fields
60
-
61
- ## Sync Engine
62
-
63
- The sync engine handles:
64
-
65
- 1. **Change Detection**: Uses checksums to detect changes
66
- 2. **Transformation**: Applies field mappings
67
- 3. **Validation**: Validates required fields
68
- 4. **Deduplication**: Tracks synced records
69
-
70
- ```typescript
71
- import { createSyncEngine, BasicFieldTransformer } from '@contractspec/example.integration-hub/sync-engine';
72
-
73
- const engine = createSyncEngine();
74
-
75
- const result = engine.transformRecord(
76
- { id: '123', data: { FirstName: 'John', LastName: 'Doe' } },
77
- [
78
- { sourceField: 'FirstName', targetField: 'first_name', mappingType: 'DIRECT' },
79
- { sourceField: 'LastName', targetField: 'last_name', mappingType: 'TRANSFORM', transformExpression: 'uppercase' },
80
- ],
81
- context
82
- );
83
- // { id: '123', data: { first_name: 'John', last_name: 'DOE' } }
84
- ```
85
-
86
- ## Transform Expressions
87
-
88
- - `uppercase` - Convert to uppercase
89
- - `lowercase` - Convert to lowercase
90
- - `trim` - Trim whitespace
91
- - `default:value` - Set default value
92
- - `concat:separator` - Join array
93
- - `split:separator` - Split string
94
- - `number` - Convert to number
95
- - `boolean` - Convert to boolean
96
- - `string` - Convert to string
97
-
98
- ## Events
99
-
100
- - `integration.created` - Integration created
101
- - `integration.connection.created` - Connection created
102
- - `integration.connection.statusChanged` - Connection status changed
103
- - `integration.syncConfig.created` - Sync config created
104
- - `integration.sync.started` - Sync started
105
- - `integration.sync.completed` - Sync completed
106
- - `integration.sync.failed` - Sync failed
107
- - `integration.record.synced` - Record synced
21
+ From `packages/examples/integration-hub`:
22
+ - `bun run dev`
23
+ - `bun run build`
24
+ - `bun run test`
25
+ - `bun run typecheck`
108
26
 
109
27
  ## Usage
110
28
 
111
- ```typescript
112
- import {
113
- CreateIntegrationContract,
114
- CreateSyncConfigContract,
115
- TriggerSyncContract,
116
- integrationHubSchemaContribution
117
- } from '@contractspec/example.integration-hub';
118
-
119
- // Create integration
120
- const integration = await executeContract(CreateIntegrationContract, {
121
- name: 'Salesforce CRM',
122
- slug: 'salesforce-crm',
123
- provider: 'salesforce',
124
- });
125
-
126
- // Create sync config
127
- const syncConfig = await executeContract(CreateSyncConfigContract, {
128
- integrationId: integration.id,
129
- connectionId: connection.id,
130
- name: 'Contacts Sync',
131
- direction: 'BIDIRECTIONAL',
132
- sourceObject: 'Contact',
133
- targetObject: 'contacts',
134
- });
135
-
136
- // Trigger sync
137
- const run = await executeContract(TriggerSyncContract, {
138
- syncConfigId: syncConfig.id,
139
- });
140
- ```
141
-
142
- ## MCP Provider Wiring
143
-
144
- Provider adapters in this workspace can be configured to call MCP endpoints
145
- (for example `mcpUrl` + headers/tokens on analytics providers, or transport
146
- selection for meeting recorder providers). This example remains provider-agnostic,
147
- so MCP transport details stay in provider config rather than contract logic.
148
-
149
- For health integrations, configure strategy routing at the connection level using
150
- `defaultTransport`, `strategyOrder`, `allowUnofficial`, `unofficialAllowList`,
151
- and optionally `oauthTokenUrl` for refresh-token flows.
152
- This keeps official and aggregator transports deterministic while requiring
153
- explicit opt-in before unofficial automation routes are used.
154
-
155
- ## Run MCP Example
156
-
157
- This package now includes a runnable MCP connectivity example:
158
- `src/run-mcp.ts`.
159
-
160
- List MCP tools from a local stdio server (default):
161
-
162
- ```bash
163
- export CONTRACTSPEC_INTEGRATION_HUB_MCP_TRANSPORT="stdio"
164
- export CONTRACTSPEC_INTEGRATION_HUB_MCP_COMMAND="npx"
165
- export CONTRACTSPEC_INTEGRATION_HUB_MCP_ARGS_JSON='["-y","@modelcontextprotocol/server-filesystem","."]'
166
-
167
- bun run --filter @contractspec/example.integration-hub run:mcp
168
- ```
169
-
170
- Call a specific MCP tool:
171
-
172
- ```bash
173
- export CONTRACTSPEC_INTEGRATION_HUB_MCP_MODE="call"
174
- export CONTRACTSPEC_INTEGRATION_HUB_MCP_TOOL_NAME="read_file"
175
- export CONTRACTSPEC_INTEGRATION_HUB_MCP_TOOL_ARGS_JSON='{"path":"README.md"}'
176
-
177
- bun run --filter @contractspec/example.integration-hub run:mcp
178
- ```
179
-
180
- Remote MCP transport is also supported via:
181
-
182
- - `CONTRACTSPEC_INTEGRATION_HUB_MCP_TRANSPORT=http|sse`
183
- - `CONTRACTSPEC_INTEGRATION_HUB_MCP_URL`
184
- - `CONTRACTSPEC_INTEGRATION_HUB_MCP_HEADERS_JSON` (optional)
185
- - `CONTRACTSPEC_INTEGRATION_HUB_MCP_ACCESS_TOKEN` or `..._ACCESS_TOKEN_ENV` (optional)
186
-
187
- ## Dependencies
188
-
189
- - `@contractspec/lib.identity-rbac` - User identity and roles
190
- - `@contractspec/lib.feature-flags` - Feature flag control
191
- - `@contractspec/lib.files` - Import/export file handling
192
- - `@contractspec/lib.jobs` - Background sync jobs
193
- - `@contractspec/module.audit-trail` - Action auditing
29
+ Use `@contractspec/example.integration-hub` as a reference implementation, or import its exported surfaces into a workspace that composes ContractSpec examples and bundles.
30
+
31
+ ## Architecture
32
+
33
+ - `src/connection` is part of the package's public or composition surface.
34
+ - `src/docs/` contains docblocks and documentation-facing exports.
35
+ - `src/events.ts` is package-level event definitions.
36
+ - `src/example.ts` is the runnable example entrypoint.
37
+ - `src/handlers/` contains handlers or demo adapters wired to contract surfaces.
38
+ - `src/index.ts` is the root public barrel and package entrypoint.
39
+ - `src/integration` is part of the package's public or composition surface.
40
+
41
+ ## Public Entry Points
42
+
43
+ - Export `.` resolves through `./src/index.ts`.
44
+ - Export `./connection` resolves through `./src/connection/index.ts`.
45
+ - Export `./connection/connection.enum` resolves through `./src/connection/connection.enum.ts`.
46
+ - Export `./connection/connection.operation` resolves through `./src/connection/connection.operation.ts`.
47
+ - Export `./connection/connection.presentation` resolves through `./src/connection/connection.presentation.ts`.
48
+ - Export `./connection/connection.schema` resolves through `./src/connection/connection.schema.ts`.
49
+ - Export `./docs` resolves through `./src/docs/index.ts`.
50
+ - Export `./docs/integration-hub.docblock` resolves through `./src/docs/integration-hub.docblock.ts`.
51
+ - Export `./events` resolves through `./src/events.ts`.
52
+ - Export `./example` resolves through `./src/example.ts`.
53
+ - The package publishes 36 total export subpaths; keep docs aligned with `package.json`.
54
+
55
+ ## Local Commands
56
+
57
+ - `bun run dev` — contractspec-bun-build dev
58
+ - `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
59
+ - `bun run lint` — bun lint:fix
60
+ - `bun run lint:check` — biome check .
61
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
62
+ - `bun run typecheck` tsc --noEmit
63
+ - `bun run validate` contractspec validate "src/**/*"
64
+ - `bun run publish:pkg` bun publish --tolerate-republish --ignore-scripts --verbose
65
+ - `bun run publish:pkg:canary` bun publish:pkg --tag canary
66
+ - `bun run clean` — rimraf dist .turbo
67
+ - `bun run build:bundle` contractspec-bun-build transpile
68
+ - `bun run build:types` — contractspec-bun-build types
69
+ - `bun run run:mcp` bun tsx src/run-mcp.ts
70
+ - `bun run prebuild` contractspec-bun-build prebuild
71
+
72
+ ## Recent Updates
73
+
74
+ - Replace eslint+prettier by biomejs to optimize speed.
75
+ - Vnext ai-native.
76
+ - Missing contract layers.
77
+ - Resolve lint, build, and type errors across nine packages.
78
+ - Add Composio universal fallback, fix provider-ranking types, and expand package exports.
79
+ - Add first-class transport, auth, versioning, and BYOK support across all integrations.
80
+
81
+ ## Notes
82
+
83
+ - Works alongside `@contractspec/lib.ai-agent`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.design-system`, `@contractspec/lib.example-shared-ui`, `@contractspec/lib.runtime-sandbox`, ...
@@ -2,5 +2,5 @@
2
2
  * Connection domain - Connection management.
3
3
  */
4
4
  export { ConnectionStatusEnum } from './connection.enum';
5
- export { ConnectionModel, CreateConnectionInputModel, } from './connection.schema';
6
5
  export { CreateConnectionContract } from './connection.operation';
6
+ export { ConnectionModel, CreateConnectionInputModel, } from './connection.schema';
@@ -27,7 +27,7 @@ var integrationHubDocBlocks = [
27
27
 
28
28
  ## UI / Presentations
29
29
 
30
- - Dashboard, integration list, connection detail, sync config editor.
30
+ - Dashboard, integration list, connection detail, sync config editor, and shared ContractSpec tables for connections/sync configs.
31
31
  - Templates registered as \`integration-hub\` in Template Registry.
32
32
 
33
33
  ## Notes
@@ -35,6 +35,7 @@ var integrationHubDocBlocks = [
35
35
  - Providers remain agnostic; keep mappings declarative for safe regeneration.
36
36
  - Seed data includes voice integrations for \`ai-voice.gradium\` and \`ai-voice.fal\`.
37
37
  - Feature flags can gate specific providers; metering can track sync volume.
38
+ - The dashboard tables demonstrate client-mode sorting, pagination, visibility, pinning, resizing, and row expansion on the shared table stack.
38
39
  `
39
40
  },
40
41
  {
@@ -27,7 +27,7 @@ var integrationHubDocBlocks = [
27
27
 
28
28
  ## UI / Presentations
29
29
 
30
- - Dashboard, integration list, connection detail, sync config editor.
30
+ - Dashboard, integration list, connection detail, sync config editor, and shared ContractSpec tables for connections/sync configs.
31
31
  - Templates registered as \`integration-hub\` in Template Registry.
32
32
 
33
33
  ## Notes
@@ -35,6 +35,7 @@ var integrationHubDocBlocks = [
35
35
  - Providers remain agnostic; keep mappings declarative for safe regeneration.
36
36
  - Seed data includes voice integrations for \`ai-voice.gradium\` and \`ai-voice.fal\`.
37
37
  - Feature flags can gate specific providers; metering can track sync volume.
38
+ - The dashboard tables demonstrate client-mode sorting, pagination, visibility, pinning, resizing, and row expansion on the shared table stack.
38
39
  `
39
40
  },
40
41
  {
package/dist/events.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/events.ts
3
3
  import { defineEvent } from "@contractspec/lib.contracts-spec";
4
- import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
4
+ import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
5
5
  var IntegrationCreatedPayload = defineSchemaModel({
6
6
  name: "IntegrationCreatedPayload",
7
7
  description: "Payload when an integration is created",
package/dist/index.d.ts CHANGED
@@ -3,10 +3,11 @@
3
3
  *
4
4
  * Demonstrates a complete integration platform with connections and sync.
5
5
  */
6
- export * from './integration';
7
6
  export * from './connection';
8
- export * from './sync';
9
7
  export { createIntegrationHandlers, type IntegrationHandlers, } from './handlers/integration.handlers';
10
- export * from './ui';
11
- export * from './sync-engine';
8
+ export * from './integration';
12
9
  export * from './mcp-example';
10
+ export * from './sync';
11
+ export * from './sync-engine';
12
+ export * from './ui';
13
+ export * from './visualizations';