Source code for deephaven.plugin.js

import abc
import pathlib
import typing

from . import Plugin

JsonValue = typing.Union[
    None,
    bool,
    int,
    float,
    str,
    typing.List["JsonValue"],
    typing.Dict[str, "JsonValue"],
]
"""A JSON node; any value that can be represented in JSON."""


[docs]class JsPlugin(Plugin): """ A JS plugin is a Plugin that allows adding javascript code under the server's URL path "js-plugins/". See https://github.com/deephaven/deephaven-plugins#js-plugins for more details about the underlying construction for JS plugins. """
[docs] @abc.abstractmethod def path(self) -> pathlib.Path: """ The directory path of the resources to serve. The path must exist. """ pass
@property @abc.abstractmethod def name(self) -> str: """ The JS plugin name. The JS plugin contents will be served via the URL path "js-plugins/{name}/", as well as included as the "name" field for the manifest entry in "js-plugins/manifest.json". """ pass @property @abc.abstractmethod def version(self) -> str: """ The JS plugin version. Will be included as the "version" field for the manifest entry in js-plugins/manifest.json". """ pass @property @abc.abstractmethod def main(self) -> str: """ The main JS file path, specified relative to root. The main JS file must exist. Will be included as the "main" field for the manifest entry in "js-plugins/manifest.json". """ pass @property def loader(self) -> typing.Optional[JsonValue]: """ The optional JS plugin loader configuration. When not None, will be included as the "loader" field for the manifest entry in "js-plugins/manifest.json". Defaults to None. """ return None def __str__(self) -> str: return f"{self.name}@{self.version}"