@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
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let effect_Schema = require("effect/Schema");
|
|
3
|
-
effect_Schema = require_rolldown_runtime.__toESM(effect_Schema);
|
|
4
|
-
|
|
5
|
-
//#region src/DocumentProtocol.ts
|
|
6
|
-
/**
|
|
7
|
-
* @since 0.0.1
|
|
8
|
-
* Protocol and schema definitions for document communication.
|
|
9
|
-
*/
|
|
10
|
-
var DocumentProtocol_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
11
|
-
AuthResultMessageSchema: () => AuthResultMessageSchema,
|
|
12
|
-
ErrorMessageSchema: () => ErrorMessageSchema,
|
|
13
|
-
OperationSchema: () => OperationSchema,
|
|
14
|
-
PongMessageSchema: () => PongMessageSchema,
|
|
15
|
-
ServerBroadcastSchema: () => ServerBroadcastSchema,
|
|
16
|
-
SnapshotMessageSchema: () => SnapshotMessageSchema,
|
|
17
|
-
SubmitResultSchema: () => SubmitResultSchema,
|
|
18
|
-
TransactionMessageSchema: () => TransactionMessageSchema,
|
|
19
|
-
TransactionSchema: () => TransactionSchema
|
|
20
|
-
});
|
|
21
|
-
/**
|
|
22
|
-
* Schema for a transaction operation.
|
|
23
|
-
*/
|
|
24
|
-
const OperationSchema = effect_Schema.Struct({
|
|
25
|
-
kind: effect_Schema.String,
|
|
26
|
-
path: effect_Schema.Unknown,
|
|
27
|
-
payload: effect_Schema.Unknown
|
|
28
|
-
});
|
|
29
|
-
/**
|
|
30
|
-
* Schema for a transaction.
|
|
31
|
-
*/
|
|
32
|
-
const TransactionSchema = effect_Schema.Struct({
|
|
33
|
-
id: effect_Schema.String,
|
|
34
|
-
ops: effect_Schema.Array(OperationSchema),
|
|
35
|
-
timestamp: effect_Schema.Number
|
|
36
|
-
});
|
|
37
|
-
/**
|
|
38
|
-
* Schema for a server message that broadcasts a committed transaction.
|
|
39
|
-
*/
|
|
40
|
-
const TransactionMessageSchema = effect_Schema.Struct({
|
|
41
|
-
type: effect_Schema.Literal("transaction"),
|
|
42
|
-
transaction: TransactionSchema,
|
|
43
|
-
version: effect_Schema.Number
|
|
44
|
-
});
|
|
45
|
-
/**
|
|
46
|
-
* Schema for a server message containing a snapshot.
|
|
47
|
-
*/
|
|
48
|
-
const SnapshotMessageSchema = effect_Schema.Struct({
|
|
49
|
-
type: effect_Schema.Literal("snapshot"),
|
|
50
|
-
state: effect_Schema.Unknown,
|
|
51
|
-
version: effect_Schema.Number
|
|
52
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
* Schema for a server error message.
|
|
55
|
-
*/
|
|
56
|
-
const ErrorMessageSchema = effect_Schema.Struct({
|
|
57
|
-
type: effect_Schema.Literal("error"),
|
|
58
|
-
transactionId: effect_Schema.String,
|
|
59
|
-
reason: effect_Schema.String
|
|
60
|
-
});
|
|
61
|
-
/**
|
|
62
|
-
* Schema for a pong message.
|
|
63
|
-
*/
|
|
64
|
-
const PongMessageSchema = effect_Schema.Struct({ type: effect_Schema.Literal("pong") });
|
|
65
|
-
/**
|
|
66
|
-
* Schema for authentication result message.
|
|
67
|
-
*/
|
|
68
|
-
const AuthResultMessageSchema = effect_Schema.Struct({
|
|
69
|
-
type: effect_Schema.Literal("auth_result"),
|
|
70
|
-
success: effect_Schema.Boolean,
|
|
71
|
-
error: effect_Schema.optional(effect_Schema.String)
|
|
72
|
-
});
|
|
73
|
-
/**
|
|
74
|
-
* Union of all server broadcast messages.
|
|
75
|
-
*/
|
|
76
|
-
const ServerBroadcastSchema = effect_Schema.Union(TransactionMessageSchema, ErrorMessageSchema);
|
|
77
|
-
/**
|
|
78
|
-
* Result of submitting a transaction.
|
|
79
|
-
*/
|
|
80
|
-
const SubmitResultSchema = effect_Schema.Union(effect_Schema.Struct({
|
|
81
|
-
success: effect_Schema.Literal(true),
|
|
82
|
-
version: effect_Schema.Number
|
|
83
|
-
}), effect_Schema.Struct({
|
|
84
|
-
success: effect_Schema.Literal(false),
|
|
85
|
-
reason: effect_Schema.String
|
|
86
|
-
}));
|
|
87
|
-
|
|
88
|
-
//#endregion
|
|
89
|
-
Object.defineProperty(exports, 'DocumentProtocol_exports', {
|
|
90
|
-
enumerable: true,
|
|
91
|
-
get: function () {
|
|
92
|
-
return DocumentProtocol_exports;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import * as Schema from "effect/Schema";
|
|
2
|
-
|
|
3
|
-
//#region src/DocumentProtocol.d.ts
|
|
4
|
-
declare namespace DocumentProtocol_d_exports {
|
|
5
|
-
export { AuthResultMessage, AuthResultMessageSchema, ErrorMessage, ErrorMessageSchema, OperationSchema, PongMessage, PongMessageSchema, ServerBroadcast, ServerBroadcastSchema, SnapshotMessage, SnapshotMessageSchema, SubmitResult, SubmitResultSchema, Transaction, TransactionMessage, TransactionMessageSchema, TransactionSchema };
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Schema for a transaction operation.
|
|
9
|
-
*/
|
|
10
|
-
declare const OperationSchema: Schema.Struct<{
|
|
11
|
-
kind: typeof Schema.String;
|
|
12
|
-
path: typeof Schema.Unknown;
|
|
13
|
-
payload: typeof Schema.Unknown;
|
|
14
|
-
}>;
|
|
15
|
-
/**
|
|
16
|
-
* Schema for a transaction.
|
|
17
|
-
*/
|
|
18
|
-
declare const TransactionSchema: Schema.Struct<{
|
|
19
|
-
id: typeof Schema.String;
|
|
20
|
-
ops: Schema.Array$<Schema.Struct<{
|
|
21
|
-
kind: typeof Schema.String;
|
|
22
|
-
path: typeof Schema.Unknown;
|
|
23
|
-
payload: typeof Schema.Unknown;
|
|
24
|
-
}>>;
|
|
25
|
-
timestamp: typeof Schema.Number;
|
|
26
|
-
}>;
|
|
27
|
-
type Transaction = Schema.Schema.Type<typeof TransactionSchema>;
|
|
28
|
-
/**
|
|
29
|
-
* Schema for a server message that broadcasts a committed transaction.
|
|
30
|
-
*/
|
|
31
|
-
declare const TransactionMessageSchema: Schema.Struct<{
|
|
32
|
-
type: Schema.Literal<["transaction"]>;
|
|
33
|
-
transaction: Schema.Struct<{
|
|
34
|
-
id: typeof Schema.String;
|
|
35
|
-
ops: Schema.Array$<Schema.Struct<{
|
|
36
|
-
kind: typeof Schema.String;
|
|
37
|
-
path: typeof Schema.Unknown;
|
|
38
|
-
payload: typeof Schema.Unknown;
|
|
39
|
-
}>>;
|
|
40
|
-
timestamp: typeof Schema.Number;
|
|
41
|
-
}>;
|
|
42
|
-
version: typeof Schema.Number;
|
|
43
|
-
}>;
|
|
44
|
-
type TransactionMessage = Schema.Schema.Type<typeof TransactionMessageSchema>;
|
|
45
|
-
/**
|
|
46
|
-
* Schema for a server message containing a snapshot.
|
|
47
|
-
*/
|
|
48
|
-
declare const SnapshotMessageSchema: Schema.Struct<{
|
|
49
|
-
type: Schema.Literal<["snapshot"]>;
|
|
50
|
-
state: typeof Schema.Unknown;
|
|
51
|
-
version: typeof Schema.Number;
|
|
52
|
-
}>;
|
|
53
|
-
type SnapshotMessage = Schema.Schema.Type<typeof SnapshotMessageSchema>;
|
|
54
|
-
/**
|
|
55
|
-
* Schema for a server error message.
|
|
56
|
-
*/
|
|
57
|
-
declare const ErrorMessageSchema: Schema.Struct<{
|
|
58
|
-
type: Schema.Literal<["error"]>;
|
|
59
|
-
transactionId: typeof Schema.String;
|
|
60
|
-
reason: typeof Schema.String;
|
|
61
|
-
}>;
|
|
62
|
-
type ErrorMessage = Schema.Schema.Type<typeof ErrorMessageSchema>;
|
|
63
|
-
/**
|
|
64
|
-
* Schema for a pong message.
|
|
65
|
-
*/
|
|
66
|
-
declare const PongMessageSchema: Schema.Struct<{
|
|
67
|
-
type: Schema.Literal<["pong"]>;
|
|
68
|
-
}>;
|
|
69
|
-
type PongMessage = Schema.Schema.Type<typeof PongMessageSchema>;
|
|
70
|
-
/**
|
|
71
|
-
* Schema for authentication result message.
|
|
72
|
-
*/
|
|
73
|
-
declare const AuthResultMessageSchema: Schema.Struct<{
|
|
74
|
-
type: Schema.Literal<["auth_result"]>;
|
|
75
|
-
success: typeof Schema.Boolean;
|
|
76
|
-
error: Schema.optional<typeof Schema.String>;
|
|
77
|
-
}>;
|
|
78
|
-
type AuthResultMessage = Schema.Schema.Type<typeof AuthResultMessageSchema>;
|
|
79
|
-
/**
|
|
80
|
-
* Union of all server broadcast messages.
|
|
81
|
-
*/
|
|
82
|
-
declare const ServerBroadcastSchema: Schema.Union<[Schema.Struct<{
|
|
83
|
-
type: Schema.Literal<["transaction"]>;
|
|
84
|
-
transaction: Schema.Struct<{
|
|
85
|
-
id: typeof Schema.String;
|
|
86
|
-
ops: Schema.Array$<Schema.Struct<{
|
|
87
|
-
kind: typeof Schema.String;
|
|
88
|
-
path: typeof Schema.Unknown;
|
|
89
|
-
payload: typeof Schema.Unknown;
|
|
90
|
-
}>>;
|
|
91
|
-
timestamp: typeof Schema.Number;
|
|
92
|
-
}>;
|
|
93
|
-
version: typeof Schema.Number;
|
|
94
|
-
}>, Schema.Struct<{
|
|
95
|
-
type: Schema.Literal<["error"]>;
|
|
96
|
-
transactionId: typeof Schema.String;
|
|
97
|
-
reason: typeof Schema.String;
|
|
98
|
-
}>]>;
|
|
99
|
-
type ServerBroadcast = Schema.Schema.Type<typeof ServerBroadcastSchema>;
|
|
100
|
-
/**
|
|
101
|
-
* Result of submitting a transaction.
|
|
102
|
-
*/
|
|
103
|
-
declare const SubmitResultSchema: Schema.Union<[Schema.Struct<{
|
|
104
|
-
success: Schema.Literal<[true]>;
|
|
105
|
-
version: typeof Schema.Number;
|
|
106
|
-
}>, Schema.Struct<{
|
|
107
|
-
success: Schema.Literal<[false]>;
|
|
108
|
-
reason: typeof Schema.String;
|
|
109
|
-
}>]>;
|
|
110
|
-
type SubmitResult = Schema.Schema.Type<typeof SubmitResultSchema>;
|
|
111
|
-
//#endregion
|
|
112
|
-
export { DocumentProtocol_d_exports, ServerBroadcast, SnapshotMessage, SubmitResult };
|
|
113
|
-
//# sourceMappingURL=DocumentProtocol.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentProtocol.d.cts","names":[],"sources":["../src/DocumentProtocol.ts"],"sourcesContent":[],"mappings":";;;;;;;;;cAaa,iBAAe,MAAA,CAAA;;;;;;;;cASf,mBAAiB,MAAA,CAAA;;;;;;;EATjB,SAAA,EAAA,oBAIX;;KAWU,WAAA,GAAc,MAAA,CAAO,MAAA,CAAO,YAAY;;;;AANvC,cAWA,wBAPX,EAOmC,MAAA,CAAA,MAPnC,CAAA;;;;;;;;IAJ4B,CAAA,CAAA,CAAA;IAAA,SAAA,EAAA,oBAAA;EAMlB,CAAA,CAAA;EAKC,OAAA,EAAA,oBAIX;;KAEU,kBAAA,GAAqB,MAAA,CAAO,MAAA,CAAO,YAAY;;;;cAK9C,uBAAqB,MAAA,CAAA;;;;;AAXG,KAiBzB,eAAA,GAAkB,MAAA,CAAO,MAAA,CAAO,IAjBP,CAAA,OAiBmB,qBAjBnB,CAAA;;AAMrC;AAKA;cAWa,oBAAkB,MAAA,CAAA;;;EAXG,MAAA,EAAA,oBAAA;CAAA,CAAA;AAMtB,KAWA,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,IAXe,CAAA,OAWH,kBAXT,CAAA;AAK5C;;;cAWa,mBAAiB,MAAA,CAAA;EAXC,IAAA,EAa7B,MAAA,CAAA,OAb6B,CAAA,CAAA,MAAA,CAAA,CAAA;CAAA,CAAA;AAMnB,KASA,WAAA,GAAc,MAAA,CAAO,MAAA,CAAO,IATa,CAAA,OASD,iBATX,CAAI;AAK7C;AAIA;AAKA;cAAa,yBAAuB,MAAA,CAAA;;;;CAAA,CAAA;AAAA,KAMxB,iBAAA,GAAoB,MAAA,CAAO,MAAA,CAAO,IANV,CAAA,OAMsB,uBANtB,CAAA;AAMpC;AAKA;;cAAa,uBAAqB,MAAA,CAAA,OAAA,MAAA,CAAA;;;;;;;;;IAAA,SAAA,EAAA,oBAAA;;;;;EAAA,aAAA,EAAA,oBAAA;EAAA,MAAA,EAAA,oBAAA;AAKlC,CAAA,CAAA,CAAA,CAAY;AASC,KATD,eAAA,GAAkB,MAAA,CAAO,MAAA,CAAO,IAkB3C,CAAA,OAlBuD,qBAkBvD,CAAA;;;;cATY,oBAAkB,MAAA,CAAA,OAAA,MAAA,CAAA;;;CAAA,CAAA,eAAA,CAAA;EAAA,OAAA,gBAAA,CAAA,CAAA,KAAA,CAAA,CAAA;EAWnB,MAAA,EAAA,oBAAyC;;KAAzC,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,YAAY"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import * as Schema from "effect/Schema";
|
|
2
|
-
|
|
3
|
-
//#region src/DocumentProtocol.d.ts
|
|
4
|
-
declare namespace DocumentProtocol_d_exports {
|
|
5
|
-
export { AuthResultMessage, AuthResultMessageSchema, ErrorMessage, ErrorMessageSchema, OperationSchema, PongMessage, PongMessageSchema, ServerBroadcast, ServerBroadcastSchema, SnapshotMessage, SnapshotMessageSchema, SubmitResult, SubmitResultSchema, Transaction, TransactionMessage, TransactionMessageSchema, TransactionSchema };
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Schema for a transaction operation.
|
|
9
|
-
*/
|
|
10
|
-
declare const OperationSchema: Schema.Struct<{
|
|
11
|
-
kind: typeof Schema.String;
|
|
12
|
-
path: typeof Schema.Unknown;
|
|
13
|
-
payload: typeof Schema.Unknown;
|
|
14
|
-
}>;
|
|
15
|
-
/**
|
|
16
|
-
* Schema for a transaction.
|
|
17
|
-
*/
|
|
18
|
-
declare const TransactionSchema: Schema.Struct<{
|
|
19
|
-
id: typeof Schema.String;
|
|
20
|
-
ops: Schema.Array$<Schema.Struct<{
|
|
21
|
-
kind: typeof Schema.String;
|
|
22
|
-
path: typeof Schema.Unknown;
|
|
23
|
-
payload: typeof Schema.Unknown;
|
|
24
|
-
}>>;
|
|
25
|
-
timestamp: typeof Schema.Number;
|
|
26
|
-
}>;
|
|
27
|
-
type Transaction = Schema.Schema.Type<typeof TransactionSchema>;
|
|
28
|
-
/**
|
|
29
|
-
* Schema for a server message that broadcasts a committed transaction.
|
|
30
|
-
*/
|
|
31
|
-
declare const TransactionMessageSchema: Schema.Struct<{
|
|
32
|
-
type: Schema.Literal<["transaction"]>;
|
|
33
|
-
transaction: Schema.Struct<{
|
|
34
|
-
id: typeof Schema.String;
|
|
35
|
-
ops: Schema.Array$<Schema.Struct<{
|
|
36
|
-
kind: typeof Schema.String;
|
|
37
|
-
path: typeof Schema.Unknown;
|
|
38
|
-
payload: typeof Schema.Unknown;
|
|
39
|
-
}>>;
|
|
40
|
-
timestamp: typeof Schema.Number;
|
|
41
|
-
}>;
|
|
42
|
-
version: typeof Schema.Number;
|
|
43
|
-
}>;
|
|
44
|
-
type TransactionMessage = Schema.Schema.Type<typeof TransactionMessageSchema>;
|
|
45
|
-
/**
|
|
46
|
-
* Schema for a server message containing a snapshot.
|
|
47
|
-
*/
|
|
48
|
-
declare const SnapshotMessageSchema: Schema.Struct<{
|
|
49
|
-
type: Schema.Literal<["snapshot"]>;
|
|
50
|
-
state: typeof Schema.Unknown;
|
|
51
|
-
version: typeof Schema.Number;
|
|
52
|
-
}>;
|
|
53
|
-
type SnapshotMessage = Schema.Schema.Type<typeof SnapshotMessageSchema>;
|
|
54
|
-
/**
|
|
55
|
-
* Schema for a server error message.
|
|
56
|
-
*/
|
|
57
|
-
declare const ErrorMessageSchema: Schema.Struct<{
|
|
58
|
-
type: Schema.Literal<["error"]>;
|
|
59
|
-
transactionId: typeof Schema.String;
|
|
60
|
-
reason: typeof Schema.String;
|
|
61
|
-
}>;
|
|
62
|
-
type ErrorMessage = Schema.Schema.Type<typeof ErrorMessageSchema>;
|
|
63
|
-
/**
|
|
64
|
-
* Schema for a pong message.
|
|
65
|
-
*/
|
|
66
|
-
declare const PongMessageSchema: Schema.Struct<{
|
|
67
|
-
type: Schema.Literal<["pong"]>;
|
|
68
|
-
}>;
|
|
69
|
-
type PongMessage = Schema.Schema.Type<typeof PongMessageSchema>;
|
|
70
|
-
/**
|
|
71
|
-
* Schema for authentication result message.
|
|
72
|
-
*/
|
|
73
|
-
declare const AuthResultMessageSchema: Schema.Struct<{
|
|
74
|
-
type: Schema.Literal<["auth_result"]>;
|
|
75
|
-
success: typeof Schema.Boolean;
|
|
76
|
-
error: Schema.optional<typeof Schema.String>;
|
|
77
|
-
}>;
|
|
78
|
-
type AuthResultMessage = Schema.Schema.Type<typeof AuthResultMessageSchema>;
|
|
79
|
-
/**
|
|
80
|
-
* Union of all server broadcast messages.
|
|
81
|
-
*/
|
|
82
|
-
declare const ServerBroadcastSchema: Schema.Union<[Schema.Struct<{
|
|
83
|
-
type: Schema.Literal<["transaction"]>;
|
|
84
|
-
transaction: Schema.Struct<{
|
|
85
|
-
id: typeof Schema.String;
|
|
86
|
-
ops: Schema.Array$<Schema.Struct<{
|
|
87
|
-
kind: typeof Schema.String;
|
|
88
|
-
path: typeof Schema.Unknown;
|
|
89
|
-
payload: typeof Schema.Unknown;
|
|
90
|
-
}>>;
|
|
91
|
-
timestamp: typeof Schema.Number;
|
|
92
|
-
}>;
|
|
93
|
-
version: typeof Schema.Number;
|
|
94
|
-
}>, Schema.Struct<{
|
|
95
|
-
type: Schema.Literal<["error"]>;
|
|
96
|
-
transactionId: typeof Schema.String;
|
|
97
|
-
reason: typeof Schema.String;
|
|
98
|
-
}>]>;
|
|
99
|
-
type ServerBroadcast = Schema.Schema.Type<typeof ServerBroadcastSchema>;
|
|
100
|
-
/**
|
|
101
|
-
* Result of submitting a transaction.
|
|
102
|
-
*/
|
|
103
|
-
declare const SubmitResultSchema: Schema.Union<[Schema.Struct<{
|
|
104
|
-
success: Schema.Literal<[true]>;
|
|
105
|
-
version: typeof Schema.Number;
|
|
106
|
-
}>, Schema.Struct<{
|
|
107
|
-
success: Schema.Literal<[false]>;
|
|
108
|
-
reason: typeof Schema.String;
|
|
109
|
-
}>]>;
|
|
110
|
-
type SubmitResult = Schema.Schema.Type<typeof SubmitResultSchema>;
|
|
111
|
-
//#endregion
|
|
112
|
-
export { DocumentProtocol_d_exports, ServerBroadcast, SnapshotMessage, SubmitResult };
|
|
113
|
-
//# sourceMappingURL=DocumentProtocol.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentProtocol.d.mts","names":[],"sources":["../src/DocumentProtocol.ts"],"sourcesContent":[],"mappings":";;;;;;;;;cAaa,iBAAe,MAAA,CAAA;;;;;;;;cASf,mBAAiB,MAAA,CAAA;;;;;;;EATjB,SAAA,EAAA,oBAIX;;KAWU,WAAA,GAAc,MAAA,CAAO,MAAA,CAAO,YAAY;;;;AANvC,cAWA,wBAPX,EAOmC,MAAA,CAAA,MAPnC,CAAA;;;;;;;;IAJ4B,CAAA,CAAA,CAAA;IAAA,SAAA,EAAA,oBAAA;EAMlB,CAAA,CAAA;EAKC,OAAA,EAAA,oBAIX;;KAEU,kBAAA,GAAqB,MAAA,CAAO,MAAA,CAAO,YAAY;;;;cAK9C,uBAAqB,MAAA,CAAA;;;;;AAXG,KAiBzB,eAAA,GAAkB,MAAA,CAAO,MAAA,CAAO,IAjBP,CAAA,OAiBmB,qBAjBnB,CAAA;;AAMrC;AAKA;cAWa,oBAAkB,MAAA,CAAA;;;EAXG,MAAA,EAAA,oBAAA;CAAA,CAAA;AAMtB,KAWA,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,IAXe,CAAA,OAWH,kBAXT,CAAA;AAK5C;;;cAWa,mBAAiB,MAAA,CAAA;EAXC,IAAA,EAa7B,MAAA,CAAA,OAb6B,CAAA,CAAA,MAAA,CAAA,CAAA;CAAA,CAAA;AAMnB,KASA,WAAA,GAAc,MAAA,CAAO,MAAA,CAAO,IATa,CAAA,OASD,iBATX,CAAI;AAK7C;AAIA;AAKA;cAAa,yBAAuB,MAAA,CAAA;;;;CAAA,CAAA;AAAA,KAMxB,iBAAA,GAAoB,MAAA,CAAO,MAAA,CAAO,IANV,CAAA,OAMsB,uBANtB,CAAA;AAMpC;AAKA;;cAAa,uBAAqB,MAAA,CAAA,OAAA,MAAA,CAAA;;;;;;;;;IAAA,SAAA,EAAA,oBAAA;;;;;EAAA,aAAA,EAAA,oBAAA;EAAA,MAAA,EAAA,oBAAA;AAKlC,CAAA,CAAA,CAAA,CAAY;AASC,KATD,eAAA,GAAkB,MAAA,CAAO,MAAA,CAAO,IAkB3C,CAAA,OAlBuD,qBAkBvD,CAAA;;;;cATY,oBAAkB,MAAA,CAAA,OAAA,MAAA,CAAA;;;CAAA,CAAA,eAAA,CAAA;EAAA,OAAA,gBAAA,CAAA,CAAA,KAAA,CAAA,CAAA;EAWnB,MAAA,EAAA,oBAAyC;;KAAzC,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,YAAY"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { __export } from "./_virtual/rolldown_runtime.mjs";
|
|
2
|
-
import * as Schema from "effect/Schema";
|
|
3
|
-
|
|
4
|
-
//#region src/DocumentProtocol.ts
|
|
5
|
-
/**
|
|
6
|
-
* @since 0.0.1
|
|
7
|
-
* Protocol and schema definitions for document communication.
|
|
8
|
-
*/
|
|
9
|
-
var DocumentProtocol_exports = /* @__PURE__ */ __export({
|
|
10
|
-
AuthResultMessageSchema: () => AuthResultMessageSchema,
|
|
11
|
-
ErrorMessageSchema: () => ErrorMessageSchema,
|
|
12
|
-
OperationSchema: () => OperationSchema,
|
|
13
|
-
PongMessageSchema: () => PongMessageSchema,
|
|
14
|
-
ServerBroadcastSchema: () => ServerBroadcastSchema,
|
|
15
|
-
SnapshotMessageSchema: () => SnapshotMessageSchema,
|
|
16
|
-
SubmitResultSchema: () => SubmitResultSchema,
|
|
17
|
-
TransactionMessageSchema: () => TransactionMessageSchema,
|
|
18
|
-
TransactionSchema: () => TransactionSchema
|
|
19
|
-
});
|
|
20
|
-
/**
|
|
21
|
-
* Schema for a transaction operation.
|
|
22
|
-
*/
|
|
23
|
-
const OperationSchema = Schema.Struct({
|
|
24
|
-
kind: Schema.String,
|
|
25
|
-
path: Schema.Unknown,
|
|
26
|
-
payload: Schema.Unknown
|
|
27
|
-
});
|
|
28
|
-
/**
|
|
29
|
-
* Schema for a transaction.
|
|
30
|
-
*/
|
|
31
|
-
const TransactionSchema = Schema.Struct({
|
|
32
|
-
id: Schema.String,
|
|
33
|
-
ops: Schema.Array(OperationSchema),
|
|
34
|
-
timestamp: Schema.Number
|
|
35
|
-
});
|
|
36
|
-
/**
|
|
37
|
-
* Schema for a server message that broadcasts a committed transaction.
|
|
38
|
-
*/
|
|
39
|
-
const TransactionMessageSchema = Schema.Struct({
|
|
40
|
-
type: Schema.Literal("transaction"),
|
|
41
|
-
transaction: TransactionSchema,
|
|
42
|
-
version: Schema.Number
|
|
43
|
-
});
|
|
44
|
-
/**
|
|
45
|
-
* Schema for a server message containing a snapshot.
|
|
46
|
-
*/
|
|
47
|
-
const SnapshotMessageSchema = Schema.Struct({
|
|
48
|
-
type: Schema.Literal("snapshot"),
|
|
49
|
-
state: Schema.Unknown,
|
|
50
|
-
version: Schema.Number
|
|
51
|
-
});
|
|
52
|
-
/**
|
|
53
|
-
* Schema for a server error message.
|
|
54
|
-
*/
|
|
55
|
-
const ErrorMessageSchema = Schema.Struct({
|
|
56
|
-
type: Schema.Literal("error"),
|
|
57
|
-
transactionId: Schema.String,
|
|
58
|
-
reason: Schema.String
|
|
59
|
-
});
|
|
60
|
-
/**
|
|
61
|
-
* Schema for a pong message.
|
|
62
|
-
*/
|
|
63
|
-
const PongMessageSchema = Schema.Struct({ type: Schema.Literal("pong") });
|
|
64
|
-
/**
|
|
65
|
-
* Schema for authentication result message.
|
|
66
|
-
*/
|
|
67
|
-
const AuthResultMessageSchema = Schema.Struct({
|
|
68
|
-
type: Schema.Literal("auth_result"),
|
|
69
|
-
success: Schema.Boolean,
|
|
70
|
-
error: Schema.optional(Schema.String)
|
|
71
|
-
});
|
|
72
|
-
/**
|
|
73
|
-
* Union of all server broadcast messages.
|
|
74
|
-
*/
|
|
75
|
-
const ServerBroadcastSchema = Schema.Union(TransactionMessageSchema, ErrorMessageSchema);
|
|
76
|
-
/**
|
|
77
|
-
* Result of submitting a transaction.
|
|
78
|
-
*/
|
|
79
|
-
const SubmitResultSchema = Schema.Union(Schema.Struct({
|
|
80
|
-
success: Schema.Literal(true),
|
|
81
|
-
version: Schema.Number
|
|
82
|
-
}), Schema.Struct({
|
|
83
|
-
success: Schema.Literal(false),
|
|
84
|
-
reason: Schema.String
|
|
85
|
-
}));
|
|
86
|
-
|
|
87
|
-
//#endregion
|
|
88
|
-
export { DocumentProtocol_exports };
|
|
89
|
-
//# sourceMappingURL=DocumentProtocol.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentProtocol.mjs","names":[],"sources":["../src/DocumentProtocol.ts"],"sourcesContent":["/**\n * @since 0.0.1\n * Protocol and schema definitions for document communication.\n */\nimport * as Schema from \"effect/Schema\";\n\n// =============================================================================\n// Schema Definitions\n// =============================================================================\n\n/**\n * Schema for a transaction operation.\n */\nexport const OperationSchema = Schema.Struct({\n kind: Schema.String,\n path: Schema.Unknown, // OperationPath is complex, treat as unknown\n payload: Schema.Unknown,\n});\n\n/**\n * Schema for a transaction.\n */\nexport const TransactionSchema = Schema.Struct({\n id: Schema.String,\n ops: Schema.Array(OperationSchema),\n timestamp: Schema.Number,\n});\n\nexport type Transaction = Schema.Schema.Type<typeof TransactionSchema>;\n\n/**\n * Schema for a server message that broadcasts a committed transaction.\n */\nexport const TransactionMessageSchema = Schema.Struct({\n type: Schema.Literal(\"transaction\"),\n transaction: TransactionSchema,\n version: Schema.Number,\n});\n\nexport type TransactionMessage = Schema.Schema.Type<typeof TransactionMessageSchema>;\n\n/**\n * Schema for a server message containing a snapshot.\n */\nexport const SnapshotMessageSchema = Schema.Struct({\n type: Schema.Literal(\"snapshot\"),\n state: Schema.Unknown,\n version: Schema.Number,\n});\n\nexport type SnapshotMessage = Schema.Schema.Type<typeof SnapshotMessageSchema>;\n\n/**\n * Schema for a server error message.\n */\nexport const ErrorMessageSchema = Schema.Struct({\n type: Schema.Literal(\"error\"),\n transactionId: Schema.String,\n reason: Schema.String,\n});\n\nexport type ErrorMessage = Schema.Schema.Type<typeof ErrorMessageSchema>;\n\n/**\n * Schema for a pong message.\n */\nexport const PongMessageSchema = Schema.Struct({\n type: Schema.Literal(\"pong\"),\n});\n\nexport type PongMessage = Schema.Schema.Type<typeof PongMessageSchema>;\n\n/**\n * Schema for authentication result message.\n */\nexport const AuthResultMessageSchema = Schema.Struct({\n type: Schema.Literal(\"auth_result\"),\n success: Schema.Boolean,\n error: Schema.optional(Schema.String),\n});\n\nexport type AuthResultMessage = Schema.Schema.Type<typeof AuthResultMessageSchema>;\n\n/**\n * Union of all server broadcast messages.\n */\nexport const ServerBroadcastSchema = Schema.Union(\n TransactionMessageSchema,\n ErrorMessageSchema\n);\n\nexport type ServerBroadcast = Schema.Schema.Type<typeof ServerBroadcastSchema>;\n\n// =============================================================================\n// Submit Result\n// =============================================================================\n\n/**\n * Result of submitting a transaction.\n */\nexport const SubmitResultSchema = Schema.Union(\n Schema.Struct({\n success: Schema.Literal(true),\n version: Schema.Number,\n }),\n Schema.Struct({\n success: Schema.Literal(false),\n reason: Schema.String,\n })\n);\n\nexport type SubmitResult = Schema.Schema.Type<typeof SubmitResultSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAaA,MAAa,kBAAkB,OAAO,OAAO;CAC3C,MAAM,OAAO;CACb,MAAM,OAAO;CACb,SAAS,OAAO;CACjB,CAAC;;;;AAKF,MAAa,oBAAoB,OAAO,OAAO;CAC7C,IAAI,OAAO;CACX,KAAK,OAAO,MAAM,gBAAgB;CAClC,WAAW,OAAO;CACnB,CAAC;;;;AAOF,MAAa,2BAA2B,OAAO,OAAO;CACpD,MAAM,OAAO,QAAQ,cAAc;CACnC,aAAa;CACb,SAAS,OAAO;CACjB,CAAC;;;;AAOF,MAAa,wBAAwB,OAAO,OAAO;CACjD,MAAM,OAAO,QAAQ,WAAW;CAChC,OAAO,OAAO;CACd,SAAS,OAAO;CACjB,CAAC;;;;AAOF,MAAa,qBAAqB,OAAO,OAAO;CAC9C,MAAM,OAAO,QAAQ,QAAQ;CAC7B,eAAe,OAAO;CACtB,QAAQ,OAAO;CAChB,CAAC;;;;AAOF,MAAa,oBAAoB,OAAO,OAAO,EAC7C,MAAM,OAAO,QAAQ,OAAO,EAC7B,CAAC;;;;AAOF,MAAa,0BAA0B,OAAO,OAAO;CACnD,MAAM,OAAO,QAAQ,cAAc;CACnC,SAAS,OAAO;CAChB,OAAO,OAAO,SAAS,OAAO,OAAO;CACtC,CAAC;;;;AAOF,MAAa,wBAAwB,OAAO,MAC1C,0BACA,mBACD;;;;AAWD,MAAa,qBAAqB,OAAO,MACvC,OAAO,OAAO;CACZ,SAAS,OAAO,QAAQ,KAAK;CAC7B,SAAS,OAAO;CACjB,CAAC,EACF,OAAO,OAAO;CACZ,SAAS,OAAO,QAAQ,MAAM;CAC9B,QAAQ,OAAO;CAChB,CAAC,CACH"}
|
package/dist/MimicConfig.cjs
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let effect_Effect = require("effect/Effect");
|
|
3
|
-
effect_Effect = require_rolldown_runtime.__toESM(effect_Effect);
|
|
4
|
-
let effect_Layer = require("effect/Layer");
|
|
5
|
-
effect_Layer = require_rolldown_runtime.__toESM(effect_Layer);
|
|
6
|
-
let effect_Context = require("effect/Context");
|
|
7
|
-
effect_Context = require_rolldown_runtime.__toESM(effect_Context);
|
|
8
|
-
let effect_Duration = require("effect/Duration");
|
|
9
|
-
effect_Duration = require_rolldown_runtime.__toESM(effect_Duration);
|
|
10
|
-
let _voidhash_mimic = require("@voidhash/mimic");
|
|
11
|
-
|
|
12
|
-
//#region src/MimicConfig.ts
|
|
13
|
-
/**
|
|
14
|
-
* @since 0.0.1
|
|
15
|
-
* Configuration types for the Mimic server.
|
|
16
|
-
*/
|
|
17
|
-
var MimicConfig_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
18
|
-
MimicServerConfigTag: () => MimicServerConfigTag,
|
|
19
|
-
layer: () => layer,
|
|
20
|
-
make: () => make
|
|
21
|
-
});
|
|
22
|
-
/**
|
|
23
|
-
* Check if a value is an InitialFn (function) rather than a plain object.
|
|
24
|
-
*/
|
|
25
|
-
const isInitialFn = (value) => typeof value === "function";
|
|
26
|
-
/**
|
|
27
|
-
* Create a MimicServerConfig from options.
|
|
28
|
-
*/
|
|
29
|
-
const make = (options) => {
|
|
30
|
-
var _options$maxIdleTime, _options$maxTransacti, _options$heartbeatInt, _options$heartbeatTim;
|
|
31
|
-
const { initial, schema } = options;
|
|
32
|
-
const initialFn = initial === void 0 ? void 0 : isInitialFn(initial) ? (context) => effect_Effect.map(initial(context), (state) => _voidhash_mimic.Primitive.applyDefaults(schema, state)) : () => effect_Effect.succeed(_voidhash_mimic.Primitive.applyDefaults(schema, initial));
|
|
33
|
-
return {
|
|
34
|
-
schema,
|
|
35
|
-
maxIdleTime: effect_Duration.decode((_options$maxIdleTime = options.maxIdleTime) !== null && _options$maxIdleTime !== void 0 ? _options$maxIdleTime : "5 minutes"),
|
|
36
|
-
maxTransactionHistory: (_options$maxTransacti = options.maxTransactionHistory) !== null && _options$maxTransacti !== void 0 ? _options$maxTransacti : 1e3,
|
|
37
|
-
heartbeatInterval: effect_Duration.decode((_options$heartbeatInt = options.heartbeatInterval) !== null && _options$heartbeatInt !== void 0 ? _options$heartbeatInt : "30 seconds"),
|
|
38
|
-
heartbeatTimeout: effect_Duration.decode((_options$heartbeatTim = options.heartbeatTimeout) !== null && _options$heartbeatTim !== void 0 ? _options$heartbeatTim : "10 seconds"),
|
|
39
|
-
presence: options.presence,
|
|
40
|
-
initial: initialFn
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Context tag for MimicServerConfig.
|
|
45
|
-
*/
|
|
46
|
-
var MimicServerConfigTag = class extends effect_Context.Tag("@voidhash/mimic-server-effect/MimicServerConfig")() {};
|
|
47
|
-
/**
|
|
48
|
-
* Create a Layer that provides MimicServerConfig.
|
|
49
|
-
*/
|
|
50
|
-
const layer = (options) => effect_Layer.succeed(MimicServerConfigTag, make(options));
|
|
51
|
-
|
|
52
|
-
//#endregion
|
|
53
|
-
Object.defineProperty(exports, 'MimicConfig_exports', {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
get: function () {
|
|
56
|
-
return MimicConfig_exports;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
exports.MimicServerConfigTag = MimicServerConfigTag;
|
|
60
|
-
exports.layer = layer;
|
package/dist/MimicConfig.d.cts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as Layer from "effect/Layer";
|
|
3
|
-
import { Presence, Primitive } from "@voidhash/mimic";
|
|
4
|
-
import * as Context from "effect/Context";
|
|
5
|
-
import * as Duration from "effect/Duration";
|
|
6
|
-
import { DurationInput } from "effect/Duration";
|
|
7
|
-
|
|
8
|
-
//#region src/MimicConfig.d.ts
|
|
9
|
-
declare namespace MimicConfig_d_exports {
|
|
10
|
-
export { InitialContext, InitialFn, MimicServerConfig, MimicServerConfigOptions, MimicServerConfigTag, layer, make };
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Context available when computing initial state for a document.
|
|
14
|
-
*/
|
|
15
|
-
interface InitialContext {
|
|
16
|
-
/**
|
|
17
|
-
* The document ID being initialized.
|
|
18
|
-
*/
|
|
19
|
-
readonly documentId: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Function that computes initial state for a document.
|
|
23
|
-
* Receives context with the document ID and returns an Effect that produces the initial state.
|
|
24
|
-
*/
|
|
25
|
-
type InitialFn<TSchema extends Primitive.AnyPrimitive> = (context: InitialContext) => Effect.Effect<Primitive.InferSetInput<TSchema>>;
|
|
26
|
-
/**
|
|
27
|
-
* Configuration for the Mimic server.
|
|
28
|
-
*
|
|
29
|
-
* Note: Authentication and persistence are now handled by injectable services
|
|
30
|
-
* (MimicAuthService and MimicDataStorage) rather than config options.
|
|
31
|
-
*/
|
|
32
|
-
interface MimicServerConfig<TSchema extends Primitive.AnyPrimitive = Primitive.AnyPrimitive> {
|
|
33
|
-
/**
|
|
34
|
-
* The schema defining the document structure.
|
|
35
|
-
*/
|
|
36
|
-
readonly schema: TSchema;
|
|
37
|
-
/**
|
|
38
|
-
* Maximum idle time for a document before it is cleaned up.
|
|
39
|
-
* @default "5 minutes"
|
|
40
|
-
*/
|
|
41
|
-
readonly maxIdleTime: Duration.Duration;
|
|
42
|
-
/**
|
|
43
|
-
* Maximum number of processed transaction IDs to track for deduplication.
|
|
44
|
-
* @default 1000
|
|
45
|
-
*/
|
|
46
|
-
readonly maxTransactionHistory: number;
|
|
47
|
-
/**
|
|
48
|
-
* Heartbeat interval for WebSocket connections.
|
|
49
|
-
* @default "30 seconds"
|
|
50
|
-
*/
|
|
51
|
-
readonly heartbeatInterval: Duration.Duration;
|
|
52
|
-
/**
|
|
53
|
-
* Timeout for heartbeat responses before considering connection dead.
|
|
54
|
-
* @default "10 seconds"
|
|
55
|
-
*/
|
|
56
|
-
readonly heartbeatTimeout: Duration.Duration;
|
|
57
|
-
/**
|
|
58
|
-
* Optional presence schema for ephemeral per-user data.
|
|
59
|
-
* When provided, enables presence features on WebSocket connections.
|
|
60
|
-
* @default undefined (presence disabled)
|
|
61
|
-
*/
|
|
62
|
-
readonly presence: Presence.AnyPresence | undefined;
|
|
63
|
-
/**
|
|
64
|
-
* Initial state function for new documents.
|
|
65
|
-
* Called when a document is created and no existing state is found in storage.
|
|
66
|
-
* Receives the document ID and returns an Effect that produces the initial state.
|
|
67
|
-
* @default undefined (documents start empty or use schema defaults)
|
|
68
|
-
*/
|
|
69
|
-
readonly initial: InitialFn<TSchema> | undefined;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Options for creating a MimicServerConfig.
|
|
73
|
-
*/
|
|
74
|
-
interface MimicServerConfigOptions<TSchema extends Primitive.AnyPrimitive = Primitive.AnyPrimitive> {
|
|
75
|
-
/**
|
|
76
|
-
* The schema defining the document structure.
|
|
77
|
-
*/
|
|
78
|
-
readonly schema: TSchema;
|
|
79
|
-
/**
|
|
80
|
-
* Maximum idle time for a document before it is cleaned up.
|
|
81
|
-
* @default "5 minutes"
|
|
82
|
-
*/
|
|
83
|
-
readonly maxIdleTime?: DurationInput;
|
|
84
|
-
/**
|
|
85
|
-
* Maximum number of processed transaction IDs to track for deduplication.
|
|
86
|
-
* @default 1000
|
|
87
|
-
*/
|
|
88
|
-
readonly maxTransactionHistory?: number;
|
|
89
|
-
/**
|
|
90
|
-
* Heartbeat interval for WebSocket connections.
|
|
91
|
-
* @default "30 seconds"
|
|
92
|
-
*/
|
|
93
|
-
readonly heartbeatInterval?: DurationInput;
|
|
94
|
-
/**
|
|
95
|
-
* Timeout for heartbeat responses.
|
|
96
|
-
* @default "10 seconds"
|
|
97
|
-
*/
|
|
98
|
-
readonly heartbeatTimeout?: DurationInput;
|
|
99
|
-
/**
|
|
100
|
-
* Optional presence schema for ephemeral per-user data.
|
|
101
|
-
* When provided, enables presence features on WebSocket connections.
|
|
102
|
-
* @default undefined (presence disabled)
|
|
103
|
-
*/
|
|
104
|
-
readonly presence?: Presence.AnyPresence;
|
|
105
|
-
/**
|
|
106
|
-
* Initial state for new documents.
|
|
107
|
-
* Can be either:
|
|
108
|
-
* - A plain object with the initial state values
|
|
109
|
-
* - A function that receives context (with documentId) and returns an Effect producing the initial state
|
|
110
|
-
*
|
|
111
|
-
* Type-safe: required fields (without defaults) must be provided,
|
|
112
|
-
* while optional fields and fields with defaults can be omitted.
|
|
113
|
-
*
|
|
114
|
-
* @example
|
|
115
|
-
* // Plain object
|
|
116
|
-
* initial: { title: "New Document", count: 0 }
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* // Function returning Effect
|
|
120
|
-
* initial: ({ documentId }) => Effect.succeed({ title: `Doc ${documentId}`, count: 0 })
|
|
121
|
-
*
|
|
122
|
-
* @default undefined (documents start empty or use schema defaults)
|
|
123
|
-
*/
|
|
124
|
-
readonly initial?: Primitive.InferSetInput<TSchema> | InitialFn<TSchema>;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Create a MimicServerConfig from options.
|
|
128
|
-
*/
|
|
129
|
-
declare const make: <TSchema extends Primitive.AnyPrimitive>(options: MimicServerConfigOptions<TSchema>) => MimicServerConfig<TSchema>;
|
|
130
|
-
declare const MimicServerConfigTag_base: Context.TagClass<MimicServerConfigTag, "@voidhash/mimic-server-effect/MimicServerConfig", MimicServerConfig<Primitive.AnyPrimitive>>;
|
|
131
|
-
/**
|
|
132
|
-
* Context tag for MimicServerConfig.
|
|
133
|
-
*/
|
|
134
|
-
declare class MimicServerConfigTag extends MimicServerConfigTag_base {}
|
|
135
|
-
/**
|
|
136
|
-
* Create a Layer that provides MimicServerConfig.
|
|
137
|
-
*/
|
|
138
|
-
declare const layer: <TSchema extends Primitive.AnyPrimitive>(options: MimicServerConfigOptions<TSchema>) => Layer.Layer<MimicServerConfigTag>;
|
|
139
|
-
//#endregion
|
|
140
|
-
export { InitialFn, MimicConfig_d_exports, MimicServerConfigOptions, MimicServerConfigTag };
|
|
141
|
-
//# sourceMappingURL=MimicConfig.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MimicConfig.d.cts","names":[],"sources":["../src/MimicConfig.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;UAkBiB,cAAA;;;;;AAAjB;AAWA;;;;AAEmB,KAFP,SAEiB,CAAA,gBAFS,SAAA,CAAU,YAEnB,CAAA,GAAA,CAAA,OAAA,EADlB,cACkB,EAAA,GAAxB,MAAA,CAAO,MAAiB,CAAV,SAAA,CAAU,aAAA,CAAc,OAAd,CAAA,CAAA;;;AAY7B;;;;AAYwB,UAZP,iBAYgB,CAAA,gBAXf,SAAA,CAAU,YAWK,GAXU,SAAA,CAAU,YAWpB,CAAA,CAAA;EAYH;;;EAqBA,SAAA,MAAA,EAvCX,OAuCW;EAAV;;AAMpB;;EAC2C,SAAU,WAAA,EAxC7B,QAAA,CAAS,QAwCoB;EAKlC;;;;EA+BG,SAAS,qBAAA,EAAA,MAAA;EAqBc;;;;EAAoB,SAAA,iBAAA,EArFnC,QAAA,CAAS,QAqF0B;EAapD;;;;EAEQ,SAAA,gBAAA,EA9FQ,QAAA,CAAS,QA8FjB;EAAlB;;AAwBD;;;qBA/GmB,QAAA,CAAS;;;AAwH9B;AAOA;;;EACW,SAAA,OAAA,EAxHS,SAwHT,CAxHmB,OAwHnB,CAAA,GAAA,SAAA;;;;;UAlHM,yCACC,SAAA,CAAU,eAAe,SAAA,CAAU;;;;mBAKlC;;;;;yBAMM;;;;;;;;;;+BAYM;;;;;8BAMD;;;;;;sBAOR,QAAA,CAAS;;;;;;;;;;;;;;;;;;;;qBAqBV,SAAA,CAAU,cAAc,WAAW,UAAU;;;;;cAarD,uBAAwB,SAAA,CAAU,uBACpC,yBAAyB,aACjC,kBAAkB;cAwBnB;;;;cASW,oBAAA,SAA6B,yBAAA;;;;cAO7B,wBAAyB,SAAA,CAAU,uBACrC,yBAAyB,aACjC,KAAA,CAAM,MAAM"}
|