Datalayer VS Code Extension - v0.0.6
    Preparing search index...

    Factory for creating service managers.

    Provides a centralized, type-safe way to create service managers of different types with appropriate configuration.

    Index

    Constructors

    Methods

    • Create a service manager of the specified type.

      Parameters

      • type: "mock"

        Type of service manager to create

      Returns Promise<IManager>

      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.

      Parameters

      • type: "pyodide"

        Type of service manager to create

      Returns Promise<IManager>

      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.

      Parameters

      • type: "local"

        Type of service manager to create

      • options: LocalManagerOptions

        Type-specific options (required for local/remote)

      Returns Promise<IManager>

      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.

      Parameters

      • type: "remote"

        Type of service manager to create

      • options: RemoteManagerOptions

        Type-specific options (required for local/remote)

      Returns Promise<IManager>

      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 from a configuration object.

      This is the preferred method for creating service managers as it provides a single, unified interface regardless of manager type.

      Parameters

      Returns Promise<IManager>

      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'
      });
    • Get the type of a service manager.

      Uses the managerType property from base classes to determine type.

      Parameters

      • manager: IManager

        Service manager to identify

      Returns "mock" | "pyodide" | "local" | "remote"

      Type of the service manager

      const type = ServiceManagerFactory.getType(manager);
      console.log(`Current manager type: ${type}`);
    • Check if a service manager is of a specific type.

      Uses the managerType property from base classes to determine type.

      Parameters

      • manager: IManager

        Service manager to check

      • type: "mock" | "pyodide" | "local" | "remote"

        Expected type

      Returns boolean

      True if manager matches the specified type

      if (ServiceManagerFactory.isType(manager, 'pyodide')) {
      console.log('Running in browser with Pyodide');
      }