@voidhash/mimic-effect 1.0.0-beta.7 → 1.0.0-beta.8

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.
Files changed (41) hide show
  1. package/.turbo/turbo-build.log +94 -94
  2. package/dist/DocumentInstance.cjs +255 -0
  3. package/dist/DocumentInstance.d.cts +74 -0
  4. package/dist/DocumentInstance.d.cts.map +1 -0
  5. package/dist/DocumentInstance.d.mts +74 -0
  6. package/dist/DocumentInstance.d.mts.map +1 -0
  7. package/dist/DocumentInstance.mjs +256 -0
  8. package/dist/DocumentInstance.mjs.map +1 -0
  9. package/dist/MimicClusterServerEngine.cjs +19 -203
  10. package/dist/MimicClusterServerEngine.d.cts.map +1 -1
  11. package/dist/MimicClusterServerEngine.d.mts.map +1 -1
  12. package/dist/MimicClusterServerEngine.mjs +24 -208
  13. package/dist/MimicClusterServerEngine.mjs.map +1 -1
  14. package/dist/MimicServerEngine.cjs +72 -10
  15. package/dist/MimicServerEngine.d.cts +12 -7
  16. package/dist/MimicServerEngine.d.cts.map +1 -1
  17. package/dist/MimicServerEngine.d.mts +12 -7
  18. package/dist/MimicServerEngine.d.mts.map +1 -1
  19. package/dist/MimicServerEngine.mjs +74 -12
  20. package/dist/MimicServerEngine.mjs.map +1 -1
  21. package/dist/Protocol.d.cts +1 -1
  22. package/dist/Protocol.d.mts +1 -1
  23. package/dist/index.cjs +2 -4
  24. package/dist/index.d.cts +2 -2
  25. package/dist/index.d.mts +2 -2
  26. package/dist/index.mjs +2 -2
  27. package/package.json +3 -3
  28. package/src/DocumentInstance.ts +510 -0
  29. package/src/MimicClusterServerEngine.ts +40 -357
  30. package/src/MimicServerEngine.ts +172 -36
  31. package/src/index.ts +3 -4
  32. package/tests/DocumentInstance.test.ts +669 -0
  33. package/dist/DocumentManager.cjs +0 -299
  34. package/dist/DocumentManager.d.cts +0 -67
  35. package/dist/DocumentManager.d.cts.map +0 -1
  36. package/dist/DocumentManager.d.mts +0 -67
  37. package/dist/DocumentManager.d.mts.map +0 -1
  38. package/dist/DocumentManager.mjs +0 -297
  39. package/dist/DocumentManager.mjs.map +0 -1
  40. package/src/DocumentManager.ts +0 -616
  41. package/tests/DocumentManager.test.ts +0 -335
@@ -1,5 +1,5 @@
1
1
 
2
- > @voidhash/mimic-effect@1.0.0-beta.7 build /home/runner/work/mimic/mimic/packages/mimic-effect
2
+ > @voidhash/mimic-effect@1.0.0-beta.8 build /home/runner/work/mimic/mimic/packages/mimic-effect
3
3
  > tsdown
4
4
 
5
5
  ℹ tsdown v0.18.2 powered by rolldown v1.0.0-beta.55
@@ -8,17 +8,17 @@
8
8
  ℹ target: es2017
9
9
  ℹ tsconfig: tsconfig.json
10
10
  ℹ Build start
11
- ℹ [CJS] dist/index.cjs  2.43 kB │ gzip: 0.50 kB
11
+ ℹ [CJS] dist/index.cjs  2.28 kB │ gzip: 0.49 kB
12
12
  ℹ [CJS] dist/testing/index.cjs  0.95 kB │ gzip: 0.22 kB
13
13
  ℹ [CJS] dist/testing/HotStorageTestSuite.cjs 38.03 kB │ gzip: 5.13 kB
14
- ℹ [CJS] dist/MimicClusterServerEngine.cjs 21.95 kB │ gzip: 5.00 kB
15
14
  ℹ [CJS] dist/testing/StorageIntegrationTestSuite.cjs 20.68 kB │ gzip: 3.67 kB
16
15
  ℹ [CJS] dist/testing/ColdStorageTestSuite.cjs 18.14 kB │ gzip: 3.22 kB
17
- ℹ [CJS] dist/DocumentManager.cjs 12.50 kB │ gzip: 3.06 kB
16
+ ℹ [CJS] dist/MimicClusterServerEngine.cjs 14.18 kB │ gzip: 3.37 kB
18
17
  ℹ [CJS] dist/MimicServer.cjs 10.37 kB │ gzip: 2.84 kB
18
+ ℹ [CJS] dist/DocumentInstance.cjs 10.23 kB │ gzip: 2.70 kB
19
+ ℹ [CJS] dist/MimicServerEngine.cjs  7.09 kB │ gzip: 2.03 kB
19
20
  ℹ [CJS] dist/testing/FailingStorage.cjs  6.91 kB │ gzip: 1.53 kB
20
21
  ℹ [CJS] dist/Metrics.cjs  4.26 kB │ gzip: 1.04 kB
21
- ℹ [CJS] dist/MimicServerEngine.cjs  4.26 kB │ gzip: 1.36 kB
22
22
  ℹ [CJS] dist/HotStorage.cjs  3.86 kB │ gzip: 1.27 kB
23
23
  ℹ [CJS] dist/PresenceManager.cjs  3.81 kB │ gzip: 1.03 kB
24
24
  ℹ [CJS] dist/Protocol.cjs  3.78 kB │ gzip: 1.14 kB
@@ -33,12 +33,12 @@
33
33
  ℹ [CJS] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.cjs  0.37 kB │ gzip: 0.23 kB
34
34
  ℹ [CJS] dist/_virtual/rolldown_runtime.cjs  0.36 kB │ gzip: 0.25 kB
35
35
  ℹ [CJS] dist/testing/types.cjs  0.34 kB │ gzip: 0.23 kB
36
- ℹ [CJS] 25 files, total: 165.46 kB
36
+ ℹ [CJS] 25 files, total: 158.11 kB
37
37
  ℹ [CJS] dist/Protocol.d.cts.map 1.57 kB │ gzip: 0.70 kB
38
38
  ℹ [CJS] dist/Types.d.cts.map 1.41 kB │ gzip: 0.65 kB
39
- ℹ [CJS] dist/MimicServerEngine.d.cts.map 1.09 kB │ gzip: 0.50 kB
39
+ ℹ [CJS] dist/DocumentInstance.d.cts.map 1.18 kB │ gzip: 0.54 kB
40
+ ℹ [CJS] dist/MimicServerEngine.d.cts.map 0.97 kB │ gzip: 0.49 kB
40
41
  ℹ [CJS] dist/ColdStorage.d.cts.map 0.70 kB │ gzip: 0.37 kB
41
- ℹ [CJS] dist/DocumentManager.d.cts.map 0.69 kB │ gzip: 0.38 kB
42
42
  ℹ [CJS] dist/HotStorage.d.cts.map 0.67 kB │ gzip: 0.35 kB
43
43
  ℹ [CJS] dist/MimicAuthService.d.cts.map 0.61 kB │ gzip: 0.35 kB
44
44
  ℹ [CJS] dist/Errors.d.cts.map 0.60 kB │ gzip: 0.32 kB
@@ -51,14 +51,14 @@
51
51
  ℹ [CJS] dist/MimicClusterServerEngine.d.cts.map 0.25 kB │ gzip: 0.19 kB
52
52
  ℹ [CJS] dist/MimicServer.d.cts.map 0.22 kB │ gzip: 0.16 kB
53
53
  ℹ [CJS] dist/Metrics.d.cts.map 0.12 kB │ gzip: 0.12 kB
54
- ℹ [CJS] dist/index.d.cts 2.17 kB │ gzip: 0.53 kB
54
+ ℹ [CJS] dist/index.d.cts 2.14 kB │ gzip: 0.53 kB
55
55
  ℹ [CJS] dist/testing/index.d.cts 0.91 kB │ gzip: 0.25 kB
56
- ℹ [CJS] dist/Protocol.d.cts 5.86 kB │ gzip: 1.34 kB
56
+ ℹ [CJS] dist/Protocol.d.cts 5.84 kB │ gzip: 1.34 kB
57
57
  ℹ [CJS] dist/Types.d.cts 5.47 kB │ gzip: 1.54 kB
58
58
  ℹ [CJS] dist/Errors.d.cts 4.86 kB │ gzip: 1.02 kB
59
- ℹ [CJS] dist/MimicServerEngine.d.cts 3.42 kB │ gzip: 1.06 kB
59
+ ℹ [CJS] dist/MimicServerEngine.d.cts 3.60 kB │ gzip: 1.09 kB
60
+ ℹ [CJS] dist/DocumentInstance.d.cts 2.81 kB │ gzip: 0.93 kB
60
61
  ℹ [CJS] dist/testing/types.d.cts 2.76 kB │ gzip: 1.15 kB
61
- ℹ [CJS] dist/DocumentManager.d.cts 2.74 kB │ gzip: 0.84 kB
62
62
  ℹ [CJS] dist/HotStorage.d.cts 2.72 kB │ gzip: 1.08 kB
63
63
  ℹ [CJS] dist/MimicAuthService.d.cts 2.70 kB │ gzip: 1.04 kB
64
64
  ℹ [CJS] dist/testing/HotStorageTestSuite.d.cts 1.93 kB │ gzip: 0.57 kB
@@ -70,85 +70,85 @@
70
70
  ℹ [CJS] dist/testing/StorageIntegrationTestSuite.d.cts 1.43 kB │ gzip: 0.57 kB
71
71
  ℹ [CJS] dist/MimicClusterServerEngine.d.cts 0.82 kB │ gzip: 0.33 kB
72
72
  ℹ [CJS] dist/MimicServer.d.cts 0.74 kB │ gzip: 0.31 kB
73
- ℹ [CJS] 36 files, total: 56.62 kB
74
- ✔ Build complete in 6470ms
75
- ℹ [ESM] dist/index.mjs  1.38 kB │ gzip: 0.35 kB
76
- ℹ [ESM] dist/testing/index.mjs  0.60 kB │ gzip: 0.19 kB
77
- ℹ [ESM] dist/testing/HotStorageTestSuite.mjs.map 63.42 kB │ gzip: 8.61 kB
78
- ℹ [ESM] dist/MimicClusterServerEngine.mjs.map 42.97 kB │ gzip: 10.20 kB
79
- ℹ [ESM] dist/testing/StorageIntegrationTestSuite.mjs.map 35.60 kB │ gzip: 6.44 kB
80
- ℹ [ESM] dist/testing/HotStorageTestSuite.mjs 34.21 kB │ gzip: 5.06 kB
81
- ℹ [ESM] dist/testing/ColdStorageTestSuite.mjs.map 31.92 kB │ gzip: 5.21 kB
82
- ℹ [ESM] dist/DocumentManager.mjs.map 28.71 kB │ gzip: 7.02 kB
83
- ℹ [ESM] dist/MimicServer.mjs.map 21.35 kB │ gzip: 5.64 kB
84
- ℹ [ESM] dist/MimicClusterServerEngine.mjs 20.49 kB │ gzip: 5.03 kB
85
- ℹ [ESM] dist/testing/StorageIntegrationTestSuite.mjs 18.49 kB │ gzip: 3.63 kB
86
- ℹ [ESM] dist/testing/ColdStorageTestSuite.mjs 16.50 kB │ gzip: 3.21 kB
87
- ℹ [ESM] dist/testing/FailingStorage.mjs.map 15.60 kB │ gzip: 3.07 kB
88
- ℹ [ESM] dist/DocumentManager.mjs 11.81 kB │ gzip: 3.08 kB
89
- ℹ [ESM] dist/HotStorage.mjs.map 10.81 kB │ gzip: 3.04 kB
90
- ℹ [ESM] dist/MimicServerEngine.mjs.map 10.06 kB │ gzip: 2.75 kB
91
- ℹ [ESM] dist/MimicServer.mjs  9.90 kB │ gzip: 2.88 kB
92
- ℹ [ESM] dist/PresenceManager.mjs.map  9.38 kB │ gzip: 2.38 kB
93
- ℹ [ESM] dist/Protocol.mjs.map  9.18 kB │ gzip: 2.15 kB
94
- ℹ [ESM] dist/testing/assertions.mjs.map  7.31 kB │ gzip: 2.01 kB
95
- ℹ [ESM] dist/testing/FailingStorage.mjs  6.49 kB │ gzip: 1.52 kB
96
- ℹ [ESM] dist/Metrics.mjs.map  6.13 kB │ gzip: 1.43 kB
97
- ℹ [ESM] dist/MimicAuthService.mjs.map  6.09 kB │ gzip: 1.85 kB
98
- ℹ [ESM] dist/ColdStorage.mjs.map  5.35 kB │ gzip: 1.64 kB
99
- ℹ [ESM] dist/MimicServerEngine.mjs  4.13 kB │ gzip: 1.37 kB
100
- ℹ [ESM] dist/Errors.mjs.map  4.00 kB │ gzip: 1.05 kB
101
- ℹ [ESM] dist/HotStorage.mjs  3.73 kB │ gzip: 1.27 kB
102
- ℹ [ESM] dist/Metrics.mjs  3.63 kB │ gzip: 1.01 kB
103
- ℹ [ESM] dist/PresenceManager.mjs  3.48 kB │ gzip: 1.04 kB
104
- ℹ [ESM] dist/testing/assertions.mjs  3.46 kB │ gzip: 1.15 kB
105
- ℹ [ESM] dist/Protocol.mjs  3.35 kB │ gzip: 1.06 kB
106
- ℹ [ESM] dist/testing/types.mjs.map  3.22 kB │ gzip: 1.15 kB
107
- ℹ [ESM] dist/MimicAuthService.mjs  2.23 kB │ gzip: 0.88 kB
108
- ℹ [ESM] dist/ColdStorage.mjs  2.01 kB │ gzip: 0.83 kB
109
- ℹ [ESM] dist/Errors.mjs  1.73 kB │ gzip: 0.61 kB
110
- ℹ [ESM] dist/Protocol.d.mts.map  1.57 kB │ gzip: 0.70 kB
111
- ℹ [ESM] dist/Types.d.mts.map  1.41 kB │ gzip: 0.65 kB
112
- ℹ [ESM] dist/MimicServerEngine.d.mts.map  1.09 kB │ gzip: 0.50 kB
113
- ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs  0.90 kB │ gzip: 0.42 kB
114
- ℹ [ESM] dist/ColdStorage.d.mts.map  0.70 kB │ gzip: 0.37 kB
115
- ℹ [ESM] dist/DocumentManager.d.mts.map  0.69 kB │ gzip: 0.38 kB
116
- ℹ [ESM] dist/HotStorage.d.mts.map  0.67 kB │ gzip: 0.35 kB
117
- ℹ [ESM] dist/MimicAuthService.d.mts.map  0.61 kB │ gzip: 0.35 kB
118
- ℹ [ESM] dist/Errors.d.mts.map  0.60 kB │ gzip: 0.32 kB
119
- ℹ [ESM] dist/testing/HotStorageTestSuite.d.mts.map  0.48 kB │ gzip: 0.29 kB
120
- ℹ [ESM] dist/_virtual/rolldown_runtime.mjs  0.47 kB │ gzip: 0.30 kB
121
- ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs  0.47 kB │ gzip: 0.30 kB
122
- ℹ [ESM] dist/PresenceManager.d.mts.map  0.45 kB │ gzip: 0.27 kB
123
- ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs  0.43 kB │ gzip: 0.24 kB
124
- ℹ [ESM] dist/testing/types.d.mts.map  0.38 kB │ gzip: 0.23 kB
125
- ℹ [ESM] dist/testing/types.mjs  0.35 kB │ gzip: 0.25 kB
126
- ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs  0.35 kB │ gzip: 0.23 kB
127
- ℹ [ESM] dist/testing/ColdStorageTestSuite.d.mts.map  0.35 kB │ gzip: 0.25 kB
128
- ℹ [ESM] dist/testing/StorageIntegrationTestSuite.d.mts.map  0.32 kB │ gzip: 0.21 kB
129
- ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs  0.30 kB │ gzip: 0.21 kB
130
- ℹ [ESM] dist/testing/FailingStorage.d.mts.map  0.26 kB │ gzip: 0.18 kB
131
- ℹ [ESM] dist/MimicClusterServerEngine.d.mts.map  0.25 kB │ gzip: 0.19 kB
132
- ℹ [ESM] dist/MimicServer.d.mts.map  0.22 kB │ gzip: 0.16 kB
133
- ℹ [ESM] dist/Metrics.d.mts.map  0.12 kB │ gzip: 0.12 kB
134
- ℹ [ESM] dist/index.d.mts  2.17 kB │ gzip: 0.53 kB
135
- ℹ [ESM] dist/testing/index.d.mts  0.91 kB │ gzip: 0.25 kB
136
- ℹ [ESM] dist/Protocol.d.mts  5.86 kB │ gzip: 1.34 kB
137
- ℹ [ESM] dist/Types.d.mts  5.47 kB │ gzip: 1.54 kB
138
- ℹ [ESM] dist/Errors.d.mts  4.86 kB │ gzip: 1.02 kB
139
- ℹ [ESM] dist/MimicServerEngine.d.mts  3.42 kB │ gzip: 1.06 kB
140
- ℹ [ESM] dist/testing/types.d.mts  2.76 kB │ gzip: 1.15 kB
141
- ℹ [ESM] dist/DocumentManager.d.mts  2.74 kB │ gzip: 0.84 kB
142
- ℹ [ESM] dist/HotStorage.d.mts  2.72 kB │ gzip: 1.08 kB
143
- ℹ [ESM] dist/MimicAuthService.d.mts  2.70 kB │ gzip: 1.04 kB
144
- ℹ [ESM] dist/testing/HotStorageTestSuite.d.mts  1.93 kB │ gzip: 0.57 kB
145
- ℹ [ESM] dist/ColdStorage.d.mts  1.74 kB │ gzip: 0.70 kB
146
- ℹ [ESM] dist/PresenceManager.d.mts  1.60 kB │ gzip: 0.63 kB
147
- ℹ [ESM] dist/Metrics.d.mts  1.59 kB │ gzip: 0.39 kB
148
- ℹ [ESM] dist/testing/ColdStorageTestSuite.d.mts  1.55 kB │ gzip: 0.50 kB
149
- ℹ [ESM] dist/testing/FailingStorage.d.mts  1.44 kB │ gzip: 0.46 kB
150
- ℹ [ESM] dist/testing/StorageIntegrationTestSuite.d.mts  1.43 kB │ gzip: 0.57 kB
151
- ℹ [ESM] dist/MimicClusterServerEngine.d.mts  0.82 kB │ gzip: 0.33 kB
152
- ℹ [ESM] dist/MimicServer.d.mts  0.74 kB │ gzip: 0.31 kB
153
- ℹ [ESM] 78 files, total: 518.62 kB
154
- ✔ Build complete in 6561ms
73
+ ℹ [CJS] 36 files, total: 57.19 kB
74
+ ✔ Build complete in 6533ms
75
+ ℹ [ESM] dist/index.mjs  1.29 kB │ gzip: 0.34 kB
76
+ ℹ [ESM] dist/testing/index.mjs  0.60 kB │ gzip: 0.19 kB
77
+ ℹ [ESM] dist/testing/HotStorageTestSuite.mjs.map 63.42 kB │ gzip: 8.61 kB
78
+ ℹ [ESM] dist/testing/StorageIntegrationTestSuite.mjs.map 35.60 kB │ gzip: 6.44 kB
79
+ ℹ [ESM] dist/testing/HotStorageTestSuite.mjs 34.21 kB │ gzip: 5.06 kB
80
+ ℹ [ESM] dist/testing/ColdStorageTestSuite.mjs.map 31.92 kB │ gzip: 5.21 kB
81
+ ℹ [ESM] dist/MimicClusterServerEngine.mjs.map 27.48 kB │ gzip: 6.52 kB
82
+ ℹ [ESM] dist/DocumentInstance.mjs.map 22.64 kB │ gzip: 5.89 kB
83
+ ℹ [ESM] dist/MimicServer.mjs.map 21.35 kB │ gzip: 5.64 kB
84
+ ℹ [ESM] dist/testing/StorageIntegrationTestSuite.mjs 18.49 kB │ gzip: 3.63 kB
85
+ ℹ [ESM] dist/testing/ColdStorageTestSuite.mjs 16.50 kB │ gzip: 3.21 kB
86
+ ℹ [ESM] dist/MimicServerEngine.mjs.map 16.45 kB │ gzip: 4.29 kB
87
+ ℹ [ESM] dist/testing/FailingStorage.mjs.map 15.60 kB │ gzip: 3.07 kB
88
+ ℹ [ESM] dist/MimicClusterServerEngine.mjs 13.13 kB │ gzip: 3.38 kB
89
+ ℹ [ESM] dist/HotStorage.mjs.map 10.81 kB │ gzip: 3.04 kB
90
+ ℹ [ESM] dist/MimicServer.mjs  9.90 kB │ gzip: 2.88 kB
91
+ ℹ [ESM] dist/DocumentInstance.mjs  9.86 kB │ gzip: 2.72 kB
92
+ ℹ [ESM] dist/PresenceManager.mjs.map  9.38 kB │ gzip: 2.38 kB
93
+ ℹ [ESM] dist/Protocol.mjs.map  9.18 kB │ gzip: 2.15 kB
94
+ ℹ [ESM] dist/testing/assertions.mjs.map  7.31 kB │ gzip: 2.01 kB
95
+ ℹ [ESM] dist/MimicServerEngine.mjs  6.69 kB │ gzip: 2.04 kB
96
+ ℹ [ESM] dist/testing/FailingStorage.mjs  6.49 kB │ gzip: 1.52 kB
97
+ ℹ [ESM] dist/Metrics.mjs.map  6.13 kB │ gzip: 1.43 kB
98
+ ℹ [ESM] dist/MimicAuthService.mjs.map  6.09 kB │ gzip: 1.85 kB
99
+ ℹ [ESM] dist/ColdStorage.mjs.map  5.35 kB │ gzip: 1.64 kB
100
+ ℹ [ESM] dist/Errors.mjs.map  4.00 kB │ gzip: 1.05 kB
101
+ ℹ [ESM] dist/HotStorage.mjs  3.73 kB │ gzip: 1.27 kB
102
+ ℹ [ESM] dist/Metrics.mjs  3.63 kB │ gzip: 1.01 kB
103
+ ℹ [ESM] dist/PresenceManager.mjs  3.48 kB │ gzip: 1.04 kB
104
+ ℹ [ESM] dist/testing/assertions.mjs  3.46 kB │ gzip: 1.15 kB
105
+ ℹ [ESM] dist/Protocol.mjs  3.35 kB │ gzip: 1.06 kB
106
+ ℹ [ESM] dist/testing/types.mjs.map  3.22 kB │ gzip: 1.15 kB
107
+ ℹ [ESM] dist/MimicAuthService.mjs  2.23 kB │ gzip: 0.88 kB
108
+ ℹ [ESM] dist/ColdStorage.mjs  2.01 kB │ gzip: 0.83 kB
109
+ ℹ [ESM] dist/Errors.mjs  1.73 kB │ gzip: 0.61 kB
110
+ ℹ [ESM] dist/Protocol.d.mts.map  1.57 kB │ gzip: 0.70 kB
111
+ ℹ [ESM] dist/Types.d.mts.map  1.41 kB │ gzip: 0.65 kB
112
+ ℹ [ESM] dist/DocumentInstance.d.mts.map  1.18 kB │ gzip: 0.54 kB
113
+ ℹ [ESM] dist/MimicServerEngine.d.mts.map  0.97 kB │ gzip: 0.49 kB
114
+ ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs  0.90 kB │ gzip: 0.42 kB
115
+ ℹ [ESM] dist/ColdStorage.d.mts.map  0.70 kB │ gzip: 0.37 kB
116
+ ℹ [ESM] dist/HotStorage.d.mts.map  0.67 kB │ gzip: 0.35 kB
117
+ ℹ [ESM] dist/MimicAuthService.d.mts.map  0.61 kB │ gzip: 0.35 kB
118
+ ℹ [ESM] dist/Errors.d.mts.map  0.60 kB │ gzip: 0.32 kB
119
+ ℹ [ESM] dist/testing/HotStorageTestSuite.d.mts.map  0.48 kB │ gzip: 0.29 kB
120
+ ℹ [ESM] dist/_virtual/rolldown_runtime.mjs  0.47 kB │ gzip: 0.30 kB
121
+ ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs  0.47 kB │ gzip: 0.30 kB
122
+ ℹ [ESM] dist/PresenceManager.d.mts.map  0.45 kB │ gzip: 0.27 kB
123
+ ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs  0.43 kB │ gzip: 0.24 kB
124
+ ℹ [ESM] dist/testing/types.d.mts.map  0.38 kB │ gzip: 0.23 kB
125
+ ℹ [ESM] dist/testing/types.mjs  0.35 kB │ gzip: 0.25 kB
126
+ ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs  0.35 kB │ gzip: 0.23 kB
127
+ ℹ [ESM] dist/testing/ColdStorageTestSuite.d.mts.map  0.35 kB │ gzip: 0.25 kB
128
+ ℹ [ESM] dist/testing/StorageIntegrationTestSuite.d.mts.map  0.32 kB │ gzip: 0.21 kB
129
+ ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs  0.30 kB │ gzip: 0.21 kB
130
+ ℹ [ESM] dist/testing/FailingStorage.d.mts.map  0.26 kB │ gzip: 0.18 kB
131
+ ℹ [ESM] dist/MimicClusterServerEngine.d.mts.map  0.25 kB │ gzip: 0.19 kB
132
+ ℹ [ESM] dist/MimicServer.d.mts.map  0.22 kB │ gzip: 0.16 kB
133
+ ℹ [ESM] dist/Metrics.d.mts.map  0.12 kB │ gzip: 0.12 kB
134
+ ℹ [ESM] dist/index.d.mts  2.14 kB │ gzip: 0.53 kB
135
+ ℹ [ESM] dist/testing/index.d.mts  0.91 kB │ gzip: 0.25 kB
136
+ ℹ [ESM] dist/Protocol.d.mts  5.84 kB │ gzip: 1.34 kB
137
+ ℹ [ESM] dist/Types.d.mts  5.47 kB │ gzip: 1.54 kB
138
+ ℹ [ESM] dist/Errors.d.mts  4.86 kB │ gzip: 1.02 kB
139
+ ℹ [ESM] dist/MimicServerEngine.d.mts  3.60 kB │ gzip: 1.09 kB
140
+ ℹ [ESM] dist/DocumentInstance.d.mts  2.81 kB │ gzip: 0.93 kB
141
+ ℹ [ESM] dist/testing/types.d.mts  2.76 kB │ gzip: 1.15 kB
142
+ ℹ [ESM] dist/HotStorage.d.mts  2.72 kB │ gzip: 1.08 kB
143
+ ℹ [ESM] dist/MimicAuthService.d.mts  2.70 kB │ gzip: 1.04 kB
144
+ ℹ [ESM] dist/testing/HotStorageTestSuite.d.mts  1.93 kB │ gzip: 0.57 kB
145
+ ℹ [ESM] dist/ColdStorage.d.mts  1.74 kB │ gzip: 0.70 kB
146
+ ℹ [ESM] dist/PresenceManager.d.mts  1.60 kB │ gzip: 0.63 kB
147
+ ℹ [ESM] dist/Metrics.d.mts  1.59 kB │ gzip: 0.39 kB
148
+ ℹ [ESM] dist/testing/ColdStorageTestSuite.d.mts  1.55 kB │ gzip: 0.50 kB
149
+ ℹ [ESM] dist/testing/FailingStorage.d.mts  1.44 kB │ gzip: 0.46 kB
150
+ ℹ [ESM] dist/testing/StorageIntegrationTestSuite.d.mts  1.43 kB │ gzip: 0.57 kB
151
+ ℹ [ESM] dist/MimicClusterServerEngine.d.mts  0.82 kB │ gzip: 0.33 kB
152
+ ℹ [ESM] dist/MimicServer.d.mts  0.74 kB │ gzip: 0.31 kB
153
+ ℹ [ESM] 78 files, total: 497.18 kB
154
+ ✔ Build complete in 6572ms
@@ -0,0 +1,255 @@
1
+ const require_Metrics = require('./Metrics.cjs');
2
+ let effect = require("effect");
3
+ let _voidhash_mimic = require("@voidhash/mimic");
4
+ let _voidhash_mimic_server = require("@voidhash/mimic/server");
5
+
6
+ //#region src/DocumentInstance.ts
7
+ /**
8
+ * @voidhash/mimic-effect - DocumentInstance
9
+ *
10
+ * Manages the lifecycle of a single document including:
11
+ * - Restoration from storage (cold storage + WAL replay)
12
+ * - Transaction submission with WAL persistence
13
+ * - Snapshot saving and trigger checking
14
+ *
15
+ * Used by both MimicServerEngine (single-node) and MimicClusterServerEngine (clustered).
16
+ */
17
+ /**
18
+ * Create a DocumentInstance for a single document.
19
+ *
20
+ * This handles:
21
+ * - Loading from cold storage or computing initial state
22
+ * - Persisting initial state immediately (crash safety)
23
+ * - Replaying WAL entries
24
+ * - Transaction submission with WAL persistence
25
+ * - Snapshot saving
26
+ */
27
+ const make = (documentId, config, coldStorage, hotStorage) => effect.Effect.gen(function* () {
28
+ const SCHEMA_VERSION = 1;
29
+ const storedDoc = yield* coldStorage.load(documentId);
30
+ let initialState;
31
+ let initialVersion = 0;
32
+ if (storedDoc) {
33
+ initialState = storedDoc.state;
34
+ initialVersion = storedDoc.version;
35
+ } else initialState = yield* computeInitialState(config, documentId);
36
+ const pubsub = yield* effect.PubSub.unbounded();
37
+ const lastSnapshotVersionRef = yield* effect.Ref.make(initialVersion);
38
+ const lastSnapshotTimeRef = yield* effect.Ref.make(Date.now());
39
+ const transactionsSinceSnapshotRef = yield* effect.Ref.make(0);
40
+ const lastActivityTimeRef = yield* effect.Ref.make(Date.now());
41
+ const document = _voidhash_mimic_server.ServerDocument.make({
42
+ schema: config.schema,
43
+ initialState,
44
+ initialVersion,
45
+ maxTransactionHistory: config.maxTransactionHistory,
46
+ onBroadcast: (message) => {
47
+ effect.Effect.runSync(effect.PubSub.publish(pubsub, {
48
+ type: "transaction",
49
+ transaction: message.transaction,
50
+ version: message.version
51
+ }));
52
+ },
53
+ onRejection: (transactionId, reason) => {
54
+ effect.Effect.runSync(effect.PubSub.publish(pubsub, {
55
+ type: "error",
56
+ transactionId,
57
+ reason
58
+ }));
59
+ }
60
+ });
61
+ if (!storedDoc) {
62
+ const initialStoredDoc = createStoredDocument(document.get(), 0, SCHEMA_VERSION);
63
+ yield* coldStorage.save(documentId, initialStoredDoc);
64
+ yield* effect.Effect.logDebug("Initial state persisted to cold storage", { documentId });
65
+ }
66
+ const walEntries = yield* hotStorage.getEntries(documentId, initialVersion);
67
+ yield* verifyWalContinuity(documentId, walEntries, initialVersion);
68
+ yield* replayWalEntries(documentId, document, walEntries);
69
+ if (storedDoc) yield* effect.Metric.increment(require_Metrics.documentsRestored);
70
+ else yield* effect.Metric.increment(require_Metrics.documentsCreated);
71
+ yield* effect.Metric.incrementBy(require_Metrics.documentsActive, 1);
72
+ const getSnapshotTracking = effect.Effect.gen(function* () {
73
+ return {
74
+ lastSnapshotVersion: yield* effect.Ref.get(lastSnapshotVersionRef),
75
+ lastSnapshotTime: yield* effect.Ref.get(lastSnapshotTimeRef),
76
+ transactionsSinceSnapshot: yield* effect.Ref.get(transactionsSinceSnapshotRef)
77
+ };
78
+ });
79
+ const saveSnapshot = effect.Effect.fn("document.snapshot.save")(function* () {
80
+ var _baseSnapshot$version;
81
+ const targetVersion = document.getVersion();
82
+ if (targetVersion <= (yield* effect.Ref.get(lastSnapshotVersionRef))) return;
83
+ const snapshotStartTime = Date.now();
84
+ const baseSnapshot = yield* coldStorage.load(documentId);
85
+ const baseVersion = (_baseSnapshot$version = baseSnapshot === null || baseSnapshot === void 0 ? void 0 : baseSnapshot.version) !== null && _baseSnapshot$version !== void 0 ? _baseSnapshot$version : 0;
86
+ const baseState = baseSnapshot === null || baseSnapshot === void 0 ? void 0 : baseSnapshot.state;
87
+ const walEntries$1 = yield* hotStorage.getEntries(documentId, baseVersion);
88
+ const snapshotResult = computeSnapshotState(config.schema, baseState, walEntries$1, targetVersion);
89
+ if (!snapshotResult) return;
90
+ const currentLastSnapshot = yield* effect.Ref.get(lastSnapshotVersionRef);
91
+ if (snapshotResult.version <= currentLastSnapshot) return;
92
+ const storedDoc$1 = createStoredDocument(snapshotResult.state, snapshotResult.version, SCHEMA_VERSION);
93
+ yield* coldStorage.save(documentId, storedDoc$1);
94
+ const snapshotDuration = Date.now() - snapshotStartTime;
95
+ yield* effect.Metric.increment(require_Metrics.storageSnapshots);
96
+ yield* effect.Metric.update(require_Metrics.storageSnapshotLatency, snapshotDuration);
97
+ yield* effect.Ref.set(lastSnapshotVersionRef, snapshotResult.version);
98
+ yield* effect.Ref.set(lastSnapshotTimeRef, Date.now());
99
+ yield* effect.Ref.set(transactionsSinceSnapshotRef, 0);
100
+ yield* effect.Effect.catchAll(hotStorage.truncate(documentId, snapshotResult.version), (e) => effect.Effect.logWarning("WAL truncate failed - will retry on next snapshot", {
101
+ documentId,
102
+ version: snapshotResult.version,
103
+ error: e
104
+ }));
105
+ });
106
+ const checkSnapshotTriggers = effect.Effect.fn("document.snapshot.check-triggers")(function* () {
107
+ if (shouldTriggerSnapshot(yield* effect.Ref.get(transactionsSinceSnapshotRef), yield* effect.Ref.get(lastSnapshotTimeRef), config.snapshot)) yield* saveSnapshot();
108
+ });
109
+ return {
110
+ document,
111
+ pubsub,
112
+ getSnapshotTracking,
113
+ submit: effect.Effect.fn("document.transaction.submit")(function* (transaction) {
114
+ const submitStartTime = Date.now();
115
+ yield* effect.Ref.set(lastActivityTimeRef, Date.now());
116
+ const validation = document.validate(transaction);
117
+ if (!validation.valid) {
118
+ yield* effect.Metric.increment(require_Metrics.transactionsRejected);
119
+ const latency$1 = Date.now() - submitStartTime;
120
+ yield* effect.Metric.update(require_Metrics.transactionsLatency, latency$1);
121
+ return {
122
+ success: false,
123
+ reason: validation.reason
124
+ };
125
+ }
126
+ const walEntry = {
127
+ transaction,
128
+ version: validation.nextVersion,
129
+ timestamp: Date.now()
130
+ };
131
+ const appendResult = yield* effect.Effect.either(hotStorage.appendWithCheck(documentId, walEntry, validation.nextVersion));
132
+ if (appendResult._tag === "Left") {
133
+ yield* effect.Effect.logError("WAL append failed", {
134
+ documentId,
135
+ version: validation.nextVersion,
136
+ error: appendResult.left
137
+ });
138
+ yield* effect.Metric.increment(require_Metrics.walAppendFailures);
139
+ const latency$1 = Date.now() - submitStartTime;
140
+ yield* effect.Metric.update(require_Metrics.transactionsLatency, latency$1);
141
+ return {
142
+ success: false,
143
+ reason: "Storage unavailable. Please retry."
144
+ };
145
+ }
146
+ document.apply(transaction);
147
+ const latency = Date.now() - submitStartTime;
148
+ yield* effect.Metric.update(require_Metrics.transactionsLatency, latency);
149
+ yield* effect.Metric.increment(require_Metrics.transactionsProcessed);
150
+ yield* effect.Metric.increment(require_Metrics.storageWalAppends);
151
+ yield* effect.Ref.update(transactionsSinceSnapshotRef, (n) => n + 1);
152
+ yield* checkSnapshotTriggers();
153
+ return {
154
+ success: true,
155
+ version: validation.nextVersion
156
+ };
157
+ }),
158
+ saveSnapshot,
159
+ checkSnapshotTriggers,
160
+ touch: effect.Effect.fn("document.touch")(function* () {
161
+ yield* effect.Ref.set(lastActivityTimeRef, Date.now());
162
+ }),
163
+ getVersion: () => document.getVersion(),
164
+ getSnapshot: () => document.getSnapshot()
165
+ };
166
+ });
167
+ /**
168
+ * Compute initial state for a new document.
169
+ */
170
+ const computeInitialState = (config, documentId) => {
171
+ if (config.initial === void 0) return effect.Effect.succeed(void 0);
172
+ if (typeof config.initial === "function") return config.initial({ documentId });
173
+ return effect.Effect.succeed(config.initial);
174
+ };
175
+ /**
176
+ * Verify WAL continuity and log warnings for any gaps.
177
+ */
178
+ const verifyWalContinuity = effect.Effect.fn("document.wal.verify")(function* (documentId, walEntries, baseVersion) {
179
+ if (walEntries.length === 0) return;
180
+ const firstWalVersion = walEntries[0].version;
181
+ const expectedFirst = baseVersion + 1;
182
+ if (firstWalVersion !== expectedFirst) {
183
+ yield* effect.Effect.logWarning("WAL version gap detected", {
184
+ documentId,
185
+ snapshotVersion: baseVersion,
186
+ firstWalVersion,
187
+ expectedFirst
188
+ });
189
+ yield* effect.Metric.increment(require_Metrics.storageVersionGaps);
190
+ }
191
+ for (let i = 1; i < walEntries.length; i++) {
192
+ const prev = walEntries[i - 1].version;
193
+ const curr = walEntries[i].version;
194
+ if (curr !== prev + 1) yield* effect.Effect.logWarning("WAL internal gap detected", {
195
+ documentId,
196
+ previousVersion: prev,
197
+ currentVersion: curr
198
+ });
199
+ }
200
+ });
201
+ /**
202
+ * Replay WAL entries onto a ServerDocument.
203
+ */
204
+ const replayWalEntries = effect.Effect.fn("document.wal.replay")(function* (documentId, document, walEntries) {
205
+ for (const entry of walEntries) {
206
+ const result = document.submit(entry.transaction);
207
+ if (!result.success) yield* effect.Effect.logWarning("Skipping corrupted WAL entry", {
208
+ documentId,
209
+ version: entry.version,
210
+ reason: result.reason
211
+ });
212
+ }
213
+ });
214
+ /**
215
+ * Compute snapshot state by replaying WAL entries on a base state.
216
+ */
217
+ const computeSnapshotState = (schema, baseState, walEntries, targetVersion) => {
218
+ const relevantEntries = walEntries.filter((e) => e.version <= targetVersion);
219
+ if (relevantEntries.length === 0 && baseState === void 0) return;
220
+ let snapshotState = baseState;
221
+ for (const entry of relevantEntries) {
222
+ const tempDoc = _voidhash_mimic.Document.make(schema, { initialState: snapshotState });
223
+ tempDoc.apply(entry.transaction.ops);
224
+ snapshotState = tempDoc.get();
225
+ }
226
+ if (snapshotState === void 0) return;
227
+ const snapshotVersion = relevantEntries.length > 0 ? relevantEntries[relevantEntries.length - 1].version : 0;
228
+ return {
229
+ state: snapshotState,
230
+ version: snapshotVersion
231
+ };
232
+ };
233
+ /**
234
+ * Check if a snapshot should be triggered.
235
+ */
236
+ const shouldTriggerSnapshot = (transactionsSinceSnapshot, lastSnapshotTime, config) => {
237
+ const now = Date.now();
238
+ const intervalMs = effect.Duration.toMillis(config.interval);
239
+ if (transactionsSinceSnapshot >= config.transactionThreshold) return true;
240
+ if (now - lastSnapshotTime >= intervalMs) return true;
241
+ return false;
242
+ };
243
+ /**
244
+ * Create a StoredDocument for persistence.
245
+ */
246
+ const createStoredDocument = (state, version, schemaVersion) => ({
247
+ state,
248
+ version,
249
+ schemaVersion,
250
+ savedAt: Date.now()
251
+ });
252
+ const DocumentInstance = { make };
253
+
254
+ //#endregion
255
+ exports.DocumentInstance = DocumentInstance;
@@ -0,0 +1,74 @@
1
+ import { ColdStorageError, HotStorageError } from "./Errors.cjs";
2
+ import { ServerBroadcast } from "./Protocol.cjs";
3
+ import { ColdStorage } from "./ColdStorage.cjs";
4
+ import { HotStorage } from "./HotStorage.cjs";
5
+ import { Duration, Effect, PubSub } from "effect";
6
+ import { Primitive, Transaction } from "@voidhash/mimic";
7
+ import { ServerDocument } from "@voidhash/mimic/server";
8
+
9
+ //#region src/DocumentInstance.d.ts
10
+
11
+ /**
12
+ * Result of submitting a transaction
13
+ */
14
+ type SubmitResult = {
15
+ readonly success: true;
16
+ readonly version: number;
17
+ } | {
18
+ readonly success: false;
19
+ readonly reason: string;
20
+ };
21
+ /**
22
+ * Configuration for a DocumentInstance
23
+ */
24
+ interface DocumentInstanceConfig<TSchema extends Primitive.AnyPrimitive> {
25
+ readonly schema: TSchema;
26
+ readonly initial?: Primitive.InferSetInput<TSchema> | ((ctx: {
27
+ documentId: string;
28
+ }) => Effect.Effect<Primitive.InferSetInput<TSchema>>);
29
+ readonly maxTransactionHistory: number;
30
+ readonly snapshot: {
31
+ readonly interval: Duration.Duration;
32
+ readonly transactionThreshold: number;
33
+ };
34
+ }
35
+ /**
36
+ * Snapshot tracking state
37
+ */
38
+ interface SnapshotTracking {
39
+ readonly lastSnapshotVersion: number;
40
+ readonly lastSnapshotTime: number;
41
+ readonly transactionsSinceSnapshot: number;
42
+ }
43
+ /**
44
+ * A DocumentInstance manages a single document's lifecycle
45
+ */
46
+ interface DocumentInstance<TSchema extends Primitive.AnyPrimitive> {
47
+ /** The underlying ServerDocument */
48
+ readonly document: ServerDocument.ServerDocument<TSchema>;
49
+ /** PubSub for broadcasting messages to subscribers */
50
+ readonly pubsub: PubSub.PubSub<ServerBroadcast>;
51
+ /** Current snapshot tracking state */
52
+ readonly getSnapshotTracking: Effect.Effect<SnapshotTracking>;
53
+ /** Submit a transaction */
54
+ readonly submit: (transaction: Transaction.Transaction) => Effect.Effect<SubmitResult, ColdStorageError | HotStorageError>;
55
+ /** Save a snapshot to cold storage */
56
+ readonly saveSnapshot: () => Effect.Effect<void, ColdStorageError | HotStorageError>;
57
+ /** Check if snapshot should be triggered and save if needed */
58
+ readonly checkSnapshotTriggers: () => Effect.Effect<void, ColdStorageError | HotStorageError>;
59
+ /** Update last activity time (for external tracking) */
60
+ readonly touch: () => Effect.Effect<void>;
61
+ /** Get current document version */
62
+ readonly getVersion: () => number;
63
+ /** Get document snapshot */
64
+ readonly getSnapshot: () => {
65
+ state: unknown;
66
+ version: number;
67
+ };
68
+ }
69
+ declare const DocumentInstance: {
70
+ make: <TSchema extends Primitive.AnyPrimitive>(documentId: string, config: DocumentInstanceConfig<TSchema>, coldStorage: ColdStorage, hotStorage: HotStorage) => Effect.Effect<DocumentInstance<TSchema>, ColdStorageError | HotStorageError>;
71
+ };
72
+ //#endregion
73
+ export { DocumentInstance, SubmitResult };
74
+ //# sourceMappingURL=DocumentInstance.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentInstance.d.cts","names":[],"sources":["../src/DocumentInstance.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;AAkDA;AASiB,KA/BL,YAAA,GA+BqB;EAAiB,SAAU,OAAA,EAAA,IAAA;EAET,SAAA,OAAA,EAAA,MAAA;CAA9B,GAAA;EAEY,SAAA,OAAA,EAAA,KAAA;EAAd,SAAO,MAAA,EAAA,MAAA;CAEoB;;;;AAE2C,UAhCxE,sBAgCwE,CAAA,gBAhCjC,SAAA,CAAU,YAgCuB,CAAA,CAAA;EAAmB,SAAA,MAAA,EA/BzF,OA+ByF;EAA/C,SAAO,OAAA,CAAA,EA7B9D,SAAA,CAAU,aA6BoD,CA7BtC,OA6BsC,CAAA,GAAA,CAAA,CAAA,GAAA,EAAA;IAEjB,UAAA,EAAA,MAAA;EAAmB,CAAA,EAAA,GA9B9B,MAAA,CAAO,MA8BuB,CA9BhB,SAAA,CAAU,aA8BM,CA9BQ,OA8BR,CAAA,CAAA,CAAA;EAAvC,SAAO,qBAAA,EAAA,MAAA;EAEsB,SAAA,QAAA,EAAA;IAAmB,SAAA,QAAA,EA7BxD,QAAA,CAAS,QA6B+C;IAAhC,SAAA,oBAAA,EAAA,MAAA;EAEvB,CAAA;;AAkbxB;;;AA3ZU,UA9CO,gBAAA,CA8CP;EACK,SAAA,mBAAA,EAAA,MAAA;EACD,SAAA,gBAAA,EAAA,MAAA;EACoB,SAAA,yBAAA,EAAA,MAAA;;;;;AAAlB,UAxCC,gBAwCD,CAAA,gBAxCkC,SAAA,CAAU,YAwC5C,CAAA,CAAA;;qBAtCK,cAAA,CAAe,eAAe;;mBAEhC,MAAA,CAAO,OAAO;;gCAED,MAAA,CAAO,OAAO;;iCAEb,WAAA,CAAY,gBAAgB,MAAA,CAAO,OAAO,cAAc,mBAAmB;;+BAE7E,MAAA,CAAO,aAAa,mBAAmB;;wCAE9B,MAAA,CAAO,aAAa,mBAAmB;;wBAEvD,MAAA,CAAO;;;;;;;;;cAkblB;yBA7ZwB,SAAA,CAAU,0CAErC,uBAAuB,uBAClB,yBACD,eACX,MAAA,CAAO,OAAO,iBAAiB,UAAU,mBAAmB"}