Skip to main content

@idpass/data-collect-core / AdapterRegistry

Class: AdapterRegistry

Defined in: components/AdapterRegistry.ts:61

Registry for external sync adapters.

Provides a centralized mechanism for registering, discovering, and instantiating ExternalSyncAdapterV2 implementations. Each adapter is registered with a type string and a factory function.

Example

import { adapterRegistry } from "@idpass/data-collect-core";

// Register an adapter
adapterRegistry.register("openspp", () => new OpenSppOdooSyncAdapter(eventStore, eventApplierService));

// Create an instance
const adapter = adapterRegistry.create("openspp");
await adapter.initialize(config);

Constructors

Constructor

new AdapterRegistry(): AdapterRegistry

Returns

AdapterRegistry

Methods

register()

register(type, factory): void

Defined in: components/AdapterRegistry.ts:72

Register an adapter factory for a given type.

Parameters

type

string

The adapter type string (e.g., "openspp", "openfn")

factory

AdapterFactory

Factory function that creates a new adapter instance

Returns

void

Throws

If type is empty or factory is not a function


create()

create(type, deps?): ExternalSyncAdapterV2

Defined in: components/AdapterRegistry.ts:93

Create a new adapter instance for the given type.

Parameters

type

string

The adapter type string

deps?

AdapterDeps

Returns

ExternalSyncAdapterV2

A new ExternalSyncAdapterV2 instance

Throws

If no factory is registered for the given type


has()

has(type): boolean

Defined in: components/AdapterRegistry.ts:110

Check if an adapter factory is registered for the given type.

Parameters

type

string

The adapter type string to check

Returns

boolean

true if a factory is registered for this type


types()

types(): string[]

Defined in: components/AdapterRegistry.ts:119

List all registered adapter types.

Returns

string[]

Array of registered type strings


describe()

describe(type): AdapterDescriptor

Defined in: components/AdapterRegistry.ts:134

Get the descriptor for an adapter type without retaining the instance.

Creates a temporary adapter instance to retrieve its descriptor, then discards the instance. Results are cached to avoid repeated instantiation.

Parameters

type

string

The adapter type string

Returns

AdapterDescriptor

The adapter's descriptor

Throws

If no factory is registered for the given type