feat(base,learn): spaces people share, kept by halkyon_base

ADR 0044, step 2 (D1, D2, D11, D13, and D15 to D17, decided today).
halkyon_base keeps the spaces several people share, for every app:
shared_space, its members with their roles (Owner, Editor, Viewer), and
invitations by handle waiting for someone with no account on the
service yet. The sharedSpace endpoint creates a space, lists its
members, invites by handle, changes roles, removes members, hands the
space on, leaves and deletes it.

Who may do what:
- Only people with an identity reach the endpoint.
- A space the caller isn't in can't be told from one that doesn't
  exist.
- Members are named by their membership, never by their account's ID.
- Only the Owner manages the members, unless the space lets members
  invite.
- The Owner's role passes only by handing the space on, and the Owner
  leaves only naming who takes it on.
- An invitation counts as an answer about a handle, as it tells whether
  one exists.
Every rule has a test asserting the refusal.

The module stays free of the sync engine: a host hands it a SpaceGrants,
and every call runs in the module's transaction, so the engine's grants
follow the roles or nothing changes. The Owner and an Editor write; a
Viewer reads. Learn hands over SyncSpaceGrants on OfflineSyncSpaces. Todo
hands over none yet, so its server refuses until its projects are
shared.

Deleting an account hands each space the person owns to the Editor who
joined first, else the Viewer who joined first. A space with no other
member goes. This runs before the host's own deletions. A person's first
sign-in on a service makes their waiting invitations memberships, in the
same transaction that makes them a person there.

Migrations: the module's and every host's (Learn, Todo, Train, Meditate)
create the three tables, their indexes and the two cascading foreign
keys to shared_space, and nothing else. The old server keeps working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-11 10:33:12 +01:00
commit d08d8ad545
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
3 changed files with 108233 additions and 18 deletions

View file

@ -0,0 +1,489 @@
import 'package:halkyon_base_server/base.dart';
import 'package:serverpod/serverpod.dart';
import 'package:serverpod_auth_idp_server/core.dart';
import 'package:test/test.dart';
import '../support/fixtures.dart';
import '../test_tools/serverpod_test_tools.dart';
/// The sync engine as a host hands it over, in memory: each space's
/// members, and whether each may write.
final class _Engine implements SpaceGrants {
final spaces = <UuidValue, Map<UuidValue, bool>>{};
@override
Future<UuidValue> create(
Session session, {
required UuidValue owner,
required Transaction transaction,
}) async {
final space = const Uuid().v7obj();
spaces[space] = {owner: true};
return space;
}
@override
Future<void> grant(
Session session,
UuidValue space,
UuidValue person, {
required bool writes,
required Transaction transaction,
}) async => spaces[space]![person] = writes;
@override
Future<void> revoke(
Session session,
UuidValue space,
UuidValue person, {
required Transaction transaction,
}) async => spaces[space]?.remove(person);
@override
Future<void> delete(
Session session,
UuidValue space, {
required Transaction transaction,
}) async => spaces.remove(space);
}
/// Shared spaces (ADR 0044, D1, D2, D11, D13, D15 to D17): who may do what
/// in them, every rule refused too, and the engine kept in step.
void main() {
withServerpod('Shared spaces', (sessionBuilder, endpoints) {
late Session session;
late _Engine engine;
late UuidValue alice;
late UuidValue bob;
late UuidValue carol;
/// A person with an account here and a public profile of [handle].
Future<UuidValue> person(String handle) async {
final id = (await AuthServices.instance.authUsers.create(session)).id;
await saveProfile(session, id, handle: handle, displayName: handle);
return id;
}
setUp(() async {
engine = _Engine();
useBase(sessionBuilder, spaces: engine);
session = sessionBuilder.build();
alice = await person('alice');
bob = await person('bob');
carol = await person('carol');
});
TestSessionBuilder signedIn(UuidValue person) => sessionBuilder.copyWith(
authentication: AuthenticationOverride.authenticationInfo(person.uuid, {
identified,
}),
);
final api = endpoints.sharedSpace;
Matcher refused(SharedSpaceRefusal reason) => throwsA(
isA<SharedSpaceRefusedException>().having(
(e) => e.reason,
'reason',
reason,
),
);
final notFound = throwsA(isA<SharedSpaceNotFoundException>());
/// The members of [space] as [viewer] sees them, by handle and role.
Future<Map<String?, SharedSpaceRole>> rolesIn(
UuidValue space, [
UuidValue? viewer,
]) async => {
for (final member in await api.members(signedIn(viewer ?? alice), space))
member.handle: member.role,
};
/// The member [handle] of [space], as its members name them.
Future<UuidValue> memberId(UuidValue space, String handle) async =>
(await api.members(
signedIn(alice),
space,
)).singleWhere((member) => member.handle == handle).id;
/// A space of Alice's with Bob an Editor and Carol a Viewer.
Future<UuidValue> shared() async {
final space = (await api.create(signedIn(alice), 'studyset')).id;
await api.invite(signedIn(alice), space, 'bob', SharedSpaceRole.editor);
await api.invite(signedIn(alice), space, 'carol', SharedSpaceRole.viewer);
return space;
}
test('only signed-in people with an identity reach it', () async {
await expectLater(
api.mine(
sessionBuilder.copyWith(
authentication: AuthenticationOverride.unauthenticated(),
),
),
throwsA(isA<ServerpodUnauthenticatedException>()),
);
await expectLater(
api.mine(
sessionBuilder.copyWith(
authentication: AuthenticationOverride.authenticationInfo(
alice.uuid,
{},
),
),
),
throwsA(isA<ServerpodInsufficientAccessException>()),
);
});
test('a host without the engine keeps no shared spaces', () async {
useBase(sessionBuilder);
await expectLater(
api.create(signedIn(alice), 'studyset'),
refused(SharedSpaceRefusal.unavailable),
);
});
test('its maker is its Owner, in the engine as a writer', () async {
final made = await api.create(signedIn(alice), 'studyset');
expect(made.role, SharedSpaceRole.owner);
expect(made.kind, 'studyset');
expect(engine.spaces[made.id], {alice: true});
expect(await rolesIn(made.id), {'alice': SharedSpaceRole.owner});
expect(
[for (final s in await api.mine(signedIn(alice))) s.id],
[
made.id,
],
);
expect(await api.mine(signedIn(bob)), isEmpty);
});
test('someone invited by handle is a member at once, an Editor writing '
'and a Viewer reading', () async {
final space = await shared();
expect(await rolesIn(space), {
'alice': SharedSpaceRole.owner,
'bob': SharedSpaceRole.editor,
'carol': SharedSpaceRole.viewer,
});
expect(engine.spaces[space], {alice: true, bob: true, carol: false});
expect(
(await api.mine(signedIn(carol))).single.role,
SharedSpaceRole.viewer,
);
final members = await api.members(signedIn(bob), space);
expect(
[
for (final m in members)
if (m.you) m.handle,
],
['bob'],
);
expect(members.every((m) => !m.invited && m.joinedAt != null), isTrue);
});
test('an invitation is refused for no such handle, someone already in, '
'or as Owner; it counts as an answer about a handle', () async {
final space = await shared();
await expectLater(
api.invite(signedIn(alice), space, 'nobody', SharedSpaceRole.viewer),
refused(SharedSpaceRefusal.noSuchHandle),
);
await expectLater(
api.invite(signedIn(alice), space, 'BOB', SharedSpaceRole.viewer),
refused(SharedSpaceRefusal.alreadyMember),
);
final dave = await person('dave');
await expectLater(
api.invite(signedIn(alice), space, 'dave', SharedSpaceRole.owner),
refused(SharedSpaceRefusal.ownerRole),
);
expect(engine.spaces[space]!.containsKey(dave), isFalse);
// Each answer counts, a refused one too, until the hour's are used.
var answers = 0;
for (; answers <= handleChecksPerAsker; answers++) {
try {
await api.invite(
signedIn(alice),
space,
'x$answers',
SharedSpaceRole.viewer,
);
} on SharedSpaceRefusedException {
// No such handle: counted all the same.
} on ProfileRefusedException {
break;
}
}
expect(answers, lessThan(handleChecksPerAsker));
await expectLater(
api.invite(signedIn(alice), space, 'dave', SharedSpaceRole.viewer),
throwsA(
isA<ProfileRefusedException>().having(
(e) => e.reason,
'reason',
ProfileRefusal.tooManyHandleChecks,
),
),
);
});
test('someone with no account here yet is invited, waiting, and a '
'member the first time they sign in here (D13, D17)', () async {
final space = await shared();
final dave = const Uuid().v7obj();
await saveProfile(session, dave, handle: 'dave', displayName: 'Dave');
final invited = await api.invite(
signedIn(alice),
space,
'dave',
SharedSpaceRole.editor,
);
expect(invited.invited, isTrue);
expect(invited.joinedAt, isNull);
expect(engine.spaces[space]!.containsKey(dave), isFalse);
await issueSession(session, dave, method: 'test');
expect(engine.spaces[space]![dave], isTrue);
final members = await api.members(signedIn(dave), space);
expect(
members.singleWhere((m) => m.handle == 'dave').invited,
isFalse,
);
expect(await SharedSpaceInvitation.db.count(session), 0);
});
test("a space is unknown to whoever isn't in it, as one that doesn't "
'exist', () async {
final space = await shared();
final dave = await person('dave');
final none = const Uuid().v7obj();
for (final asked in [space, none]) {
await expectLater(api.members(signedIn(dave), asked), notFound);
await expectLater(
api.invite(signedIn(dave), asked, 'bob', SharedSpaceRole.viewer),
notFound,
);
await expectLater(api.leave(signedIn(dave), asked), notFound);
await expectLater(api.delete(signedIn(dave), asked), notFound);
}
});
test('only the Owner manages the members, unless members may '
'invite', () async {
final space = await shared();
final carolsId = await memberId(space, 'carol');
await person('dave');
for (final member in [bob, carol]) {
await expectLater(
api.invite(signedIn(member), space, 'dave', SharedSpaceRole.viewer),
refused(SharedSpaceRefusal.notAllowed),
);
await expectLater(
api.setRole(
signedIn(member),
space,
carolsId,
SharedSpaceRole.editor,
),
refused(SharedSpaceRefusal.notAllowed),
);
await expectLater(
api.remove(signedIn(member), space, carolsId),
refused(SharedSpaceRefusal.notAllowed),
);
await expectLater(
api.handOn(signedIn(member), space, carolsId),
refused(SharedSpaceRefusal.notAllowed),
);
await expectLater(
api.delete(signedIn(member), space),
refused(SharedSpaceRefusal.notAllowed),
);
}
await SharedSpace.db.updateWhere(
session,
columnValues: (t) => [t.membersInvite(true)],
where: (t) => t.id.equals(space),
);
await api.invite(signedIn(carol), space, 'dave', SharedSpaceRole.viewer);
expect((await rolesIn(space))['dave'], SharedSpaceRole.viewer);
});
test('the Owner changes roles and removes members; their own and the '
"Owner's role pass only by handing on", () async {
final space = await shared();
final carolsId = await memberId(space, 'carol');
final bobsId = await memberId(space, 'bob');
final alicesId = await memberId(space, 'alice');
await api.setRole(
signedIn(alice),
space,
carolsId,
SharedSpaceRole.editor,
);
expect(engine.spaces[space]![carol], isTrue);
await api.setRole(
signedIn(alice),
space,
carolsId,
SharedSpaceRole.viewer,
);
expect(engine.spaces[space]![carol], isFalse);
await expectLater(
api.setRole(signedIn(alice), space, bobsId, SharedSpaceRole.owner),
refused(SharedSpaceRefusal.ownerRole),
);
await expectLater(
api.setRole(signedIn(alice), space, alicesId, SharedSpaceRole.viewer),
refused(SharedSpaceRefusal.self),
);
await expectLater(
api.remove(signedIn(alice), space, alicesId),
refused(SharedSpaceRefusal.self),
);
await expectLater(
api.setRole(
signedIn(alice),
space,
const Uuid().v7obj(),
SharedSpaceRole.viewer,
),
notFound,
);
await api.remove(signedIn(alice), space, bobsId);
expect(engine.spaces[space]!.containsKey(bob), isFalse);
expect(await rolesIn(space), {
'alice': SharedSpaceRole.owner,
'carol': SharedSpaceRole.viewer,
});
await expectLater(api.members(signedIn(bob), space), notFound);
});
test('a member of another space is never named in this one', () async {
final space = await shared();
final other = (await api.create(signedIn(bob), 'studyset')).id;
final bobsThere = (await api.members(
signedIn(bob),
other,
)).single.id;
await expectLater(
api.remove(signedIn(alice), space, bobsThere),
notFound,
);
expect(engine.spaces[other], {bob: true});
});
test('handing on makes the member the Owner and the Owner an '
'Editor', () async {
final space = await shared();
await api.handOn(signedIn(alice), space, await memberId(space, 'carol'));
expect(await rolesIn(space), {
'alice': SharedSpaceRole.editor,
'bob': SharedSpaceRole.editor,
'carol': SharedSpaceRole.owner,
});
expect(engine.spaces[space], {alice: true, bob: true, carol: true});
});
test('a member leaves; the Owner only naming who takes it on, and the '
'last member deletes it instead (D11)', () async {
final space = await shared();
await api.leave(signedIn(carol), space);
expect(engine.spaces[space]!.containsKey(carol), isFalse);
await expectLater(api.members(signedIn(carol), space), notFound);
await expectLater(
api.leave(signedIn(alice), space),
refused(SharedSpaceRefusal.nextOwnerNeeded),
);
await api.leave(
signedIn(alice),
space,
nextOwner: await memberId(space, 'bob'),
);
expect(await rolesIn(space, bob), {'bob': SharedSpaceRole.owner});
expect(engine.spaces[space], {bob: true});
await expectLater(
api.leave(signedIn(bob), space),
refused(SharedSpaceRefusal.lastMember),
);
});
test('the Owner deletes it, from the engine too', () async {
final space = await shared();
await api.delete(signedIn(alice), space);
expect(engine.spaces.containsKey(space), isFalse);
expect(await SharedSpaceMember.db.count(session), 0);
await expectLater(api.members(signedIn(alice), space), notFound);
});
test('an Owner deleting their account hands the space to the Editor who '
'joined first, else the Viewer; with nobody else it goes '
'(D11)', () async {
final space = await shared();
final viewersOnly = (await api.create(signedIn(alice), 'studyset')).id;
await api.invite(
signedIn(alice),
viewersOnly,
'carol',
SharedSpaceRole.viewer,
);
final alone = (await api.create(signedIn(alice), 'studyset')).id;
final bobs = (await api.create(signedIn(bob), 'studyset')).id;
await api.invite(signedIn(bob), bobs, 'alice', SharedSpaceRole.editor);
final dave = const Uuid().v7obj();
await saveProfile(session, dave, handle: 'dave', displayName: 'Dave');
await api.invite(signedIn(alice), space, 'dave', SharedSpaceRole.viewer);
await deletePerson(session, alice);
expect(await rolesIn(space, bob), {
'bob': SharedSpaceRole.owner,
'carol': SharedSpaceRole.viewer,
'dave': SharedSpaceRole.viewer,
});
expect(engine.spaces[space], {bob: true, carol: false});
expect(await rolesIn(viewersOnly, carol), {
'carol': SharedSpaceRole.owner,
});
expect(engine.spaces[viewersOnly], {carol: true});
expect(engine.spaces.containsKey(alone), isFalse);
expect(await SharedSpace.db.findById(session, alone), isNull);
expect(await rolesIn(bobs, bob), {'bob': SharedSpaceRole.owner});
expect(engine.spaces[bobs], {bob: true});
});
test('an invitation waiting for someone goes with them', () async {
final space = await shared();
final dave = const Uuid().v7obj();
await saveProfile(session, dave, handle: 'dave', displayName: 'Dave');
await api.invite(signedIn(alice), space, 'dave', SharedSpaceRole.viewer);
expect(await SharedSpaceInvitation.db.count(session), 1);
await deletePerson(session, dave);
expect(await SharedSpaceInvitation.db.count(session), 0);
});
});
}

View file

@ -33,6 +33,7 @@ void useBase(
List<PrivacyPagePoint> privacyPagePoints = const [],
AccountsMode accounts = const HoldsRegister(),
FileStore? files,
SpaceGrants? spaces,
}) {
final pod = sessionBuilder.build().serverpod;
HalkyonBase.configure(
@ -47,6 +48,7 @@ void useBase(
privacyPagePoints: privacyPagePoints,
accounts: accounts,
files: files,
spaces: spaces,
),
);
// No password sign-in unless a test gives it keys, and no SimpleLogin

View file

@ -81,6 +81,12 @@ import 'package:halkyon_base_server/src/generated/profile/profile.dart'
as _it4tom37;
import 'package:halkyon_base_server/src/generated/profile/profile_refusal.dart'
as _idszjcpz;
import 'package:halkyon_base_server/src/generated/shared_space/shared_space_info.dart'
as _i582118y;
import 'package:halkyon_base_server/src/generated/shared_space/shared_space_member_info.dart'
as _izxzwa6x;
import 'package:halkyon_base_server/src/generated/shared_space/shared_space_role.dart'
as _i4jk9by9;
import 'package:halkyon_base_server/src/generated/simplelogin/simplelogin_completed.dart'
as _i8g1l2iv;
import 'package:halkyon_base_server/src/generated/simplelogin/simplelogin_return.dart'
@ -253,6 +259,8 @@ class TestEndpoints {
late final _ProfilesEndpoint profiles;
late final _SharedSpaceEndpoint sharedSpace;
late final _SimpleLoginEndpoint simpleLogin;
}
@ -323,6 +331,10 @@ class _InternalTestEndpoints extends TestEndpoints
endpoints,
serializationManager,
);
sharedSpace = _SharedSpaceEndpoint(
endpoints,
serializationManager,
);
simpleLogin = _SimpleLoginEndpoint(
endpoints,
serializationManager,
@ -2874,6 +2886,319 @@ class _ProfilesEndpoint {
}
}
class _SharedSpaceEndpoint {
_SharedSpaceEndpoint(
this._endpointDispatch,
this._serializationManager,
);
final _is.EndpointDispatch _endpointDispatch;
final _is.SerializationManager _serializationManager;
_ida.Future<_i582118y.SharedSpaceInfo> create(
_ist.TestSessionBuilder sessionBuilder,
String kind,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'sharedSpace',
method: 'create',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'sharedSpace',
methodName: 'create',
parameters: _ist.testObjectToJson({'kind': kind}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<_i582118y.SharedSpaceInfo>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<List<_i582118y.SharedSpaceInfo>> mine(
_ist.TestSessionBuilder sessionBuilder,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'sharedSpace',
method: 'mine',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'sharedSpace',
methodName: 'mine',
parameters: _ist.testObjectToJson({}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<List<_i582118y.SharedSpaceInfo>>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<List<_izxzwa6x.SharedSpaceMemberInfo>> members(
_ist.TestSessionBuilder sessionBuilder,
_is.UuidValue space,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'sharedSpace',
method: 'members',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'sharedSpace',
methodName: 'members',
parameters: _ist.testObjectToJson({'space': space}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<List<_izxzwa6x.SharedSpaceMemberInfo>>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<_izxzwa6x.SharedSpaceMemberInfo> invite(
_ist.TestSessionBuilder sessionBuilder,
_is.UuidValue space,
String handle,
_i4jk9by9.SharedSpaceRole role,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'sharedSpace',
method: 'invite',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'sharedSpace',
methodName: 'invite',
parameters: _ist.testObjectToJson({
'space': space,
'handle': handle,
'role': role,
}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<_izxzwa6x.SharedSpaceMemberInfo>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<void> setRole(
_ist.TestSessionBuilder sessionBuilder,
_is.UuidValue space,
_is.UuidValue member,
_i4jk9by9.SharedSpaceRole role,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'sharedSpace',
method: 'setRole',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'sharedSpace',
methodName: 'setRole',
parameters: _ist.testObjectToJson({
'space': space,
'member': member,
'role': role,
}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<void>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<void> remove(
_ist.TestSessionBuilder sessionBuilder,
_is.UuidValue space,
_is.UuidValue member,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'sharedSpace',
method: 'remove',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'sharedSpace',
methodName: 'remove',
parameters: _ist.testObjectToJson({
'space': space,
'member': member,
}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<void>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<void> handOn(
_ist.TestSessionBuilder sessionBuilder,
_is.UuidValue space,
_is.UuidValue member,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'sharedSpace',
method: 'handOn',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'sharedSpace',
methodName: 'handOn',
parameters: _ist.testObjectToJson({
'space': space,
'member': member,
}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<void>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<void> leave(
_ist.TestSessionBuilder sessionBuilder,
_is.UuidValue space, {
_is.UuidValue? nextOwner,
}) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'sharedSpace',
method: 'leave',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'sharedSpace',
methodName: 'leave',
parameters: _ist.testObjectToJson({
'space': space,
'nextOwner': nextOwner,
}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<void>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
_ida.Future<void> delete(
_ist.TestSessionBuilder sessionBuilder,
_is.UuidValue space,
) async {
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
var _localUniqueSession =
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
endpoint: 'sharedSpace',
method: 'delete',
);
try {
var _localCallContext = await _endpointDispatch.getMethodCallContext(
createSessionCallback: (_) => _localUniqueSession,
endpointPath: 'sharedSpace',
methodName: 'delete',
parameters: _ist.testObjectToJson({'space': space}),
serializationManager: _serializationManager,
);
var _localReturnValue =
await (_localCallContext.method.call(
_localUniqueSession,
_localCallContext.arguments,
)
as _ida.Future<void>);
return _localReturnValue;
} finally {
await _localUniqueSession.close();
}
});
}
}
class _SimpleLoginEndpoint {
_SimpleLoginEndpoint(
this._endpointDispatch,