Function: createAdapterNamespace()
Makaio Framework / ai-adapters-core / createAdapterNamespace
Function: createAdapterNamespace()
Section titled “Function: createAdapterNamespace()”createAdapterNamespace<
N,Schemas>(domain,schemas,options?):BusNamespace<N,SubjectRecordFromSchemaRecord<Schemas>,{ [KeyType in PropertyKey]: AllPropertiesOfUnion<FilterablePayload<SubjectRecordFromSchemaRecord<Schemas>[keyof Schemas & string]>>[KeyType] },Schemas>
Defined in: ../../../adapters/core/src/factory/create-adapter-namespace.ts:50
Creates an adapter namespace with typed subject definitions.
Seam: Thin wrapper around MakaioBus.registerNamespace that:
- Delegates to bus-core for namespace registration
- Preserves FilterPayload type for type-safe withFilter()
- Provides extension point for future adapter-specific features
Type Parameters
Section titled “Type Parameters”N extends string
Schemas
Section titled “Schemas”Schemas extends SchemaRecord
Parameters
Section titled “Parameters”domain
Section titled “domain”N
Namespace domain (e.g., ‘adapter:claudeCode’)
schemas
Section titled “schemas”Schemas
Record of subject schemas (events and requests)
options?
Section titled “options?”Registration options (e.g., skipBusValidation for Zod version conflicts)
Returns
Section titled “Returns”BusNamespace<N, SubjectRecordFromSchemaRecord<Schemas>, { [KeyType in PropertyKey]: AllPropertiesOfUnion<FilterablePayload<SubjectRecordFromSchemaRecord<Schemas>[keyof Schemas & string]>>[KeyType] }, Schemas>
Adapter namespace with typed subjects and pre-computed FilterPayload
Example
Section titled “Example”const ClaudeCodeNamespace = createAdapterNamespace('adapter:claudeCode', { thinking: z.object({ content: z.string() }), getContext: { request: z.object({ path: z.string() }), response: z.object({ content: z.string() }), },});
// Access typed subjectsClaudeCodeNamespace.subjects.thinking;
// Get scoped bus with type-safe filteringconst bus = await ClaudeCodeNamespace.scopedBus();bus.withFilter({ content: 'test' }); // ✅ Type-checked
// For adapters with bundled Zod v3 (e.g., @github/copilot/sdk):const CopilotNamespace = createAdapterNamespace('adapter:copilot', schemas, { skipBusValidation: true, // Skip validation due to Zod version conflict});