hypha-rpc 0.20.12 → 0.20.14

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.
@@ -706,12 +706,13 @@ class RPC extends _utils__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
706
706
 
707
707
  _extract_service_info(service) {
708
708
  const config = service.config || {};
709
- config.workspace = config.workspace || self._local_workspace;
709
+ config.workspace =
710
+ config.workspace || this._local_workspace || this._connection.workspace;
710
711
  const skipContext = config.require_context;
711
712
  const serviceSchema = _get_schema(service, null, skipContext);
712
713
  const serviceInfo = {
713
714
  config: config,
714
- id: `${this._client_id}:${service["id"]}`,
715
+ id: `${config.workspace}/${this._client_id}:${service["id"]}`,
715
716
  name: service.name || service["id"],
716
717
  description: service.description || "",
717
718
  type: service.type || "generic",
@@ -4864,18 +4865,14 @@ async function connectToServer(config) {
4864
4865
  async function getApp(clientId) {
4865
4866
  clientId = clientId || "*";
4866
4867
  (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assert)(!clientId.includes(":"), "clientId should not contain ':'");
4867
- let workspace;
4868
- if (clientId.includes("/")) {
4869
- [workspace, clientId] = clientId.split("/");
4870
- } else {
4871
- workspace = connection_info.workspace;
4868
+ if (!clientId.includes("/")) {
4869
+ clientId = connection_info.workspace + "/" + clientId;
4872
4870
  }
4873
- const query = {
4874
- workspace: workspace,
4875
- client_id: clientId,
4876
- service_id: "default",
4877
- };
4878
- return await wm.getService(query);
4871
+ (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assert)(
4872
+ clientId.split("/").length === 2,
4873
+ "clientId should match pattern workspace/clientId",
4874
+ );
4875
+ return await wm.getService(`${clientId}:default`);
4879
4876
  }
4880
4877
 
4881
4878
  async function listApps(ws) {