qodalis-cli-server-plugin-data-explorer-mongo 1.0.0b30__tar.gz → 1.0.0b32__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,3 +45,6 @@ node_modules/
45
45
 
46
46
  # Portal site copied into the package at build time (scripts/copy_portal.py)
47
47
  plugins/portal/qodalis_cli_portal/site/
48
+
49
+ # Dashboard plugins installed from the marketplace (admin plugin, default dir)
50
+ qcli-data/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: qodalis-cli-server-plugin-data-explorer-mongo
3
- Version: 1.0.0b30
3
+ Version: 1.0.0b32
4
4
  Summary: MongoDB Data Explorer provider plugin for Qodalis CLI servers
5
5
  Project-URL: Homepage, https://github.com/qodalis-solutions/cli-server-python
6
6
  Project-URL: Repository, https://github.com/qodalis-solutions/cli-server-python
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "qodalis-cli-server-plugin-data-explorer-mongo"
7
- version = "1.0.0b30"
7
+ version = "1.0.0b32"
8
8
  description = "MongoDB Data Explorer provider plugin for Qodalis CLI servers"
9
9
  readme = { text = "", content-type = "text/plain" }
10
10
  license = "MIT"
@@ -28,6 +28,9 @@ dependencies = [
28
28
  "motor>=3.0.0",
29
29
  ]
30
30
 
31
+ [project.entry-points."qodalis_cli.plugins"]
32
+ data-explorer-mongo = "qodalis_cli_data_explorer_mongo.plugin:create_plugin"
33
+
31
34
  [project.urls]
32
35
  Homepage = "https://github.com/qodalis-solutions/cli-server-python"
33
36
  Repository = "https://github.com/qodalis-solutions/cli-server-python"
@@ -0,0 +1,54 @@
1
+ """The MongoDB data explorer source's entry point (``qodalis_cli.plugins``): one source of the data explorer
2
+ (``/api/qcli/data-explorer``, the dashboard's Data explorer page, the ``data_*`` MCP tools), its connection as settings
3
+ (a ``secret``: kept server-side, never returned). Read-only by default. Nothing is added until it is configured
4
+ (then a restart): until then the plugin needs configuration."""
5
+
6
+ from __future__ import annotations
7
+
8
+ from typing import Any
9
+
10
+ from qodalis_cli_server_abstractions import CLI_PLUGIN_LOAD_ORDER, CliPluginEntryInfo
11
+ from qodalis_cli_server_abstractions.config import CliConfigSettingDefinition
12
+ from qodalis_cli_server_abstractions.data_explorer_source_entry import (
13
+ DataExplorerSourceEntry,
14
+ connection_setting,
15
+ create_data_explorer_source,
16
+ data_explorer_source_settings,
17
+ )
18
+ from qodalis_cli_server_abstractions.data_explorer_types import DataExplorerLanguage, DataExplorerOutputFormat
19
+
20
+ #: The plugin, for ``builder.add_plugin`` (the marketplace's record says it for an installed copy).
21
+ plugin = CliPluginEntryInfo(id="data-explorer-mongo", package="qodalis-cli-server-plugin-data-explorer-mongo", title="Data explorer: MongoDB", icon="🍃")
22
+
23
+ #: Loads after the data explorer's own entry.
24
+ order = CLI_PLUGIN_LOAD_ORDER.SOURCE
25
+
26
+
27
+ def _create(v: dict[str, Any], context: Any) -> Any:
28
+ from .mongo_provider import MongoDataExplorerProvider
29
+
30
+ return MongoDataExplorerProvider(str(v["connectionString"]), str(v["database"]))
31
+
32
+
33
+ ENTRY = DataExplorerSourceEntry(
34
+ title="Data explorer: MongoDB",
35
+ name="mongo",
36
+ description="MongoDB database",
37
+ language=DataExplorerLanguage.JSON,
38
+ output=DataExplorerOutputFormat.JSON,
39
+ connection=[
40
+ connection_setting("e.g. mongodb://user:password@host:27017"),
41
+ CliConfigSettingDefinition(key="database", label="Database", description="The database queried", type="string",
42
+ required=True, default="", requires_restart=True),
43
+ ],
44
+ create=_create,
45
+ )
46
+
47
+
48
+ def settings() -> list[CliConfigSettingDefinition]:
49
+ """Its settings (code options of the same keys are their defaults)."""
50
+ return data_explorer_source_settings(ENTRY)
51
+
52
+
53
+ async def create_plugin(context: Any) -> Any:
54
+ return await create_data_explorer_source(context, ENTRY)