From 818ec15c0018058d0448684be4fc0c17f833b6c1 Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Mon, 28 Oct 2024 22:38:19 +0000 Subject: [PATCH] feat: save self-hosted server details on member info We added support for self-hosted servers in 98d9981dda7aeb1bd724d7b051934db3307565a1. This saves the details to project-level member info. This is a follow-up to 191369434887cc5b9908345b2c418e4a1f93325e. --- src/mapeo-project.js | 3 ++- src/member-api.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mapeo-project.js b/src/mapeo-project.js index 8bac0de7..89996dc9 100644 --- a/src/mapeo-project.js +++ b/src/mapeo-project.js @@ -627,7 +627,7 @@ export class MapeoProject extends TypedEmitter { } /** - * @param {Pick} value + * @param {Pick} value * @returns {Promise} */ async [kSetOwnDeviceInfo](value) { @@ -640,6 +640,7 @@ export class MapeoProject extends TypedEmitter { const doc = { name: value.name, deviceType: value.deviceType, + selfHostedServerDetails: value.selfHostedServerDetails, schemaName: /** @type {const} */ ('deviceInfo'), } diff --git a/src/member-api.js b/src/member-api.js index 55085597..3af048a2 100644 --- a/src/member-api.js +++ b/src/member-api.js @@ -36,6 +36,8 @@ import { ROLES, isRoleIdForNewInvite } from './roles.js' * @prop {DeviceInfo['name']} [name] * @prop {DeviceInfo['deviceType']} [deviceType] * @prop {DeviceInfo['createdAt']} [joinedAt] + * @prop {object} [selfHostedServerDetails] + * @prop {string} selfHostedServerDetails.baseUrl */ export class MemberApi extends TypedEmitter { @@ -304,6 +306,8 @@ export class MemberApi extends TypedEmitter { memberInfo.name = deviceInfo?.name memberInfo.deviceType = deviceInfo?.deviceType memberInfo.joinedAt = deviceInfo?.createdAt + memberInfo.selfHostedServerDetails = + deviceInfo?.selfHostedServerDetails } catch (err) { // Attempting to get someone else may throw because sync hasn't occurred or completed // Only throw if attempting to get themself since the relevant information should be available