Formatting

This commit is contained in:
2026-04-20 12:26:35 +00:00
parent 32c42cdc2d
commit dbfb2c68d2
32 changed files with 3557 additions and 1828 deletions

View File

@@ -34,7 +34,7 @@ import { compileCashAssemblyString } from "@xo-cash/engine";
export type InvitationEventMap = {
"invitation-updated": XOInvitation;
"invitation-status-changed": string;
"error": Error;
error: Error;
};
export type InvitationDependencies = {
@@ -153,25 +153,25 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
this.syncServer.connect(),
this.syncServer.getInvitation(this.data.invitationIdentifier),
]);
// There is a chance we get SSE messages before the invitation is returned, so we want to combine any commits
const sseCommits = this.data.commits;
// Merge the commits
const combinedCommits = this.mergeCommits(
sseCommits,
invitation?.commits ?? [],
);
// Set the invitation data with the combined commits
this.data = { ...this.data, ...invitation, commits: combinedCommits };
// Store the invitation in the storage
await this.storage.set(this.data.invitationIdentifier, this.data);
// Publish the invitation to the sync server
this.publishInvitation(this.data);
// Compute and emit initial status
await this.updateStatus();
} catch (err) {
@@ -215,7 +215,9 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
/**
* Publish the invitation to the sync server
*/
private async publishInvitation(invitation: XOInvitation = this.data): Promise<void> {
private async publishInvitation(
invitation: XOInvitation = this.data,
): Promise<void> {
try {
await this.syncServer.publishInvitation(invitation);
} catch (err) {