@tangle-network/agent-integrations 0.75.3 → 0.76.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +10 -14
  2. package/data/bundled-adapter-manifests.json +1 -1
  3. package/dist/{adapters-CrN3lR4d.js → adapters-Bx-UTWRg.js} +55 -8
  4. package/dist/{adapters-CrN3lR4d.js.map → adapters-Bx-UTWRg.js.map} +1 -1
  5. package/dist/{bundled-manifest-data-C7dav10o.js → bundled-manifest-data-BgTJ7dmp.js} +33 -1
  6. package/dist/{bundled-manifest-data-C7dav10o.js.map → bundled-manifest-data-BgTJ7dmp.js.map} +1 -1
  7. package/dist/{bundled-manifest-runtime-G6p2i9W-.d.ts → bundled-manifest-runtime-EpjLQKA9.d.ts} +7 -3
  8. package/dist/bundled-manifest-runtime-EpjLQKA9.d.ts.map +1 -0
  9. package/dist/{catalog-DmAjfp4i.d.ts → catalog-z4zNeXVL.d.ts} +3 -3
  10. package/dist/{catalog-DmAjfp4i.d.ts.map → catalog-z4zNeXVL.d.ts.map} +1 -1
  11. package/dist/catalog.d.ts +1 -1
  12. package/dist/{cloudbeds-BL5EF3xl.js → cloudbeds-CGSoT275.js} +17 -2
  13. package/dist/cloudbeds-CGSoT275.js.map +1 -0
  14. package/dist/connect/index.d.ts +1 -1
  15. package/dist/connect/index.js +1 -1
  16. package/dist/connectors/adapters/index.d.ts +2 -2
  17. package/dist/connectors/adapters/index.js +3 -3
  18. package/dist/connectors/index.d.ts +7 -7
  19. package/dist/connectors/index.js +8 -7
  20. package/dist/connectors/oauth.d.ts +2 -2
  21. package/dist/connectors/oauth.js +7 -205
  22. package/dist/connectors/oauth.js.map +1 -1
  23. package/dist/{consumer-BafUQUla.d.ts → consumer-YE5ibTlI.d.ts} +18 -9
  24. package/dist/consumer-YE5ibTlI.d.ts.map +1 -0
  25. package/dist/consumer.d.ts +1 -1
  26. package/dist/consumer.js +1 -1
  27. package/dist/{core-types-DfCMwTYt.d.ts → core-types-0BenSoZJ.d.ts} +17 -3
  28. package/dist/core-types-0BenSoZJ.d.ts.map +1 -0
  29. package/dist/{coverage-catalog-oQiZ8yot.d.ts → coverage-catalog-5LheuThC.d.ts} +2 -2
  30. package/dist/{coverage-catalog-oQiZ8yot.d.ts.map → coverage-catalog-5LheuThC.d.ts.map} +1 -1
  31. package/dist/coverage-catalog.d.ts +1 -1
  32. package/dist/{hub-D13zPQGr.js → hub-Cl8phyJ9.js} +316 -149
  33. package/dist/hub-Cl8phyJ9.js.map +1 -0
  34. package/dist/{hub-fmmnwC2s.d.ts → hub-DkiKVWJX.d.ts} +5 -3
  35. package/dist/hub-DkiKVWJX.d.ts.map +1 -0
  36. package/dist/hub.d.ts +1 -1
  37. package/dist/hub.js +1 -1
  38. package/dist/{index-DbwNiedC.d.ts → index-BFK-G6g1.d.ts} +2 -2
  39. package/dist/{index-DbwNiedC.d.ts.map → index-BFK-G6g1.d.ts.map} +1 -1
  40. package/dist/{index-CHD_8Gn2.d.ts → index-BNzWrQM0.d.ts} +3 -3
  41. package/dist/{index-CHD_8Gn2.d.ts.map → index-BNzWrQM0.d.ts.map} +1 -1
  42. package/dist/{index-B-VH5b3E.d.ts → index-CkCYzn8f.d.ts} +2 -2
  43. package/dist/{index-B-VH5b3E.d.ts.map → index-CkCYzn8f.d.ts.map} +1 -1
  44. package/dist/{index-BKTHRkGz.d.ts → index-WwSnaq5E.d.ts} +11 -2
  45. package/dist/{index-BKTHRkGz.d.ts.map → index-WwSnaq5E.d.ts.map} +1 -1
  46. package/dist/{index-CW1fmxQi.d.ts → index-poLalSQ6.d.ts} +3 -3
  47. package/dist/{index-CW1fmxQi.d.ts.map → index-poLalSQ6.d.ts.map} +1 -1
  48. package/dist/index.d.ts +18 -18
  49. package/dist/index.js +11 -10
  50. package/dist/internal/bundled-manifest-runtime.d.ts +1 -1
  51. package/dist/internal/bundled-manifest-runtime.js +30 -2
  52. package/dist/internal/bundled-manifest-runtime.js.map +1 -1
  53. package/dist/mcp.d.ts +2 -2
  54. package/dist/mcp.js +2 -2
  55. package/dist/middleware/index.d.ts +1 -1
  56. package/dist/middleware/index.js +1 -1
  57. package/dist/{oauth-tzsnaJIb.d.ts → oauth-DoUCpYU_.d.ts} +85 -64
  58. package/dist/oauth-DoUCpYU_.d.ts.map +1 -0
  59. package/dist/oauth-protocol-CFrGJlSz.js +195 -0
  60. package/dist/oauth-protocol-CFrGJlSz.js.map +1 -0
  61. package/dist/{policy-C9frNJFH.d.ts → policy-C8jynxf9.d.ts} +2 -2
  62. package/dist/{policy-C9frNJFH.d.ts.map → policy-C8jynxf9.d.ts.map} +1 -1
  63. package/dist/{registry-CE1iu5zX.d.ts → registry-0xWMSBUu.d.ts} +3 -3
  64. package/dist/{registry-CE1iu5zX.d.ts.map → registry-0xWMSBUu.d.ts.map} +1 -1
  65. package/dist/{registry-core-DtFI-9kF.d.ts → registry-core-B1ApiG47.d.ts} +2 -2
  66. package/dist/{registry-core-DtFI-9kF.d.ts.map → registry-core-B1ApiG47.d.ts.map} +1 -1
  67. package/dist/registry.d.ts +2 -2
  68. package/dist/registry.js +1 -1
  69. package/dist/runtime.d.ts +1 -1
  70. package/dist/sandbox.d.ts +1 -1
  71. package/dist/{specs-Dp7I8aL5.js → specs-02Un982U.js} +2 -2
  72. package/dist/{specs-Dp7I8aL5.js.map → specs-02Un982U.js.map} +1 -1
  73. package/dist/specs.d.ts +1 -1
  74. package/dist/specs.js +1 -1
  75. package/dist/{src-6gBH8WOq.js → src-VFvRn2yV.js} +13 -6
  76. package/dist/src-VFvRn2yV.js.map +1 -0
  77. package/dist/{tangle-id-Bq7jkKmE.d.ts → tangle-id-BW5dTiGi.d.ts} +2 -2
  78. package/dist/{tangle-id-Bq7jkKmE.d.ts.map → tangle-id-BW5dTiGi.d.ts.map} +1 -1
  79. package/dist/{tangle-id-81ShqJ7k.js → tangle-id-DUsy7I9_.js} +2 -2
  80. package/dist/{tangle-id-81ShqJ7k.js.map → tangle-id-DUsy7I9_.js.map} +1 -1
  81. package/dist/{types-W418mSuf.d.ts → types-Bq85dJDW.d.ts} +13 -1
  82. package/dist/types-Bq85dJDW.d.ts.map +1 -0
  83. package/dist/{types-BSDXGSi5.js → types-CjrugGcd.js} +13 -7
  84. package/dist/types-CjrugGcd.js.map +1 -0
  85. package/dist/webhooks/index.js +1 -1
  86. package/dist/worker.d.ts +3 -3
  87. package/package.json +1 -1
  88. package/dist/bundled-manifest-runtime-G6p2i9W-.d.ts.map +0 -1
  89. package/dist/cloudbeds-BL5EF3xl.js.map +0 -1
  90. package/dist/consumer-BafUQUla.d.ts.map +0 -1
  91. package/dist/core-types-DfCMwTYt.d.ts.map +0 -1
  92. package/dist/hub-D13zPQGr.js.map +0 -1
  93. package/dist/hub-fmmnwC2s.d.ts.map +0 -1
  94. package/dist/oauth-tzsnaJIb.d.ts.map +0 -1
  95. package/dist/src-6gBH8WOq.js.map +0 -1
  96. package/dist/types-BSDXGSi5.js.map +0 -1
  97. package/dist/types-W418mSuf.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub-Cl8phyJ9.js","names":["base64UrlEncode"],"sources":["../src/core-error.ts","../src/adapter-provider.ts","../src/credentials.ts","../src/hub.ts"],"sourcesContent":["/**\n * IntegrationError — the runtime error class thrown by the hub, providers,\n * adapters, and runtime helpers. Lives in its own module so any source\n * file can import it without pulling the package barrel (`./index.ts`)\n * and forming a cycle.\n *\n * The richer {@link IntegrationRuntimeError} (in `./errors.ts`) is a\n * separate, structured error type used by consumers wiring custom\n * error → HTTP-status mappings. `IntegrationError` is the legacy/canonical\n * throw shape kept for back-compat with everything that already catches it.\n */\n\nexport type IntegrationErrorRuntimeCode =\n | 'provider_not_found'\n | 'connector_not_found'\n | 'connection_not_found'\n | 'connection_not_active'\n | 'auth_not_supported'\n | 'capability_invalid'\n | 'capability_expired'\n | 'scope_denied'\n | 'action_denied'\n | 'action_not_found'\n | 'trigger_not_found'\n | 'approval_required'\n | 'policy_denied'\n | 'config_missing'\n | 'provider_failure'\n | 'credential_invalid'\n | 'credential_scope_invalid'\n | 'credential_rate_limited'\n | 'credential_probe_unsupported'\n | 'credential_persistence_failure'\n | 'connection_metadata_invalid'\n | 'connection_parameters_missing'\n | 'connection_parameters_invalid'\n\nexport class IntegrationError extends Error {\n constructor(\n message: string,\n readonly code: IntegrationErrorRuntimeCode,\n ) {\n super(message)\n this.name = 'IntegrationError'\n }\n}\n","import type {\n CapabilityMutationResult,\n CapabilityReadResult,\n ConnectorAdapter,\n ConnectorCredentials,\n ConnectorInvocation,\n OAuth2UrlTemplateMetadataSpec,\n ResolvedDataSource,\n} from './connectors/types.js'\nimport type {\n IntegrationActionRequest,\n IntegrationActionResult,\n IntegrationCatalogSource,\n IntegrationConnection,\n IntegrationConnector,\n IntegrationProvider,\n IntegrationProviderKind,\n} from './core-types.js'\nimport { CredentialsExpired, ProviderRateLimited, ProviderConfigError } from './connectors/types.js'\nimport { IntegrationError } from './core-error.js'\nimport { buildOAuthAuthorizationUrl, exchangeAuthorizationCode, redactOAuthSensitiveText, oauthClientCredentialRedactionValues, createOAuthBasicAuthorizationHeader } from './connectors/oauth-protocol.js'\n\n/** OAuth client credentials the host resolves at start/exchange time.\n * The lib never reads env or any vault — kept edge-runtime-safe. */\nexport interface OAuthClientCredentials {\n clientId: string\n /** Omit for public clients whose manifest uses tokenClientAuthMethod=none. */\n clientSecret?: string\n /** Business-login configuration; replaces per-request scopes. */\n configId?: string\n}\n\nexport interface ConnectorAdapterProviderOptions {\n id?: string\n kind?: IntegrationProviderKind\n adapters: ConnectorAdapter[]\n resolveDataSource: (connection: IntegrationConnection) => Promise<ResolvedDataSource> | ResolvedDataSource\n /** Invoked when an adapter rotates credentials during executeRead /\n * executeMutation (e.g. an OAuth access token refreshed on expiry). The\n * host re-encrypts + persists the rotated envelope so the next expiry\n * does not force a reconnect. Carries the connection so the host can\n * resolve the secretRef. */\n onCredentialsRotated?: (event: {\n connection: IntegrationConnection\n credentials: ConnectorCredentials\n }) => Promise<void> | void\n /** Resolve OAuth client_id and, for confidential clients, client_secret at\n * start- and exchange-time. Host owns env, vault, and per-tenant\n * overrides. Return null to refuse the flow (lib will throw\n * `config_missing`). The lib never logs the secret nor includes it\n * in thrown error messages. */\n resolveOAuthClient?: (input: { connectorId: string }) =>\n | Promise<OAuthClientCredentials | null>\n | OAuthClientCredentials\n | null\n /** Fetch implementation forwarded to the OAuth token exchange. Default\n * is `globalThis.fetch`. Tests inject a mock. */\n fetchImpl?: typeof fetch\n now?: () => Date\n /** Initial encrypted credential commit. Return the canonical reconnect id and secretRef. */\n persistConnection?: (input: { connection: IntegrationConnection; credentials: ConnectorCredentials }) => Promise<IntegrationConnection>\n /** Bounds provider work, including adapters that ignore cancellation. */\n operationTimeoutMs?: number\n}\n\nexport function createConnectorAdapterProvider(options: ConnectorAdapterProviderOptions): IntegrationProvider {\n const providerId = options.id ?? 'first-party'\n const now = options.now ?? (() => new Date())\n const fetchImpl = options.fetchImpl ?? (globalThis.fetch?.bind(globalThis) as typeof fetch | undefined)\n const adapters = new Map(options.adapters.filter((adapter) => !adapter.inboundOnly).map((adapter) => [adapter.manifest.kind, adapter]))\n const requireAdapter = (id: string) => {\n const adapter = adapters.get(id)\n if (!adapter) throw new IntegrationError(`Connector adapter ${id} not found.`, 'connector_not_found')\n if (adapter.catalogOnly) throw new IntegrationError(`Connector ${id} is not configured.`, 'config_missing')\n return adapter\n }\n const requireOAuth = (adapter: ConnectorAdapter) => {\n const auth = oauthManifestAuth(adapter.manifest.auth)\n if (!auth || (auth.grantType ?? 'authorization_code') !== 'authorization_code') {\n throw new IntegrationError(`Connector ${adapter.manifest.kind} does not support authorization-code OAuth.`, 'auth_not_supported')\n }\n return auth\n }\n const requireClient = async (connectorId: string, auth: NonNullable<ReturnType<typeof oauthManifestAuth>>) => {\n const client = await options.resolveOAuthClient?.({ connectorId })\n if (!client?.clientId || (auth.tokenClientAuthMethod !== 'none' && !client.clientSecret)) {\n throw new IntegrationError(`OAuth client credentials unavailable for ${connectorId}.`, 'config_missing')\n }\n if (auth.tokenClientAuthMethod && !['none', 'client_secret_post', 'client_secret_basic'].includes(auth.tokenClientAuthMethod)) {\n throw new IntegrationError('Unsupported OAuth token client authentication method.', 'config_missing')\n }\n return client\n }\n const commit = async (connection: IntegrationConnection, credentials: ConnectorCredentials) => {\n if (!options.persistConnection) throw new IntegrationError('An encrypted credential commit is required.', 'config_missing')\n try {\n const stored = await options.persistConnection({ connection, credentials })\n if (!stored.id || !stored.secretRef?.id || stored.owner.id !== connection.owner.id || stored.owner.type !== connection.owner.type\n || stored.providerId !== connection.providerId || stored.connectorId !== connection.connectorId) throw new Error('Invalid credential commit result.')\n return stored\n } catch (cause) { throw new IntegrationError('Credential commit rejected.', cause instanceof IntegrationError ? cause.code : 'credential_persistence_failure') }\n }\n const provider: IntegrationProvider = {\n id: providerId,\n kind: options.kind ?? 'first_party',\n listConnectors: () => [...adapters.values()].map((adapter) => manifestToConnector(providerId, adapter)),\n async startAuth(request) {\n const adapter = requireAdapter(request.connectorId)\n const auth = requireOAuth(adapter)\n const client = await requireClient(request.connectorId, auth)\n if (!auth.authorizationUrl) throw new IntegrationError('OAuth authorization URL missing.', 'config_missing')\n const metadata = resolveOAuthConnectionMetadata(auth, request.metadata, request.connectorId)\n resolveOAuthUrlTemplate(auth.tokenUrl, metadata, request.connectorId, auth.urlTemplateMetadata)\n const pkce = resolveOAuthPkceMode(auth.pkce, request.connectorId)\n const state = request.state ?? randomState()\n const requestedScopes = request.requestedScopes.length ? request.requestedScopes : auth.scopes\n return {\n providerId, connectorId: request.connectorId, state, requestedScopes,\n authUrl: buildOAuthAuthorizationUrl({\n ...auth, ...client, state, redirectUri: request.redirectUri,\n authorizationUrl: resolveOAuthUrlTemplate(auth.authorizationUrl, metadata, request.connectorId, auth.urlTemplateMetadata),\n scopes: requestedScopes,\n codeChallenge: pkce === 'unsupported' ? undefined : requirePkceChallenge(request.codeChallenge, request.connectorId),\n }),\n metadata,\n }\n },\n async completeAuth(request) {\n const adapter = requireAdapter(request.connectorId)\n const auth = requireOAuth(adapter)\n if (!request.code) throw new IntegrationError('OAuth authorization code missing.', 'config_missing')\n if (!options.persistConnection) throw new IntegrationError('An encrypted credential commit is required.', 'config_missing')\n const metadata = resolveOAuthConnectionMetadata(auth, request.metadata, request.connectorId)\n const codeVerifier = resolveOAuthPkceMode(auth.pkce, request.connectorId) === 'unsupported'\n ? undefined : requirePkceVerifier(request.codeVerifier, request.connectorId)\n // Validate both endpoints before an adapter can send the code elsewhere.\n resolveOAuthUrlTemplate(auth.tokenUrl, metadata, request.connectorId, auth.urlTemplateMetadata)\n const client = await requireClient(request.connectorId, auth)\n const exchanged = await boundedProviderCall(options.operationTimeoutMs, request.signal, async (signal) => {\n if (adapter.exchangeOAuth) return adapter.exchangeOAuth({ ...request, code: request.code!, codeVerifier, signal })\n try {\n const tokens = await exchangeAuthorizationCode({\n ...auth, ...client, code: request.code!, codeVerifier, redirectUri: request.redirectUri,\n tokenUrl: resolveOAuthUrlTemplate(auth.tokenUrl, metadata, request.connectorId, auth.urlTemplateMetadata),\n fetchImpl, signal,\n })\n return {\n credentials: { kind: 'oauth2' as const, accessToken: tokens.accessToken, refreshToken: tokens.refreshToken,\n expiresAt: tokens.expiresIn && tokens.expiresIn > 0 ? now().getTime() + tokens.expiresIn * 1000 : undefined },\n scopes: tokens.scope?.split(/[\\s,]+/).filter(Boolean) ?? [], metadata: tokens.metadata ?? {},\n }\n } catch (cause) {\n throw new IntegrationError(cause instanceof Error ? cause.message : 'OAuth exchange failed.', 'provider_failure')\n }\n }).catch((cause: unknown) => {\n const secrets = [request.code!, codeVerifier ?? '', ...oauthClientCredentialRedactionValues(client.clientId, client.clientSecret,\n client.clientSecret ? createOAuthBasicAuthorizationHeader(client.clientId, client.clientSecret) : undefined)]\n throw new IntegrationError(redactOAuthSensitiveText(cause instanceof Error ? cause.message : 'OAuth exchange failed.', secrets), 'provider_failure')\n })\n if (request.signal?.aborted) throw new IntegrationError('OAuth exchange aborted.', 'provider_failure')\n const credentials = exchanged.credentials\n if (credentials.kind !== 'oauth2' || !credentials.accessToken) throw new IntegrationError('OAuth exchange returned invalid credentials.', 'provider_failure')\n const issued = now().toISOString()\n return commit({\n id: randomConnectionId(), owner: request.owner, providerId, connectorId: request.connectorId,\n status: 'active', grantedScopes: exchanged.scopes.length ? exchanged.scopes : request.requestedScopes ?? [],\n createdAt: issued, updatedAt: issued,\n expiresAt: credentials.expiresAt ? new Date(credentials.expiresAt).toISOString() : undefined,\n metadata: { ...metadata, ...exchanged.metadata },\n }, credentials)\n },\n async testConnection(connection) {\n const adapter = requireAdapter(connection.connectorId)\n let source: ResolvedDataSource\n try { source = await options.resolveDataSource(connection) } catch { return 'credential_persistence_failure' }\n let observed = false\n const credentials = new Proxy(source.credentials, {\n get(target, key, receiver) { observed = true; return Reflect.get(target, key, receiver) },\n has(target, key) { observed = true; return Reflect.has(target, key) },\n ownKeys(target) { observed = true; return Reflect.ownKeys(target) },\n set(target, key, value, receiver) { observed = true; return Reflect.set(target, key, value, receiver) },\n })\n let acceptRotations = true\n let deadlineExpired = false\n let rotationFailed = false\n let persistence = Promise.resolve()\n const persistRotation = (next: ConnectorCredentials) => {\n if (!observed || !acceptRotations || deadlineExpired) return Promise.resolve()\n if (!options.onCredentialsRotated) { rotationFailed = true; return Promise.resolve() }\n persistence = persistence.then(async () => {\n if (deadlineExpired) return\n try { await options.onCredentialsRotated!({ connection, credentials: next }) }\n catch { rotationFailed = true }\n })\n return persistence\n }\n let status: import('./core-types.js').IntegrationConnectionTestStatus\n try {\n const result = await boundedProviderCall(options.operationTimeoutMs, undefined, () =>\n adapter.test({ ...source, credentials }, persistRotation),\n () => { deadlineExpired = true },\n )\n status = result.ok ? 'healthy' : classifyConnectionFailure(result.reason)\n } catch (cause) {\n if (cause instanceof ProviderOperationAborted) return 'network'\n status = classifyConnectionFailure(cause)\n } finally { acceptRotations = false }\n await persistence\n if (!observed) return 'unsupported'\n if (rotationFailed) return 'credential_persistence_failure'\n return status\n },\n async connectApiKey(request) {\n if (!request.apiKey || !options.persistConnection) throw new IntegrationError('API key and encrypted credential commit required.', 'config_missing')\n const adapter = requireAdapter(request.connectorId)\n const auth = adapter.manifest.auth.kind === 'one_of' ? adapter.manifest.auth.options : [adapter.manifest.auth]\n if (!auth.some((entry) => entry.kind === 'api-key')) throw new IntegrationError('Connector does not support API keys.', 'auth_not_supported')\n const metadata = adapter.validateConnectionMetadata ? adapter.validateConnectionMetadata(request.metadata ?? {})\n : !request.metadata || !Object.keys(request.metadata).length ? {} : null\n if (!metadata) throw new IntegrationError('Invalid connection metadata.', 'connection_metadata_invalid')\n const issued = now().toISOString()\n const connection: IntegrationConnection = {\n id: randomConnectionId(), owner: request.owner, providerId, connectorId: request.connectorId,\n status: 'active', grantedScopes: [], createdAt: issued, updatedAt: issued, metadata,\n }\n const credentials: ConnectorCredentials = { kind: 'api-key', apiKey: request.apiKey }\n const probe = createConnectorAdapterProvider({ ...options, onCredentialsRotated: undefined,\n resolveDataSource: () => ({ id: connection.id, projectId: request.owner.id, publishedAgentId: null,\n kind: request.connectorId, label: adapter.manifest.displayName, consistencyModel: adapter.manifest.defaultConsistencyModel,\n scopes: [], metadata, credentials, status: 'active' }),\n })\n const status = await probe.testConnection!(connection)\n if (status !== 'healthy') throw new IntegrationError(`Credential probe failed: ${status}.`, status === 'reconnect_required' ? 'credential_invalid'\n : status === 'rate_limited' ? 'credential_rate_limited' : status === 'unsupported' ? 'credential_probe_unsupported'\n : status === 'credential_persistence_failure' ? status : 'provider_failure')\n return commit(connection, credentials)\n },\n async invokeAction(connection, request) {\n const adapter = requireAdapter(connection.connectorId)\n const capability = adapter.manifest.capabilities.find((candidate) => candidate.name === request.action)\n if (!capability) {\n throw new IntegrationError(`Capability ${request.action} is not defined by ${connection.connectorId}.`, 'action_not_found')\n }\n const source = await options.resolveDataSource(connection)\n let rotationPersistence = Promise.resolve()\n const persistRotation = (credentials: ConnectorCredentials): Promise<void> => {\n if (!options.onCredentialsRotated) return Promise.resolve()\n rotationPersistence = rotationPersistence.then(() =>\n options.onCredentialsRotated!({ connection, credentials }),\n )\n // Some third-party adapters do not await this callback. Attach a\n // rejection observer immediately, then let the original promise keep\n // its rejection for the adapter or the provider's finally block.\n void rotationPersistence.catch(() => {})\n return rotationPersistence\n }\n const invocation: ConnectorInvocation = {\n source,\n capabilityName: request.action,\n args: toRecord(request.input),\n idempotencyKey: request.idempotencyKey ?? `idem_${connection.id}_${request.action}_${now().getTime()}`,\n expectedEtag: typeof request.metadata?.expectedEtag === 'string' ? request.metadata.expectedEtag : undefined,\n callSessionId: typeof request.metadata?.callSessionId === 'string' ? request.metadata.callSessionId : undefined,\n onCredentialsRotated: options.onCredentialsRotated\n ? persistRotation\n : undefined,\n }\n try {\n if (capability.class === 'read') {\n if (!adapter.executeRead) {\n throw new IntegrationError(`Connector ${connection.connectorId} does not implement reads.`, 'action_not_found')\n }\n const result = await adapter.executeRead(invocation)\n return readResultToAction(request, result)\n }\n if (capability.class === 'mutation') {\n if (!adapter.executeMutation) {\n throw new IntegrationError(`Connector ${connection.connectorId} does not implement mutations.`, 'action_not_found')\n }\n const result = await adapter.executeMutation(invocation)\n return mutationResultToAction(request, result)\n }\n throw new IntegrationError(`Capability ${request.action} is not invokable as an action.`, 'action_not_found')\n } finally {\n // A provider can rotate a refresh token before the requested action\n // fails. Persist that full envelope regardless of the action outcome.\n await rotationPersistence\n }\n },\n }\n return provider\n}\n\nexport function adapterManifestsToConnectors(\n adapters: ConnectorAdapter[],\n providerId = 'first-party',\n): IntegrationConnector[] {\n return adapters.map((adapter) => manifestToConnector(providerId, adapter))\n}\n\nexport function createConnectorAdapterCatalogSource(options: {\n id?: string\n providerId?: string\n adapters: ConnectorAdapter[]\n precedence?: number\n}): IntegrationCatalogSource {\n const sourceId = options.id ?? 'first-party'\n return {\n id: sourceId,\n precedence: options.precedence,\n connectors: adapterManifestsToConnectors(options.adapters, options.providerId ?? sourceId),\n }\n}\n\nexport function manifestToConnector(providerId: string, adapter: ConnectorAdapter): IntegrationConnector {\n const manifest = adapter.manifest\n const primaryAuth = primaryManifestAuth(manifest.auth)\n const oauthAuth = oauthManifestAuth(manifest.auth)\n return {\n id: manifest.kind,\n providerId,\n title: manifest.displayName,\n category: mapCategory(manifest.category),\n auth: mapAuth(primaryAuth.kind),\n scopes: primaryAuth.kind === 'oauth2' ? primaryAuth.scopes : [],\n actions: manifest.capabilities\n .filter((capability) => capability.class === 'read' || capability.class === 'mutation')\n .map((capability) => ({\n id: capability.name,\n title: titleFromName(capability.name),\n risk: capability.class === 'read' ? 'read' : capability.externalEffect ? 'destructive' : 'write',\n requiredScopes: capability.requiredScopes ?? [],\n dataClass: inferDataClass(manifest.category),\n ...(capability.consistencyModel ? { consistencyModel: capability.consistencyModel } : {}),\n description: capability.description,\n approvalRequired: capability.class === 'mutation',\n inputSchema: capability.parameters,\n })),\n metadata: {\n source: 'first-party-adapter',\n supportTier: 'firstPartyExecutable',\n executable: !adapter.catalogOnly,\n oauthPkce: oauthAuth\n ? resolveOAuthPkceMode(oauthAuth.pkce, manifest.kind)\n : undefined,\n authOptions: manifest.auth.kind === 'one_of' ? manifest.auth.options.map((auth) => auth.kind) : [manifest.auth.kind],\n preferredAuth: manifest.auth.kind === 'one_of' ? manifest.auth.preferred : manifest.auth.kind,\n oauthConnectionParameters: oauthAuth ? oauthConnectionParameters(oauthAuth) : [],\n },\n }\n}\n\nfunction readResultToAction(request: IntegrationActionRequest, result: CapabilityReadResult): IntegrationActionResult {\n return {\n ok: true,\n action: request.action,\n output: result.data,\n metadata: {\n etag: result.etag,\n fetchedAt: result.fetchedAt,\n },\n }\n}\n\nfunction mutationResultToAction(request: IntegrationActionRequest, result: CapabilityMutationResult): IntegrationActionResult {\n if (result.status === 'committed') {\n return {\n ok: true,\n action: request.action,\n output: result.data,\n metadata: {\n etagAfter: result.etagAfter,\n committedAt: result.committedAt,\n idempotentReplay: result.idempotentReplay,\n },\n }\n }\n if (result.status === 'conflict') {\n return {\n ok: false,\n action: request.action,\n output: {\n conflict: true,\n message: result.message,\n alternatives: result.alternatives,\n currentState: result.currentState,\n },\n }\n }\n return {\n ok: false,\n action: request.action,\n output: {\n rateLimited: true,\n retryAfterMs: result.retryAfterMs,\n message: result.message,\n },\n }\n}\n\nfunction mapAuth(kind: ConnectorAdapter['manifest']['auth']['kind']): IntegrationConnector['auth'] {\n if (kind === 'one_of') return 'custom'\n if (kind === 'oauth2') return 'oauth2'\n if (kind === 'api-key') return 'api_key'\n if (kind === 'none') return 'none'\n return 'custom'\n}\n\nfunction primaryManifestAuth(auth: ConnectorAdapter['manifest']['auth']): Exclude<ConnectorAdapter['manifest']['auth'], { kind: 'one_of' }> {\n if (auth.kind !== 'one_of') return auth\n return auth.options.find((option) => option.kind === auth.preferred) ?? auth.options[0]\n}\n\nfunction oauthManifestAuth(auth: ConnectorAdapter['manifest']['auth']): Extract<Exclude<ConnectorAdapter['manifest']['auth'], { kind: 'one_of' }>, { kind: 'oauth2' }> | undefined {\n if (auth.kind === 'oauth2') return auth\n if (auth.kind !== 'one_of') return undefined\n return auth.options.find((option): option is Extract<typeof option, { kind: 'oauth2' }> => option.kind === 'oauth2')\n}\n\n/** Resolve the manifest value at the last possible point before an OAuth\n * request. The runtime check matters because adapters can enter through JS or\n * an `any` cast without first passing the static manifest validator. */\nfunction resolveOAuthPkceMode(\n value: unknown,\n connectorId: string,\n): 'required' | 'supported' | 'unsupported' {\n if (value === undefined || value === 'required') return 'required'\n if (value === 'supported' || value === 'unsupported') return value\n throw new IntegrationError(\n `Connector ${connectorId} has an invalid OAuth PKCE posture.`,\n 'config_missing',\n )\n}\n\nfunction requirePkceChallenge(value: string | undefined, connectorId: string): string {\n if (!value || !/^[A-Za-z0-9_-]{43}$/.test(value)) {\n throw new IntegrationError(\n `OAuth PKCE S256 challenge missing or invalid for ${connectorId}.`,\n 'config_missing',\n )\n }\n return value\n}\n\nfunction requirePkceVerifier(value: string | undefined, connectorId: string): string {\n if (!value || !/^[A-Za-z0-9._~-]{43,128}$/.test(value)) {\n throw new IntegrationError(\n `OAuth PKCE verifier missing or invalid for ${connectorId}.`,\n 'config_missing',\n )\n }\n return value\n}\n\n/** Resolve provider-owned tenant labels embedded in OAuth URLs.\n *\n * Shopify and Gorgias put the merchant name in the hostname. Only one DNS\n * label is accepted for each placeholder, so connection metadata cannot turn\n * a provider URL into an arbitrary credential destination.\n */\nfunction resolveOAuthUrlTemplate(\n template: string,\n metadata: Record<string, unknown> | undefined,\n connectorId: string,\n metadataSpecs?: Readonly<Record<string, OAuth2UrlTemplateMetadataSpec>>,\n): string {\n const placeholders = [...template.matchAll(/\\{([A-Za-z][A-Za-z0-9_]*)\\}/g)]\n let resolved = template\n for (const match of placeholders) {\n const key = match[1]\n const raw = metadata?.[key]\n const metadataSpec = metadataSpecs?.[key]\n if (metadataSpec?.kind === 'base-url') {\n if (typeof raw !== 'string') {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} requires metadata.${key} as a provider base URL.`,\n raw === undefined ? 'connection_parameters_missing' : 'connection_parameters_invalid',\n )\n }\n resolved = resolved.replaceAll(\n match[0],\n resolveOAuthMetadataBaseUrl(raw, metadataSpec, connectorId, key),\n )\n continue\n }\n if (metadataSpec?.kind === 'path-segment') {\n if (!isOAuthPathSegmentPlaceholder(template, match.index ?? -1, match[0])) {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} declares metadata.${key} outside a complete path segment.`,\n 'config_missing',\n )\n }\n if (typeof raw !== 'string' || !isOAuthPathSegment(raw.trim())) {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} requires metadata.${key} as a valid path segment.`,\n raw === undefined ? 'connection_parameters_missing' : 'connection_parameters_invalid',\n )\n }\n resolved = resolved.replaceAll(match[0], encodeURIComponent(raw.trim()))\n continue\n }\n if (typeof raw !== 'string' || !isDnsLabel(raw.trim())) {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} requires metadata.${key} as a valid tenant label.`,\n raw === undefined ? 'connection_parameters_missing' : 'connection_parameters_invalid',\n )\n }\n resolved = resolved.replaceAll(match[0], raw.trim().toLowerCase())\n }\n\n let url: URL\n try {\n url = new URL(resolved)\n } catch {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} is invalid.`,\n 'config_missing',\n )\n }\n if (url.protocol !== 'https:' || url.username || url.password || !isPublicDnsHostname(url.hostname)) {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} must be HTTPS without embedded credentials.`,\n 'config_missing',\n )\n }\n return url.toString()\n}\n\nfunction isOAuthPathSegment(value: string): boolean {\n return (\n value !== '.' &&\n value !== '..' &&\n /^[A-Za-z0-9._~-]{1,128}$/.test(value)\n )\n}\n\nfunction isOAuthPathSegmentPlaceholder(\n template: string,\n index: number,\n placeholder: string,\n): boolean {\n if (index < 0) return false\n const schemeIndex = template.indexOf('://')\n const rootEnd = schemeIndex >= 0\n ? schemeIndex + 3\n : template.startsWith('{')\n ? template.indexOf('}') + 1\n : 0\n const pathStart = template.indexOf('/', rootEnd)\n const end = index + placeholder.length\n const queryStart = template.search(/[?#]/)\n return (\n pathStart >= 0 &&\n index >= pathStart &&\n (queryStart < 0 || index < queryStart) &&\n template[index - 1] === '/' &&\n (end === template.length || template[end] === '/' || template[end] === '?' || template[end] === '#')\n )\n}\n\nfunction resolveOAuthMetadataBaseUrl(\n value: string,\n spec: Extract<OAuth2UrlTemplateMetadataSpec, { kind: 'base-url' }>,\n connectorId: string,\n metadataKey: string,\n): string {\n let url: URL\n try {\n url = new URL(value.trim())\n } catch {\n throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey)\n }\n if (\n url.protocol !== 'https:' ||\n url.username ||\n url.password ||\n url.pathname !== '/' ||\n url.search ||\n url.hash\n ) {\n throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey)\n }\n const exactAllowed = spec.allowedBaseUrls?.some((candidate) => sameOrigin(candidate, url)) ?? false\n const suffixAllowed = spec.allowedBaseUrlSuffixes?.some((suffix) =>\n !url.port &&\n suffix.startsWith('.') &&\n url.hostname.toLowerCase().endsWith(suffix.toLowerCase())\n ) ?? false\n const hasExplicitAllowlist = Boolean(\n spec.allowedBaseUrls?.length || spec.allowedBaseUrlSuffixes?.length,\n )\n if (hasExplicitAllowlist && !exactAllowed && !suffixAllowed) {\n throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey)\n }\n if (spec.requirePublicHttps && !isPublicDnsHostname(url.hostname)) {\n throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey)\n }\n return url.origin\n}\n\nfunction invalidOAuthMetadataBaseUrl(connectorId: string, metadataKey: string): IntegrationError {\n return new IntegrationError(\n `OAuth URL for ${connectorId} requires metadata.${metadataKey} as an allowed HTTPS provider root.`,\n 'connection_parameters_invalid',\n )\n}\n\nfunction sameOrigin(candidate: string, actual: URL): boolean {\n try {\n const allowed = new URL(candidate)\n return (\n allowed.protocol === 'https:' &&\n !allowed.username &&\n !allowed.password &&\n allowed.pathname === '/' &&\n !allowed.search &&\n !allowed.hash &&\n allowed.origin === actual.origin\n )\n } catch {\n return false\n }\n}\n\nfunction isPublicDnsHostname(hostname: string): boolean {\n const normalized = hostname.toLowerCase().replace(/^\\[|\\]$/g, '')\n if (\n normalized === 'localhost' ||\n normalized.endsWith('.localhost') ||\n normalized.endsWith('.local') ||\n normalized.endsWith('.internal') ||\n normalized.endsWith('.home.arpa')\n ) {\n return false\n }\n // OAuth redirects to self-hosted instances require a DNS name. Reject\n // literal IP addresses because fetch cannot pin DNS against rebinding.\n if (/^[0-9.]+$/.test(normalized) || normalized.includes(':')) return false\n return normalized.includes('.') && normalized.split('.').every(isDnsLabel)\n}\n\nfunction isDnsLabel(value: string): boolean {\n return value.length > 0 && value.length <= 63 && /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(value)\n}\n\nfunction mapCategory(category: ConnectorAdapter['manifest']['category']): IntegrationConnector['category'] {\n if (category === 'comms') return 'chat'\n if (category === 'spreadsheet') return 'database'\n if (category === 'doc') return 'docs'\n if (category === 'commerce') return 'workflow'\n // The manifest taxonomy is richer than the hub-facade taxonomy. Sales/market\n // intelligence and HR/payroll connectors collapse to the nearest hub bucket:\n // contact/company intelligence reads like CRM; the rest have no closer fit.\n if (category === 'sales-intelligence') return 'crm'\n if (category === 'market-intelligence' || category === 'hr') return 'other'\n return category === 'other' ? 'other' : category\n}\n\nfunction inferDataClass(category: ConnectorAdapter['manifest']['category']): 'public' | 'internal' | 'private' | 'sensitive' {\n if (category === 'commerce') return 'sensitive'\n if (category === 'webhook') return 'internal'\n return 'private'\n}\n\nfunction titleFromName(name: string): string {\n return name\n .split(/[._-]/g)\n .filter(Boolean)\n .map((part) => part.slice(0, 1).toUpperCase() + part.slice(1))\n .join(' ')\n}\n\nfunction toRecord(input: unknown): Record<string, unknown> {\n if (input && typeof input === 'object' && !Array.isArray(input)) return input as Record<string, unknown>\n return {}\n}\n\nfunction randomState(): string {\n // 192 bits of entropy — comfortable CSRF margin and stays URL-safe.\n const bytes = new Uint8Array(24)\n globalThis.crypto.getRandomValues(bytes)\n return base64UrlEncode(bytes)\n}\n\nfunction randomConnectionId(): string {\n if (typeof globalThis.crypto?.randomUUID === 'function') {\n return `conn_${globalThis.crypto.randomUUID().replace(/-/g, '')}`\n }\n const bytes = new Uint8Array(16)\n globalThis.crypto.getRandomValues(bytes)\n return `conn_${base64UrlEncode(bytes)}`\n}\n\nfunction base64UrlEncode(bytes: Uint8Array): string {\n let bin = ''\n for (const b of bytes) bin += String.fromCharCode(b)\n // btoa is defined in browsers, workers, and Node ≥ 16.\n const b64 = typeof btoa === 'function' ? btoa(bin) : Buffer.from(bin, 'binary').toString('base64')\n return b64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '')\n}\n\nclass ProviderOperationAborted extends Error {}\n\n/** The losing promise remains observed; only an on-time result reaches a credential commit. */\nasync function boundedProviderCall<T>(timeoutMs: number | undefined, parent: AbortSignal | undefined, start: (signal: AbortSignal) => Promise<T>, onAbort?: () => void): Promise<T> {\n const budget = timeoutMs ?? 10_000\n if (!Number.isFinite(budget) || budget <= 0) throw new IntegrationError('Invalid provider timeout.', 'config_missing')\n const controller = new AbortController()\n let timer: ReturnType<typeof setTimeout> | undefined\n let rejectAbort: (reason: Error) => void = () => {}\n const abort = () => { onAbort?.(); controller.abort(); rejectAbort(new ProviderOperationAborted('Provider operation aborted or timed out.')) }\n try {\n return await Promise.race([\n new Promise<never>((_, reject) => {\n rejectAbort = reject\n timer = setTimeout(abort, budget)\n parent?.addEventListener('abort', abort, { once: true })\n if (parent?.aborted) abort()\n }),\n Promise.resolve().then(() => {\n if (controller.signal.aborted) throw new Error('Provider operation aborted.')\n return start(controller.signal)\n }),\n ])\n } finally {\n clearTimeout(timer)\n parent?.removeEventListener('abort', abort)\n controller.abort()\n }\n}\n\nfunction classifyConnectionFailure(raw: unknown): import('./core-types.js').IntegrationConnectionTestStatus {\n if (raw instanceof ProviderRateLimited) return 'rate_limited'\n if (raw instanceof CredentialsExpired) return 'reconnect_required'\n if (raw instanceof ProviderConfigError) return 'provider_failure'\n const message = raw instanceof Error ? raw.message : typeof raw === 'string' ? raw : ''\n if (/\\b429\\b|rate.?limit|too many requests|\\bthrottl|(?:quota|daily limit).*(?:exceed|exhaust)/i.test(message)) return 'rate_limited'\n if (/rejected credentials|credentials?.*(?:expired|invalid|revoked)|(?:access|refresh|oauth|bearer)?\\s*token.*(?:expired|invalid|revoked)|invalid[_\\s-]?grant|\\bunauthori[sz]ed\\b|authentication failed|\\bhttp\\s*401\\b|\\(401\\)/i.test(message)) return 'reconnect_required'\n if (/network|fetch failed|\\bECONN[A-Z]+\\b|\\bENOTFOUND\\b|\\bEAI_AGAIN\\b|\\bETIMEDOUT\\b|socket hang up|timed?\\s*out|abort(?:ed)?/i.test(message)) return 'network'\n return 'provider_failure'\n}\n\nfunction oauthConnectionParameters(auth: NonNullable<ReturnType<typeof oauthManifestAuth>>) {\n const placeholders = new Set([...`${auth.authorizationUrl ?? ''} ${auth.tokenUrl}`.matchAll(/\\{([A-Za-z][A-Za-z0-9_]*)\\}/g)].map((match) => match[1]))\n return [...placeholders].map((key) => ({ key, required: true, kind: auth.urlTemplateMetadata?.[key]?.kind ?? 'dns-label',\n ...auth.urlTemplateMetadata?.[key] }))\n}\n\nfunction resolveOAuthConnectionMetadata(auth: NonNullable<ReturnType<typeof oauthManifestAuth>>, raw: Record<string, unknown> | undefined, id: string): Record<string, unknown> {\n const metadata = { ...raw }\n for (const parameter of oauthConnectionParameters(auth)) {\n const spec = auth.urlTemplateMetadata?.[parameter.key]\n if (parameter.kind !== 'dns-label') continue\n let value = metadata[parameter.key]\n if (typeof value === 'string' && /^https:\\/\\//i.test(value.trim())) {\n try {\n const url = new URL(value.trim())\n const template = spec?.kind === 'dns-label' ? spec.connectionMetadata?.template : undefined\n const expected = template ? new URL(template.replaceAll(`{${parameter.key}}`, 'oauth-tenant')) : undefined\n const suffix = expected?.hostname.startsWith('oauth-tenant.') ? expected.hostname.slice('oauth-tenant'.length) : undefined\n if (!suffix || !url.hostname.endsWith(suffix) || url.username || url.password || url.port\n || url.pathname !== '/' || url.search || url.hash) throw new Error('Invalid tenant origin')\n value = url.hostname.slice(0, -suffix.length)\n } catch { throw new IntegrationError(`Invalid tenant origin ${parameter.key}.`, 'connection_parameters_invalid') }\n }\n if (typeof value !== 'string' || !isDnsLabel(value.trim())) throw new IntegrationError(`Invalid tenant label ${parameter.key}.`, value === undefined ? 'connection_parameters_missing' : 'connection_parameters_invalid')\n metadata[parameter.key] = value.trim().toLowerCase()\n if (spec?.kind === 'dns-label' && spec.connectionMetadata) {\n metadata[spec.connectionMetadata.key] = resolveOAuthUrlTemplate(spec.connectionMetadata.template, metadata, id, auth.urlTemplateMetadata)\n }\n }\n return metadata\n}\n","import { createConnectorAdapterProvider, type ConnectorAdapterProviderOptions } from './adapter-provider.js'\nimport type {\n ConnectorAdapter,\n ConnectorCredentials,\n ResolvedDataSource,\n} from './connectors/types.js'\nimport type {\n IntegrationConnection,\n IntegrationConnectionStore,\n IntegrationCredentialsRotatedEvent,\n IntegrationOAuthState,\n IntegrationOAuthStateOutcome,\n IntegrationOAuthStateStore,\n IntegrationProvider,\n IntegrationSecretStore,\n SecretRef,\n} from './core-types.js'\n\nexport type {\n IntegrationOAuthState,\n IntegrationOAuthStateOutcome,\n IntegrationOAuthStateStore,\n IntegrationSecretStore,\n}\n\nexport interface ConnectionCredentialResolverOptions {\n secrets: IntegrationSecretStore\n connections?: IntegrationConnectionStore\n adapters?: ConnectorAdapter[]\n now?: () => Date\n markConnectionError?: (connection: IntegrationConnection, error: Error) => Promise<void> | void\n}\n\ninterface CredentialRefreshFlight {\n promise: Promise<ConnectorCredentials>\n cancelled: boolean\n settled: boolean\n waiters: number\n}\n\ninterface CredentialPersistenceLease {\n cancelled: boolean\n}\n\nclass CredentialRefreshRevokedError extends Error {\n constructor() {\n super('Connection was revoked during credential refresh.')\n this.name = 'CredentialRefreshRevokedError'\n }\n}\n\nconst credentialRefreshes = new WeakMap<\n IntegrationSecretStore,\n Map<string, CredentialRefreshFlight>\n>()\nconst credentialPersistences = new WeakMap<\n IntegrationSecretStore,\n Map<string, Set<CredentialPersistenceLease>>\n>()\nconst credentialRevocations = new WeakMap<IntegrationSecretStore, Map<string, number>>()\n\nexport class InMemoryIntegrationSecretStore implements IntegrationSecretStore {\n private readonly secrets = new Map<string, ConnectorCredentials>()\n\n get(ref: SecretRef): ConnectorCredentials | undefined {\n return this.secrets.get(secretKey(ref))\n }\n\n put(ref: SecretRef, credentials: ConnectorCredentials): void {\n this.secrets.set(secretKey(ref), credentials)\n }\n\n delete(ref: SecretRef): void {\n this.secrets.delete(secretKey(ref))\n }\n}\n\n/** Test/dev double for {@link IntegrationOAuthStateStore}. Production hubs\n * inject a durable implementation; this one keeps records in a Map and\n * enforces the single-use + expiry contract. */\nexport class InMemoryIntegrationOAuthStateStore implements IntegrationOAuthStateStore {\n private readonly states = new Map<string, IntegrationOAuthState>()\n\n put(state: IntegrationOAuthState): void {\n this.states.set(state.state, state)\n }\n\n consume(state: string): IntegrationOAuthStateOutcome {\n const record = this.states.get(state)\n this.states.delete(state)\n if (!record) return { ok: false, reason: 'unknown' }\n if (record.expiresAt <= Date.now()) return { ok: false, reason: 'expired' }\n return { ok: true, state: record }\n }\n\n sweep(now: number): void {\n for (const [key, record] of this.states) {\n if (record.expiresAt <= now) this.states.delete(key)\n }\n }\n}\n\nexport function createConnectionCredentialResolver(options: ConnectionCredentialResolverOptions) {\n const now = options.now ?? (() => new Date())\n return async function resolveDataSource(connection: IntegrationConnection): Promise<ResolvedDataSource> {\n const credentials = await resolveConnectionCredentials(connection, {\n secrets: options.secrets,\n connections: options.connections,\n adapters: options.adapters,\n now,\n markConnectionError: options.markConnectionError,\n })\n return {\n id: connection.id,\n projectId: String(connection.metadata?.projectId ?? connection.owner.id),\n publishedAgentId: typeof connection.metadata?.publishedAgentId === 'string' ? connection.metadata.publishedAgentId : null,\n kind: connection.connectorId,\n label: connection.account?.displayName ?? connection.account?.email ?? connection.connectorId,\n consistencyModel: typeof connection.metadata?.consistencyModel === 'string' ? connection.metadata.consistencyModel as never : 'authoritative',\n scopes: connection.grantedScopes,\n metadata: connection.metadata ?? {},\n credentials,\n status: connection.status === 'active' ? 'active' : connection.status === 'revoked' ? 'revoked' : 'error',\n }\n }\n}\n\nexport async function resolveConnectionCredentials(input: IntegrationConnection, options: ConnectionCredentialResolverOptions): Promise<ConnectorCredentials> {\n if (input.status !== 'active') throw new Error(`Connection ${input.id} is ${input.status}.`)\n if (!input.secretRef) return { kind: 'none' }\n const now = options.now ?? (() => new Date())\n const current = await options.secrets.get(input.secretRef)\n if (!current) throw new Error(`Secret ${input.secretRef.provider}/${input.secretRef.id} not found.`)\n if (!isExpiredOauth(current, now)) return current\n\n const adapter = options.adapters?.find((candidate) => candidate.manifest.kind === input.connectorId)\n if (!adapter?.refreshToken) return current\n let refresh: CredentialRefreshFlight | undefined\n try {\n await assertCredentialRefreshActive(input, options, now)\n refresh = acquireCredentialRefresh({\n connectorId: input.connectorId,\n secretRef: input.secretRef,\n secrets: options.secrets,\n now,\n refreshToken: adapter.refreshToken.bind(adapter),\n })\n const refreshed = await refresh.promise\n await assertCredentialRefreshActive(input, options, now, refresh)\n if (options.connections) {\n await options.connections.put({\n ...input,\n status: 'active',\n updatedAt: now().toISOString(),\n expiresAt: refreshed.kind === 'oauth2' && refreshed.expiresAt ? new Date(refreshed.expiresAt).toISOString() : input.expiresAt,\n })\n await assertCredentialRefreshActive(input, options, now, refresh)\n }\n return refreshed\n } catch (error) {\n const err = error instanceof Error ? error : new Error('Credential refresh failed.')\n if (err instanceof CredentialRefreshRevokedError) throw err\n await options.markConnectionError?.(input, err)\n if (options.connections) {\n await options.connections.put({\n ...input,\n status: 'expired',\n updatedAt: now().toISOString(),\n })\n }\n throw err\n } finally {\n if (refresh) {\n releaseCredentialRefresh(\n options.secrets,\n input.connectorId,\n input.secretRef,\n refresh,\n )\n }\n }\n}\n\nfunction acquireCredentialRefresh(input: {\n connectorId: string\n secretRef: SecretRef\n secrets: IntegrationSecretStore\n now: () => Date\n refreshToken: (credentials: ConnectorCredentials) => Promise<ConnectorCredentials>\n}): CredentialRefreshFlight {\n let refreshes = credentialRefreshes.get(input.secrets)\n if (!refreshes) {\n refreshes = new Map()\n credentialRefreshes.set(input.secrets, refreshes)\n }\n const key = credentialRefreshKey(input.connectorId, input.secretRef)\n if (credentialRevocations.get(input.secrets)?.has(key)) {\n throw new CredentialRefreshRevokedError()\n }\n const existing = refreshes.get(key)\n if (existing) {\n existing.waiters += 1\n return existing\n }\n\n let flight: CredentialRefreshFlight\n const promise = Promise.resolve().then(async () => {\n // A prior refresh can settle between the caller's first read and this\n // flight. Re-read before redeeming a provider's rotating refresh token.\n const latest = await input.secrets.get(input.secretRef)\n if (!latest) {\n throw new Error(\n `Secret ${input.secretRef.provider}/${input.secretRef.id} not found.`,\n )\n }\n if (!isExpiredOauth(latest, input.now)) return latest\n const refreshed = await input.refreshToken(latest)\n if (flight.cancelled) throw new CredentialRefreshRevokedError()\n await input.secrets.put(input.secretRef, refreshed)\n if (flight.cancelled) {\n await input.secrets.delete?.(input.secretRef)\n throw new CredentialRefreshRevokedError()\n }\n return refreshed\n })\n flight = {\n promise,\n cancelled: false,\n settled: false,\n waiters: 1,\n }\n refreshes.set(key, flight)\n\n const settle = () => {\n flight.settled = true\n clearCredentialRefresh(input.secrets, key, flight)\n }\n // Observe rejection immediately. Every caller still receives the original\n // rejected promise and applies its connection-specific error transition.\n void promise.then(settle, settle)\n return flight\n}\n\nfunction releaseCredentialRefresh(\n secrets: IntegrationSecretStore,\n connectorId: string,\n secretRef: SecretRef,\n flight: CredentialRefreshFlight,\n): void {\n flight.waiters -= 1\n clearCredentialRefresh(\n secrets,\n credentialRefreshKey(connectorId, secretRef),\n flight,\n )\n}\n\nfunction clearCredentialRefresh(\n secrets: IntegrationSecretStore,\n key: string,\n flight: CredentialRefreshFlight,\n): void {\n if (!flight.settled || flight.waiters !== 0) return\n const refreshes = credentialRefreshes.get(secrets)\n if (refreshes?.get(key) !== flight) return\n refreshes.delete(key)\n if (refreshes.size === 0) credentialRefreshes.delete(secrets)\n}\n\nasync function assertCredentialRefreshActive(\n input: IntegrationConnection,\n options: ConnectionCredentialResolverOptions,\n now: () => Date,\n operation?: CredentialPersistenceLease,\n): Promise<void> {\n const key = input.secretRef\n ? credentialRefreshKey(input.connectorId, input.secretRef)\n : undefined\n let revoked = operation?.cancelled === true\n || (key !== undefined\n && credentialRevocations.get(options.secrets)?.has(key) === true)\n let stored: IntegrationConnection | undefined\n if (options.connections) {\n stored = await options.connections.get(input.id)\n revoked ||= stored?.status === 'revoked'\n }\n if (!revoked && input.secretRef) {\n revoked = await options.secrets.get(input.secretRef) === undefined\n }\n if (!revoked) return\n\n if (operation) operation.cancelled = true\n if (input.secretRef) await options.secrets.delete?.(input.secretRef)\n if (options.connections && stored?.status !== 'revoked') {\n await options.connections.put({\n ...(stored ?? input),\n status: 'revoked',\n updatedAt: now().toISOString(),\n })\n }\n throw new CredentialRefreshRevokedError()\n}\n\nexport type CredentialBackedAdapterProviderOptions =\n Omit<ConnectorAdapterProviderOptions, 'resolveDataSource' | 'onCredentialsRotated'>\n & ConnectionCredentialResolverOptions\n & {\n /** Fired after the provider re-persists rotated credentials to the\n * secret + connection stores. Receives the hub-shaped event including\n * the resolved secretRef so the host can drive external re-encryption\n * or telemetry. */\n onCredentialsRotated?: (event: IntegrationCredentialsRotatedEvent) => Promise<void> | void\n }\n\nexport function createCredentialBackedAdapterProvider(options: CredentialBackedAdapterProviderOptions): IntegrationProvider {\n const now = options.now ?? (() => new Date())\n return createConnectorAdapterProvider({\n ...options,\n resolveDataSource: createConnectionCredentialResolver(options),\n onCredentialsRotated: async ({ connection, credentials }) => {\n const persistence = connection.secretRef\n ? acquireCredentialPersistence(\n options.secrets,\n connection.connectorId,\n connection.secretRef,\n )\n : undefined\n try {\n await assertCredentialRefreshActive(connection, options, now, persistence)\n if (connection.secretRef) {\n await options.secrets.put(connection.secretRef, credentials)\n }\n await assertCredentialRefreshActive(connection, options, now, persistence)\n if (options.connections) {\n await options.connections.put({\n ...connection,\n status: 'active',\n updatedAt: now().toISOString(),\n expiresAt: credentials.kind === 'oauth2' && credentials.expiresAt\n ? new Date(credentials.expiresAt).toISOString()\n : connection.expiresAt,\n })\n await assertCredentialRefreshActive(connection, options, now, persistence)\n }\n await options.onCredentialsRotated?.({ connection, secretRef: connection.secretRef, credentials })\n await assertCredentialRefreshActive(connection, options, now, persistence)\n } finally {\n if (persistence && connection.secretRef) {\n releaseCredentialPersistence(\n options.secrets,\n connection.connectorId,\n connection.secretRef,\n persistence,\n )\n }\n }\n },\n })\n}\n\nfunction acquireCredentialPersistence(\n secrets: IntegrationSecretStore,\n connectorId: string,\n secretRef: SecretRef,\n): CredentialPersistenceLease {\n let persistences = credentialPersistences.get(secrets)\n if (!persistences) {\n persistences = new Map()\n credentialPersistences.set(secrets, persistences)\n }\n const key = credentialRefreshKey(connectorId, secretRef)\n let leases = persistences.get(key)\n if (!leases) {\n leases = new Set()\n persistences.set(key, leases)\n }\n const lease = {\n cancelled: credentialRevocations.get(secrets)?.has(key) === true,\n }\n leases.add(lease)\n return lease\n}\n\nfunction releaseCredentialPersistence(\n secrets: IntegrationSecretStore,\n connectorId: string,\n secretRef: SecretRef,\n lease: CredentialPersistenceLease,\n): void {\n const persistences = credentialPersistences.get(secrets)\n if (!persistences) return\n const key = credentialRefreshKey(connectorId, secretRef)\n const leases = persistences.get(key)\n leases?.delete(lease)\n if (leases?.size === 0) persistences.delete(key)\n if (persistences.size === 0) credentialPersistences.delete(secrets)\n}\n\nexport async function revokeConnection(input: {\n connection: IntegrationConnection\n connections?: IntegrationConnectionStore\n secrets?: IntegrationSecretStore\n now?: () => Date\n}): Promise<IntegrationConnection> {\n const finishRevocation = input.connection.secretRef && input.secrets\n ? beginCredentialRevocation(\n input.secrets,\n input.connection.connectorId,\n input.connection.secretRef,\n )\n : undefined\n try {\n if (input.connection.secretRef) await input.secrets?.delete?.(input.connection.secretRef)\n const revoked: IntegrationConnection = {\n ...input.connection,\n status: 'revoked',\n updatedAt: (input.now?.() ?? new Date()).toISOString(),\n }\n await input.connections?.put(revoked)\n return revoked\n } finally {\n finishRevocation?.()\n }\n}\n\nfunction beginCredentialRevocation(\n secrets: IntegrationSecretStore,\n connectorId: string,\n secretRef: SecretRef,\n): () => void {\n const key = credentialRefreshKey(connectorId, secretRef)\n let revocations = credentialRevocations.get(secrets)\n if (!revocations) {\n revocations = new Map()\n credentialRevocations.set(secrets, revocations)\n }\n revocations.set(key, (revocations.get(key) ?? 0) + 1)\n const flight = credentialRefreshes.get(secrets)?.get(key)\n if (flight) flight.cancelled = true\n for (const persistence of credentialPersistences.get(secrets)?.get(key) ?? []) {\n persistence.cancelled = true\n }\n\n return () => {\n const remaining = (revocations?.get(key) ?? 1) - 1\n if (remaining > 0) revocations?.set(key, remaining)\n else revocations?.delete(key)\n if (revocations?.size === 0) credentialRevocations.delete(secrets)\n }\n}\n\nfunction isExpiredOauth(credentials: ConnectorCredentials, now: () => Date): boolean {\n return credentials.kind === 'oauth2'\n && typeof credentials.expiresAt === 'number'\n && credentials.expiresAt <= now().getTime()\n && Boolean(credentials.refreshToken)\n}\n\nfunction secretKey(ref: SecretRef): string {\n return `${ref.provider}:${ref.id}`\n}\n\nfunction credentialRefreshKey(connectorId: string, ref: SecretRef): string {\n return JSON.stringify([connectorId, ref.provider, ref.id])\n}\n","import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from 'node:crypto'\nimport {\n composeIntegrationRegistry,\n type ComposeIntegrationRegistryOptions,\n type IntegrationRegistry,\n} from './registry-core.js'\nimport {\n InMemoryIntegrationOAuthStateStore,\n InMemoryIntegrationSecretStore,\n type IntegrationOAuthState,\n} from './credentials.js'\nimport { IntegrationError } from './core-error.js'\nimport type {\n CompleteAuthRequest,\n ConnectApiKeyRequest,\n IntegrationActionGuard,\n IntegrationActionRequest,\n IntegrationActionResult,\n IntegrationActor,\n IntegrationCapability,\n IntegrationConnection,\n IntegrationConnectionStore,\n IntegrationConnector,\n IntegrationHubOptions,\n IntegrationPolicyEngine,\n IntegrationProvider,\n IntegrationTriggerEvent,\n IntegrationTriggerSubscription,\n InvokeWithCapabilityRequest,\n IssueCapabilityRequest,\n IssuedIntegrationCapability,\n StartAuthRequest,\n StartAuthResult,\n} from './core-types.js'\n\nexport class IntegrationHub {\n private readonly providers = new Map<string, IntegrationProvider>()\n private readonly store: IntegrationConnectionStore\n private readonly capabilitySecret: string\n private readonly guard: IntegrationActionGuard | undefined\n private readonly policy: IntegrationPolicyEngine | undefined\n /** Host-injected (or in-memory default) secret store. The hub re-persists\n * rotated credentials here when a connection carries a secretRef. */\n readonly secretStore: IntegrationHubOptions['secretStore']\n private readonly oauthStateStore: NonNullable<IntegrationHubOptions['oauthStateStore']>\n private readonly oauthStateTtlMs: number\n private readonly credentialsRotated: IntegrationHubOptions['credentialsRotated']\n private readonly now: () => Date\n\n constructor(options: IntegrationHubOptions) {\n if (!options.capabilitySecret) {\n throw new IntegrationError('capabilitySecret is required.', 'capability_invalid')\n }\n for (const provider of options.providers) this.providers.set(provider.id, provider)\n this.store = options.store\n this.capabilitySecret = options.capabilitySecret\n this.guard = options.guard\n this.policy = options.policy\n this.secretStore = options.secretStore ?? new InMemoryIntegrationSecretStore()\n this.oauthStateStore = options.oauthStateStore ?? new InMemoryIntegrationOAuthStateStore()\n this.oauthStateTtlMs = options.oauthStateTtlMs ?? 10 * 60 * 1000\n this.credentialsRotated = options.credentialsRotated\n this.now = options.now ?? (() => new Date())\n }\n\n async listConnectors(): Promise<IntegrationConnector[]> {\n const catalogs = await Promise.all([...this.providers.values()].map((provider) => provider.listConnectors()))\n return catalogs.flat()\n }\n\n async listRegistry(options: ComposeIntegrationRegistryOptions = {}): Promise<IntegrationRegistry> {\n const sources = await Promise.all([...this.providers.values()].map(async (provider) => ({\n id: provider.id,\n connectors: await provider.listConnectors(),\n })))\n return composeIntegrationRegistry(sources, options)\n }\n\n async startAuth(providerId: string, request: StartAuthRequest): Promise<StartAuthResult> {\n const provider = this.requireProvider(providerId)\n if (!provider.startAuth) throw new IntegrationError(`Provider ${providerId} does not support auth start.`, 'auth_not_supported')\n const connector = await this.requireConnector(provider, request.connectorId)\n const pkce = connectorOAuthPkceMode(connector)\n const pkcePair = pkce === 'unsupported' ? undefined : createPkcePair()\n const result = await provider.startAuth({\n ...request,\n codeChallenge: pkcePair?.challenge,\n })\n const record: IntegrationOAuthState = {\n state: result.state,\n providerId,\n connectorId: request.connectorId,\n owner: request.owner,\n requestedScopes: result.requestedScopes ?? request.requestedScopes,\n redirectUri: request.redirectUri,\n codeVerifier: pkcePair?.verifier,\n expiresAt: this.now().getTime() + this.oauthStateTtlMs,\n metadata: result.metadata ?? request.metadata,\n }\n await this.oauthStateStore.put(record)\n return result\n }\n\n async completeAuth(providerId: string, request: CompleteAuthRequest): Promise<IntegrationConnection> {\n const provider = this.requireProvider(providerId)\n if (!provider.completeAuth) throw new IntegrationError(`Provider ${providerId} does not support auth completion.`, 'auth_not_supported')\n const outcome = await this.oauthStateStore.consume(request.state)\n if (!outcome.ok) {\n throw new IntegrationError(`Integration OAuth state ${outcome.reason}: possible CSRF, replay, or stale flow.`, 'capability_invalid')\n }\n if (outcome.state.providerId !== providerId || outcome.state.connectorId !== request.connectorId) {\n throw new IntegrationError('Integration OAuth state does not match completion request.', 'capability_invalid')\n }\n if (outcome.state.redirectUri !== request.redirectUri) {\n throw new IntegrationError('Integration OAuth redirect URI does not match the start request.', 'capability_invalid')\n }\n const pinnedMetadata = request.metadata || outcome.state.metadata\n ? { ...request.metadata, ...outcome.state.metadata }\n : undefined\n const connection = await provider.completeAuth({\n ...request,\n connectorId: outcome.state.connectorId,\n owner: outcome.state.owner,\n state: outcome.state.state,\n redirectUri: outcome.state.redirectUri,\n codeVerifier: outcome.state.codeVerifier,\n requestedScopes: outcome.state.requestedScopes,\n metadata: pinnedMetadata,\n })\n await this.store.put(connection)\n return connection\n }\n\n async connectApiKey(providerId: string, request: ConnectApiKeyRequest): Promise<IntegrationConnection> {\n const provider = this.requireProvider(providerId)\n if (!provider.connectApiKey) throw new IntegrationError('Provider does not support API-key connections.', 'auth_not_supported')\n const connection = await provider.connectApiKey(request)\n await this.store.put(connection)\n return connection\n }\n\n async testConnection(connectionId: string) {\n const connection = await this.requireConnection(connectionId)\n this.assertConnectionActive(connection)\n const provider = this.requireProvider(connection.providerId)\n return provider.testConnection ? provider.testConnection(connection) : 'unsupported' as const\n }\n\n async upsertConnection(connection: IntegrationConnection): Promise<IntegrationConnection> {\n await this.store.put(connection)\n return connection\n }\n\n async listConnections(owner: IntegrationActor): Promise<IntegrationConnection[]> {\n return this.store.listByOwner(owner)\n }\n\n async getConnection(connectionId: string): Promise<IntegrationConnection | undefined> {\n return this.store.get(connectionId)\n }\n\n async issueCapability(request: IssueCapabilityRequest): Promise<IssuedIntegrationCapability> {\n const connection = await this.requireConnection(request.connectionId)\n this.assertConnectionActive(connection)\n assertScopes(connection, request.scopes)\n const now = this.now()\n const capability: IntegrationCapability = {\n id: `cap_${randomUUID()}`,\n subject: request.subject,\n connectionId: request.connectionId,\n scopes: unique(request.scopes),\n allowedActions: unique(request.allowedActions),\n issuedAt: now.toISOString(),\n expiresAt: new Date(now.getTime() + request.ttlMs).toISOString(),\n metadata: request.metadata,\n }\n return { capability, token: signCapability(capability, this.capabilitySecret) }\n }\n\n verifyCapability(token: string): IntegrationCapability {\n const capability = verifyCapabilityToken(token, this.capabilitySecret)\n if (Date.parse(capability.expiresAt) <= this.now().getTime()) {\n throw new IntegrationError('Integration capability expired.', 'capability_expired')\n }\n return capability\n }\n\n async invokeWithCapability(token: string, request: InvokeWithCapabilityRequest): Promise<IntegrationActionResult> {\n const capability = this.verifyCapability(token)\n if (!capability.allowedActions.includes(request.action)) {\n throw new IntegrationError(`Capability does not allow action ${request.action}.`, 'action_denied')\n }\n const connection = await this.requireConnection(capability.connectionId)\n this.assertConnectionActive(connection)\n const provider = this.requireProvider(connection.providerId)\n const connector = await this.requireConnector(provider, connection.connectorId)\n const action = connector.actions.find((candidate) => candidate.id === request.action)\n if (!action) throw new IntegrationError(`Action ${request.action} is not defined by connector ${connector.id}.`, 'action_not_found')\n assertScopes(connection, action.requiredScopes)\n assertScopes({ ...connection, grantedScopes: capability.scopes }, action.requiredScopes)\n const fullRequest: IntegrationActionRequest = { ...request, connectionId: connection.id }\n const proceed = async () => {\n if (!this.policy) return provider.invokeAction(connection, fullRequest)\n const decision = await this.policy.decide({\n connection,\n request: fullRequest,\n action,\n subject: capability.subject,\n })\n if (decision.decision === 'deny') {\n throw new IntegrationError(decision.reason, 'policy_denied')\n }\n if (decision.decision === 'require_approval') {\n return {\n ok: false,\n action: request.action,\n output: { approvalRequired: true, approval: decision.approval },\n metadata: { policyDecision: decision.decision, reason: decision.reason, ...decision.metadata },\n }\n }\n return provider.invokeAction(connection, fullRequest)\n }\n if (this.guard) {\n return this.guard.invokeAction({ connection, request: fullRequest, action }, proceed)\n }\n return proceed()\n }\n\n async subscribeTrigger(connectionId: string, trigger: string, targetUrl?: string): Promise<IntegrationTriggerSubscription> {\n const connection = await this.requireConnection(connectionId)\n this.assertConnectionActive(connection)\n const provider = this.requireProvider(connection.providerId)\n const connector = await this.requireConnector(provider, connection.connectorId)\n const spec = connector.triggers?.find((candidate) => candidate.id === trigger)\n if (!spec) throw new IntegrationError(`Trigger ${trigger} is not defined by connector ${connector.id}.`, 'trigger_not_found')\n assertScopes(connection, spec.requiredScopes)\n if (!provider.subscribeTrigger) {\n throw new IntegrationError(`Provider ${provider.id} does not support triggers.`, 'auth_not_supported')\n }\n return provider.subscribeTrigger(connection, trigger, targetUrl)\n }\n\n private requireProvider(providerId: string): IntegrationProvider {\n const provider = this.providers.get(providerId)\n if (!provider) throw new IntegrationError(`Provider ${providerId} not found.`, 'provider_not_found')\n return provider\n }\n\n private async requireConnector(provider: IntegrationProvider, connectorId: string): Promise<IntegrationConnector> {\n const connector = (await provider.listConnectors()).find((candidate) => candidate.id === connectorId)\n if (!connector) throw new IntegrationError(`Connector ${connectorId} not found.`, 'connector_not_found')\n return connector\n }\n\n private async requireConnection(connectionId: string): Promise<IntegrationConnection> {\n const connection = await this.store.get(connectionId)\n if (!connection) throw new IntegrationError(`Connection ${connectionId} not found.`, 'connection_not_found')\n return connection\n }\n\n private assertConnectionActive(connection: IntegrationConnection): void {\n if (connection.status !== 'active') {\n throw new IntegrationError(`Connection ${connection.id} is ${connection.status}.`, 'connection_not_active')\n }\n if (connection.expiresAt && Date.parse(connection.expiresAt) <= this.now().getTime()) {\n throw new IntegrationError(`Connection ${connection.id} is expired.`, 'connection_not_active')\n }\n }\n}\n\n\nexport function signCapability(capability: IntegrationCapability, secret: string): string {\n const payload = base64UrlEncode(JSON.stringify(capability))\n const signature = hmac(payload, secret)\n return `${payload}.${signature}`\n}\n\nexport function verifyCapabilityToken(token: string, secret: string): IntegrationCapability {\n const [payload, signature] = token.split('.')\n if (!payload || !signature) throw new IntegrationError('Malformed integration capability.', 'capability_invalid')\n const expected = hmac(payload, secret)\n if (!constantTimeEqual(signature, expected)) throw new IntegrationError('Invalid integration capability signature.', 'capability_invalid')\n let parsed: IntegrationCapability\n try {\n parsed = JSON.parse(base64UrlDecode(payload)) as IntegrationCapability\n } catch {\n throw new IntegrationError('Invalid integration capability payload.', 'capability_invalid')\n }\n if (!parsed.id || !parsed.connectionId || !Array.isArray(parsed.scopes) || !Array.isArray(parsed.allowedActions)) {\n throw new IntegrationError('Invalid integration capability payload.', 'capability_invalid')\n }\n return parsed\n}\n\n\nfunction assertScopes(connection: Pick<IntegrationConnection, 'grantedScopes'>, requiredScopes: string[]): void {\n const missing = requiredScopes.filter((scope) => !connection.grantedScopes.includes(scope))\n if (missing.length > 0) throw new IntegrationError(`Missing integration scopes: ${missing.join(', ')}`, 'scope_denied')\n}\n\n\ntype IntegrationOAuthPkceMode = 'required' | 'supported' | 'unsupported'\n\nfunction connectorOAuthPkceMode(connector: IntegrationConnector): IntegrationOAuthPkceMode {\n const value = connector.metadata?.oauthPkce\n if (value === undefined) return 'required'\n if (value === 'required' || value === 'supported' || value === 'unsupported') return value\n throw new IntegrationError(\n `Connector ${connector.id} declares an invalid OAuth PKCE posture.`,\n 'config_missing',\n )\n}\n\nfunction createPkcePair(): { verifier: string; challenge: string } {\n const verifier = randomBytes(48).toString('base64url')\n const challenge = createHash('sha256').update(verifier).digest('base64url')\n return { verifier, challenge }\n}\n\nfunction hmac(payload: string, secret: string): string {\n return createHmac('sha256', secret).update(payload).digest('base64url')\n}\n\nfunction constantTimeEqual(a: string, b: string): boolean {\n const left = Buffer.from(a)\n const right = Buffer.from(b)\n return left.length === right.length && timingSafeEqual(left, right)\n}\n\nfunction base64UrlEncode(value: string): string {\n return Buffer.from(value, 'utf8').toString('base64url')\n}\n\nfunction base64UrlDecode(value: string): string {\n return Buffer.from(value, 'base64url').toString('utf8')\n}\n\nfunction unique<T>(values: T[]): T[] {\n return [...new Set(values)]\n}\n\n"],"mappings":";;;;;AAq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,YAAY,EAAE,CAAC,CAAC,SAAS,WAAW;CAErD,OAAO;EAAE;EAAU,WADD,WAAW,QAAQ,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,OAAO,WACpC;CAAE;AAC/B;AAEA,SAAS,KAAK,SAAiB,QAAwB;CACrD,OAAO,WAAW,UAAU,MAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,OAAO,WAAW;AACxE;AAEA,SAAS,kBAAkB,GAAW,GAAoB;CACxD,MAAM,OAAO,OAAO,KAAK,CAAC;CAC1B,MAAM,QAAQ,OAAO,KAAK,CAAC;CAC3B,OAAO,KAAK,WAAW,MAAM,UAAU,gBAAgB,MAAM,KAAK;AACpE;AAEA,SAAS,gBAAgB,OAAuB;CAC9C,OAAO,OAAO,KAAK,OAAO,MAAM,CAAC,CAAC,SAAS,WAAW;AACxD;AAEA,SAAS,gBAAgB,OAAuB;CAC9C,OAAO,OAAO,KAAK,OAAO,WAAW,CAAC,CAAC,SAAS,MAAM;AACxD;AAEA,SAAS,OAAU,QAAkB;CACnC,OAAO,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC;AAC5B"}
@@ -1,5 +1,5 @@
1
- import { A as IntegrationTriggerSubscription, F as StartAuthRequest, I as StartAuthResult, M as IssueCapabilityRequest, N as IssuedIntegrationCapability, a as IntegrationActionResult, b as IntegrationHubOptions, d as IntegrationConnection, j as InvokeWithCapabilityRequest, l as IntegrationCapability, p as IntegrationConnector, s as IntegrationActor, t as CompleteAuthRequest } from "./core-types-DfCMwTYt.js";
2
- import { n as IntegrationRegistry, t as ComposeIntegrationRegistryOptions } from "./registry-core-DtFI-9kF.js";
1
+ import { F as IssuedIntegrationCapability, L as StartAuthRequest, M as IntegrationTriggerSubscription, N as InvokeWithCapabilityRequest, P as IssueCapabilityRequest, R as StartAuthResult, S as IntegrationHubOptions, c as IntegrationActor, f as IntegrationConnection, h as IntegrationConnector, m as IntegrationConnectionTestStatus, n as ConnectApiKeyRequest, o as IntegrationActionResult, t as CompleteAuthRequest, u as IntegrationCapability } from "./core-types-0BenSoZJ.js";
2
+ import { n as IntegrationRegistry, t as ComposeIntegrationRegistryOptions } from "./registry-core-B1ApiG47.js";
3
3
  //#region src/hub.d.ts
4
4
  declare class IntegrationHub {
5
5
  private readonly providers;
@@ -19,6 +19,8 @@ declare class IntegrationHub {
19
19
  listRegistry(options?: ComposeIntegrationRegistryOptions): Promise<IntegrationRegistry>;
20
20
  startAuth(providerId: string, request: StartAuthRequest): Promise<StartAuthResult>;
21
21
  completeAuth(providerId: string, request: CompleteAuthRequest): Promise<IntegrationConnection>;
22
+ connectApiKey(providerId: string, request: ConnectApiKeyRequest): Promise<IntegrationConnection>;
23
+ testConnection(connectionId: string): Promise<IntegrationConnectionTestStatus>;
22
24
  upsertConnection(connection: IntegrationConnection): Promise<IntegrationConnection>;
23
25
  listConnections(owner: IntegrationActor): Promise<IntegrationConnection[]>;
24
26
  getConnection(connectionId: string): Promise<IntegrationConnection | undefined>;
@@ -35,4 +37,4 @@ declare function signCapability(capability: IntegrationCapability, secret: strin
35
37
  declare function verifyCapabilityToken(token: string, secret: string): IntegrationCapability;
36
38
  //#endregion
37
39
  export { signCapability as n, verifyCapabilityToken as r, IntegrationHub as t };
38
- //# sourceMappingURL=hub-fmmnwC2s.d.ts.map
40
+ //# sourceMappingURL=hub-DkiKVWJX.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub-DkiKVWJX.d.ts","names":["_$__core_types_js0.IntegrationConnectionTestStatus"],"sources":["../src/hub.ts"],"mappings":";;;cAmCa;mBACM;mBACA;mBACA;mBACA;mBACA;;;WAGR,aAAa;mBACL;mBACA;mBACA;mBACA;EAEjB,YAAY,SAAS;EAgBf,kBAAkB,QAAQ;EAK1B,aAAa,UAAS,oCAAyC,QAAQ;EAQvE,UAAU,oBAAoB,SAAS,mBAAmB,QAAQ;EAyBlE,aAAa,oBAAoB,SAAS,sBAAsB,QAAQ;EA8BxE,cAAc,oBAAoB,SAAS,uBAAuB,QAAQ;EAQ1E,eAAe,uBAAoB,QAR+BA;EAelE,iBAAiB,YAAY,wBAAwB,QAAQ;EAK7D,gBAAgB,OAAO,mBAAmB,QAAQ;EAIlD,cAAc,uBAAuB,QAAQ;EAI7C,gBAAgB,SAAS,yBAAyB,QAAQ;EAkBhE,iBAAiB,gBAAgB;EAQ3B,qBAAqB,eAAe,SAAS,8BAA8B,QAAQ;EAyCnF,iBAAiB,sBAAsB,iBAAiB,qBAAqB,QAAQ;UAcnF;UAMM;UAMA;UAMN;;iBAWM,eAAe,YAAY,uBAAuB;iBAMlD,sBAAsB,eAAe,iBAAiB"}
package/dist/hub.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as signCapability, r as verifyCapabilityToken, t as IntegrationHub } from "./hub-fmmnwC2s.js";
1
+ import { n as signCapability, r as verifyCapabilityToken, t as IntegrationHub } from "./hub-DkiKVWJX.js";
2
2
  export { IntegrationHub, signCapability, verifyCapabilityToken };
package/dist/hub.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as signCapability, r as verifyCapabilityToken, t as IntegrationHub } from "./hub-D13zPQGr.js";
1
+ import { n as signCapability, r as verifyCapabilityToken, t as IntegrationHub } from "./hub-Cl8phyJ9.js";
2
2
  export { IntegrationHub, signCapability, verifyCapabilityToken };
@@ -1,4 +1,4 @@
1
- import { a as TangleIdentityOptions, i as TangleIdentityClient, s as TangleTokenVerifyFailure } from "./tangle-id-Bq7jkKmE.js";
1
+ import { a as TangleIdentityOptions, i as TangleIdentityClient, s as TangleTokenVerifyFailure } from "./tangle-id-BW5dTiGi.js";
2
2
  //#region src/middleware/index.d.ts
3
3
  /** Auth context the middleware attaches to the request on success. */
4
4
  interface TangleAuthContext {
@@ -105,4 +105,4 @@ interface ExpressLikeResponse {
105
105
  }
106
106
  //#endregion
107
107
  export { TangleAuthContext as a, expressTangleAuthMiddleware as c, requireTangleAuth as d, RequireTangleAuthOptions as i, extractToken as l, ExpressLikeResponse as n, TangleAuthOutcome as o, HonoLikeContext as r, TangleAuthReason as s, ExpressLikeRequest as t, honoTangleAuthMiddleware as u };
108
- //# sourceMappingURL=index-DbwNiedC.d.ts.map
108
+ //# sourceMappingURL=index-BFK-G6g1.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DbwNiedC.d.ts","names":[],"sources":["../src/middleware/index.ts"],"mappings":";;;UAmDiB;EACf;EACA;EACA;EACA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;KAGU;EACN;EAAU,MAAM;;EAChB;EAAW;EAAyB,QAAQ;;;KAGtC,6FAIR;UAGa,iCAAiC;;;;EAIhD,SAAS;;;;EAIT;;;;;EAKA;;;;;;;;iBASoB,kBACpB,SAAS,KAAK,qBACd,OAAM,2BACL,QAAQ;;;;;;;;;;;;iBA2EK,aACd,SAAS,KAAK,qBACd;;;;;;;;;;iBAkDc,yBAAyB,OAAM,4BAA6B,GAErE,iBAAe,YACN,kBACX,QAAQ;;UAoBI;EACf;IAAO,KAAK;;EACZ,IAAI,mBAAmB,OAAO;;;;;;;;iBAShB,4BAA4B,OAAM,4BAA6B,KAEtE,oBAAkB,KAClB,qBAAmB,OACjB,2BACN;;UAoBY;EACf,SAAS;EACT,aAAa;;UAEE;EACf,OAAO;EACP,WAAW,cAAc;EACzB,IAAI"}
1
+ {"version":3,"file":"index-BFK-G6g1.d.ts","names":[],"sources":["../src/middleware/index.ts"],"mappings":";;;UAmDiB;EACf;EACA;EACA;EACA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;KAGU;EACN;EAAU,MAAM;;EAChB;EAAW;EAAyB,QAAQ;;;KAGtC,6FAIR;UAGa,iCAAiC;;;;EAIhD,SAAS;;;;EAIT;;;;;EAKA;;;;;;;;iBASoB,kBACpB,SAAS,KAAK,qBACd,OAAM,2BACL,QAAQ;;;;;;;;;;;;iBA2EK,aACd,SAAS,KAAK,qBACd;;;;;;;;;;iBAkDc,yBAAyB,OAAM,4BAA6B,GAErE,iBAAe,YACN,kBACX,QAAQ;;UAoBI;EACf;IAAO,KAAK;;EACZ,IAAI,mBAAmB,OAAO;;;;;;;;iBAShB,4BAA4B,OAAM,4BAA6B,KAEtE,oBAAkB,KAClB,qBAAmB,OACjB,2BACN;;UAoBY;EACf,SAAS;EACT,aAAa;;UAEE;EACf,OAAO;EACP,WAAW,cAAc;EACzB,IAAI"}
@@ -1,5 +1,5 @@
1
- import { C as OAuth2UrlTemplateMetadataSpec, p as ConnectorManifest } from "./types-W418mSuf.js";
2
- import "./index-BKTHRkGz.js";
1
+ import { C as OAuth2UrlTemplateMetadataSpec, p as ConnectorManifest } from "./types-Bq85dJDW.js";
2
+ import "./index-WwSnaq5E.js";
3
3
  //#region src/connectors/webhooks.d.ts
4
4
  /**
5
5
  * Inbound webhook signature verifiers — provider-specific HMAC schemes.
@@ -127,4 +127,4 @@ declare function bundledOAuth2Auth(manifest: ConnectorManifest): (BundledOAuth2A
127
127
  }) | undefined;
128
128
  //#endregion
129
129
  export { verifyStripeSignature as C, verifySlackSignature as S, TwilioVerifyOptions as _, bundledOAuth2Auth as a, verifyEmailSignature as b, hasBundledAdapter as c, DEFAULT_SIGNATURE_TOLERANCE_SECONDS as d, EmailVerifyOptions as f, StripeVerifyOptions as g, SlackVerifyOptions as h, bundledAuthMode as i, listBundledAdapterKinds as l, ParsedStripeSignatureHeader as m, BundledOAuth2AuthContract as n, bundledOAuth2AuthContract as o, GenericHmacVerifyOptions as p, bundledApiKeyHint as r, getBundledAdapterManifest as s, BundledAuthMode as t, listBundledAdapterManifests as u, firstHeader as v, verifyTwilioSignature as w, verifyHmacSignature as x, parseStripeSignatureHeader as y };
130
- //# sourceMappingURL=index-CHD_8Gn2.d.ts.map
130
+ //# sourceMappingURL=index-BNzWrQM0.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-CHD_8Gn2.d.ts","names":[],"sources":["../src/connectors/webhooks.ts","../src/connectors/bundled-manifest-data.ts"],"mappings":";;;;;;;;;;;;;;;;;;;cAmBa;UAcI;EACf;EACA;;iBAGc,2BAA2B,iBAAiB;UAkB3C;;EAEf;;EAEA;;;iBAIc,sBACd,iBACA,yBACA,gBACA,UAAS;UA0BM;EACf;EACA;;iBAGc,qBACd,iBACA,yBACA,yBACA,gBACA,UAAS;UAuBM;;;EAGf;;;EAGA;;EAEA;;iBAGc,oBACd,iBACA,yBACA,gBACA,UAAS;UAqCM;;;;EAIf;;;;EAIA;;EAEA;;;iBAIc,sBACd;EACE;EACA;EACA;EACA,QAAQ;GAEV,UAAS;UAkCM;;EAEf;;EAEA;;;iBAIc,qBACd,iBACA,yBACA,yBACA,gBACA,UAAS;iBAoBK,YACd,SAAS,+CACT;;;;iBCrPc,+BAA+B;;iBAK/B,0BAA0B,eAAe;;iBAKzC,kBAAkB;;iBAKlB;;;;;;;;;KAYJ;;;iBASI,gBAAgB,UAAU,oBAAoB;;iBAqB9C,kBAAkB,UAAU;UAS3B;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAkB;EAClB,sBAAsB;EACtB,sBAAsB,SAAS,eAAe;;;;iBAKhC,0BACd,UAAU,oBACT;;iBAiCa,kBAAkB,UAAU,qBACvC;EACC;EACA"}
1
+ {"version":3,"file":"index-BNzWrQM0.d.ts","names":[],"sources":["../src/connectors/webhooks.ts","../src/connectors/bundled-manifest-data.ts"],"mappings":";;;;;;;;;;;;;;;;;;;cAmBa;UAcI;EACf;EACA;;iBAGc,2BAA2B,iBAAiB;UAkB3C;;EAEf;;EAEA;;;iBAIc,sBACd,iBACA,yBACA,gBACA,UAAS;UA0BM;EACf;EACA;;iBAGc,qBACd,iBACA,yBACA,yBACA,gBACA,UAAS;UAuBM;;;EAGf;;;EAGA;;EAEA;;iBAGc,oBACd,iBACA,yBACA,gBACA,UAAS;UAqCM;;;;EAIf;;;;EAIA;;EAEA;;;iBAIc,sBACd;EACE;EACA;EACA;EACA,QAAQ;GAEV,UAAS;UAkCM;;EAEf;;EAEA;;;iBAIc,qBACd,iBACA,yBACA,yBACA,gBACA,UAAS;iBAoBK,YACd,SAAS,+CACT;;;;iBCrPc,+BAA+B;;iBAK/B,0BAA0B,eAAe;;iBAKzC,kBAAkB;;iBAKlB;;;;;;;;;KAYJ;;;iBASI,gBAAgB,UAAU,oBAAoB;;iBAqB9C,kBAAkB,UAAU;UAS3B;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAkB;EAClB,sBAAsB;EACtB,sBAAsB,SAAS,eAAe;;;;iBAKhC,0BACd,UAAU,oBACT;;iBAiCa,kBAAkB,UAAU,qBACvC;EACC;EACA"}
@@ -1,4 +1,4 @@
1
- import { a as TangleIdentityOptions, l as TangleUserSummary } from "./tangle-id-Bq7jkKmE.js";
1
+ import { a as TangleIdentityOptions, l as TangleUserSummary } from "./tangle-id-BW5dTiGi.js";
2
2
  import { i as PLATFORM_ACCESS_POLICY_VERSION } from "./billing-access-policy-CtvuHvM8.js";
3
3
  //#region src/connect/index.d.ts
4
4
  /** Request accepted by Platform's `/cross-site/exchange` route. */
@@ -103,4 +103,4 @@ declare class InMemoryConnectStateStore {
103
103
  }
104
104
  //#endregion
105
105
  export { PlatformExchangeRequest as a, StartConnectOutput as c, startConnectFlow as d, InMemoryConnectStateStore as i, finishConnectFlow as l, FinishConnectInput as n, PlatformExchangeResponse as o, FinishConnectOutput as r, StartConnectInput as s, ConnectFlowOptions as t, revokeConnectFlow as u };
106
- //# sourceMappingURL=index-B-VH5b3E.d.ts.map
106
+ //# sourceMappingURL=index-CkCYzn8f.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-B-VH5b3E.d.ts","names":[],"sources":["../src/connect/index.ts"],"mappings":";;;;UA2DiB;EACf;EACA;;;;;;;;;UAUe;EACf;EACA;EACA,gCAAgC;EAChC;EACA;IACE;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;;EAEF;;UAGe,2BAA2B;;EAE1C;;UAGe;;;EAGf;;;;EAIA;;;;;EAKA;;UAGe;;EAEf;;UAGe;;EAEf;;EAEA;;UAGe;;EAEf;;EAEA;;EAEA,MAAM;;EAEN;;EAEA,gCAAgC;;;;iBAKlB,iBACd,MAAM,oBACN,OAAO,oBACN;;;iBAmBmB,kBACpB,MAAM,oBACN,OAAO,qBACN,QAAQ;;iBAwEW,kBACpB,MAAM,oBACN;EAAS;IACR;;;;;;;cAqBU;mBACM;EAEjB,IAAI,eAAe;IAAS;IAAe;;EAO3C,QAAQ;IAAkB;;;EAQ1B"}
1
+ {"version":3,"file":"index-CkCYzn8f.d.ts","names":[],"sources":["../src/connect/index.ts"],"mappings":";;;;UA2DiB;EACf;EACA;;;;;;;;;UAUe;EACf;EACA;EACA,gCAAgC;EAChC;EACA;IACE;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;;EAEF;;UAGe,2BAA2B;;EAE1C;;UAGe;;;EAGf;;;;EAIA;;;;;EAKA;;UAGe;;EAEf;;UAGe;;EAEf;;EAEA;;UAGe;;EAEf;;EAEA;;EAEA,MAAM;;EAEN;;EAEA,gCAAgC;;;;iBAKlB,iBACd,MAAM,oBACN,OAAO,oBACN;;;iBAmBmB,kBACpB,MAAM,oBACN,OAAO,qBACN,QAAQ;;iBAwEW,kBACpB,MAAM,oBACN;EAAS;IACR;;;;;;;cAqBU;mBACM;EAEjB,IAAI,eAAe;IAAS;IAAe;;EAO3C,QAAQ;IAAkB;;;EAQ1B"}
@@ -1,4 +1,4 @@
1
- import { A as ResolvedDataSource, d as ConnectorCredentials, f as ConnectorInvocation, l as CapabilityReadResult, o as CapabilityMutationResult, p as ConnectorManifest, u as ConnectorAdapter, y as EventHandlerResult } from "./types-W418mSuf.js";
1
+ import { A as ResolvedDataSource, d as ConnectorCredentials, f as ConnectorInvocation, l as CapabilityReadResult, o as CapabilityMutationResult, p as ConnectorManifest, u as ConnectorAdapter, y as EventHandlerResult } from "./types-Bq85dJDW.js";
2
2
  import { Admin, Consumer, ISocketFactory, Kafka, KafkaConfig, Producer } from "kafkajs";
3
3
  import { MongoClientOptions } from "mongodb";
4
4
  import { ChannelModel, Options, SocketOptions } from "amqplib";
@@ -3411,7 +3411,9 @@ declare const metaAdsConnector: ConnectorAdapter;
3411
3411
  declare const base$3: ConnectorAdapter;
3412
3412
  declare const xAdsConnector: {
3413
3413
  manifest: ConnectorManifest;
3414
+ validateConnectionMetadata?(metadata: Record<string, unknown>): Record<string, unknown> | null;
3414
3415
  inboundOnly?: boolean;
3416
+ catalogOnly?: boolean;
3415
3417
  executeRead?(inv: ConnectorInvocation): Promise<CapabilityReadResult>;
3416
3418
  verifySignature?(input: {
3417
3419
  rawBody: string;
@@ -3431,6 +3433,7 @@ declare const xAdsConnector: {
3431
3433
  state: string;
3432
3434
  codeVerifier?: string;
3433
3435
  redirectUri: string;
3436
+ signal?: AbortSignal;
3434
3437
  }): Promise<{
3435
3438
  credentials: ConnectorCredentials;
3436
3439
  scopes: string[];
@@ -3453,7 +3456,9 @@ declare const tiktokAdsConnector: ConnectorAdapter;
3453
3456
  declare const base$2: ConnectorAdapter;
3454
3457
  declare const linkedinAdsConnector: {
3455
3458
  manifest: ConnectorManifest;
3459
+ validateConnectionMetadata?(metadata: Record<string, unknown>): Record<string, unknown> | null;
3456
3460
  inboundOnly?: boolean;
3461
+ catalogOnly?: boolean;
3457
3462
  executeRead?(inv: ConnectorInvocation): Promise<CapabilityReadResult>;
3458
3463
  verifySignature?(input: {
3459
3464
  rawBody: string;
@@ -3473,6 +3478,7 @@ declare const linkedinAdsConnector: {
3473
3478
  state: string;
3474
3479
  codeVerifier?: string;
3475
3480
  redirectUri: string;
3481
+ signal?: AbortSignal;
3476
3482
  }): Promise<{
3477
3483
  credentials: ConnectorCredentials;
3478
3484
  scopes: string[];
@@ -3492,7 +3498,9 @@ declare const linkedinAdsConnector: {
3492
3498
  declare const base$1: ConnectorAdapter;
3493
3499
  declare const redditAdsConnector: {
3494
3500
  manifest: ConnectorManifest;
3501
+ validateConnectionMetadata?(metadata: Record<string, unknown>): Record<string, unknown> | null;
3495
3502
  inboundOnly?: boolean;
3503
+ catalogOnly?: boolean;
3496
3504
  executeRead?(inv: ConnectorInvocation): Promise<CapabilityReadResult>;
3497
3505
  verifySignature?(input: {
3498
3506
  rawBody: string;
@@ -3512,6 +3520,7 @@ declare const redditAdsConnector: {
3512
3520
  state: string;
3513
3521
  codeVerifier?: string;
3514
3522
  redirectUri: string;
3523
+ signal?: AbortSignal;
3515
3524
  }): Promise<{
3516
3525
  credentials: ConnectorCredentials;
3517
3526
  scopes: string[];
@@ -5531,4 +5540,4 @@ declare const cloudbedsConnector: ConnectorAdapter;
5531
5540
  declare const pricelabsConnector: ConnectorAdapter;
5532
5541
  //#endregion
5533
5542
  export { zeplinConnector as $, linkedinAdsConnector as $a, GoogleDocsOptions as $c, azureBlobStorageConnector as $d, MicrosoftCalendarOptions as $f, leadConnectorConnector as $i, contentfulConnector as $l, postgresConnector as $n, copyAiConnector as $o, humeAiConnector as $r, avalaraConnector as $s, supadataConnector as $t, digitalPilotConnector as $u, leadmagicConnector as A, hashiCorpVaultConnector as Aa, amazonBedrockConnector as Ac, oktaConnector as Ad, rampConnector as Af, mattermostConnector as Ai, datadogConnector as Al, retableConnector as An, firefliesAiConnector as Ao, niftyConnector as Ar, captainDataConnector as As, tiktokConnector as At, quickbooksConnector as Au, snovIoConnector as B, googleSearchConnector as Ba, activecampaignConnector as Bc, twentyConnector as Bd, ClientCredentialsRestSpec as Bf, loftyConnector as Bi, dropboxConnector as Bl, rapidtextAiConnector as Bn, dumplingAiConnector as Bo, metabaseConnector as Br, billplzConnector as Bs, timelinesAiConnector as Bt, modelslabConnector as Bu, usergemsConnector as C, huggingFaceConnector as Ca, amazonCloudWatchConnector as Cc, anyhookWebsocketConnector as Cd, gtmAgentConnector as Cf, microsoftDynamicsCrmConnector as Ci, opsgenieConnector as Cl, scrapegraphaiConnector as Cn, fireberryConnector as Co, odooConnector as Cr, chargekeepConnector as Cs, umamiConnector as Ct, EtsyOptions as Cu, zenrowsConnector as D, housecallProConnector as Da, alaiConnector as Dc, scimConnector as Dd, netsuiteConnector as Df, messagebirdConnector as Di, discourseConnector as Dl, runwareConnector as Dn, enrichlayerConnector as Do, notionConnector as Dr, cannyConnector as Ds, twilioConnector as Dt, bigcommerceConnector as Du, oceanIoConnector as E, influencersClubConnector as Ea, altTextAiConnector as Ec, actualbudgetConnector as Ed, sageIntacctConnector as Ef, mauticConnector as Ei, digitalOceanConnector as El, saasticConnector as En, fathomConnector as Eo, notion as Er, capsuleCrmConnector as Es, upgradechatConnector as Et, shopifyConnector as Eu, serperConnector as F, greenptConnector as Fa, afforaiConnector as Fc, linkedinConnector as Fd, PhonyConnectorOptions as Ff, mastodonConnector as Fi, mycaseConnector as Fl, RedditOptions as Fn, easyPeasyAiConnector as Fo, MongoDbConnectorOptions as Fr, bookedinConnector as Fs, typefullyConnector as Ft, zohoBooksConnector as Fu, lagrowthmachineConnector as G, googleMeetConnector as Ga, MicrosoftTeamsOptions as Gc, airtableConnector as Gd, RestRequestSpec as Gf, llmrailsConnector as Gi, figmaConnector as Gl, pushbulletConnector as Gn, descriptConnector as Go, knockConnector as Gr, beamerConnector as Gs, teableConnector as Gt, flowParserConnector as Gu, contactoutConnector as H, googlePubSubConnector as Ha, sharepoint as Hc, salesforceConnector as Hd, RestConnectorSpec as Hf, logrocketConnector as Hi, canvaConnector as Hl, quadernoConnector as Hn, documergeConnector as Ho, medullarConnector as Hr, bitlyConnector as Hs, textcortexAiConnector as Ht, generatebannersConnector as Hu, leadfeederConnector as I, googleTasksConnector as Ia, agentxConnector as Ic, instagramBusinessConnector as Id, createPhonyConnector as If, lucidyaConnector as Ii, mondayConnector as Il, reddit as In, edenAiConnector as Io, createMongoDbConnector as Ir, bexioConnector as Is, totalcmsConnector as It, zohoDeskConnector as Iu, pipedreamConnector as J, MicrosoftAdsOptions as Ja, outlookMail as Jc, githubConnector as Jd, docuseal as Jf, linkaConnector as Ji, confluenceConnector as Jl, predictLeadsConnector as Jn, deepseekConnector as Jo, insightoAiConnector as Jr, azureOpenaiConnector as Js, talkableConnector as Jt, everhourConnector as Ju, heyreachConnector as K, AmazonAdsOptions as Ka, microsoftTeams as Kc, gitlabConnector as Kd, declarativeRestConnector as Kf, lobstermailConnector as Ki, adobeSignConnector as Kl, proxycurlConnector as Kn, devinConnector as Ko, kallabotAiConnector as Kr, baremetricsConnector as Ks, ticktickConnector as Kt, fellowConnector as Ku, commonRoomConnector as L, googleMyBusinessConnector as La, airOpsConnector as Lc, facebookPagesConnector as Ld, phonyConnector as Lf, luxuryPresenceConnector as Li, trelloConnector as Ll, redditConnector as Ln, elasticEmailConnector as Lo, mongodbConnector as Lr, bolnaConnector as Ls, togglTrackConnector as Lt, zohoCrmConnector as Lu, crustdataConnector as M, hastewireConnector as Ma, aipriseConnector as Mc, telegramConnector as Md, stripePackConnector as Mf, mailgunConnector as Mi, clioConnector as Ml, reoonVerifierConnector as Mn, emailitConnector as Mo, MySqlConnectorOptions as Mr, campaignMonitorConnector as Ms, twitter as Mt, zohoCampaignsConnector as Mu, autoboundConnector as N, guideliteConnector as Na, acumbamailConnector as Nc, LinkedInOptions as Nd, WhatsappBusinessOptions as Nf, manychatConnector as Ni, basecampConnector as Nl, taxjarConnector as Nn, emailoctopusConnector as No, createMySqlConnector as Nr, brilliantDirectoriesConnector as Ns, twitterConnector as Nt, zohoMailConnector as Nu, phantombusterConnector as O, heymarketSmsConnector as Oa, airtopConnector as Oc, oneloginConnector as Od, billComConnector as Of, meetgeekAiConnector as Oi, cloudflareConnector as Ol, robollyConnector as On, fathomAnalyticsConnector as Oo, nocodbConnector as Or, chainalysisApiConnector as Os, TikTokOptions as Ot, gustoConnector as Ou, warmlyConnector as P, greipConnector as Pa, aidbaseConnector as Pc, createLinkedinConnector as Pd, whatsappBusiness as Pf, matomoConnector as Pi, clickupConnector as Pl, recurlyConnector as Pn, dustConnector as Po, mysqlConnector as Pr, browseAiConnector as Ps, twinLabsConnector as Pt, zohoInvoiceConnector as Pu, zuoraConnector as Q, redditAdsConnector as Qa, googleForms as Qc, azureEventGridConnector as Qd, hubspot as Qf, linkupConnector as Qi, sanityConnector as Ql, createPostgresConnector as Qn, datafuelConnector as Qo, hystructConnector as Qr, azureCommunicationServicesConnector as Qs, swarmnodeConnector as Qt, docsbotConnector as Qu, builtwithConnector as R, googlechatConnector as Ra, savvycalConnector as Rc, discordConnector as Rd, twilioSmsConnector as Rf, mailerLiteConnector as Ri, linearConnector as Rl, reachinboxConnector as Rn, documentproConnector as Ro, mindStudioConnector as Rr, blueskyConnector as Rs, todoistConnector as Rt, closeConnector as Ru, hightouchConnector as S, insightlyConnector as Sa, amazonLambdaConnector as Sc, apifyConnector as Sd, rssConnector as Sf, microsoftDynamics365BusinessCentralConnector as Si, auth0Connector as Sl, scrapelessConnector as Sn, flowluConnector as So, omniCoConnector as Sr, chatlingConnector as Ss, uscreenConnector as St, quickzuConnector as Su, seamlessAiConnector as T, hunterConnector as Ta, alttextifyConnector as Tc, aianswerConnector as Td, webhookConnector as Tf, microsoft365PeopleConnector as Ti, clicksendConnector as Tl, saleorConnector as Tn, filloutFormsConnector as To, NotionOptions as Tr, cashfreePaymentsConnector as Ts, vapiConnector as Tt, ebayConnector as Tu, bettercontactConnector as U, googleCloudStorageConnector as Ua, OneDriveOptions as Uc, asanaConnector as Ud, RestCredentialPlacement as Uf, lokaliseConnector as Ui, miroConnector as Ul, qawafelConnector as Un, dittofeedConnector as Uo, mailchainConnector as Ur, blandAiConnector as Us, tenzoConnector as Ut, genderApiConnector as Uu, findymailConnector as V, googleBigqueryConnector as Va, SharePointOptions as Vc, firebaseConnector as Vd, clientCredentialsRestConnector as Vf, logsnagConnector as Vi, boxConnector as Vl, raiaAiConnector as Vn, doctlyConnector as Vo, mollieConnector as Vr, biginByZohoConnector as Vs, timeOpsConnector as Vt, giftbitConnector as Vu, saleshandyConnector as W, youtubeDataConnector as Wa, oneDrive as Wc, baserowConnector as Wd, RestOperationSpec as Wf, magicalApiConnector as Wi, figjamConnector as Wl, pushoverConnector as Wn, datocmsConnector as Wo, loopsConnector as Wr, bettermodeConnector as Ws, telnyxConnector as Wt, gammaConnector as Wu, n8nConnector as X, pinterestAdsConnector as Xa, microsoftGraph as Xc, stripeWebhookReceiverConnector as Xd, slack as Xf, lemlistConnector as Xi, webflowConnector as Xl, postizConnector as Xn, copperConnector as Xo, imapConnector as Xr, azureAdConnector as Xs, systemeIoConnector as Xt, echowinConnector as Xu, makeConnector as Y, createMicrosoftAdsConnector as Ya, MicrosoftGraphOptions as Yc, slackEventsConnector as Yd, SlackOptions as Yf, letsCalendarConnector as Yi, wordpressConnector as Yl, posthogConnector as Yn, customgptConnector as Yo, instaChartsConnector as Yr, barcodeLookupConnector as Ys, tableauConnector as Yt, elevenlabsConnector as Yu, zapierConnector as Z, snapchatAdsConnector as Za, GoogleFormsOptions as Zc, azureServiceBusConnector as Zd, HubSpotOptions as Zf, lightfunnelsConnector as Zi, codaConnector as Zl, PostgresConnectorOptions as Zn, cryptolensConnector as Zo, ibmCognoseConnector as Zr, autocallsConnector as Zs, stripeConnector as Zt, dripConnector as Zu, modjoConnector as _, jiraDataCenterConnector as _a, apitemplateIoConnector as _c, bikaConnector as _d, csvFilesConnector as _f, microsoftTodoConnector as _i, huggingfaceConnector as _l, serpstatConnector as _n, formstackConnector as _o, ConnectorAdapterFactoryDefinition as _p, openmicAiConnector as _r, circleConnector as _s, voucheryIoConnector as _t, helpscoutConnector as _u, resendConnector as a, kudosityConnector as aa, adpConnector as ac, contextualAiConnector as ad, RedshiftConnectorOptions as af, granolaConnector as ai, smooveConnector as al, smartsheetConnector as an, googleSearchConsoleConnector as ao, googleErrorReason as ap, perplexityAiConnector as ar, cometapiConnector as as, workableConnector as at, calComConnector as au, signwellConnector as b, imageRouterConnector as ba, amazonSnsConnector as bc, bannerbearConnector as bd, kafkaConnector as bf, microsoftPowerBiConnector as bi, anthropicConnector as bl, skyprepConnector as bn, flipandoConnector as bo, openRouterConnector as br, chartlyConnector as bs, vidlab7Connector as bt, zendeskConnector as bu, inkboxConnector as c, klentyConnector as ca, clayConnector as cc, clearoutphoneConnector as cd, RedisConnectorOptions as cf, gotifyConnector as ci, vercelConnector as cl, simplirouteConnector as cn, freshserviceConnector as co, gmail as cp, parseurConnector as cr, cognitoFormsConnector as cs, woodpeckerConnector as ct, marketoConnector as cu, ringcentralConnector as d, kapsoConnector as da, similarwebConnector as dc, chatAidConnector as dd, RabbitMqConnectorOptions as df, exaConnector as di, workdayConnector as dl, signrequestConnector as dn, fragmentConnector as do, googleSheets as dp, pastefyConnector as dr, cloutlyConnector as ds, whatsappConnector as dt, sendgridConnector as du, lettaConnector as ea, avomaConnector as ec, detectingAiConnector as ed, amazonS3Connector as ef, hedyConnector as ei, googleDocs as el, squareConnector as en, tiktokAdsConnector as eo, microsoftCalendar as ep, pollybotAiConnector as er, dashworksConnector as es, zerobounceConnector as et, zohoBookingsConnector as eu, gongConnector as f, kizeoFormsConnector as fa, apolloConnector as fc, chaindeskConnector as fd, createRabbitMqConnector as ff, missiveConnector as fi, ripplingConnector as fl, oneSpanSignConnector as fn, frameConnector as fo, GoogleDriveOptions as fp, paperformConnector as fr, clockifyConnector as fs, webscrapingAiConnector as ft, klaviyoConnector as fu, factorsAiConnector as g, justInvoiceConnector as ga, ampecoConnector as gc, buttondownConnector as gd, excelFilesConnector as gf, millionverifierConnector as gi, weaviateConnector as gl, tregConnector as gn, foreplayCoConnector as go, CONNECTOR_ADAPTER_FACTORIES as gp, opnformConnector as gr, checkoutConnector as gs, vtexConnector as gt, frontConnector as gu, getresponseConnector as h, jiraCloudConnector as ha, appfollowConnector as hc, cambAiConnector as hd, parquetFilesConnector as hf, mindeeConnector as hi, pineconeConnector as hl, serviceNowConnector as hn, fountainConnector as ho, googleCalendar as hp, orimonConnector as hr, chatnodeConnector as hs, vtigerConnector as ht, gorgiasConnector as hu, clerkConnector as i, leapAiConnector as ia, ashbyConnector as ic, contiguityConnector as id, sftpConnector as if, zoomConnector as ii, hellosign as il, smartsuiteConnector as in, googleAnalyticsConnector as io, googleApiError as ip, personalAiConnector as ir, comfyicuConnector as is, writesonicBulkConnector as it, calCom as iu, fullenrichConnector as j, heygenConnector as ja, aircallConnector as jc, TELEGRAM_FILE_DOWNLOAD_ROOT as jd, plaidConnector as jf, matrixConnector as ji, sentryConnector as jl, replyIoConnector as jn, esignaturesConnector as jo, neonConnector as jr, braveSearchConnector as js, TwitterOptions as jt, attioConnector as ju, brightdataConnector as k, harvestConnector as ka, amazonSecretsManagerConnector as kc, pingIdentityConnector as kd, brexConnector as kf, mailerooConnector as ki, amplitudeConnector as kl, retellAiConnector as kn, firecrawlConnector as ko, ninjapipeConnector as kr, certopusConnector as ks, tiktok as kt, xeroConnector as ku, demandbaseConnector as l, kissflowConnector as la, cognismConnector as lc, claudeConnector as ld, createRedisConnector as lf, glideConnector as li, greenhouseConnector as ll, shippoConnector as ln, freeAgentConnector as lo, googleSlidesConnector as lp, paywhirlConnector as lr, clicdataConnector as ls, wonderchatConnector as lt, postmarkConnector as lu, outreachConnector as m, joggAiConnector as ma, apitableConnector as mc, cartloomConnector as md, duckdbConnector as mf, mixmaxConnector as mi, qdrantConnector as ml, signNowConnector as mn, mailercheckConnector as mo, GoogleCalendarOptions as mp, oracleDatabaseConnector as mr, cloudinaryConnector as ms, wafeqConnector as mt, freshdeskConnector as mu, cloudbedsConnector as n, lemonSqueezyConnector as na, avianConnector as nc, dappierConnector as nd, SftpConnectorOptions as nf, griptapeConnector as ni, pandadoc as nl, snowflakeConnector as nn, metaAdsConnector as no, classifyGoogleError as np, plausibleConnector as nr, crispConnector as ns, wrikeConnector as nt, calendlyConnector as nu, linqWhatsappConnector as o, koFiConnector as oa, paychexConnector as oc, codyConnector as od, createRedshiftConnector as of, gristConnector as oi, typeformConnector as ol, smartleadConnector as on, gistlyConnector as oo, googleTestFailureReason as op, peekshotConnector as or, cloudconvertConnector as os, woocommerceConnector as ot, customerIoConnector as ou, salesloftConnector as p, jotformConnector as pa, aminosConnector as pc, chainAwareConnector as pd, rabbitMqConnector as pf, mixpanelConnector as pi, bamboohrConnector as pl, ironcladConnector as pn, freshsalesConnector as po, googleDrive as pp, paddleConnector as pr, clockodoConnector as ps, whatConvertsConnector as pt, mailchimpConnector as pu, amplemarketConnector as q, createAmazonAdsConnector as qa, OutlookMailOptions as qc, giteaConnector as qd, DocuSealOptions as qf, localaiConnector as qi, docusignConnector as ql, productboardConnector as qn, denserAiConnector as qo, instasentConnector as qr, backblazeConnector as qs, tallyConnector as qt, featheryConnector as qu, sendblueConnector as r, kommoConnector as ra, assemblyaiConnector as rc, couchbaseConnector as rd, createSftpConnector as rf, affinityConnector as ri, HelloSignOptions as rl, smsmodeConnector as rn, googleAdsConnector as ro, classifyGoogleReason as rp, placidConnector as rr, constantContactConnector as rs, wufooConnector as rt, CalComOptions as ru, linqConnector as s, knackConnector as sa, zoominfoConnector as sc, clickfunnelsConnector as sd, redshiftConnector as sf, gptzeroDetectAiConnector as si, netlifyConnector as sl, simplybookmeConnector as sn, ghostcmsConnector as so, GmailOptions as sp, pdfmonkeyConnector as sr, cohereConnector as ss, wootricConnector as st, brazeConnector as su, pricelabsConnector as t, leexiConnector as ta, asknewsConnector as tc, deepgramConnector as td, chessComConnector as tf, heartbeatConnector as ti, PandaDocOptions as tl, socialkitConnector as tn, xAdsConnector as to, GoogleErrorClass as tp, pocketbaseConnector as tr, convertkitConnector as ts, youcanbookmeConnector as tt, acuitySchedulingConnector as tu, dialpadConnector as u, kimaiConnector as ua, semrushConnector as uc, chatsistantConnector as ud, redisConnector as uf, googleVertexaiConnector as ui, leverConnector as ul, shortIoConnector as un, gameballConnector as uo, GoogleSheetsOptions as up, pinchPaymentsConnector as ur, clearoutConnector as us, whatsscaleConnector as ut, sendpulseConnector as uu, nooksConnector as v, invoiceninjaConnector as va, amazonTextractConnector as vc, beehiivConnector as vd, KafkaConnectorOptions as vf, microsoftExcel365Connector as vi, geminiConnector as vl, senjaConnector as vn, formbricksConnector as vo, ConnectorAdapterFactoryEnvNames as vp, opportifyConnector as vr, chatDataConnector as vs, vlmRunConnector as vt, intercomConnector as vu, theirstackConnector as w, neverbounceConnector as wa, amazonEventBridgeConnector as wc, airparserConnector as wd, httpConnector as wf, memConnector as wi, pagerdutyConnector as wl, sardisConnector as wn, facebookLeadsConnector as wo, ntfyConnector as wr, chargebeeConnector as ws, validatedmailsConnector as wt, etsyConnector as wu, polytomicConnector as x, instantlyAiConnector as xa, amazonSesConnector as xc, askHandleConnector as xd, publicKafkaSocketFactory as xf, microsoft365PlannerConnector as xi, openaiConnector as xl, seekTableConnector as xn, flowiseConnector as xo, omnihrConnector as xr, chatbaseConnector as xs, vboutConnector as xt, zagomailConnector as xu, justcallConnector as y, jinaAiConnector as ya, amazonSqsConnector as yc, base44Connector as yd, createKafkaConnector as yf, microsoftOnenoteConnector as yi, googleGeminiConnector as yl, sendinblueConnector as yn, folkConnector as yo, resolveConnectorAdapterFactoryOptions as yp, openPhoneConnector as yr, chatwootConnector as ys, videoaskConnector as yt, zendeskSellConnector as yu, wizaConnector as z, googleContactsConnector as za, kustomerConnector as zc, supabaseConnector as zd, ClientCredentialsRegion as zf, lushaConnector as zi, adobeCreativeCloudConnector as zl, recallAiConnector as zn, dubConnector as zo, segmentConnector as zr, bonjoroConnector as zs, tlDvConnector as zt, pipedriveConnector as zu };
5534
- //# sourceMappingURL=index-BKTHRkGz.d.ts.map
5543
+ //# sourceMappingURL=index-WwSnaq5E.d.ts.map