chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase
This commit is contained in:
parent
970e08c466
commit
1f7e365a4e
237 changed files with 1951 additions and 49413 deletions
|
|
@ -82,7 +82,12 @@ export interface IntegrationResponse {
|
|||
export class IntegrationHub {
|
||||
private integrations: Map<IntegrationType, IntegrationBase> = new Map()
|
||||
private config: Required<IntegrationHubConfig>
|
||||
private _endpoints: Record<IntegrationType, string> = {} as any
|
||||
/**
|
||||
* Endpoint paths keyed by integration type. Starts empty and gains one key
|
||||
* per integration enabled in initialize() — disabled integrations have no
|
||||
* entry, hence the sparse-record assertion on the initializer.
|
||||
*/
|
||||
private _endpoints: Record<IntegrationType, string> = {} as Record<IntegrationType, string>
|
||||
|
||||
/**
|
||||
* Create and initialize the Integration Hub
|
||||
|
|
@ -168,7 +173,7 @@ export class IntegrationHub {
|
|||
|
||||
private getBasePath(type: IntegrationType): string {
|
||||
const basePath = this.config.basePath
|
||||
const cfg = this.config.config?.[type] as any
|
||||
const cfg = this.config.config?.[type]
|
||||
|
||||
switch (type) {
|
||||
case 'odata':
|
||||
|
|
@ -222,7 +227,13 @@ export class IntegrationHub {
|
|||
if (path.startsWith(basePath) || path === basePath) {
|
||||
const integration = this.integrations.get(type as IntegrationType)
|
||||
if (integration && 'handleRequest' in integration) {
|
||||
const handler = integration as any
|
||||
// The `in` guard proved the integration exposes an HTTP handler.
|
||||
// Each integration declares its own structurally-compatible
|
||||
// request/response shapes (e.g. the OData request/response pair),
|
||||
// so the hub dispatches through this minimal common signature.
|
||||
const handler = integration as IntegrationBase & {
|
||||
handleRequest(request: IntegrationRequest): Promise<IntegrationResponse>
|
||||
}
|
||||
const relativePath = path.slice(basePath.length) || '/'
|
||||
|
||||
return handler.handleRequest({
|
||||
|
|
|
|||
Reference in a new issue