@voidhash/mimic-effect 0.0.9 → 1.0.0-beta.2
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 +136 -90
- package/README.md +385 -0
- package/dist/ColdStorage.cjs +60 -0
- package/dist/ColdStorage.d.cts +53 -0
- package/dist/ColdStorage.d.cts.map +1 -0
- package/dist/ColdStorage.d.mts +53 -0
- package/dist/ColdStorage.d.mts.map +1 -0
- package/dist/ColdStorage.mjs +60 -0
- package/dist/ColdStorage.mjs.map +1 -0
- package/dist/DocumentManager.cjs +263 -82
- package/dist/DocumentManager.d.cts +44 -22
- package/dist/DocumentManager.d.cts.map +1 -1
- package/dist/DocumentManager.d.mts +44 -22
- package/dist/DocumentManager.d.mts.map +1 -1
- package/dist/DocumentManager.mjs +259 -67
- package/dist/DocumentManager.mjs.map +1 -1
- package/dist/Errors.cjs +54 -0
- package/dist/Errors.d.cts +96 -0
- package/dist/Errors.d.cts.map +1 -0
- package/dist/Errors.d.mts +96 -0
- package/dist/Errors.d.mts.map +1 -0
- package/dist/Errors.mjs +48 -0
- package/dist/Errors.mjs.map +1 -0
- package/dist/HotStorage.cjs +100 -0
- package/dist/HotStorage.d.cts +70 -0
- package/dist/HotStorage.d.cts.map +1 -0
- package/dist/HotStorage.d.mts +70 -0
- package/dist/HotStorage.d.mts.map +1 -0
- package/dist/HotStorage.mjs +100 -0
- package/dist/HotStorage.mjs.map +1 -0
- package/dist/Metrics.cjs +143 -0
- package/dist/Metrics.d.cts +31 -0
- package/dist/Metrics.d.cts.map +1 -0
- package/dist/Metrics.d.mts +31 -0
- package/dist/Metrics.d.mts.map +1 -0
- package/dist/Metrics.mjs +126 -0
- package/dist/Metrics.mjs.map +1 -0
- package/dist/MimicAuthService.cjs +61 -45
- package/dist/MimicAuthService.d.cts +61 -48
- package/dist/MimicAuthService.d.cts.map +1 -1
- package/dist/MimicAuthService.d.mts +61 -48
- package/dist/MimicAuthService.d.mts.map +1 -1
- package/dist/MimicAuthService.mjs +60 -36
- package/dist/MimicAuthService.mjs.map +1 -1
- package/dist/MimicClusterServerEngine.cjs +521 -0
- package/dist/MimicClusterServerEngine.d.cts +17 -0
- package/dist/MimicClusterServerEngine.d.cts.map +1 -0
- package/dist/MimicClusterServerEngine.d.mts +17 -0
- package/dist/MimicClusterServerEngine.d.mts.map +1 -0
- package/dist/MimicClusterServerEngine.mjs +523 -0
- package/dist/MimicClusterServerEngine.mjs.map +1 -0
- package/dist/MimicServer.cjs +205 -96
- package/dist/MimicServer.d.cts +9 -110
- package/dist/MimicServer.d.cts.map +1 -1
- package/dist/MimicServer.d.mts +9 -110
- package/dist/MimicServer.d.mts.map +1 -1
- package/dist/MimicServer.mjs +206 -90
- package/dist/MimicServer.mjs.map +1 -1
- package/dist/MimicServerEngine.cjs +97 -0
- package/dist/MimicServerEngine.d.cts +78 -0
- package/dist/MimicServerEngine.d.cts.map +1 -0
- package/dist/MimicServerEngine.d.mts +78 -0
- package/dist/MimicServerEngine.d.mts.map +1 -0
- package/dist/MimicServerEngine.mjs +97 -0
- package/dist/MimicServerEngine.mjs.map +1 -0
- package/dist/PresenceManager.cjs +75 -91
- package/dist/PresenceManager.d.cts +17 -66
- package/dist/PresenceManager.d.cts.map +1 -1
- package/dist/PresenceManager.d.mts +17 -66
- package/dist/PresenceManager.d.mts.map +1 -1
- package/dist/PresenceManager.mjs +74 -78
- package/dist/PresenceManager.mjs.map +1 -1
- package/dist/Protocol.cjs +146 -0
- package/dist/Protocol.d.cts +203 -0
- package/dist/Protocol.d.cts.map +1 -0
- package/dist/Protocol.d.mts +203 -0
- package/dist/Protocol.d.mts.map +1 -0
- package/dist/Protocol.mjs +132 -0
- package/dist/Protocol.mjs.map +1 -0
- package/dist/Types.d.cts +172 -0
- package/dist/Types.d.cts.map +1 -0
- package/dist/Types.d.mts +172 -0
- package/dist/Types.d.mts.map +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +1 -25
- package/dist/_virtual/rolldown_runtime.mjs +4 -1
- package/dist/index.cjs +37 -75
- package/dist/index.d.cts +13 -12
- package/dist/index.d.mts +13 -12
- package/dist/index.mjs +12 -12
- package/dist/testing/ColdStorageTestSuite.cjs +508 -0
- package/dist/testing/ColdStorageTestSuite.d.cts +36 -0
- package/dist/testing/ColdStorageTestSuite.d.cts.map +1 -0
- package/dist/testing/ColdStorageTestSuite.d.mts +36 -0
- package/dist/testing/ColdStorageTestSuite.d.mts.map +1 -0
- package/dist/testing/ColdStorageTestSuite.mjs +508 -0
- package/dist/testing/ColdStorageTestSuite.mjs.map +1 -0
- package/dist/testing/FailingStorage.cjs +135 -0
- package/dist/testing/FailingStorage.d.cts +43 -0
- package/dist/testing/FailingStorage.d.cts.map +1 -0
- package/dist/testing/FailingStorage.d.mts +43 -0
- package/dist/testing/FailingStorage.d.mts.map +1 -0
- package/dist/testing/FailingStorage.mjs +136 -0
- package/dist/testing/FailingStorage.mjs.map +1 -0
- package/dist/testing/HotStorageTestSuite.cjs +585 -0
- package/dist/testing/HotStorageTestSuite.d.cts +40 -0
- package/dist/testing/HotStorageTestSuite.d.cts.map +1 -0
- package/dist/testing/HotStorageTestSuite.d.mts +40 -0
- package/dist/testing/HotStorageTestSuite.d.mts.map +1 -0
- package/dist/testing/HotStorageTestSuite.mjs +585 -0
- package/dist/testing/HotStorageTestSuite.mjs.map +1 -0
- package/dist/testing/StorageIntegrationTestSuite.cjs +349 -0
- package/dist/testing/StorageIntegrationTestSuite.d.cts +35 -0
- package/dist/testing/StorageIntegrationTestSuite.d.cts.map +1 -0
- package/dist/testing/StorageIntegrationTestSuite.d.mts +35 -0
- package/dist/testing/StorageIntegrationTestSuite.d.mts.map +1 -0
- package/dist/testing/StorageIntegrationTestSuite.mjs +349 -0
- package/dist/testing/StorageIntegrationTestSuite.mjs.map +1 -0
- package/dist/testing/assertions.cjs +114 -0
- package/dist/testing/assertions.mjs +109 -0
- package/dist/testing/assertions.mjs.map +1 -0
- package/dist/testing/index.cjs +14 -0
- package/dist/testing/index.d.cts +6 -0
- package/dist/testing/index.d.mts +6 -0
- package/dist/testing/index.mjs +7 -0
- package/dist/testing/types.cjs +15 -0
- package/dist/testing/types.d.cts +90 -0
- package/dist/testing/types.d.cts.map +1 -0
- package/dist/testing/types.d.mts +90 -0
- package/dist/testing/types.d.mts.map +1 -0
- package/dist/testing/types.mjs +16 -0
- package/dist/testing/types.mjs.map +1 -0
- package/package.json +18 -3
- package/src/ColdStorage.ts +136 -0
- package/src/DocumentManager.ts +550 -190
- package/src/Errors.ts +114 -0
- package/src/HotStorage.ts +239 -0
- package/src/Metrics.ts +187 -0
- package/src/MimicAuthService.ts +126 -64
- package/src/MimicClusterServerEngine.ts +946 -0
- package/src/MimicServer.ts +448 -195
- package/src/MimicServerEngine.ts +276 -0
- package/src/PresenceManager.ts +169 -240
- package/src/Protocol.ts +350 -0
- package/src/Types.ts +231 -0
- package/src/index.ts +57 -23
- package/src/testing/ColdStorageTestSuite.ts +589 -0
- package/src/testing/FailingStorage.ts +286 -0
- package/src/testing/HotStorageTestSuite.ts +762 -0
- package/src/testing/StorageIntegrationTestSuite.ts +504 -0
- package/src/testing/assertions.ts +181 -0
- package/src/testing/index.ts +83 -0
- package/src/testing/types.ts +100 -0
- package/tests/ColdStorage.test.ts +24 -0
- package/tests/DocumentManager.test.ts +158 -287
- package/tests/HotStorage.test.ts +24 -0
- package/tests/MimicAuthService.test.ts +102 -134
- package/tests/MimicClusterServerEngine.test.ts +587 -0
- package/tests/MimicServer.test.ts +90 -226
- package/tests/MimicServerEngine.test.ts +521 -0
- package/tests/PresenceManager.test.ts +22 -63
- package/tests/Protocol.test.ts +190 -0
- package/tests/StorageIntegration.test.ts +259 -0
- package/tsconfig.json +1 -1
- package/tsdown.config.ts +1 -1
- package/dist/DocumentProtocol.cjs +0 -94
- package/dist/DocumentProtocol.d.cts +0 -113
- package/dist/DocumentProtocol.d.cts.map +0 -1
- package/dist/DocumentProtocol.d.mts +0 -113
- package/dist/DocumentProtocol.d.mts.map +0 -1
- package/dist/DocumentProtocol.mjs +0 -89
- package/dist/DocumentProtocol.mjs.map +0 -1
- package/dist/MimicConfig.cjs +0 -60
- package/dist/MimicConfig.d.cts +0 -141
- package/dist/MimicConfig.d.cts.map +0 -1
- package/dist/MimicConfig.d.mts +0 -141
- package/dist/MimicConfig.d.mts.map +0 -1
- package/dist/MimicConfig.mjs +0 -50
- package/dist/MimicConfig.mjs.map +0 -1
- package/dist/MimicDataStorage.cjs +0 -83
- package/dist/MimicDataStorage.d.cts +0 -113
- package/dist/MimicDataStorage.d.cts.map +0 -1
- package/dist/MimicDataStorage.d.mts +0 -113
- package/dist/MimicDataStorage.d.mts.map +0 -1
- package/dist/MimicDataStorage.mjs +0 -74
- package/dist/MimicDataStorage.mjs.map +0 -1
- package/dist/WebSocketHandler.cjs +0 -365
- package/dist/WebSocketHandler.d.cts +0 -34
- package/dist/WebSocketHandler.d.cts.map +0 -1
- package/dist/WebSocketHandler.d.mts +0 -34
- package/dist/WebSocketHandler.d.mts.map +0 -1
- package/dist/WebSocketHandler.mjs +0 -355
- package/dist/WebSocketHandler.mjs.map +0 -1
- package/dist/auth/NoAuth.cjs +0 -43
- package/dist/auth/NoAuth.d.cts +0 -22
- package/dist/auth/NoAuth.d.cts.map +0 -1
- package/dist/auth/NoAuth.d.mts +0 -22
- package/dist/auth/NoAuth.d.mts.map +0 -1
- package/dist/auth/NoAuth.mjs +0 -36
- package/dist/auth/NoAuth.mjs.map +0 -1
- package/dist/errors.cjs +0 -74
- package/dist/errors.d.cts +0 -89
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.mts +0 -89
- package/dist/errors.d.mts.map +0 -1
- package/dist/errors.mjs +0 -67
- package/dist/errors.mjs.map +0 -1
- package/dist/storage/InMemoryDataStorage.cjs +0 -57
- package/dist/storage/InMemoryDataStorage.d.cts +0 -19
- package/dist/storage/InMemoryDataStorage.d.cts.map +0 -1
- package/dist/storage/InMemoryDataStorage.d.mts +0 -19
- package/dist/storage/InMemoryDataStorage.d.mts.map +0 -1
- package/dist/storage/InMemoryDataStorage.mjs +0 -48
- package/dist/storage/InMemoryDataStorage.mjs.map +0 -1
- package/src/DocumentProtocol.ts +0 -112
- package/src/MimicConfig.ts +0 -211
- package/src/MimicDataStorage.ts +0 -157
- package/src/WebSocketHandler.ts +0 -735
- package/src/auth/NoAuth.ts +0 -46
- package/src/errors.ts +0 -113
- package/src/storage/InMemoryDataStorage.ts +0 -66
- package/tests/DocumentProtocol.test.ts +0 -113
- package/tests/InMemoryDataStorage.test.ts +0 -190
- package/tests/MimicConfig.test.ts +0 -290
- package/tests/MimicDataStorage.test.ts +0 -190
- package/tests/NoAuth.test.ts +0 -94
- package/tests/WebSocketHandler.test.ts +0 -321
- package/tests/errors.test.ts +0 -77
package/dist/MimicServer.cjs
CHANGED
|
@@ -1,125 +1,234 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
const require_Errors = require('./Errors.cjs');
|
|
2
|
+
const require_Metrics = require('./Metrics.cjs');
|
|
3
|
+
const require_MimicServerEngine = require('./MimicServerEngine.cjs');
|
|
4
|
+
const require_Protocol = require('./Protocol.cjs');
|
|
4
5
|
const require_MimicAuthService = require('./MimicAuthService.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const require_InMemoryDataStorage = require('./storage/InMemoryDataStorage.cjs');
|
|
8
|
-
const require_NoAuth = require('./auth/NoAuth.cjs');
|
|
9
|
-
let effect_Effect = require("effect/Effect");
|
|
10
|
-
effect_Effect = require_rolldown_runtime.__toESM(effect_Effect);
|
|
11
|
-
let effect_Layer = require("effect/Layer");
|
|
12
|
-
effect_Layer = require_rolldown_runtime.__toESM(effect_Layer);
|
|
6
|
+
let effect = require("effect");
|
|
7
|
+
let _voidhash_mimic = require("@voidhash/mimic");
|
|
13
8
|
let _effect_platform = require("@effect/platform");
|
|
14
9
|
|
|
15
10
|
//#region src/MimicServer.ts
|
|
16
11
|
/**
|
|
17
|
-
* @
|
|
18
|
-
*
|
|
12
|
+
* @voidhash/mimic-effect - MimicServer
|
|
13
|
+
*
|
|
14
|
+
* WebSocket route layer for MimicServerEngine.
|
|
15
|
+
* Creates routes compatible with HttpLayerRouter.
|
|
19
16
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
const DEFAULT_PATH = "/mimic";
|
|
18
|
+
const DEFAULT_HEARTBEAT_INTERVAL = effect.Duration.seconds(30);
|
|
19
|
+
const DEFAULT_HEARTBEAT_TIMEOUT = effect.Duration.seconds(10);
|
|
20
|
+
/**
|
|
21
|
+
* Resolve route configuration with defaults
|
|
22
|
+
*/
|
|
23
|
+
const resolveRouteConfig = (config) => {
|
|
24
|
+
var _config$path;
|
|
25
|
+
return {
|
|
26
|
+
path: (_config$path = config === null || config === void 0 ? void 0 : config.path) !== null && _config$path !== void 0 ? _config$path : DEFAULT_PATH,
|
|
27
|
+
heartbeatInterval: (config === null || config === void 0 ? void 0 : config.heartbeatInterval) ? effect.Duration.decode(config.heartbeatInterval) : DEFAULT_HEARTBEAT_INTERVAL,
|
|
28
|
+
heartbeatTimeout: (config === null || config === void 0 ? void 0 : config.heartbeatTimeout) ? effect.Duration.decode(config.heartbeatTimeout) : DEFAULT_HEARTBEAT_TIMEOUT
|
|
29
|
+
};
|
|
30
|
+
};
|
|
24
31
|
/**
|
|
25
|
-
*
|
|
32
|
+
* Extract document ID from URL path.
|
|
33
|
+
* Expected format: /basePath/doc/{documentId}
|
|
26
34
|
*/
|
|
27
|
-
const
|
|
35
|
+
const extractDocumentId = (path) => {
|
|
36
|
+
const parts = path.replace(/^\/+/, "").split("/");
|
|
37
|
+
const docIndex = parts.lastIndexOf("doc");
|
|
38
|
+
const part = parts[docIndex + 1];
|
|
39
|
+
if (docIndex !== -1 && part) return effect.Effect.succeed(decodeURIComponent(part));
|
|
40
|
+
return effect.Effect.fail(new require_Errors.MissingDocumentIdError({ path }));
|
|
41
|
+
};
|
|
28
42
|
/**
|
|
29
|
-
*
|
|
30
|
-
* This handler:
|
|
31
|
-
* 1. Extracts the document ID from the URL path
|
|
32
|
-
* 2. Upgrades the HTTP connection to WebSocket
|
|
33
|
-
* 3. Delegates to the WebSocketHandler for document sync
|
|
43
|
+
* Handle a WebSocket connection for a document.
|
|
34
44
|
*/
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
const handleWebSocketConnection = (socket, documentId, engine, authService, _routeConfig) => effect.Effect.gen(function* () {
|
|
46
|
+
const connectionId = crypto.randomUUID();
|
|
47
|
+
const connectionStartTime = Date.now();
|
|
48
|
+
yield* effect.Metric.increment(require_Metrics.connectionsTotal);
|
|
49
|
+
yield* effect.Metric.incrementBy(require_Metrics.connectionsActive, 1);
|
|
50
|
+
const state = {
|
|
51
|
+
documentId,
|
|
52
|
+
connectionId,
|
|
53
|
+
authenticated: false,
|
|
54
|
+
hasPresence: false
|
|
55
|
+
};
|
|
56
|
+
const write = yield* socket.writer;
|
|
57
|
+
const sendMessage = (message) => write(require_Protocol.encodeServerMessage(message));
|
|
58
|
+
const sendPresenceSnapshot = effect.Effect.gen(function* () {
|
|
59
|
+
if (!engine.config.presence) return;
|
|
60
|
+
const snapshot = yield* engine.getPresenceSnapshot(documentId);
|
|
61
|
+
yield* sendMessage(require_Protocol.presenceSnapshotMessage(connectionId, snapshot.presences));
|
|
62
|
+
});
|
|
63
|
+
const sendDocumentSnapshot = effect.Effect.gen(function* () {
|
|
64
|
+
const snapshot = yield* engine.getSnapshot(documentId);
|
|
65
|
+
yield* sendMessage(require_Protocol.snapshotMessage(snapshot.state, snapshot.version));
|
|
66
|
+
});
|
|
67
|
+
const handleAuth = (token) => effect.Effect.gen(function* () {
|
|
68
|
+
const result = yield* effect.Effect.either(authService.authenticate(token, documentId));
|
|
69
|
+
if (result._tag === "Right") {
|
|
70
|
+
state.authenticated = true;
|
|
71
|
+
state.authContext = result.right;
|
|
72
|
+
yield* sendMessage(require_Protocol.authResultSuccess(result.right.userId, result.right.permission));
|
|
73
|
+
yield* sendDocumentSnapshot;
|
|
74
|
+
yield* sendPresenceSnapshot;
|
|
75
|
+
} else {
|
|
76
|
+
var _result$left$reason;
|
|
77
|
+
yield* effect.Metric.increment(require_Metrics.connectionsErrors);
|
|
78
|
+
yield* sendMessage(require_Protocol.authResultFailure((_result$left$reason = result.left.reason) !== null && _result$left$reason !== void 0 ? _result$left$reason : "Authentication failed"));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const handlePresenceSet = (data) => effect.Effect.gen(function* () {
|
|
82
|
+
if (!state.authenticated) return;
|
|
83
|
+
if (!state.authContext) return;
|
|
84
|
+
if (!engine.config.presence) return;
|
|
85
|
+
if (state.authContext.permission !== "write") {
|
|
86
|
+
yield* effect.Effect.logWarning("Presence set rejected - read-only user", { connectionId });
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const validated = _voidhash_mimic.Presence.validateSafe(engine.config.presence, data);
|
|
90
|
+
if (validated === void 0) {
|
|
91
|
+
yield* effect.Effect.logWarning("Invalid presence data received", {
|
|
92
|
+
connectionId,
|
|
93
|
+
data
|
|
94
|
+
});
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
yield* engine.setPresence(documentId, connectionId, {
|
|
98
|
+
data: validated,
|
|
99
|
+
userId: state.authContext.userId
|
|
100
|
+
});
|
|
101
|
+
state.hasPresence = true;
|
|
102
|
+
});
|
|
103
|
+
const handlePresenceClear = effect.Effect.gen(function* () {
|
|
104
|
+
if (!state.authenticated) return;
|
|
105
|
+
if (!engine.config.presence) return;
|
|
106
|
+
yield* engine.removePresence(documentId, connectionId);
|
|
107
|
+
state.hasPresence = false;
|
|
108
|
+
});
|
|
109
|
+
const handleMessage = (message) => effect.Effect.gen(function* () {
|
|
110
|
+
yield* engine.touch(documentId);
|
|
111
|
+
switch (message.type) {
|
|
112
|
+
case "auth":
|
|
113
|
+
yield* handleAuth(message.token);
|
|
114
|
+
break;
|
|
115
|
+
case "ping":
|
|
116
|
+
yield* sendMessage(require_Protocol.pong());
|
|
117
|
+
break;
|
|
118
|
+
case "submit":
|
|
119
|
+
var _state$authContext;
|
|
120
|
+
if (!state.authenticated) {
|
|
121
|
+
yield* sendMessage(require_Protocol.errorMessage(message.transaction.id, "Not authenticated"));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (((_state$authContext = state.authContext) === null || _state$authContext === void 0 ? void 0 : _state$authContext.permission) !== "write") {
|
|
125
|
+
yield* sendMessage(require_Protocol.errorMessage(message.transaction.id, "Write permission required"));
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const submitResult = yield* engine.submit(documentId, message.transaction);
|
|
129
|
+
if (!submitResult.success) yield* sendMessage(require_Protocol.errorMessage(message.transaction.id, submitResult.reason));
|
|
130
|
+
break;
|
|
131
|
+
case "request_snapshot":
|
|
132
|
+
if (!state.authenticated) return;
|
|
133
|
+
const snapshot = yield* engine.getSnapshot(documentId);
|
|
134
|
+
yield* sendMessage(require_Protocol.snapshotMessage(snapshot.state, snapshot.version));
|
|
135
|
+
break;
|
|
136
|
+
case "presence_set":
|
|
137
|
+
yield* handlePresenceSet(message.data);
|
|
138
|
+
break;
|
|
139
|
+
case "presence_clear":
|
|
140
|
+
yield* handlePresenceClear;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
const subscribeFiber = yield* effect.Effect.fork(effect.Effect.gen(function* () {
|
|
145
|
+
while (!state.authenticated) yield* effect.Effect.sleep(effect.Duration.millis(100));
|
|
146
|
+
const broadcastStream = yield* engine.subscribe(documentId);
|
|
147
|
+
yield* effect.Stream.runForEach(broadcastStream, (broadcast) => sendMessage(broadcast));
|
|
148
|
+
}).pipe(effect.Effect.scoped));
|
|
149
|
+
const presenceFiber = yield* effect.Effect.fork(effect.Effect.gen(function* () {
|
|
150
|
+
if (!engine.config.presence) return;
|
|
151
|
+
while (!state.authenticated) yield* effect.Effect.sleep(effect.Duration.millis(100));
|
|
152
|
+
const presenceStream = yield* engine.subscribePresence(documentId);
|
|
153
|
+
yield* effect.Stream.runForEach(presenceStream, (event) => effect.Effect.gen(function* () {
|
|
154
|
+
if (event.id === connectionId) return;
|
|
155
|
+
if (event.type === "presence_update") yield* sendMessage(require_Protocol.presenceUpdateMessage(event.id, event.data, event.userId));
|
|
156
|
+
else if (event.type === "presence_remove") yield* sendMessage(require_Protocol.presenceRemoveMessage(event.id));
|
|
157
|
+
}));
|
|
158
|
+
}).pipe(effect.Effect.scoped));
|
|
159
|
+
yield* effect.Effect.addFinalizer(() => effect.Effect.gen(function* () {
|
|
160
|
+
const duration = Date.now() - connectionStartTime;
|
|
161
|
+
yield* effect.Fiber.interrupt(subscribeFiber);
|
|
162
|
+
yield* effect.Fiber.interrupt(presenceFiber);
|
|
163
|
+
if (state.hasPresence && engine.config.presence) yield* engine.removePresence(documentId, connectionId);
|
|
164
|
+
yield* effect.Metric.incrementBy(require_Metrics.connectionsActive, -1);
|
|
165
|
+
yield* effect.Metric.update(require_Metrics.connectionsDuration, duration);
|
|
166
|
+
yield* effect.Effect.logDebug("WebSocket connection closed", {
|
|
167
|
+
connectionId,
|
|
168
|
+
documentId,
|
|
169
|
+
durationMs: duration
|
|
170
|
+
});
|
|
171
|
+
}));
|
|
172
|
+
yield* socket.runRaw((data) => effect.Effect.gen(function* () {
|
|
173
|
+
yield* handleMessage(yield* require_Protocol.parseClientMessage(data));
|
|
174
|
+
}).pipe(effect.Effect.catchAll((error) => effect.Effect.logError("Message handling error", error))));
|
|
50
175
|
});
|
|
51
176
|
/**
|
|
52
|
-
* Create a
|
|
177
|
+
* Create a route layer for MimicServerEngine.
|
|
53
178
|
*
|
|
54
|
-
* This
|
|
55
|
-
*
|
|
56
|
-
* 2. Handles WebSocket upgrades for document sync
|
|
57
|
-
* 3. Provides all required dependencies (config, auth, storage, document manager)
|
|
58
|
-
*
|
|
59
|
-
* By default, uses in-memory storage and no authentication.
|
|
60
|
-
* To override these defaults, provide custom layers before the defaults:
|
|
179
|
+
* This creates a WebSocket route that connects to the engine.
|
|
180
|
+
* Use Layer.mergeAll to compose with other routes.
|
|
61
181
|
*
|
|
62
182
|
* @example
|
|
63
183
|
* ```typescript
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* title: Primitive.String(),
|
|
70
|
-
* completed: Primitive.Boolean(),
|
|
71
|
-
* });
|
|
184
|
+
* // 1. Create the engine
|
|
185
|
+
* const Engine = MimicServerEngine.make({
|
|
186
|
+
* schema: DocSchema,
|
|
187
|
+
* initial: { title: "Untitled" },
|
|
188
|
+
* })
|
|
72
189
|
*
|
|
73
|
-
* // Create the
|
|
190
|
+
* // 2. Create the WebSocket route
|
|
74
191
|
* const MimicRoute = MimicServer.layerHttpLayerRouter({
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
192
|
+
* path: "/mimic",
|
|
193
|
+
* })
|
|
194
|
+
*
|
|
195
|
+
* // 3. Wire together
|
|
196
|
+
* const MimicLive = MimicRoute.pipe(
|
|
197
|
+
* Layer.provide(Engine),
|
|
198
|
+
* Layer.provide(ColdStorage.InMemory.make()),
|
|
199
|
+
* Layer.provide(HotStorage.InMemory.make()),
|
|
200
|
+
* Layer.provide(MimicAuthService.NoAuth.make()),
|
|
201
|
+
* )
|
|
78
202
|
*
|
|
79
|
-
* //
|
|
80
|
-
* const
|
|
81
|
-
* basePath: "/mimic/todo",
|
|
82
|
-
* schema: TodoSchema,
|
|
83
|
-
* authLayer: MimicAuthService.layer({
|
|
84
|
-
* authHandler: (token) => ({ success: true, userId: token })
|
|
85
|
-
* })
|
|
86
|
-
* });
|
|
203
|
+
* // 4. Compose with other routes
|
|
204
|
+
* const AllRoutes = Layer.mergeAll(MimicLive, DocsRoute, OtherRoutes)
|
|
87
205
|
*
|
|
88
|
-
* //
|
|
89
|
-
* const AllRoutes = Layer.mergeAll(MimicRoute, OtherRoutes);
|
|
206
|
+
* // 5. Serve
|
|
90
207
|
* HttpLayerRouter.serve(AllRoutes).pipe(
|
|
91
|
-
* Layer.provide(
|
|
208
|
+
* Layer.provide(NodeHttpServer.layer(createServer, { port: 3000 })),
|
|
92
209
|
* Layer.launch,
|
|
93
|
-
*
|
|
94
|
-
* )
|
|
210
|
+
* NodeRuntime.runMain
|
|
211
|
+
* )
|
|
95
212
|
* ```
|
|
96
213
|
*/
|
|
97
|
-
const layerHttpLayerRouter = (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
214
|
+
const layerHttpLayerRouter = (options) => {
|
|
215
|
+
const routeConfig = resolveRouteConfig(options);
|
|
216
|
+
const routePath = `${routeConfig.path}/doc/:documentId`;
|
|
217
|
+
return effect.Layer.scopedDiscard(effect.Effect.gen(function* () {
|
|
218
|
+
const router = yield* _effect_platform.HttpLayerRouter.HttpRouter;
|
|
219
|
+
const engine = yield* require_MimicServerEngine.MimicServerEngineTag;
|
|
220
|
+
const authService = yield* require_MimicAuthService.MimicAuthServiceTag;
|
|
221
|
+
const handler = (request) => effect.Effect.gen(function* () {
|
|
222
|
+
const documentIdResult = yield* effect.Effect.either(extractDocumentId(request.url));
|
|
223
|
+
if (documentIdResult._tag === "Left") return _effect_platform.HttpServerResponse.text(`Missing document ID in path: ${request.url}`, { status: 400 });
|
|
224
|
+
const documentId = documentIdResult.right;
|
|
225
|
+
yield* handleWebSocketConnection(yield* request.upgrade, documentId, engine, authService, routeConfig).pipe(effect.Effect.scoped, effect.Effect.catchAll((error) => effect.Effect.logError("WebSocket connection error", error)));
|
|
226
|
+
return _effect_platform.HttpServerResponse.empty();
|
|
107
227
|
});
|
|
108
|
-
|
|
109
|
-
const storageLayer = (_options$storageLayer = options.storageLayer) !== null && _options$storageLayer !== void 0 ? _options$storageLayer : require_InMemoryDataStorage.layerDefault;
|
|
110
|
-
const depsLayer = effect_Layer.mergeAll(configLayer, authLayer, storageLayer);
|
|
111
|
-
return effect_Layer.scopedDiscard(effect_Effect.gen(function* () {
|
|
112
|
-
const router = yield* _effect_platform.HttpLayerRouter.HttpRouter;
|
|
113
|
-
const handler = yield* makeMimicHandler;
|
|
114
|
-
yield* router.add("GET", wsPath, handler);
|
|
115
|
-
})).pipe(effect_Layer.provide(require_DocumentManager.layer), effect_Layer.provide(require_PresenceManager.layer), effect_Layer.provide(depsLayer));
|
|
228
|
+
yield* router.add("GET", routePath, handler);
|
|
116
229
|
}));
|
|
117
230
|
};
|
|
231
|
+
const MimicServer = { layerHttpLayerRouter };
|
|
118
232
|
|
|
119
233
|
//#endregion
|
|
120
|
-
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () {
|
|
123
|
-
return MimicServer_exports;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
234
|
+
exports.MimicServer = MimicServer;
|
package/dist/MimicServer.d.cts
CHANGED
|
@@ -1,116 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MimicDataStorageTag } from "./MimicDataStorage.cjs";
|
|
3
|
-
import { DocumentManagerTag } from "./DocumentManager.cjs";
|
|
1
|
+
import { MimicServerRouteConfig } from "./Types.cjs";
|
|
4
2
|
import { MimicAuthServiceTag } from "./MimicAuthService.cjs";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
3
|
+
import { MimicServerEngineTag } from "./MimicServerEngine.cjs";
|
|
4
|
+
import { Layer } from "effect";
|
|
5
|
+
import * as _effect_platform_HttpServerError0 from "@effect/platform/HttpServerError";
|
|
8
6
|
import { HttpLayerRouter } from "@effect/platform";
|
|
9
|
-
import { PathInput } from "@effect/platform/HttpRouter";
|
|
10
7
|
|
|
11
8
|
//#region src/MimicServer.d.ts
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* Options for creating a Mimic server layer.
|
|
17
|
-
*/
|
|
18
|
-
interface MimicLayerOptions<TSchema extends Primitive.AnyPrimitive> {
|
|
19
|
-
/**
|
|
20
|
-
* Base path for document routes (used for path matching).
|
|
21
|
-
* @example "/mimic/todo" - documents accessed at "/mimic/todo/:documentId"
|
|
22
|
-
*/
|
|
23
|
-
readonly basePath?: PathInput;
|
|
24
|
-
/**
|
|
25
|
-
* The schema defining the document structure.
|
|
26
|
-
*/
|
|
27
|
-
readonly schema: TSchema;
|
|
28
|
-
/**
|
|
29
|
-
* Maximum number of processed transaction IDs to track for deduplication.
|
|
30
|
-
* @default 1000
|
|
31
|
-
*/
|
|
32
|
-
readonly maxTransactionHistory?: number;
|
|
33
|
-
/**
|
|
34
|
-
* Optional presence schema for ephemeral per-user data.
|
|
35
|
-
* When provided, enables presence features on WebSocket connections.
|
|
36
|
-
*/
|
|
37
|
-
readonly presence?: Presence.AnyPresence;
|
|
38
|
-
/**
|
|
39
|
-
* Initial state for new documents.
|
|
40
|
-
* Can be either:
|
|
41
|
-
* - A plain object with the initial state values
|
|
42
|
-
* - A function that receives context (with documentId) and returns an Effect producing the initial state
|
|
43
|
-
*
|
|
44
|
-
* When using a function that requires Effect services (has R requirements),
|
|
45
|
-
* you must also provide `initialLayer` to supply those dependencies.
|
|
46
|
-
*
|
|
47
|
-
* Type-safe: required fields (without defaults) must be provided,
|
|
48
|
-
* while optional fields and fields with defaults can be omitted.
|
|
49
|
-
*
|
|
50
|
-
* @default undefined (documents start empty or use schema defaults)
|
|
51
|
-
*/
|
|
52
|
-
readonly initial?: Primitive.InferSetInput<TSchema> | InitialFn<TSchema>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Create the document manager layer.
|
|
56
|
-
*/
|
|
57
|
-
declare const documentManagerLayer: <TSchema extends Primitive.AnyPrimitive>(options: MimicServerConfigOptions<TSchema>) => Layer.Layer<DocumentManagerTag>;
|
|
58
|
-
/**
|
|
59
|
-
* Options for layerHttpLayerRouter including optional custom layers.
|
|
60
|
-
*/
|
|
61
|
-
interface MimicLayerRouterOptions<TSchema extends Primitive.AnyPrimitive> extends MimicLayerOptions<TSchema> {
|
|
62
|
-
/** Custom auth layer. Defaults to NoAuth (all connections allowed). */
|
|
63
|
-
readonly authLayer?: Layer.Layer<MimicAuthServiceTag>;
|
|
64
|
-
/** Custom storage layer. Defaults to InMemoryDataStorage. */
|
|
65
|
-
readonly storageLayer?: Layer.Layer<MimicDataStorageTag>;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Create a Mimic server layer that integrates with HttpLayerRouter.
|
|
69
|
-
*
|
|
70
|
-
* This function creates a layer that:
|
|
71
|
-
* 1. Registers a WebSocket route at the specified base path
|
|
72
|
-
* 2. Handles WebSocket upgrades for document sync
|
|
73
|
-
* 3. Provides all required dependencies (config, auth, storage, document manager)
|
|
74
|
-
*
|
|
75
|
-
* By default, uses in-memory storage and no authentication.
|
|
76
|
-
* To override these defaults, provide custom layers before the defaults:
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* import { MimicServer, MimicAuthService } from "@voidhash/mimic-effect";
|
|
81
|
-
* import { HttpLayerRouter } from "@effect/platform";
|
|
82
|
-
* import { Primitive } from "@voidhash/mimic";
|
|
83
|
-
*
|
|
84
|
-
* const TodoSchema = Primitive.Struct({
|
|
85
|
-
* title: Primitive.String(),
|
|
86
|
-
* completed: Primitive.Boolean(),
|
|
87
|
-
* });
|
|
88
|
-
*
|
|
89
|
-
* // Create the Mimic route layer with defaults
|
|
90
|
-
* const MimicRoute = MimicServer.layerHttpLayerRouter({
|
|
91
|
-
* basePath: "/mimic/todo",
|
|
92
|
-
* schema: TodoSchema
|
|
93
|
-
* });
|
|
94
|
-
*
|
|
95
|
-
* // Or with custom auth - use Layer.provide to inject before defaults
|
|
96
|
-
* const MimicRouteWithAuth = MimicServer.layerHttpLayerRouter({
|
|
97
|
-
* basePath: "/mimic/todo",
|
|
98
|
-
* schema: TodoSchema,
|
|
99
|
-
* authLayer: MimicAuthService.layer({
|
|
100
|
-
* authHandler: (token) => ({ success: true, userId: token })
|
|
101
|
-
* })
|
|
102
|
-
* });
|
|
103
|
-
*
|
|
104
|
-
* // Merge with other routes and serve
|
|
105
|
-
* const AllRoutes = Layer.mergeAll(MimicRoute, OtherRoutes);
|
|
106
|
-
* HttpLayerRouter.serve(AllRoutes).pipe(
|
|
107
|
-
* Layer.provide(BunHttpServer.layer({ port: 3000 })),
|
|
108
|
-
* Layer.launch,
|
|
109
|
-
* BunRuntime.runMain
|
|
110
|
-
* );
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
declare const layerHttpLayerRouter: <TSchema extends Primitive.AnyPrimitive, TError, TRequirements>(optionsEf: Effect.Effect<MimicLayerRouterOptions<TSchema>, TError, TRequirements>) => Layer.Layer<never, TError, TRequirements | HttpLayerRouter.HttpRouter>;
|
|
9
|
+
|
|
10
|
+
declare const MimicServer: {
|
|
11
|
+
layerHttpLayerRouter: (options?: MimicServerRouteConfig) => Layer.Layer<never, never, HttpLayerRouter.HttpRouter | MimicServerEngineTag | MimicAuthServiceTag | HttpLayerRouter.Request<"Error", _effect_platform_HttpServerError0.RequestError>>;
|
|
12
|
+
};
|
|
114
13
|
//#endregion
|
|
115
|
-
export {
|
|
14
|
+
export { MimicServer };
|
|
116
15
|
//# sourceMappingURL=MimicServer.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MimicServer.d.cts","names":[],"sources":["../src/MimicServer.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MimicServer.d.cts","names":[],"sources":["../src/MimicServer.ts"],"sourcesContent":[],"mappings":";;;;;;;;;cAmea;mCA7DD,2BAAsB,KAAA,CAAA,oBAAA,eAAA,CAAA,aAAA,uBAAA,sBAAA,eAAA,CAAA,iBAAA,iCAAA,CAAA,YAAA"}
|
package/dist/MimicServer.d.mts
CHANGED
|
@@ -1,116 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MimicDataStorageTag } from "./MimicDataStorage.mjs";
|
|
3
|
-
import { DocumentManagerTag } from "./DocumentManager.mjs";
|
|
1
|
+
import { MimicServerRouteConfig } from "./Types.mjs";
|
|
4
2
|
import { MimicAuthServiceTag } from "./MimicAuthService.mjs";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { Presence, Primitive } from "@voidhash/mimic";
|
|
3
|
+
import { MimicServerEngineTag } from "./MimicServerEngine.mjs";
|
|
4
|
+
import { Layer } from "effect";
|
|
8
5
|
import { HttpLayerRouter } from "@effect/platform";
|
|
9
|
-
import
|
|
6
|
+
import * as _effect_platform_HttpServerError0 from "@effect/platform/HttpServerError";
|
|
10
7
|
|
|
11
8
|
//#region src/MimicServer.d.ts
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* Options for creating a Mimic server layer.
|
|
17
|
-
*/
|
|
18
|
-
interface MimicLayerOptions<TSchema extends Primitive.AnyPrimitive> {
|
|
19
|
-
/**
|
|
20
|
-
* Base path for document routes (used for path matching).
|
|
21
|
-
* @example "/mimic/todo" - documents accessed at "/mimic/todo/:documentId"
|
|
22
|
-
*/
|
|
23
|
-
readonly basePath?: PathInput;
|
|
24
|
-
/**
|
|
25
|
-
* The schema defining the document structure.
|
|
26
|
-
*/
|
|
27
|
-
readonly schema: TSchema;
|
|
28
|
-
/**
|
|
29
|
-
* Maximum number of processed transaction IDs to track for deduplication.
|
|
30
|
-
* @default 1000
|
|
31
|
-
*/
|
|
32
|
-
readonly maxTransactionHistory?: number;
|
|
33
|
-
/**
|
|
34
|
-
* Optional presence schema for ephemeral per-user data.
|
|
35
|
-
* When provided, enables presence features on WebSocket connections.
|
|
36
|
-
*/
|
|
37
|
-
readonly presence?: Presence.AnyPresence;
|
|
38
|
-
/**
|
|
39
|
-
* Initial state for new documents.
|
|
40
|
-
* Can be either:
|
|
41
|
-
* - A plain object with the initial state values
|
|
42
|
-
* - A function that receives context (with documentId) and returns an Effect producing the initial state
|
|
43
|
-
*
|
|
44
|
-
* When using a function that requires Effect services (has R requirements),
|
|
45
|
-
* you must also provide `initialLayer` to supply those dependencies.
|
|
46
|
-
*
|
|
47
|
-
* Type-safe: required fields (without defaults) must be provided,
|
|
48
|
-
* while optional fields and fields with defaults can be omitted.
|
|
49
|
-
*
|
|
50
|
-
* @default undefined (documents start empty or use schema defaults)
|
|
51
|
-
*/
|
|
52
|
-
readonly initial?: Primitive.InferSetInput<TSchema> | InitialFn<TSchema>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Create the document manager layer.
|
|
56
|
-
*/
|
|
57
|
-
declare const documentManagerLayer: <TSchema extends Primitive.AnyPrimitive>(options: MimicServerConfigOptions<TSchema>) => Layer.Layer<DocumentManagerTag>;
|
|
58
|
-
/**
|
|
59
|
-
* Options for layerHttpLayerRouter including optional custom layers.
|
|
60
|
-
*/
|
|
61
|
-
interface MimicLayerRouterOptions<TSchema extends Primitive.AnyPrimitive> extends MimicLayerOptions<TSchema> {
|
|
62
|
-
/** Custom auth layer. Defaults to NoAuth (all connections allowed). */
|
|
63
|
-
readonly authLayer?: Layer.Layer<MimicAuthServiceTag>;
|
|
64
|
-
/** Custom storage layer. Defaults to InMemoryDataStorage. */
|
|
65
|
-
readonly storageLayer?: Layer.Layer<MimicDataStorageTag>;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Create a Mimic server layer that integrates with HttpLayerRouter.
|
|
69
|
-
*
|
|
70
|
-
* This function creates a layer that:
|
|
71
|
-
* 1. Registers a WebSocket route at the specified base path
|
|
72
|
-
* 2. Handles WebSocket upgrades for document sync
|
|
73
|
-
* 3. Provides all required dependencies (config, auth, storage, document manager)
|
|
74
|
-
*
|
|
75
|
-
* By default, uses in-memory storage and no authentication.
|
|
76
|
-
* To override these defaults, provide custom layers before the defaults:
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* import { MimicServer, MimicAuthService } from "@voidhash/mimic-effect";
|
|
81
|
-
* import { HttpLayerRouter } from "@effect/platform";
|
|
82
|
-
* import { Primitive } from "@voidhash/mimic";
|
|
83
|
-
*
|
|
84
|
-
* const TodoSchema = Primitive.Struct({
|
|
85
|
-
* title: Primitive.String(),
|
|
86
|
-
* completed: Primitive.Boolean(),
|
|
87
|
-
* });
|
|
88
|
-
*
|
|
89
|
-
* // Create the Mimic route layer with defaults
|
|
90
|
-
* const MimicRoute = MimicServer.layerHttpLayerRouter({
|
|
91
|
-
* basePath: "/mimic/todo",
|
|
92
|
-
* schema: TodoSchema
|
|
93
|
-
* });
|
|
94
|
-
*
|
|
95
|
-
* // Or with custom auth - use Layer.provide to inject before defaults
|
|
96
|
-
* const MimicRouteWithAuth = MimicServer.layerHttpLayerRouter({
|
|
97
|
-
* basePath: "/mimic/todo",
|
|
98
|
-
* schema: TodoSchema,
|
|
99
|
-
* authLayer: MimicAuthService.layer({
|
|
100
|
-
* authHandler: (token) => ({ success: true, userId: token })
|
|
101
|
-
* })
|
|
102
|
-
* });
|
|
103
|
-
*
|
|
104
|
-
* // Merge with other routes and serve
|
|
105
|
-
* const AllRoutes = Layer.mergeAll(MimicRoute, OtherRoutes);
|
|
106
|
-
* HttpLayerRouter.serve(AllRoutes).pipe(
|
|
107
|
-
* Layer.provide(BunHttpServer.layer({ port: 3000 })),
|
|
108
|
-
* Layer.launch,
|
|
109
|
-
* BunRuntime.runMain
|
|
110
|
-
* );
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
declare const layerHttpLayerRouter: <TSchema extends Primitive.AnyPrimitive, TError, TRequirements>(optionsEf: Effect.Effect<MimicLayerRouterOptions<TSchema>, TError, TRequirements>) => Layer.Layer<never, TError, TRequirements | HttpLayerRouter.HttpRouter>;
|
|
9
|
+
|
|
10
|
+
declare const MimicServer: {
|
|
11
|
+
layerHttpLayerRouter: (options?: MimicServerRouteConfig) => Layer.Layer<never, never, HttpLayerRouter.HttpRouter | MimicServerEngineTag | MimicAuthServiceTag | HttpLayerRouter.Request<"Error", _effect_platform_HttpServerError0.RequestError>>;
|
|
12
|
+
};
|
|
114
13
|
//#endregion
|
|
115
|
-
export {
|
|
14
|
+
export { MimicServer };
|
|
116
15
|
//# sourceMappingURL=MimicServer.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MimicServer.d.mts","names":[],"sources":["../src/MimicServer.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MimicServer.d.mts","names":[],"sources":["../src/MimicServer.ts"],"sourcesContent":[],"mappings":";;;;;;;;;cAmea;mCA7DD,2BAAsB,KAAA,CAAA,oBAAA,eAAA,CAAA,aAAA,uBAAA,sBAAA,eAAA,CAAA,iBAAA,iCAAA,CAAA,YAAA"}
|