Comunica
    Preparing search index...

    Interface ISeekableBindingsStream

    A stream of bindings that can skip ahead to a binding, instead of being consumed one at a time.

    This is for example useful for merge joins that want to skip ahead.

    BindingsStream

    interface ISeekableBindingsStream {
        _properties?: { [name: string]: any };
        _propertyCallbacks?: { [name: string]: [(value: any) => void] };
        _state: number;
        seek: (target: Bindings) => void;
        get closed(): boolean;
        get destroyed(): boolean;
        get done(): boolean;
        get ended(): boolean;
        get readable(): boolean;
        set readable(readable: boolean): void;
        _changeState(newState: number, eventAsync?: boolean): boolean;
        _destroy(cause: Error | undefined, callback: (error?: Error) => void): void;
        _end(destroy?: boolean): void;
        _endAsync(): void;
        _toStringDetails(): string;
        "[asyncIterator]"(): ESAsyncIterator<Bindings>;
        "[captureRejectionSymbol]"?<K>(
            error: Error,
            event: string | symbol,
            ...args: AnyRest,
        ): void;
        addListener<K>(
            eventName: string | symbol,
            listener: (...args: any[]) => void,
        ): this;
        append(
            items: AsyncIterator<Bindings> | Bindings[],
        ): AsyncIterator<Bindings>;
        clone(): ClonedIterator<Bindings>;
        close(): void;
        copyProperties(source: AsyncIterator<any>, propertyNames: string[]): void;
        destroy(cause?: Error): void;
        emit<K>(eventName: string | symbol, ...args: AnyRest): boolean;
        eventNames(): (string | symbol)[];
        filter<K extends Bindings>(
            filter: (item: Bindings) => item is K,
            self?: any,
        ): AsyncIterator<K>;
        filter(
            filter: (item: Bindings) => boolean,
            self?: any,
        ): AsyncIterator<Bindings>;
        forEach(callback: (item: Bindings) => void, self?: object): void;
        getMaxListeners(): number;
        getProperties(): { [name: string]: any };
        getProperty<P>(
            propertyName: string,
            callback?: (value: P) => void,
        ): P | undefined;
        listenerCount<K>(eventName: string | symbol, listener?: Function): number;
        listeners<K>(eventName: string | symbol): Function[];
        map<D>(map: MapFunction<Bindings, D>, self?: any): AsyncIterator<D>;
        off<K>(
            eventName: string | symbol,
            listener: (...args: any[]) => void,
        ): this;
        on<K>(eventName: string | symbol, listener: (...args: any[]) => void): this;
        once<K>(
            eventName: string | symbol,
            listener: (...args: any[]) => void,
        ): this;
        prepend(
            items: AsyncIterator<Bindings> | Bindings[],
        ): AsyncIterator<Bindings>;
        prependListener<K>(
            eventName: string | symbol,
            listener: (...args: any[]) => void,
        ): this;
        prependOnceListener<K>(
            eventName: string | symbol,
            listener: (...args: any[]) => void,
        ): this;
        range(start: number, end: number): AsyncIterator<Bindings>;
        rawListeners<K>(eventName: string | symbol): Function[];
        read(): Bindings | null;
        removeAllListeners(eventName?: string | symbol): this;
        removeListener<K>(
            eventName: string | symbol,
            listener: (...args: any[]) => void,
        ): this;
        setMaxListeners(n: number): this;
        setProperties(properties: { [name: string]: any }): void;
        setProperty<P>(propertyName: string, value: P): void;
        skip(offset: number): AsyncIterator<Bindings>;
        surround(
            prepend: AsyncIteratorOrArray<Bindings>,
            append: AsyncIteratorOrArray<Bindings>,
        ): AsyncIterator<Bindings>;
        take(limit: number): AsyncIterator<Bindings>;
        toArray(options?: { limit?: number }): Promise<Bindings[]>;
        toString(): string;
        transform<D>(options?: TransformOptions<Bindings, D>): AsyncIterator<D>;
        uniq(by?: (item: Bindings) => any): AsyncIterator<Bindings>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    _properties?: { [name: string]: any }
    _propertyCallbacks?: { [name: string]: [(value: any) => void] }
    _state: number
    seek: (target: Bindings) => void

    Skip past every remaining binding that precedes target in this stream's declared term order.

    After this call the next read returns the first binding that does not precede target, or nothing if the stream holds no such binding. Implementations may skip fewer bindings than they could. No implementation may skip a binding that does not precede target.

    Type Declaration

      • (target: Bindings): void
      • Parameters

        • target: Bindings

          The bindings to skip ahead to.

        Returns void

    Accessors

    • get closed(): boolean

      Gets whether the iterator has stopped generating new items.

      Returns boolean

    • get destroyed(): boolean

      Gets whether the iterator has been destroyed.

      Returns boolean

    • get done(): boolean

      Gets whether the iterator will not emit anymore items, either due to being closed or due to being destroyed.

      Returns boolean

    • get ended(): boolean

      Gets whether the iterator has finished emitting items.

      Returns boolean

    • get readable(): boolean

      Gets or sets whether this iterator might have items available for read. A value of false means there are definitely no items available; a value of true means items might be available.

      Returns boolean

      module:asynciterator.AsyncIterator.readable

    • set readable(readable: boolean): void

      Parameters

      • readable: boolean

      Returns void

    Methods

    • Protected

      Changes the iterator to the given state if possible and necessary, possibly emitting events to signal that change.

      Parameters

      • newState: number

        The ID of the new state

      • OptionaleventAsync: boolean

        Whether resulting events should be emitted asynchronously

      Returns boolean

      Whether the state was changed

      module:asynciterator.AsyncIterator.end

    • Called by module:asynciterator.AsyncIterator#destroy. Implementers can override this, but this should not be called directly.

      Parameters

      • cause: Error | undefined

        The reason why the iterator is destroyed.

      • callback: (error?: Error) => void

        A callback function with an optional error argument.

      Returns void

    • Protected

      Ends the iterator and cleans up. Should never be called before module:asynciterator.AsyncIterator#close; typically, close is responsible for calling _end.

      Parameters

      • Optionaldestroy: boolean

        If the iterator should be forcefully destroyed.

      Returns void

      module:asynciterator.AsyncIterator.end

    • Protected

      Asynchronously calls _end.

      Returns void

    • Protected

      Generates details for a textual representation of the iterator.

      Returns string

    • An AsyncIterator is async iterable. This allows iterators to be used via the for-await syntax.

      In cases where the returned EcmaScript AsyncIterator will not be fully consumed, it is recommended to manually listen for error events on the main AsyncIterator to avoid uncaught error messages.

      Returns ESAsyncIterator<Bindings>

      An EcmaScript AsyncIterator

    • Type Parameters

      • K

      Parameters

      • error: Error
      • event: string | symbol
      • ...args: AnyRest

      Returns void

    • Alias for emitter.on(eventName, listener).

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • listener: (...args: any[]) => void

      Returns this

      v0.1.26

    • Appends the items after those of the current iterator. After this operation, only read the returned iterator instead of the current one.

      Parameters

      • items: AsyncIterator<Bindings> | Bindings[]

        Items to insert after this iterator's (remaining) items

      Returns AsyncIterator<Bindings>

      A new iterator that appends items to this iterator

    • Creates a copy of the current iterator, containing all items emitted from this point onward. Further copies can be created; they will all start from this same point. After this operation, only read the returned copies instead of the original iterator.

      Returns ClonedIterator<Bindings>

      A new iterator that contains all future items of this iterator

    • Stops the iterator from generating new items. Already generated items or terminating items can still be emitted. After this, the iterator will end asynchronously.

      Returns void

      module:asynciterator.AsyncIterator.end

    • Copies the given properties from the source iterator.

      Parameters

      • source: AsyncIterator<any>

        The iterator to copy from

      • propertyNames: string[]

        List of property names to copy

      Returns void

    • Destroy the iterator and stop it from generating new items. This will not do anything if the iterator was already ended or destroyed. All internal resources will be released an no new items will be emitted, even not already generated items. Implementors should not override this method, but instead implement module:asynciterator.AsyncIterator#_destroy.

      Parameters

      • Optionalcause: Error

        An optional error to emit.

      Returns void

      module:asynciterator.AsyncIterator.end

      module:asynciterator.AsyncIterator.error Only if an error is passed.

    • Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.

      Returns true if the event had listeners, false otherwise.

      import { EventEmitter } from 'node:events';
      const myEmitter = new EventEmitter();

      // First listener
      myEmitter.on('event', function firstListener() {
      console.log('Helloooo! first listener');
      });
      // Second listener
      myEmitter.on('event', function secondListener(arg1, arg2) {
      console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
      });
      // Third listener
      myEmitter.on('event', function thirdListener(...args) {
      const parameters = args.join(', ');
      console.log(`event with parameters ${parameters} in third listener`);
      });

      console.log(myEmitter.listeners('event'));

      myEmitter.emit('event', 1, 2, 3, 4, 5);

      // Prints:
      // [
      // [Function: firstListener],
      // [Function: secondListener],
      // [Function: thirdListener]
      // ]
      // Helloooo! first listener
      // event with parameters 1, 2 in second listener
      // event with parameters 1, 2, 3, 4, 5 in third listener

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • ...args: AnyRest

      Returns boolean

      v0.1.26

    • Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

      import { EventEmitter } from 'node:events';

      const myEE = new EventEmitter();
      myEE.on('foo', () => {});
      myEE.on('bar', () => {});

      const sym = Symbol('symbol');
      myEE.on(sym, () => {});

      console.log(myEE.eventNames());
      // Prints: [ 'foo', 'bar', Symbol(symbol) ]

      Returns (string | symbol)[]

      v6.0.0

    • Return items from this iterator that match the filter. After this operation, only read the returned iterator instead of the current one.

      Type Parameters

      • K extends Bindings

      Parameters

      • filter: (item: Bindings) => item is K

        A filter function to call on this iterator's (remaining) items

      • Optionalself: any

        The this pointer for the filter function

      Returns AsyncIterator<K>

      A new iterator that filters items from this iterator

    • Return items from this iterator that match the filter. After this operation, only read the returned iterator instead of the current one.

      Parameters

      • filter: (item: Bindings) => boolean

        A filter function to call on this iterator's (remaining) items

      • Optionalself: any

        The this pointer for the filter function

      Returns AsyncIterator<Bindings>

      A new iterator that filters items from this iterator

    • Invokes the callback for each remaining item in the iterator. Switches the iterator to flow mode.

      Parameters

      • callback: (item: Bindings) => void

        A function that will be called with each item

      • Optionalself: object

        The this pointer for the callback

      Returns void

    • Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.

      Returns number

      v1.0.0

    • Retrieves all properties of the iterator.

      Returns { [name: string]: any }

      An object with property names as keys.

    • Retrieves the property with the given name from the iterator. If no callback is passed, it returns the value of the property or undefined if the property is not set. If a callback is passed, it returns undefined and calls the callback with the property the moment it is set.

      Type Parameters

      • P

      Parameters

      • propertyName: string

        The name of the property to retrieve

      • Optionalcallback: (value: P) => void

        A one-argument callback to receive the property value

      Returns P | undefined

      The value of the property (if set and no callback is given)

    • Returns the number of listeners listening for the event named eventName. If listener is provided, it will return how many times the listener is found in the list of the listeners of the event.

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event being listened for

      • Optionallistener: Function

        The event handler function

      Returns number

      v3.2.0

    • Returns a copy of the array of listeners for the event named eventName.

      server.on('connection', (stream) => {
      console.log('someone connected!');
      });
      console.log(util.inspect(server.listeners('connection')));
      // Prints: [ [Function] ]

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

      Returns Function[]

      v0.1.26

    • Maps items from this iterator using the given function. After this operation, only read the returned iterator instead of the current one.

      Type Parameters

      • D

      Parameters

      • map: MapFunction<Bindings, D>

        A mapping function to call on this iterator's (remaining) items

      • Optionalself: any

        The this pointer for the mapping function

      Returns AsyncIterator<D>

      A new iterator that maps the items from this iterator

    • Alias for emitter.removeListener().

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • listener: (...args: any[]) => void

      Returns this

      v10.0.0

    • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

      server.on('connection', (stream) => {
      console.log('someone connected!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the event listener to the beginning of the listeners array.

      import { EventEmitter } from 'node:events';
      const myEE = new EventEmitter();
      myEE.on('foo', () => console.log('a'));
      myEE.prependListener('foo', () => console.log('b'));
      myEE.emit('foo');
      // Prints:
      // b
      // a

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

      • listener: (...args: any[]) => void

        The callback function

      Returns this

      v0.1.101

    • Adds a one-time listener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

      server.once('connection', (stream) => {
      console.log('Ah, we have our first user!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the event listener to the beginning of the listeners array.

      import { EventEmitter } from 'node:events';
      const myEE = new EventEmitter();
      myEE.once('foo', () => console.log('a'));
      myEE.prependOnceListener('foo', () => console.log('b'));
      myEE.emit('foo');
      // Prints:
      // b
      // a

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

      • listener: (...args: any[]) => void

        The callback function

      Returns this

      v0.3.0

    • Prepends the items after those of the current iterator. After this operation, only read the returned iterator instead of the current one.

      Parameters

      • items: AsyncIterator<Bindings> | Bindings[]

        Items to insert before this iterator's (remaining) items

      Returns AsyncIterator<Bindings>

      A new iterator that prepends items to this iterator

    • Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

      server.prependListener('connection', (stream) => {
      console.log('someone connected!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

      • listener: (...args: any[]) => void

        The callback function

      Returns this

      v6.0.0

    • Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

      server.prependOnceListener('connection', (stream) => {
      console.log('Ah, we have our first user!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

      • listener: (...args: any[]) => void

        The callback function

      Returns this

      v6.0.0

    • Limits the current iterator to the given range. The current iterator may not be read anymore until the returned iterator ends.

      Parameters

      • start: number

        Index of the first item to return

      • end: number

        Index of the last item to return

      Returns AsyncIterator<Bindings>

      A new iterator with items in the given range

    • Returns a copy of the array of listeners for the event named eventName, including any wrappers (such as those created by .once()).

      import { EventEmitter } from 'node:events';
      const emitter = new EventEmitter();
      emitter.once('log', () => console.log('log once'));

      // Returns a new Array with a function `onceWrapper` which has a property
      // `listener` which contains the original listener bound above
      const listeners = emitter.rawListeners('log');
      const logFnWrapper = listeners[0];

      // Logs "log once" to the console and does not unbind the `once` event
      logFnWrapper.listener();

      // Logs "log once" to the console and removes the listener
      logFnWrapper();

      emitter.on('log', () => console.log('log persistently'));
      // Will return a new Array with a single function bound by `.on()` above
      const newListeners = emitter.rawListeners('log');

      // Logs "log persistently" twice
      newListeners[0]();
      emitter.emit('log');

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

      Returns Function[]

      v9.4.0

    • Tries to read the next item from the iterator. This is the main method for reading the iterator in on-demand mode, where new items are only created when needed by consumers. If no items are currently available, this methods returns null. The module:asynciterator.event:readable event will then signal when new items might be ready. To read all items from the iterator, switch to flow mode by subscribing to the module:asynciterator.event:data event. When in flow mode, do not use the read method.

      Returns Bindings | null

      The next item, or null if none is available

    • Removes all listeners, or those of the specified eventName.

      It is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module (e.g. sockets or file streams).

      Returns a reference to the EventEmitter, so that calls can be chained.

      Parameters

      • OptionaleventName: string | symbol

      Returns this

      v0.1.26

    • Removes the specified listener from the listener array for the event named eventName.

      const callback = (stream) => {
      console.log('someone connected!');
      };
      server.on('connection', callback);
      // ...
      server.removeListener('connection', callback);

      removeListener() will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times to the listener array for the specified eventName, then removeListener() must be called multiple times to remove each instance.

      Once an event is emitted, all listeners attached to it at the time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution will not remove them fromemit() in progress. Subsequent events behave as expected.

      import { EventEmitter } from 'node:events';
      class MyEmitter extends EventEmitter {}
      const myEmitter = new MyEmitter();

      const callbackA = () => {
      console.log('A');
      myEmitter.removeListener('event', callbackB);
      };

      const callbackB = () => {
      console.log('B');
      };

      myEmitter.on('event', callbackA);

      myEmitter.on('event', callbackB);

      // callbackA removes listener callbackB but it will still be called.
      // Internal listener array at time of emit [callbackA, callbackB]
      myEmitter.emit('event');
      // Prints:
      // A
      // B

      // callbackB is now removed.
      // Internal listener array [callbackA]
      myEmitter.emit('event');
      // Prints:
      // A

      Because listeners are managed using an internal array, calling this will change the position indices of any listener registered after the listener being removed. This will not impact the order in which listeners are called, but it means that any copies of the listener array as returned by the emitter.listeners() method will need to be recreated.

      When a single function has been added as a handler multiple times for a single event (as in the example below), removeListener() will remove the most recently added instance. In the example the once('ping') listener is removed:

      import { EventEmitter } from 'node:events';
      const ee = new EventEmitter();

      function pong() {
      console.log('pong');
      }

      ee.on('ping', pong);
      ee.once('ping', pong);
      ee.removeListener('ping', pong);

      ee.emit('ping');
      ee.emit('ping');

      Returns a reference to the EventEmitter, so that calls can be chained.

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol
      • listener: (...args: any[]) => void

      Returns this

      v0.1.26

    • By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.

      Returns a reference to the EventEmitter, so that calls can be chained.

      Parameters

      • n: number

      Returns this

      v0.3.5

    • Sets all of the given properties.

      Parameters

      • properties: { [name: string]: any }

        Key/value pairs of properties to set

      Returns void

    • Sets the property with the given name to the value.

      Type Parameters

      • P

      Parameters

      • propertyName: string

        The name of the property to set

      • value: P

        The new value of the property

      Returns void

    • Skips the given number of items from the current iterator. The current iterator may not be read anymore until the returned iterator ends.

      Parameters

      • offset: number

        The number of items to skip

      Returns AsyncIterator<Bindings>

      A new iterator that skips the given number of items

    • Surrounds items of the current iterator with the given items. After this operation, only read the returned iterator instead of the current one.

      Parameters

      • prepend: AsyncIteratorOrArray<Bindings>

        Items to insert before this iterator's (remaining) items

      • append: AsyncIteratorOrArray<Bindings>

        Items to insert after this iterator's (remaining) items

      Returns AsyncIterator<Bindings>

      A new iterator that appends and prepends items to this iterator

    • Limits the current iterator to the given number of items. The current iterator may not be read anymore until the returned iterator ends.

      Parameters

      • limit: number

        The maximum number of items

      Returns AsyncIterator<Bindings>

      A new iterator with at most the given number of items

    • Consume all remaining items of the iterator into an array that will be returned asynchronously.

      Parameters

      • Optionaloptions: { limit?: number }

        Settings for array creation

        • Optionallimit?: number

          The maximum number of items to place in the array.

      Returns Promise<Bindings[]>

    • Returns a string representation of an object.

      Returns string

    • Transforms items from this iterator. After this operation, only read the returned iterator instead of the current one.

      Type Parameters

      • D

      Parameters

      • Optionaloptions: TransformOptions<Bindings, D>

        Settings of the iterator, or the transformation function

        • maxbufferSize

          The maximum number of items to keep in the buffer

        • autoStart

          Whether buffering starts directly after construction

        • offset

          The number of items to skip

        • limit

          The maximum number of items

        • filter

          A function to synchronously filter items from the source

        • map

          A function to synchronously transform items from the source

        • transform

          A function to asynchronously transform items from the source

        • optional

          If transforming is optional, the original item is pushed when its mapping yields null or its transformation yields no items

        • prepend

          Items to insert before the source items

        • append

          Items to insert after the source items

      Returns AsyncIterator<D>

      A new iterator that maps the items from this iterator

    • Returns a new iterator containing all of the unique items in the original iterator.

      Parameters

      • Optionalby: (item: Bindings) => any

        The derived value by which to determine uniqueness (e.g., stringification). Defaults to the identity function.

      Returns AsyncIterator<Bindings>

      An iterator with duplicates filtered out.