@voidhash/mimic-effect 0.0.2 → 0.0.4
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/.turbo/turbo-build.log +99 -14
- package/dist/DocumentManager.cjs +118 -0
- package/dist/DocumentManager.d.cts +45 -0
- package/dist/DocumentManager.d.cts.map +1 -0
- package/dist/DocumentManager.d.mts +45 -0
- package/dist/DocumentManager.d.mts.map +1 -0
- package/dist/DocumentManager.mjs +105 -0
- package/dist/DocumentManager.mjs.map +1 -0
- package/dist/DocumentProtocol.cjs +94 -0
- package/dist/DocumentProtocol.d.cts +113 -0
- package/dist/DocumentProtocol.d.cts.map +1 -0
- package/dist/DocumentProtocol.d.mts +113 -0
- package/dist/DocumentProtocol.d.mts.map +1 -0
- package/dist/DocumentProtocol.mjs +89 -0
- package/dist/DocumentProtocol.mjs.map +1 -0
- package/dist/MimicAuthService.cjs +55 -0
- package/dist/MimicAuthService.d.cts +65 -0
- package/dist/MimicAuthService.d.cts.map +1 -0
- package/dist/MimicAuthService.d.mts +65 -0
- package/dist/MimicAuthService.d.mts.map +1 -0
- package/dist/MimicAuthService.mjs +47 -0
- package/dist/MimicAuthService.mjs.map +1 -0
- package/dist/MimicConfig.cjs +52 -0
- package/dist/MimicConfig.d.cts +115 -0
- package/dist/MimicConfig.d.cts.map +1 -0
- package/dist/MimicConfig.d.mts +115 -0
- package/dist/MimicConfig.d.mts.map +1 -0
- package/dist/MimicConfig.mjs +43 -0
- package/dist/MimicConfig.mjs.map +1 -0
- package/dist/MimicDataStorage.cjs +83 -0
- package/dist/MimicDataStorage.d.cts +113 -0
- package/dist/MimicDataStorage.d.cts.map +1 -0
- package/dist/MimicDataStorage.d.mts +113 -0
- package/dist/MimicDataStorage.d.mts.map +1 -0
- package/dist/MimicDataStorage.mjs +74 -0
- package/dist/MimicDataStorage.mjs.map +1 -0
- package/dist/MimicServer.cjs +122 -0
- package/dist/MimicServer.d.cts +106 -0
- package/dist/MimicServer.d.cts.map +1 -0
- package/dist/MimicServer.d.mts +106 -0
- package/dist/MimicServer.d.mts.map +1 -0
- package/dist/MimicServer.mjs +116 -0
- package/dist/MimicServer.mjs.map +1 -0
- package/dist/PresenceManager.cjs +108 -0
- package/dist/PresenceManager.d.cts +91 -0
- package/dist/PresenceManager.d.cts.map +1 -0
- package/dist/PresenceManager.d.mts +91 -0
- package/dist/PresenceManager.d.mts.map +1 -0
- package/dist/PresenceManager.mjs +95 -0
- package/dist/PresenceManager.mjs.map +1 -0
- package/dist/WebSocketHandler.cjs +365 -0
- package/dist/WebSocketHandler.d.cts +34 -0
- package/dist/WebSocketHandler.d.cts.map +1 -0
- package/dist/WebSocketHandler.d.mts +34 -0
- package/dist/WebSocketHandler.d.mts.map +1 -0
- package/dist/WebSocketHandler.mjs +355 -0
- package/dist/WebSocketHandler.mjs.map +1 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.cjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.cjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.cjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.cjs +18 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs +12 -0
- package/dist/_virtual/rolldown_runtime.cjs +43 -0
- package/dist/{chunk-C6wwvPpM.mjs → _virtual/rolldown_runtime.mjs} +1 -1
- package/dist/auth/NoAuth.cjs +43 -0
- package/dist/auth/NoAuth.d.cts +22 -0
- package/dist/auth/NoAuth.d.cts.map +1 -0
- package/dist/auth/NoAuth.d.mts +22 -0
- package/dist/auth/NoAuth.d.mts.map +1 -0
- package/dist/auth/NoAuth.mjs +36 -0
- package/dist/auth/NoAuth.mjs.map +1 -0
- package/dist/errors.cjs +74 -0
- package/dist/errors.d.cts +89 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +89 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/errors.mjs +67 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/index.cjs +29 -1227
- package/dist/index.d.cts +12 -795
- package/dist/index.d.mts +12 -795
- package/dist/index.mjs +13 -1162
- package/dist/storage/InMemoryDataStorage.cjs +57 -0
- package/dist/storage/InMemoryDataStorage.d.cts +19 -0
- package/dist/storage/InMemoryDataStorage.d.cts.map +1 -0
- package/dist/storage/InMemoryDataStorage.d.mts +19 -0
- package/dist/storage/InMemoryDataStorage.d.mts.map +1 -0
- package/dist/storage/InMemoryDataStorage.mjs +48 -0
- package/dist/storage/InMemoryDataStorage.mjs.map +1 -0
- package/package.json +3 -3
- package/src/DocumentManager.ts +2 -2
- package/src/MimicConfig.ts +22 -1
- package/src/MimicServer.ts +11 -161
- package/tests/DocumentManager.test.ts +61 -0
- package/tests/MimicConfig.test.ts +72 -0
- package/tests/MimicServer.test.ts +55 -162
- package/tsdown.config.ts +1 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { __export } from "./_virtual/rolldown_runtime.mjs";
|
|
2
|
+
import { MimicServerConfigTag } from "./MimicConfig.mjs";
|
|
3
|
+
import { DocumentManagerTag } from "./DocumentManager.mjs";
|
|
4
|
+
import { MimicAuthServiceTag } from "./MimicAuthService.mjs";
|
|
5
|
+
import { PresenceManagerTag } from "./PresenceManager.mjs";
|
|
6
|
+
import { MessageParseError, MissingDocumentIdError } from "./errors.mjs";
|
|
7
|
+
import { _objectSpread2 } from "./_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Stream from "effect/Stream";
|
|
10
|
+
import * as Duration from "effect/Duration";
|
|
11
|
+
import { Presence, Transaction } from "@voidhash/mimic";
|
|
12
|
+
import * as Fiber from "effect/Fiber";
|
|
13
|
+
|
|
14
|
+
//#region src/WebSocketHandler.ts
|
|
15
|
+
/**
|
|
16
|
+
* @since 0.0.1
|
|
17
|
+
* WebSocket connection handler using Effect Platform Socket API.
|
|
18
|
+
*/
|
|
19
|
+
var WebSocketHandler_exports = /* @__PURE__ */ __export({
|
|
20
|
+
extractDocumentId: () => extractDocumentId,
|
|
21
|
+
handleConnection: () => handleConnection,
|
|
22
|
+
makeHandler: () => makeHandler
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Extract document ID from URL path.
|
|
26
|
+
* Expected format: /doc/{documentId}
|
|
27
|
+
*/
|
|
28
|
+
const extractDocumentId = (path) => {
|
|
29
|
+
const parts = path.replace(/^\/+/, "").split("/");
|
|
30
|
+
const docIndex = parts.lastIndexOf("doc");
|
|
31
|
+
const part = parts[docIndex + 1];
|
|
32
|
+
if (docIndex !== -1 && part) return Effect.succeed(decodeURIComponent(part));
|
|
33
|
+
return Effect.fail(new MissingDocumentIdError({}));
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Decodes an encoded client message from the wire format.
|
|
37
|
+
*/
|
|
38
|
+
const decodeClientMessage = (encoded) => {
|
|
39
|
+
if (encoded.type === "submit") return {
|
|
40
|
+
type: "submit",
|
|
41
|
+
transaction: Transaction.decode(encoded.transaction)
|
|
42
|
+
};
|
|
43
|
+
return encoded;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Encodes a server message for the wire format.
|
|
47
|
+
*/
|
|
48
|
+
const encodeServerMessageForWire = (message) => {
|
|
49
|
+
if (message.type === "transaction") return {
|
|
50
|
+
type: "transaction",
|
|
51
|
+
transaction: Transaction.encode(message.transaction),
|
|
52
|
+
version: message.version
|
|
53
|
+
};
|
|
54
|
+
return message;
|
|
55
|
+
};
|
|
56
|
+
const parseClientMessage = (data) => Effect.try({
|
|
57
|
+
try: () => {
|
|
58
|
+
const text = typeof data === "string" ? data : new TextDecoder().decode(data);
|
|
59
|
+
return decodeClientMessage(JSON.parse(text));
|
|
60
|
+
},
|
|
61
|
+
catch: (cause) => new MessageParseError({ cause })
|
|
62
|
+
});
|
|
63
|
+
const encodeServerMessage = (message) => JSON.stringify(encodeServerMessageForWire(message));
|
|
64
|
+
/**
|
|
65
|
+
* Handle a WebSocket connection for a document.
|
|
66
|
+
*
|
|
67
|
+
* @param socket - The Effect Platform Socket
|
|
68
|
+
* @param path - The URL path (e.g., "/doc/my-document-id")
|
|
69
|
+
* @returns An Effect that handles the connection lifecycle
|
|
70
|
+
*/
|
|
71
|
+
const handleConnection = (socket, path) => Effect.gen(function* () {
|
|
72
|
+
const config = yield* MimicServerConfigTag;
|
|
73
|
+
const authService = yield* MimicAuthServiceTag;
|
|
74
|
+
const documentManager = yield* DocumentManagerTag;
|
|
75
|
+
const presenceManager = yield* PresenceManagerTag;
|
|
76
|
+
const documentId = yield* extractDocumentId(path);
|
|
77
|
+
const connectionId = crypto.randomUUID();
|
|
78
|
+
let state = {
|
|
79
|
+
documentId,
|
|
80
|
+
connectionId,
|
|
81
|
+
authenticated: false
|
|
82
|
+
};
|
|
83
|
+
let hasPresence = false;
|
|
84
|
+
const write = yield* socket.writer;
|
|
85
|
+
const sendMessage = (message) => write(encodeServerMessage(message));
|
|
86
|
+
const sendPresenceSnapshot = Effect.gen(function* () {
|
|
87
|
+
if (!config.presence) return;
|
|
88
|
+
yield* sendMessage({
|
|
89
|
+
type: "presence_snapshot",
|
|
90
|
+
selfId: connectionId,
|
|
91
|
+
presences: (yield* presenceManager.getSnapshot(documentId)).presences
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
const handleAuth = (token) => Effect.gen(function* () {
|
|
95
|
+
const result = yield* authService.authenticate(token);
|
|
96
|
+
if (result.success) {
|
|
97
|
+
state = _objectSpread2(_objectSpread2({}, state), {}, {
|
|
98
|
+
authenticated: true,
|
|
99
|
+
userId: result.userId
|
|
100
|
+
});
|
|
101
|
+
yield* sendMessage({
|
|
102
|
+
type: "auth_result",
|
|
103
|
+
success: true
|
|
104
|
+
});
|
|
105
|
+
yield* sendPresenceSnapshot;
|
|
106
|
+
} else yield* sendMessage({
|
|
107
|
+
type: "auth_result",
|
|
108
|
+
success: false,
|
|
109
|
+
error: result.error
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
const handlePresenceSet = (data) => Effect.gen(function* () {
|
|
113
|
+
if (!state.authenticated) return;
|
|
114
|
+
if (!config.presence) return;
|
|
115
|
+
const validated = Presence.validateSafe(config.presence, data);
|
|
116
|
+
if (validated === void 0) {
|
|
117
|
+
yield* Effect.logWarning("Invalid presence data received", {
|
|
118
|
+
connectionId,
|
|
119
|
+
data
|
|
120
|
+
});
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
yield* presenceManager.set(documentId, connectionId, {
|
|
124
|
+
data: validated,
|
|
125
|
+
userId: state.userId
|
|
126
|
+
});
|
|
127
|
+
hasPresence = true;
|
|
128
|
+
});
|
|
129
|
+
const handlePresenceClear = Effect.gen(function* () {
|
|
130
|
+
if (!state.authenticated) return;
|
|
131
|
+
if (!config.presence) return;
|
|
132
|
+
yield* presenceManager.remove(documentId, connectionId);
|
|
133
|
+
hasPresence = false;
|
|
134
|
+
});
|
|
135
|
+
const handleMessage = (message) => Effect.gen(function* () {
|
|
136
|
+
switch (message.type) {
|
|
137
|
+
case "auth":
|
|
138
|
+
yield* handleAuth(message.token);
|
|
139
|
+
break;
|
|
140
|
+
case "ping":
|
|
141
|
+
yield* sendMessage({ type: "pong" });
|
|
142
|
+
break;
|
|
143
|
+
case "submit":
|
|
144
|
+
if (!state.authenticated) {
|
|
145
|
+
yield* sendMessage({
|
|
146
|
+
type: "error",
|
|
147
|
+
transactionId: message.transaction.id,
|
|
148
|
+
reason: "Not authenticated"
|
|
149
|
+
});
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const submitResult = yield* documentManager.submit(documentId, message.transaction);
|
|
153
|
+
if (!submitResult.success) yield* sendMessage({
|
|
154
|
+
type: "error",
|
|
155
|
+
transactionId: message.transaction.id,
|
|
156
|
+
reason: submitResult.reason
|
|
157
|
+
});
|
|
158
|
+
break;
|
|
159
|
+
case "request_snapshot":
|
|
160
|
+
if (!state.authenticated) return;
|
|
161
|
+
yield* sendMessage(yield* Effect.catchAll(documentManager.getSnapshot(documentId), () => Effect.succeed({
|
|
162
|
+
type: "snapshot",
|
|
163
|
+
state: null,
|
|
164
|
+
version: 0
|
|
165
|
+
})));
|
|
166
|
+
break;
|
|
167
|
+
case "presence_set":
|
|
168
|
+
yield* handlePresenceSet(message.data);
|
|
169
|
+
break;
|
|
170
|
+
case "presence_clear":
|
|
171
|
+
yield* handlePresenceClear;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
const subscribeFiber = yield* Effect.fork(Effect.gen(function* () {
|
|
176
|
+
while (!state.authenticated) yield* Effect.sleep(Duration.millis(100));
|
|
177
|
+
const broadcastStream = yield* Effect.catchAll(documentManager.subscribe(documentId), () => Effect.succeed(Stream.empty));
|
|
178
|
+
yield* Stream.runForEach(broadcastStream, (broadcast) => sendMessage(broadcast));
|
|
179
|
+
}).pipe(Effect.scoped));
|
|
180
|
+
const presenceFiber = yield* Effect.fork(Effect.gen(function* () {
|
|
181
|
+
if (!config.presence) return;
|
|
182
|
+
while (!state.authenticated) yield* Effect.sleep(Duration.millis(100));
|
|
183
|
+
const presenceStream = yield* presenceManager.subscribe(documentId);
|
|
184
|
+
yield* Stream.runForEach(presenceStream, (event) => Effect.gen(function* () {
|
|
185
|
+
if (event.id === connectionId) return;
|
|
186
|
+
if (event.type === "presence_update") yield* sendMessage({
|
|
187
|
+
type: "presence_update",
|
|
188
|
+
id: event.id,
|
|
189
|
+
data: event.data,
|
|
190
|
+
userId: event.userId
|
|
191
|
+
});
|
|
192
|
+
else if (event.type === "presence_remove") yield* sendMessage({
|
|
193
|
+
type: "presence_remove",
|
|
194
|
+
id: event.id
|
|
195
|
+
});
|
|
196
|
+
}));
|
|
197
|
+
}).pipe(Effect.scoped));
|
|
198
|
+
yield* Effect.addFinalizer(() => Effect.gen(function* () {
|
|
199
|
+
yield* Fiber.interrupt(subscribeFiber);
|
|
200
|
+
yield* Fiber.interrupt(presenceFiber);
|
|
201
|
+
if (hasPresence && config.presence) yield* presenceManager.remove(documentId, connectionId);
|
|
202
|
+
}));
|
|
203
|
+
yield* socket.runRaw((data) => Effect.gen(function* () {
|
|
204
|
+
yield* handleMessage(yield* parseClientMessage(data));
|
|
205
|
+
}).pipe(Effect.catchAll((error) => Effect.logError("Message handling error", error))));
|
|
206
|
+
});
|
|
207
|
+
/**
|
|
208
|
+
* Create a handler function for the WebSocket server.
|
|
209
|
+
* Returns a function that takes a socket and document ID.
|
|
210
|
+
*/
|
|
211
|
+
const makeHandler = Effect.gen(function* () {
|
|
212
|
+
const config = yield* MimicServerConfigTag;
|
|
213
|
+
const authService = yield* MimicAuthServiceTag;
|
|
214
|
+
const documentManager = yield* DocumentManagerTag;
|
|
215
|
+
const presenceManager = yield* PresenceManagerTag;
|
|
216
|
+
return (socket, documentId) => handleConnectionWithDocumentId(socket, documentId).pipe(Effect.provideService(MimicServerConfigTag, config), Effect.provideService(MimicAuthServiceTag, authService), Effect.provideService(DocumentManagerTag, documentManager), Effect.provideService(PresenceManagerTag, presenceManager), Effect.scoped);
|
|
217
|
+
});
|
|
218
|
+
/**
|
|
219
|
+
* Handle a WebSocket connection for a document (using document ID directly).
|
|
220
|
+
*/
|
|
221
|
+
const handleConnectionWithDocumentId = (socket, documentId) => Effect.gen(function* () {
|
|
222
|
+
const config = yield* MimicServerConfigTag;
|
|
223
|
+
const authService = yield* MimicAuthServiceTag;
|
|
224
|
+
const documentManager = yield* DocumentManagerTag;
|
|
225
|
+
const presenceManager = yield* PresenceManagerTag;
|
|
226
|
+
const connectionId = crypto.randomUUID();
|
|
227
|
+
let state = {
|
|
228
|
+
documentId,
|
|
229
|
+
connectionId,
|
|
230
|
+
authenticated: false
|
|
231
|
+
};
|
|
232
|
+
let hasPresence = false;
|
|
233
|
+
const write = yield* socket.writer;
|
|
234
|
+
const sendMessage = (message) => write(encodeServerMessage(message));
|
|
235
|
+
const sendPresenceSnapshot = Effect.gen(function* () {
|
|
236
|
+
if (!config.presence) return;
|
|
237
|
+
yield* sendMessage({
|
|
238
|
+
type: "presence_snapshot",
|
|
239
|
+
selfId: connectionId,
|
|
240
|
+
presences: (yield* presenceManager.getSnapshot(documentId)).presences
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
const handleAuth = (token) => Effect.gen(function* () {
|
|
244
|
+
const result = yield* authService.authenticate(token);
|
|
245
|
+
if (result.success) {
|
|
246
|
+
state = _objectSpread2(_objectSpread2({}, state), {}, {
|
|
247
|
+
authenticated: true,
|
|
248
|
+
userId: result.userId
|
|
249
|
+
});
|
|
250
|
+
yield* sendMessage({
|
|
251
|
+
type: "auth_result",
|
|
252
|
+
success: true
|
|
253
|
+
});
|
|
254
|
+
yield* sendPresenceSnapshot;
|
|
255
|
+
} else yield* sendMessage({
|
|
256
|
+
type: "auth_result",
|
|
257
|
+
success: false,
|
|
258
|
+
error: result.error
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
const handlePresenceSet = (data) => Effect.gen(function* () {
|
|
262
|
+
if (!state.authenticated) return;
|
|
263
|
+
if (!config.presence) return;
|
|
264
|
+
const validated = Presence.validateSafe(config.presence, data);
|
|
265
|
+
if (validated === void 0) {
|
|
266
|
+
yield* Effect.logWarning("Invalid presence data received", {
|
|
267
|
+
connectionId,
|
|
268
|
+
data
|
|
269
|
+
});
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
yield* presenceManager.set(documentId, connectionId, {
|
|
273
|
+
data: validated,
|
|
274
|
+
userId: state.userId
|
|
275
|
+
});
|
|
276
|
+
hasPresence = true;
|
|
277
|
+
});
|
|
278
|
+
const handlePresenceClear = Effect.gen(function* () {
|
|
279
|
+
if (!state.authenticated) return;
|
|
280
|
+
if (!config.presence) return;
|
|
281
|
+
yield* presenceManager.remove(documentId, connectionId);
|
|
282
|
+
hasPresence = false;
|
|
283
|
+
});
|
|
284
|
+
const handleMessage = (message) => Effect.gen(function* () {
|
|
285
|
+
switch (message.type) {
|
|
286
|
+
case "auth":
|
|
287
|
+
yield* handleAuth(message.token);
|
|
288
|
+
break;
|
|
289
|
+
case "ping":
|
|
290
|
+
yield* sendMessage({ type: "pong" });
|
|
291
|
+
break;
|
|
292
|
+
case "submit":
|
|
293
|
+
if (!state.authenticated) {
|
|
294
|
+
yield* sendMessage({
|
|
295
|
+
type: "error",
|
|
296
|
+
transactionId: message.transaction.id,
|
|
297
|
+
reason: "Not authenticated"
|
|
298
|
+
});
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const submitResult = yield* documentManager.submit(documentId, message.transaction);
|
|
302
|
+
if (!submitResult.success) yield* sendMessage({
|
|
303
|
+
type: "error",
|
|
304
|
+
transactionId: message.transaction.id,
|
|
305
|
+
reason: submitResult.reason
|
|
306
|
+
});
|
|
307
|
+
break;
|
|
308
|
+
case "request_snapshot":
|
|
309
|
+
if (!state.authenticated) return;
|
|
310
|
+
yield* sendMessage(yield* documentManager.getSnapshot(documentId));
|
|
311
|
+
break;
|
|
312
|
+
case "presence_set":
|
|
313
|
+
yield* handlePresenceSet(message.data);
|
|
314
|
+
break;
|
|
315
|
+
case "presence_clear":
|
|
316
|
+
yield* handlePresenceClear;
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
const subscribeFiber = yield* Effect.fork(Effect.gen(function* () {
|
|
321
|
+
while (!state.authenticated) yield* Effect.sleep(Duration.millis(100));
|
|
322
|
+
const broadcastStream = yield* documentManager.subscribe(documentId);
|
|
323
|
+
yield* Stream.runForEach(broadcastStream, (broadcast) => sendMessage(broadcast));
|
|
324
|
+
}).pipe(Effect.scoped));
|
|
325
|
+
const presenceFiber = yield* Effect.fork(Effect.gen(function* () {
|
|
326
|
+
if (!config.presence) return;
|
|
327
|
+
while (!state.authenticated) yield* Effect.sleep(Duration.millis(100));
|
|
328
|
+
const presenceStream = yield* presenceManager.subscribe(documentId);
|
|
329
|
+
yield* Stream.runForEach(presenceStream, (event) => Effect.gen(function* () {
|
|
330
|
+
if (event.id === connectionId) return;
|
|
331
|
+
if (event.type === "presence_update") yield* sendMessage({
|
|
332
|
+
type: "presence_update",
|
|
333
|
+
id: event.id,
|
|
334
|
+
data: event.data,
|
|
335
|
+
userId: event.userId
|
|
336
|
+
});
|
|
337
|
+
else if (event.type === "presence_remove") yield* sendMessage({
|
|
338
|
+
type: "presence_remove",
|
|
339
|
+
id: event.id
|
|
340
|
+
});
|
|
341
|
+
}));
|
|
342
|
+
}).pipe(Effect.scoped));
|
|
343
|
+
yield* Effect.addFinalizer(() => Effect.gen(function* () {
|
|
344
|
+
yield* Fiber.interrupt(subscribeFiber);
|
|
345
|
+
yield* Fiber.interrupt(presenceFiber);
|
|
346
|
+
if (hasPresence && config.presence) yield* presenceManager.remove(documentId, connectionId);
|
|
347
|
+
}));
|
|
348
|
+
yield* socket.runRaw((data) => Effect.gen(function* () {
|
|
349
|
+
yield* handleMessage(yield* parseClientMessage(data));
|
|
350
|
+
}).pipe(Effect.catchAll((error) => Effect.logError("Message handling error", error))));
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
//#endregion
|
|
354
|
+
export { WebSocketHandler_exports, extractDocumentId, handleConnection };
|
|
355
|
+
//# sourceMappingURL=WebSocketHandler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebSocketHandler.mjs","names":["state: ConnectionState"],"sources":["../src/WebSocketHandler.ts"],"sourcesContent":["/**\n * @since 0.0.1\n * WebSocket connection handler using Effect Platform Socket API.\n */\nimport * as Effect from \"effect/Effect\";\nimport * as Stream from \"effect/Stream\";\nimport * as Fiber from \"effect/Fiber\";\nimport * as Scope from \"effect/Scope\";\nimport * as Duration from \"effect/Duration\";\nimport type * as Socket from \"@effect/platform/Socket\";\nimport { Transaction, Presence } from \"@voidhash/mimic\";\n\nimport * as Protocol from \"./DocumentProtocol.js\";\nimport { MimicServerConfigTag } from \"./MimicConfig.js\";\nimport { MimicAuthServiceTag } from \"./MimicAuthService.js\";\nimport { DocumentManagerTag } from \"./DocumentManager.js\";\nimport { PresenceManagerTag } from \"./PresenceManager.js\";\nimport type * as PresenceManager from \"./PresenceManager.js\";\nimport {\n MessageParseError,\n MissingDocumentIdError,\n} from \"./errors.js\";\n\n// =============================================================================\n// Client Message Types (matching mimic-client Transport.ts)\n// =============================================================================\n\ninterface SubmitMessage {\n readonly type: \"submit\";\n readonly transaction: Protocol.Transaction;\n}\n\ninterface EncodedSubmitMessage {\n readonly type: \"submit\";\n readonly transaction: Transaction.EncodedTransaction;\n}\n\ninterface RequestSnapshotMessage {\n readonly type: \"request_snapshot\";\n}\n\ninterface PingMessage {\n readonly type: \"ping\";\n}\n\ninterface AuthMessage {\n readonly type: \"auth\";\n readonly token: string;\n}\n\ninterface PresenceSetMessage {\n readonly type: \"presence_set\";\n readonly data: unknown;\n}\n\ninterface PresenceClearMessage {\n readonly type: \"presence_clear\";\n}\n\ntype ClientMessage =\n | SubmitMessage\n | RequestSnapshotMessage\n | PingMessage\n | AuthMessage\n | PresenceSetMessage\n | PresenceClearMessage;\n\ntype EncodedClientMessage =\n | EncodedSubmitMessage\n | RequestSnapshotMessage\n | PingMessage\n | AuthMessage\n | PresenceSetMessage\n | PresenceClearMessage;\n\n// =============================================================================\n// Server Message Types (matching mimic-client Transport.ts)\n// =============================================================================\n\ninterface PongMessage {\n readonly type: \"pong\";\n}\n\ninterface AuthResultMessage {\n readonly type: \"auth_result\";\n readonly success: boolean;\n readonly error?: string;\n}\n\ninterface EncodedTransactionMessage {\n readonly type: \"transaction\";\n readonly transaction: Transaction.EncodedTransaction;\n readonly version: number;\n}\n\n// Presence server messages\ninterface PresenceSnapshotMessage {\n readonly type: \"presence_snapshot\";\n readonly selfId: string;\n readonly presences: Record<string, { data: unknown; userId?: string }>;\n}\n\ninterface PresenceUpdateMessage {\n readonly type: \"presence_update\";\n readonly id: string;\n readonly data: unknown;\n readonly userId?: string;\n}\n\ninterface PresenceRemoveMessage {\n readonly type: \"presence_remove\";\n readonly id: string;\n}\n\ntype ServerMessage =\n | Protocol.TransactionMessage\n | Protocol.SnapshotMessage\n | Protocol.ErrorMessage\n | PongMessage\n | AuthResultMessage\n | PresenceSnapshotMessage\n | PresenceUpdateMessage\n | PresenceRemoveMessage;\n\ntype EncodedServerMessage =\n | EncodedTransactionMessage\n | Protocol.SnapshotMessage\n | Protocol.ErrorMessage\n | PongMessage\n | AuthResultMessage\n | PresenceSnapshotMessage\n | PresenceUpdateMessage\n | PresenceRemoveMessage;\n\n// =============================================================================\n// WebSocket Connection State\n// =============================================================================\n\ninterface ConnectionState {\n readonly documentId: string;\n readonly connectionId: string;\n readonly authenticated: boolean;\n readonly userId?: string;\n}\n\n// =============================================================================\n// URL Path Parsing\n// =============================================================================\n\n/**\n * Extract document ID from URL path.\n * Expected format: /doc/{documentId}\n */\nexport const extractDocumentId = (\n path: string\n): Effect.Effect<string, MissingDocumentIdError> => {\n // Remove leading slash and split\n const parts = path.replace(/^\\/+/, \"\").split(\"/\");\n\n // Find the last occurrence of 'doc' in the path\n const docIndex = parts.lastIndexOf(\"doc\");\n const part = parts[docIndex + 1];\n if (docIndex !== -1 && part) {\n return Effect.succeed(decodeURIComponent(part));\n }\n return Effect.fail(new MissingDocumentIdError({}));\n};\n\n// =============================================================================\n// Message Parsing\n// =============================================================================\n\n/**\n * Decodes an encoded client message from the wire format.\n */\nconst decodeClientMessage = (encoded: EncodedClientMessage): ClientMessage => {\n if (encoded.type === \"submit\") {\n return {\n type: \"submit\",\n transaction: Transaction.decode(encoded.transaction),\n };\n }\n return encoded;\n};\n\n/**\n * Encodes a server message for the wire format.\n */\nconst encodeServerMessageForWire = (message: ServerMessage): EncodedServerMessage => {\n if (message.type === \"transaction\") {\n return {\n type: \"transaction\",\n transaction: Transaction.encode(message.transaction),\n version: message.version,\n };\n }\n return message;\n};\n\nconst parseClientMessage = (\n data: string | Uint8Array\n): Effect.Effect<ClientMessage, MessageParseError> =>\n Effect.try({\n try: () => {\n const text =\n typeof data === \"string\" ? data : new TextDecoder().decode(data);\n const encoded = JSON.parse(text) as EncodedClientMessage;\n return decodeClientMessage(encoded);\n },\n catch: (cause) => new MessageParseError({ cause }),\n });\n\nconst encodeServerMessage = (message: ServerMessage): string =>\n JSON.stringify(encodeServerMessageForWire(message));\n\n// =============================================================================\n// WebSocket Handler\n// =============================================================================\n\n/**\n * Handle a WebSocket connection for a document.\n *\n * @param socket - The Effect Platform Socket\n * @param path - The URL path (e.g., \"/doc/my-document-id\")\n * @returns An Effect that handles the connection lifecycle\n */\nexport const handleConnection = (\n socket: Socket.Socket,\n path: string\n): Effect.Effect<\n void,\n Socket.SocketError | MissingDocumentIdError | MessageParseError,\n MimicServerConfigTag | MimicAuthServiceTag | DocumentManagerTag | PresenceManagerTag | Scope.Scope\n> =>\n Effect.gen(function* () {\n const config = yield* MimicServerConfigTag;\n const authService = yield* MimicAuthServiceTag;\n const documentManager = yield* DocumentManagerTag;\n const presenceManager = yield* PresenceManagerTag;\n\n // Extract document ID from path\n const documentId = yield* extractDocumentId(path);\n const connectionId = crypto.randomUUID();\n\n // Track connection state\n let state: ConnectionState = {\n documentId,\n connectionId,\n authenticated: false, // Start unauthenticated, auth service will validate\n };\n\n // Track if this connection has set presence (for cleanup)\n let hasPresence = false;\n\n // Get the socket writer\n const write = yield* socket.writer;\n\n // Helper to send a message to the client\n const sendMessage = (message: ServerMessage) =>\n write(encodeServerMessage(message));\n\n // Send presence snapshot after auth\n const sendPresenceSnapshot = Effect.gen(function* () {\n if (!config.presence) return;\n\n const snapshot = yield* presenceManager.getSnapshot(documentId);\n yield* sendMessage({\n type: \"presence_snapshot\",\n selfId: connectionId,\n presences: snapshot.presences,\n });\n });\n\n // Handle authentication using the auth service\n const handleAuth = (token: string) =>\n Effect.gen(function* () {\n const result = yield* authService.authenticate(token);\n\n if (result.success) {\n state = {\n ...state,\n authenticated: true,\n userId: result.userId,\n };\n yield* sendMessage({ type: \"auth_result\", success: true });\n\n // Send presence snapshot after successful auth\n yield* sendPresenceSnapshot;\n } else {\n yield* sendMessage({\n type: \"auth_result\",\n success: false,\n error: result.error,\n });\n }\n });\n\n // Handle presence set\n const handlePresenceSet = (data: unknown) =>\n Effect.gen(function* () {\n if (!state.authenticated) return;\n if (!config.presence) return;\n\n // Validate presence data against schema\n const validated = Presence.validateSafe(config.presence, data);\n if (validated === undefined) {\n yield* Effect.logWarning(\"Invalid presence data received\", { connectionId, data });\n return;\n }\n\n // Store in presence manager\n yield* presenceManager.set(documentId, connectionId, {\n data: validated,\n userId: state.userId,\n });\n\n hasPresence = true;\n });\n\n // Handle presence clear\n const handlePresenceClear = Effect.gen(function* () {\n if (!state.authenticated) return;\n if (!config.presence) return;\n\n yield* presenceManager.remove(documentId, connectionId);\n hasPresence = false;\n });\n\n // Handle a client message\n const handleMessage = (message: ClientMessage) =>\n Effect.gen(function* () {\n switch (message.type) {\n case \"auth\":\n yield* handleAuth(message.token);\n break;\n\n case \"ping\":\n yield* sendMessage({ type: \"pong\" });\n break;\n\n case \"submit\":\n if (!state.authenticated) {\n yield* sendMessage({\n type: \"error\",\n transactionId: message.transaction.id,\n reason: \"Not authenticated\",\n });\n return;\n }\n // Submit to the document manager\n const submitResult = yield* documentManager.submit(\n documentId,\n message.transaction as any\n );\n // If rejected, send error (success is broadcast to all)\n if (!submitResult.success) {\n yield* sendMessage({\n type: \"error\",\n transactionId: message.transaction.id,\n reason: submitResult.reason,\n });\n }\n break;\n\n case \"request_snapshot\":\n if (!state.authenticated) {\n return;\n }\n const snapshot = yield* Effect.catchAll(\n documentManager.getSnapshot(documentId),\n () =>\n Effect.succeed({\n type: \"snapshot\" as const,\n state: null,\n version: 0,\n })\n );\n yield* sendMessage(snapshot);\n break;\n\n case \"presence_set\":\n yield* handlePresenceSet(message.data);\n break;\n\n case \"presence_clear\":\n yield* handlePresenceClear;\n break;\n }\n });\n\n // Subscribe to document broadcasts\n const subscribeFiber = yield* Effect.fork(\n Effect.gen(function* () {\n // Wait until authenticated before subscribing\n while (!state.authenticated) {\n yield* Effect.sleep(Duration.millis(100));\n }\n\n // Subscribe to the document\n const broadcastStream = yield* Effect.catchAll(\n documentManager.subscribe(documentId),\n () => Effect.succeed(Stream.empty)\n );\n\n // Forward broadcasts to the WebSocket\n yield* Stream.runForEach(broadcastStream, (broadcast) =>\n sendMessage(broadcast as ServerMessage)\n );\n }).pipe(Effect.scoped)\n );\n\n // Subscribe to presence events (if presence is enabled)\n const presenceFiber = yield* Effect.fork(\n Effect.gen(function* () {\n if (!config.presence) return;\n\n // Wait until authenticated before subscribing\n while (!state.authenticated) {\n yield* Effect.sleep(Duration.millis(100));\n }\n\n // Subscribe to presence events\n const presenceStream = yield* presenceManager.subscribe(documentId);\n\n // Forward presence events to the WebSocket, filtering out our own events (no-echo)\n yield* Stream.runForEach(presenceStream, (event) =>\n Effect.gen(function* () {\n // Don't echo our own presence events\n if (event.id === connectionId) return;\n\n if (event.type === \"presence_update\") {\n yield* sendMessage({\n type: \"presence_update\",\n id: event.id,\n data: event.data,\n userId: event.userId,\n });\n } else if (event.type === \"presence_remove\") {\n yield* sendMessage({\n type: \"presence_remove\",\n id: event.id,\n });\n }\n })\n );\n }).pipe(Effect.scoped)\n );\n\n // Ensure cleanup on disconnect\n yield* Effect.addFinalizer(() =>\n Effect.gen(function* () {\n // Interrupt the subscribe fibers\n yield* Fiber.interrupt(subscribeFiber);\n yield* Fiber.interrupt(presenceFiber);\n\n // Remove presence if we had any\n if (hasPresence && config.presence) {\n yield* presenceManager.remove(documentId, connectionId);\n }\n })\n );\n\n // Process incoming messages\n yield* socket.runRaw((data) =>\n Effect.gen(function* () {\n const message = yield* parseClientMessage(data);\n yield* handleMessage(message);\n }).pipe(\n Effect.catchAll((error) =>\n Effect.logError(\"Message handling error\", error)\n )\n )\n );\n });\n\n// =============================================================================\n// WebSocket Server Handler Factory\n// =============================================================================\n\n/**\n * Create a handler function for the WebSocket server.\n * Returns a function that takes a socket and document ID.\n */\nexport const makeHandler = Effect.gen(function* () {\n const config = yield* MimicServerConfigTag;\n const authService = yield* MimicAuthServiceTag;\n const documentManager = yield* DocumentManagerTag;\n const presenceManager = yield* PresenceManagerTag;\n\n return (socket: Socket.Socket, documentId: string) =>\n handleConnectionWithDocumentId(socket, documentId).pipe(\n Effect.provideService(MimicServerConfigTag, config),\n Effect.provideService(MimicAuthServiceTag, authService),\n Effect.provideService(DocumentManagerTag, documentManager),\n Effect.provideService(PresenceManagerTag, presenceManager),\n Effect.scoped\n );\n});\n\n/**\n * Handle a WebSocket connection for a document (using document ID directly).\n */\nconst handleConnectionWithDocumentId = (\n socket: Socket.Socket,\n documentId: string\n): Effect.Effect<\n void,\n Socket.SocketError | MessageParseError,\n MimicServerConfigTag | MimicAuthServiceTag | DocumentManagerTag | PresenceManagerTag | Scope.Scope\n> =>\n Effect.gen(function* () {\n const config = yield* MimicServerConfigTag;\n const authService = yield* MimicAuthServiceTag;\n const documentManager = yield* DocumentManagerTag;\n const presenceManager = yield* PresenceManagerTag;\n\n const connectionId = crypto.randomUUID();\n\n // Track connection state\n let state: ConnectionState = {\n documentId,\n connectionId,\n authenticated: false,\n };\n\n // Track if this connection has set presence (for cleanup)\n let hasPresence = false;\n\n // Get the socket writer\n const write = yield* socket.writer;\n\n // Helper to send a message to the client\n const sendMessage = (message: ServerMessage) =>\n write(encodeServerMessage(message));\n\n // Send presence snapshot after auth\n const sendPresenceSnapshot = Effect.gen(function* () {\n if (!config.presence) return;\n\n const snapshot = yield* presenceManager.getSnapshot(documentId);\n yield* sendMessage({\n type: \"presence_snapshot\",\n selfId: connectionId,\n presences: snapshot.presences,\n });\n });\n\n // Handle authentication using the auth service\n const handleAuth = (token: string) =>\n Effect.gen(function* () {\n const result = yield* authService.authenticate(token);\n\n if (result.success) {\n state = {\n ...state,\n authenticated: true,\n userId: result.userId,\n };\n yield* sendMessage({ type: \"auth_result\", success: true });\n\n // Send presence snapshot after successful auth\n yield* sendPresenceSnapshot;\n } else {\n yield* sendMessage({\n type: \"auth_result\",\n success: false,\n error: result.error,\n });\n }\n });\n\n // Handle presence set\n const handlePresenceSet = (data: unknown) =>\n Effect.gen(function* () {\n if (!state.authenticated) return;\n if (!config.presence) return;\n\n // Validate presence data against schema\n const validated = Presence.validateSafe(config.presence, data);\n if (validated === undefined) {\n yield* Effect.logWarning(\"Invalid presence data received\", { connectionId, data });\n return;\n }\n\n // Store in presence manager\n yield* presenceManager.set(documentId, connectionId, {\n data: validated,\n userId: state.userId,\n });\n\n hasPresence = true;\n });\n\n // Handle presence clear\n const handlePresenceClear = Effect.gen(function* () {\n if (!state.authenticated) return;\n if (!config.presence) return;\n\n yield* presenceManager.remove(documentId, connectionId);\n hasPresence = false;\n });\n\n // Handle a client message\n const handleMessage = (message: ClientMessage) =>\n Effect.gen(function* () {\n switch (message.type) {\n case \"auth\":\n yield* handleAuth(message.token);\n break;\n\n case \"ping\":\n yield* sendMessage({ type: \"pong\" });\n break;\n\n case \"submit\":\n if (!state.authenticated) {\n yield* sendMessage({\n type: \"error\",\n transactionId: message.transaction.id,\n reason: \"Not authenticated\",\n });\n return;\n }\n const submitResult = yield* documentManager.submit(\n documentId,\n message.transaction as any\n );\n if (!submitResult.success) {\n yield* sendMessage({\n type: \"error\",\n transactionId: message.transaction.id,\n reason: submitResult.reason,\n });\n }\n break;\n\n case \"request_snapshot\":\n if (!state.authenticated) {\n return;\n }\n const snapshot = yield* documentManager.getSnapshot(documentId);\n yield* sendMessage(snapshot);\n break;\n\n case \"presence_set\":\n yield* handlePresenceSet(message.data);\n break;\n\n case \"presence_clear\":\n yield* handlePresenceClear;\n break;\n }\n });\n\n // Subscribe to document broadcasts\n const subscribeFiber = yield* Effect.fork(\n Effect.gen(function* () {\n // Wait until authenticated before subscribing\n while (!state.authenticated) {\n yield* Effect.sleep(Duration.millis(100));\n }\n\n // Subscribe to the document\n const broadcastStream = yield* documentManager.subscribe(documentId);\n\n // Forward broadcasts to the WebSocket\n yield* Stream.runForEach(broadcastStream, (broadcast) =>\n sendMessage(broadcast as ServerMessage)\n );\n }).pipe(Effect.scoped)\n );\n\n // Subscribe to presence events (if presence is enabled)\n const presenceFiber = yield* Effect.fork(\n Effect.gen(function* () {\n if (!config.presence) return;\n\n // Wait until authenticated before subscribing\n while (!state.authenticated) {\n yield* Effect.sleep(Duration.millis(100));\n }\n\n // Subscribe to presence events\n const presenceStream = yield* presenceManager.subscribe(documentId);\n\n // Forward presence events to the WebSocket, filtering out our own events (no-echo)\n yield* Stream.runForEach(presenceStream, (event) =>\n Effect.gen(function* () {\n // Don't echo our own presence events\n if (event.id === connectionId) return;\n\n if (event.type === \"presence_update\") {\n yield* sendMessage({\n type: \"presence_update\",\n id: event.id,\n data: event.data,\n userId: event.userId,\n });\n } else if (event.type === \"presence_remove\") {\n yield* sendMessage({\n type: \"presence_remove\",\n id: event.id,\n });\n }\n })\n );\n }).pipe(Effect.scoped)\n );\n\n // Ensure cleanup on disconnect\n yield* Effect.addFinalizer(() =>\n Effect.gen(function* () {\n // Interrupt the subscribe fibers\n yield* Fiber.interrupt(subscribeFiber);\n yield* Fiber.interrupt(presenceFiber);\n\n // Remove presence if we had any\n if (hasPresence && config.presence) {\n yield* presenceManager.remove(documentId, connectionId);\n }\n })\n );\n\n // Process incoming messages\n yield* socket.runRaw((data) =>\n Effect.gen(function* () {\n const message = yield* parseClientMessage(data);\n yield* handleMessage(message);\n }).pip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;GACD,CAAC,KAAK,OAAO,OAAO,CACvB;AAGD,QAAO,OAAO,mBACZ,OAAO,IAAI,aAAa;AAEtB,SAAO,MAAM,UAAU,eAAe;AACtC,SAAO,MAAM,UAAU,cAAc;AAGrC,MAAI,eAAe,OAAO,SACxB,QAAO,gBAAgB,OAAO,YAAY,aAAa;GAEzD,CACH;AAGD,QAAO,OAAO,QAAQ,SACpB,OAAO,IAAI,aAAa;AAEtB,SAAO,cADS,OAAO,mBAAmB,KAAK,CAClB;GAC7B,CAAC,KACD,OAAO,UAAU,UACf,OAAO,SAAS,0BAA0B,MAAM,CACjD,CACF,CACF;EACD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const require_toPropertyKey = require('./toPropertyKey.cjs');
|
|
2
|
+
|
|
3
|
+
//#region \0@oxc-project+runtime@0.103.0/helpers/defineProperty.js
|
|
4
|
+
function _defineProperty(e, r, t) {
|
|
5
|
+
return (r = require_toPropertyKey.toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
6
|
+
value: t,
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
configurable: !0,
|
|
9
|
+
writable: !0
|
|
10
|
+
}) : e[r] = t, e;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
exports._defineProperty = _defineProperty;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { toPropertyKey } from "./toPropertyKey.mjs";
|
|
2
|
+
|
|
3
|
+
//#region \0@oxc-project+runtime@0.103.0/helpers/defineProperty.js
|
|
4
|
+
function _defineProperty(e, r, t) {
|
|
5
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
6
|
+
value: t,
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
configurable: !0,
|
|
9
|
+
writable: !0
|
|
10
|
+
}) : e[r] = t, e;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { _defineProperty };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require_defineProperty = require('./defineProperty.cjs');
|
|
2
|
+
|
|
3
|
+
//#region \0@oxc-project+runtime@0.103.0/helpers/objectSpread2.js
|
|
4
|
+
function ownKeys(e, r) {
|
|
5
|
+
var t = Object.keys(e);
|
|
6
|
+
if (Object.getOwnPropertySymbols) {
|
|
7
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
8
|
+
r && (o = o.filter(function(r$1) {
|
|
9
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
10
|
+
})), t.push.apply(t, o);
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
function _objectSpread2(e) {
|
|
15
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
16
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
17
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
|
|
18
|
+
require_defineProperty._defineProperty(e, r$1, t[r$1]);
|
|
19
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
20
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return e;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports._objectSpread2 = _objectSpread2;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { _defineProperty } from "./defineProperty.mjs";
|
|
2
|
+
|
|
3
|
+
//#region \0@oxc-project+runtime@0.103.0/helpers/objectSpread2.js
|
|
4
|
+
function ownKeys(e, r) {
|
|
5
|
+
var t = Object.keys(e);
|
|
6
|
+
if (Object.getOwnPropertySymbols) {
|
|
7
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
8
|
+
r && (o = o.filter(function(r$1) {
|
|
9
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
10
|
+
})), t.push.apply(t, o);
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
function _objectSpread2(e) {
|
|
15
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
16
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
17
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
|
|
18
|
+
_defineProperty(e, r$1, t[r$1]);
|
|
19
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
20
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return e;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { _objectSpread2 };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const require_typeof = require('./typeof.cjs');
|
|
2
|
+
|
|
3
|
+
//#region \0@oxc-project+runtime@0.103.0/helpers/toPrimitive.js
|
|
4
|
+
function toPrimitive(t, r) {
|
|
5
|
+
if ("object" != require_typeof._typeof(t) || !t) return t;
|
|
6
|
+
var e = t[Symbol.toPrimitive];
|
|
7
|
+
if (void 0 !== e) {
|
|
8
|
+
var i = e.call(t, r || "default");
|
|
9
|
+
if ("object" != require_typeof._typeof(i)) return i;
|
|
10
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11
|
+
}
|
|
12
|
+
return ("string" === r ? String : Number)(t);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.toPrimitive = toPrimitive;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { _typeof } from "./typeof.mjs";
|
|
2
|
+
|
|
3
|
+
//#region \0@oxc-project+runtime@0.103.0/helpers/toPrimitive.js
|
|
4
|
+
function toPrimitive(t, r) {
|
|
5
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
6
|
+
var e = t[Symbol.toPrimitive];
|
|
7
|
+
if (void 0 !== e) {
|
|
8
|
+
var i = e.call(t, r || "default");
|
|
9
|
+
if ("object" != _typeof(i)) return i;
|
|
10
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11
|
+
}
|
|
12
|
+
return ("string" === r ? String : Number)(t);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { toPrimitive };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const require_typeof = require('./typeof.cjs');
|
|
2
|
+
const require_toPrimitive = require('./toPrimitive.cjs');
|
|
3
|
+
|
|
4
|
+
//#region \0@oxc-project+runtime@0.103.0/helpers/toPropertyKey.js
|
|
5
|
+
function toPropertyKey(t) {
|
|
6
|
+
var i = require_toPrimitive.toPrimitive(t, "string");
|
|
7
|
+
return "symbol" == require_typeof._typeof(i) ? i : i + "";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.toPropertyKey = toPropertyKey;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { _typeof } from "./typeof.mjs";
|
|
2
|
+
import { toPrimitive } from "./toPrimitive.mjs";
|
|
3
|
+
|
|
4
|
+
//#region \0@oxc-project+runtime@0.103.0/helpers/toPropertyKey.js
|
|
5
|
+
function toPropertyKey(t) {
|
|
6
|
+
var i = toPrimitive(t, "string");
|
|
7
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { toPropertyKey };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
//#region \0@oxc-project+runtime@0.103.0/helpers/typeof.js
|
|
3
|
+
function _typeof(o) {
|
|
4
|
+
"@babel/helpers - typeof";
|
|
5
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
6
|
+
return typeof o$1;
|
|
7
|
+
} : function(o$1) {
|
|
8
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
9
|
+
}, _typeof(o);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
Object.defineProperty(exports, '_typeof', {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _typeof;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.103.0/helpers/typeof.js
|
|
2
|
+
function _typeof(o) {
|
|
3
|
+
"@babel/helpers - typeof";
|
|
4
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
5
|
+
return typeof o$1;
|
|
6
|
+
} : function(o$1) {
|
|
7
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
8
|
+
}, _typeof(o);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { _typeof };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (all, symbols) => {
|
|
9
|
+
let target = {};
|
|
10
|
+
for (var name in all) {
|
|
11
|
+
__defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (symbols) {
|
|
17
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
+
key = keys[i];
|
|
25
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
26
|
+
__defProp(to, key, {
|
|
27
|
+
get: ((k) => from[k]).bind(null, key),
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
36
|
+
value: mod,
|
|
37
|
+
enumerable: true
|
|
38
|
+
}) : target, mod));
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
|
|
42
|
+
exports.__export = __export;
|
|
43
|
+
exports.__toESM = __toESM;
|