@mozaik-ai/core 4.2.0-beta.5 → 4.2.0-beta.7
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.
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -77,20 +77,20 @@ var CreateParticipantUseCase = class {
|
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
// src/application/use-cases/participant-
|
|
81
|
-
var
|
|
80
|
+
// src/application/use-cases/participant-join.ts
|
|
81
|
+
var ParticipantJoinUseCase = class {
|
|
82
82
|
constructor(spaceRepository, eventPublisher) {
|
|
83
83
|
this.spaceRepository = spaceRepository;
|
|
84
84
|
this.eventPublisher = eventPublisher;
|
|
85
85
|
}
|
|
86
|
-
async execute(spaceId,
|
|
86
|
+
async execute(spaceId, participant) {
|
|
87
87
|
const space = await this.spaceRepository.findById(spaceId);
|
|
88
88
|
if (!space) {
|
|
89
89
|
throw new Error("Space not found");
|
|
90
90
|
}
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
93
|
-
throw new Error("Participant
|
|
91
|
+
const existingParticipant = space.getParticipant(participant.getId());
|
|
92
|
+
if (existingParticipant) {
|
|
93
|
+
throw new Error("Participant already joined");
|
|
94
94
|
}
|
|
95
95
|
const event = space.addParticipant(participant);
|
|
96
96
|
if (event) {
|
|
@@ -129,8 +129,8 @@ var EventPublisher = class {
|
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
-
// src/application/use-cases/participant-
|
|
133
|
-
var
|
|
132
|
+
// src/application/use-cases/participant-leave.ts
|
|
133
|
+
var ParticipantLeaveUseCase = class {
|
|
134
134
|
constructor(spaceRepository, eventPublisher) {
|
|
135
135
|
this.spaceRepository = spaceRepository;
|
|
136
136
|
this.eventPublisher = eventPublisher;
|
|
@@ -281,11 +281,11 @@ function defineRuntime() {
|
|
|
281
281
|
const createSpace = async (name) => {
|
|
282
282
|
return await createSpaceUseCase.execute(name);
|
|
283
283
|
};
|
|
284
|
-
const participantJoinedUseCase = new
|
|
285
|
-
const join = async (spaceId,
|
|
286
|
-
return await participantJoinedUseCase.execute(spaceId,
|
|
284
|
+
const participantJoinedUseCase = new ParticipantJoinUseCase(spaceRepository, eventPublisher);
|
|
285
|
+
const join = async (spaceId, participant) => {
|
|
286
|
+
return await participantJoinedUseCase.execute(spaceId, participant);
|
|
287
287
|
};
|
|
288
|
-
const participantLeftUseCase = new
|
|
288
|
+
const participantLeftUseCase = new ParticipantLeaveUseCase(spaceRepository, eventPublisher);
|
|
289
289
|
const leave = async (spaceId, participantId) => {
|
|
290
290
|
return await participantLeftUseCase.execute(spaceId, participantId);
|
|
291
291
|
};
|