StaticcreateCreate a service manager of the specified type.
Type of service manager to create
Promise resolving to configured service manager
// Mock manager (no options needed)
const mock = await ServiceManagerFactory.create('mock');
// Pyodide manager (no options needed)
const pyodide = await ServiceManagerFactory.create('pyodide');
// Local manager (requires kernel info)
const local = await ServiceManagerFactory.create('local', {
kernelId: 'abc-123',
kernelName: 'Python 3.11',
url: 'local-kernel://python311'
});
// Remote manager (requires server URL)
const remote = await ServiceManagerFactory.create('remote', {
url: 'http://localhost:8888',
token: 'my-token'
});
Create a service manager of the specified type.
Type of service manager to create
Promise resolving to configured service manager
// Mock manager (no options needed)
const mock = await ServiceManagerFactory.create('mock');
// Pyodide manager (no options needed)
const pyodide = await ServiceManagerFactory.create('pyodide');
// Local manager (requires kernel info)
const local = await ServiceManagerFactory.create('local', {
kernelId: 'abc-123',
kernelName: 'Python 3.11',
url: 'local-kernel://python311'
});
// Remote manager (requires server URL)
const remote = await ServiceManagerFactory.create('remote', {
url: 'http://localhost:8888',
token: 'my-token'
});
Create a service manager of the specified type.
Type of service manager to create
Type-specific options (required for local/remote)
Promise resolving to configured service manager
// Mock manager (no options needed)
const mock = await ServiceManagerFactory.create('mock');
// Pyodide manager (no options needed)
const pyodide = await ServiceManagerFactory.create('pyodide');
// Local manager (requires kernel info)
const local = await ServiceManagerFactory.create('local', {
kernelId: 'abc-123',
kernelName: 'Python 3.11',
url: 'local-kernel://python311'
});
// Remote manager (requires server URL)
const remote = await ServiceManagerFactory.create('remote', {
url: 'http://localhost:8888',
token: 'my-token'
});
Create a service manager of the specified type.
Type of service manager to create
Type-specific options (required for local/remote)
Promise resolving to configured service manager
// Mock manager (no options needed)
const mock = await ServiceManagerFactory.create('mock');
// Pyodide manager (no options needed)
const pyodide = await ServiceManagerFactory.create('pyodide');
// Local manager (requires kernel info)
const local = await ServiceManagerFactory.create('local', {
kernelId: 'abc-123',
kernelName: 'Python 3.11',
url: 'local-kernel://python311'
});
// Remote manager (requires server URL)
const remote = await ServiceManagerFactory.create('remote', {
url: 'http://localhost:8888',
token: 'my-token'
});
StaticfromCreate a service manager from a configuration object.
This is the preferred method for creating service managers as it provides a single, unified interface regardless of manager type.
Discriminated union configuration
Promise resolving to configured service manager
// Mock
const mock = await ServiceManagerFactory.fromConfig({ type: 'mock' });
// Pyodide
const pyodide = await ServiceManagerFactory.fromConfig({ type: 'pyodide' });
// Local kernel
const local = await ServiceManagerFactory.fromConfig({
type: 'local',
kernelId: 'abc-123',
kernelName: 'Python 3.11',
url: 'local-kernel://python311'
});
// Remote server
const remote = await ServiceManagerFactory.fromConfig({
type: 'remote',
url: 'http://localhost:8888',
token: 'my-token'
});
StaticgetGet the type of a service manager.
Uses the managerType property from base classes to determine type.
Service manager to identify
Type of the service manager
StaticisCheck if a service manager is of a specific type.
Uses the managerType property from base classes to determine type.
Service manager to check
Expected type
True if manager matches the specified type
Factory for creating service managers.
Provides a centralized, type-safe way to create service managers of different types with appropriate configuration.