michael-s-molina commented on code in PR #31934:
URL: https://github.com/apache/superset/pull/31934#discussion_r2006302092


##########
superset/extensions/api.py:
##########
@@ -0,0 +1,209 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import json
+import re
+from io import BytesIO
+from typing import Any
+from zipfile import is_zipfile, ZipFile
+
+from flask import request, send_file
+from flask.wrappers import Response
+from flask_appbuilder.api import expose, permission_name, protect, safe
+
+from superset import db
+from superset.daos.extension import ExtensionDAO
+from superset.extensions import event_logger
+from superset.extensions.types import Manifest
+from superset.utils.core import check_is_safe_zip
+from superset.views.base_api import BaseSupersetApi, requires_form_data, 
statsd_metrics
+
+BUNDLE_REGEX = re.compile(r"^dist/([^/]+)$")
+
+
+class ExtensionsRestApi(BaseSupersetApi):
+    allow_browser_login = True
+    resource_name = "extensions"
+
+    @protect()
+    @safe
+    @expose("/", methods=("GET",))
+    @permission_name("read")
+    def get(self, **kwargs: Any) -> Response:
+        # TODO: Move code to command
+        result = []
+        extensions = ExtensionDAO.find_all()
+        for extension in extensions:
+            manifest: Manifest = json.loads(extension.manifest)
+            files = list(json.loads(extension.bundle))
+            remote_entry_url = 
f"http://localhost:9000/api/v1/extensions/{extension.name}/remoteEntry.js";
+            exposed_modules = [
+                exposed_module
+                for module in manifest["moduleFederation"]
+                for exposed_module in module["exposes"]
+            ]
+            extension_data = {
+                "name": extension.name,
+                "manifest": manifest,
+                "remoteEntry": remote_entry_url,
+                "files": files,
+                "scope": extension.name,
+                "exposedModules": exposed_modules,

Review Comment:
   @villebro We need to decide if we send the `manifest` or its parsed values 
like `exposedModules`, `contributions`, etc. Sending both seems redundant.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to