document-drive 4.0.4 → 4.1.0-dev.10

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 (279) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/prisma/schema.prisma +1 -2
  6. package/dist/src/drive-document-model/gen/document-model.js +3 -3
  7. package/dist/src/drive-document-model/gen/document-model.js.map +1 -1
  8. package/dist/src/drive-document-model/gen/drive/actions.d.ts +34 -10
  9. package/dist/src/drive-document-model/gen/drive/actions.d.ts.map +1 -1
  10. package/dist/src/drive-document-model/gen/node/actions.d.ts +30 -9
  11. package/dist/src/drive-document-model/gen/node/actions.d.ts.map +1 -1
  12. package/dist/src/drive-document-model/gen/node/creators.d.ts +6 -2
  13. package/dist/src/drive-document-model/gen/node/creators.d.ts.map +1 -1
  14. package/dist/src/drive-document-model/gen/node/creators.js +8 -1
  15. package/dist/src/drive-document-model/gen/node/creators.js.map +1 -1
  16. package/dist/src/drive-document-model/gen/reducer.d.ts.map +1 -1
  17. package/dist/src/drive-document-model/gen/reducer.js +32 -31
  18. package/dist/src/drive-document-model/gen/reducer.js.map +1 -1
  19. package/dist/src/drive-document-model/gen/schema/types.d.ts +1 -14
  20. package/dist/src/drive-document-model/gen/schema/types.d.ts.map +1 -1
  21. package/dist/src/drive-document-model/gen/schema/zod.d.ts +1 -5
  22. package/dist/src/drive-document-model/gen/schema/zod.d.ts.map +1 -1
  23. package/dist/src/drive-document-model/gen/schema/zod.js +0 -12
  24. package/dist/src/drive-document-model/gen/schema/zod.js.map +1 -1
  25. package/dist/src/drive-document-model/gen/types.d.ts +17 -5
  26. package/dist/src/drive-document-model/gen/types.d.ts.map +1 -1
  27. package/dist/src/drive-document-model/gen/types.js.map +1 -1
  28. package/dist/src/drive-document-model/module.d.ts +2 -1
  29. package/dist/src/drive-document-model/module.d.ts.map +1 -1
  30. package/dist/src/drive-document-model/src/reducers/node.d.ts.map +1 -1
  31. package/dist/src/drive-document-model/src/reducers/node.js +1 -25
  32. package/dist/src/drive-document-model/src/reducers/node.js.map +1 -1
  33. package/dist/src/drive-document-model/src/tests/actions.test.js +1 -23
  34. package/dist/src/drive-document-model/src/tests/actions.test.js.map +1 -1
  35. package/dist/src/drive-document-model/src/tests/base.test.js +0 -32
  36. package/dist/src/drive-document-model/src/tests/base.test.js.map +1 -1
  37. package/dist/src/drive-document-model/src/tests/node.test.js +4 -0
  38. package/dist/src/drive-document-model/src/tests/node.test.js.map +1 -1
  39. package/dist/src/drive-document-model/src/tests/utils.test.js +7 -37
  40. package/dist/src/drive-document-model/src/tests/utils.test.js.map +1 -1
  41. package/dist/src/drive-document-model/src/utils.d.ts +2 -8
  42. package/dist/src/drive-document-model/src/utils.d.ts.map +1 -1
  43. package/dist/src/drive-document-model/src/utils.js +6 -55
  44. package/dist/src/drive-document-model/src/utils.js.map +1 -1
  45. package/dist/src/processors/types.d.ts +2 -1
  46. package/dist/src/processors/types.d.ts.map +1 -1
  47. package/dist/src/queue/base.d.ts +6 -27
  48. package/dist/src/queue/base.d.ts.map +1 -1
  49. package/dist/src/queue/base.js +15 -203
  50. package/dist/src/queue/base.js.map +1 -1
  51. package/dist/src/queue/event.d.ts +41 -0
  52. package/dist/src/queue/event.d.ts.map +1 -0
  53. package/dist/src/queue/event.js +222 -0
  54. package/dist/src/queue/event.js.map +1 -0
  55. package/dist/src/queue/redis.d.ts +1 -27
  56. package/dist/src/queue/redis.d.ts.map +1 -1
  57. package/dist/src/queue/redis.js +122 -110
  58. package/dist/src/queue/redis.js.map +1 -1
  59. package/dist/src/queue/types.d.ts +18 -12
  60. package/dist/src/queue/types.d.ts.map +1 -1
  61. package/dist/src/queue/types.js +3 -0
  62. package/dist/src/queue/types.js.map +1 -1
  63. package/dist/src/read-mode/server.js.map +1 -1
  64. package/dist/src/read-mode/types.d.ts.map +1 -1
  65. package/dist/src/server/base-server.d.ts +90 -13
  66. package/dist/src/server/base-server.d.ts.map +1 -1
  67. package/dist/src/server/base-server.js +552 -250
  68. package/dist/src/server/base-server.js.map +1 -1
  69. package/dist/src/server/builder.js +2 -2
  70. package/dist/src/server/builder.js.map +1 -1
  71. package/dist/src/server/error.d.ts +3 -3
  72. package/dist/src/server/error.d.ts.map +1 -1
  73. package/dist/src/server/error.js +2 -2
  74. package/dist/src/server/error.js.map +1 -1
  75. package/dist/src/server/listener/listener-manager.d.ts +5 -6
  76. package/dist/src/server/listener/listener-manager.d.ts.map +1 -1
  77. package/dist/src/server/listener/listener-manager.js +62 -79
  78. package/dist/src/server/listener/listener-manager.js.map +1 -1
  79. package/dist/src/server/listener/transmitter/internal.d.ts +4 -4
  80. package/dist/src/server/listener/transmitter/internal.d.ts.map +1 -1
  81. package/dist/src/server/listener/transmitter/internal.js +18 -13
  82. package/dist/src/server/listener/transmitter/internal.js.map +1 -1
  83. package/dist/src/server/listener/transmitter/pull-responder.d.ts.map +1 -1
  84. package/dist/src/server/listener/transmitter/pull-responder.js +14 -8
  85. package/dist/src/server/listener/transmitter/pull-responder.js.map +1 -1
  86. package/dist/src/server/listener/transmitter/switchboard-push.d.ts.map +1 -1
  87. package/dist/src/server/listener/transmitter/switchboard-push.js +13 -8
  88. package/dist/src/server/listener/transmitter/switchboard-push.js.map +1 -1
  89. package/dist/src/server/listener/util.d.ts +1 -1
  90. package/dist/src/server/listener/util.d.ts.map +1 -1
  91. package/dist/src/server/listener/util.js +1 -1
  92. package/dist/src/server/listener/util.js.map +1 -1
  93. package/dist/src/server/sync-manager.d.ts +8 -10
  94. package/dist/src/server/sync-manager.d.ts.map +1 -1
  95. package/dist/src/server/sync-manager.js +62 -147
  96. package/dist/src/server/sync-manager.js.map +1 -1
  97. package/dist/src/server/sync-unit-map.d.ts +137 -0
  98. package/dist/src/server/sync-unit-map.d.ts.map +1 -0
  99. package/dist/src/server/sync-unit-map.js +234 -0
  100. package/dist/src/server/sync-unit-map.js.map +1 -0
  101. package/dist/src/server/types.d.ts +122 -38
  102. package/dist/src/server/types.d.ts.map +1 -1
  103. package/dist/src/server/types.js.map +1 -1
  104. package/dist/src/server/utils.d.ts +12 -3
  105. package/dist/src/server/utils.d.ts.map +1 -1
  106. package/dist/src/server/utils.js +44 -1
  107. package/dist/src/server/utils.js.map +1 -1
  108. package/dist/src/storage/browser.d.ts +8 -4
  109. package/dist/src/storage/browser.d.ts.map +1 -1
  110. package/dist/src/storage/browser.js +80 -22
  111. package/dist/src/storage/browser.js.map +1 -1
  112. package/dist/src/storage/filesystem.d.ts +8 -4
  113. package/dist/src/storage/filesystem.d.ts.map +1 -1
  114. package/dist/src/storage/filesystem.js +79 -22
  115. package/dist/src/storage/filesystem.js.map +1 -1
  116. package/dist/src/storage/ipfs.d.ts.map +1 -1
  117. package/dist/src/storage/ipfs.js.map +1 -1
  118. package/dist/src/storage/memory.d.ts +9 -5
  119. package/dist/src/storage/memory.d.ts.map +1 -1
  120. package/dist/src/storage/memory.js +76 -22
  121. package/dist/src/storage/memory.js.map +1 -1
  122. package/dist/src/storage/prisma/client/edge.js +5 -4
  123. package/dist/src/storage/prisma/client/index-browser.js +2 -1
  124. package/dist/src/storage/prisma/client/index.d.ts +58 -249
  125. package/dist/src/storage/prisma/client/index.js +5 -4
  126. package/dist/src/storage/prisma/client/package.json +1 -1
  127. package/dist/src/storage/prisma/client/schema.prisma +2 -3
  128. package/dist/src/storage/prisma/client/wasm.js +2 -1
  129. package/dist/src/storage/prisma/prisma.d.ts +13 -8
  130. package/dist/src/storage/prisma/prisma.d.ts.map +1 -1
  131. package/dist/src/storage/prisma/prisma.js +119 -51
  132. package/dist/src/storage/prisma/prisma.js.map +1 -1
  133. package/dist/src/storage/types.d.ts +45 -6
  134. package/dist/src/storage/types.d.ts.map +1 -1
  135. package/dist/src/storage/utils.d.ts +3 -0
  136. package/dist/src/storage/utils.d.ts.map +1 -1
  137. package/dist/src/storage/utils.js +14 -0
  138. package/dist/src/storage/utils.js.map +1 -1
  139. package/dist/src/utils/default-drives-manager.d.ts.map +1 -1
  140. package/dist/src/utils/default-drives-manager.js.map +1 -1
  141. package/dist/src/utils/gql-transformations.d.ts +14 -5
  142. package/dist/src/utils/gql-transformations.d.ts.map +1 -1
  143. package/dist/src/utils/gql-transformations.js +1 -0
  144. package/dist/src/utils/gql-transformations.js.map +1 -1
  145. package/dist/src/utils/graphql.d.ts +2 -2
  146. package/dist/src/utils/graphql.d.ts.map +1 -1
  147. package/dist/src/utils/migrations.d.ts.map +1 -1
  148. package/dist/src/utils/migrations.js.map +1 -1
  149. package/dist/src/utils/misc.d.ts +4 -2
  150. package/dist/src/utils/misc.d.ts.map +1 -1
  151. package/dist/src/utils/misc.js +4 -0
  152. package/dist/src/utils/misc.js.map +1 -1
  153. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  154. package/package.json +5 -4
  155. package/dist/test/cache.test.d.ts +0 -2
  156. package/dist/test/cache.test.d.ts.map +0 -1
  157. package/dist/test/cache.test.js +0 -281
  158. package/dist/test/cache.test.js.map +0 -1
  159. package/dist/test/default-remote-drives.test.d.ts +0 -2
  160. package/dist/test/default-remote-drives.test.d.ts.map +0 -1
  161. package/dist/test/default-remote-drives.test.js +0 -446
  162. package/dist/test/default-remote-drives.test.js.map +0 -1
  163. package/dist/test/document-helpers/addUndo.test.d.ts +0 -2
  164. package/dist/test/document-helpers/addUndo.test.d.ts.map +0 -1
  165. package/dist/test/document-helpers/addUndo.test.js +0 -120
  166. package/dist/test/document-helpers/addUndo.test.js.map +0 -1
  167. package/dist/test/document-helpers/attachBranch.test.d.ts +0 -2
  168. package/dist/test/document-helpers/attachBranch.test.d.ts.map +0 -1
  169. package/dist/test/document-helpers/attachBranch.test.js +0 -333
  170. package/dist/test/document-helpers/attachBranch.test.js.map +0 -1
  171. package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts +0 -2
  172. package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts.map +0 -1
  173. package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.js +0 -252
  174. package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.js.map +0 -1
  175. package/dist/test/document-helpers/garbageCollect.test.d.ts +0 -2
  176. package/dist/test/document-helpers/garbageCollect.test.d.ts.map +0 -1
  177. package/dist/test/document-helpers/garbageCollect.test.js +0 -136
  178. package/dist/test/document-helpers/garbageCollect.test.js.map +0 -1
  179. package/dist/test/document-helpers/groupOperationsByScope.test.d.ts +0 -2
  180. package/dist/test/document-helpers/groupOperationsByScope.test.d.ts.map +0 -1
  181. package/dist/test/document-helpers/groupOperationsByScope.test.js +0 -98
  182. package/dist/test/document-helpers/groupOperationsByScope.test.js.map +0 -1
  183. package/dist/test/document-helpers/merge.test.d.ts +0 -2
  184. package/dist/test/document-helpers/merge.test.d.ts.map +0 -1
  185. package/dist/test/document-helpers/merge.test.js +0 -757
  186. package/dist/test/document-helpers/merge.test.js.map +0 -1
  187. package/dist/test/document-helpers/nextSkipNumber.test.d.ts +0 -2
  188. package/dist/test/document-helpers/nextSkipNumber.test.d.ts.map +0 -1
  189. package/dist/test/document-helpers/nextSkipNumber.test.js +0 -123
  190. package/dist/test/document-helpers/nextSkipNumber.test.js.map +0 -1
  191. package/dist/test/document-helpers/prepareOperations.test.d.ts +0 -2
  192. package/dist/test/document-helpers/prepareOperations.test.d.ts.map +0 -1
  193. package/dist/test/document-helpers/prepareOperations.test.js +0 -304
  194. package/dist/test/document-helpers/prepareOperations.test.js.map +0 -1
  195. package/dist/test/document-helpers/removeExistingOperations.test.d.ts +0 -2
  196. package/dist/test/document-helpers/removeExistingOperations.test.d.ts.map +0 -1
  197. package/dist/test/document-helpers/removeExistingOperations.test.js +0 -150
  198. package/dist/test/document-helpers/removeExistingOperations.test.js.map +0 -1
  199. package/dist/test/document-helpers/reshuffleByTimestamp.test.d.ts +0 -2
  200. package/dist/test/document-helpers/reshuffleByTimestamp.test.d.ts.map +0 -1
  201. package/dist/test/document-helpers/reshuffleByTimestamp.test.js +0 -148
  202. package/dist/test/document-helpers/reshuffleByTimestamp.test.js.map +0 -1
  203. package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts +0 -2
  204. package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts.map +0 -1
  205. package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.js +0 -200
  206. package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.js.map +0 -1
  207. package/dist/test/document-helpers/sortOperations.test.d.ts +0 -2
  208. package/dist/test/document-helpers/sortOperations.test.d.ts.map +0 -1
  209. package/dist/test/document-helpers/sortOperations.test.js +0 -101
  210. package/dist/test/document-helpers/sortOperations.test.js.map +0 -1
  211. package/dist/test/document-helpers/split.test.d.ts +0 -2
  212. package/dist/test/document-helpers/split.test.d.ts.map +0 -1
  213. package/dist/test/document-helpers/split.test.js +0 -121
  214. package/dist/test/document-helpers/split.test.js.map +0 -1
  215. package/dist/test/document-helpers/utils.d.ts +0 -8
  216. package/dist/test/document-helpers/utils.d.ts.map +0 -1
  217. package/dist/test/document-helpers/utils.js +0 -22
  218. package/dist/test/document-helpers/utils.js.map +0 -1
  219. package/dist/test/drive-operations.test.d.ts +0 -2
  220. package/dist/test/drive-operations.test.d.ts.map +0 -1
  221. package/dist/test/drive-operations.test.js +0 -145
  222. package/dist/test/drive-operations.test.js.map +0 -1
  223. package/dist/test/graphql.test.d.ts +0 -2
  224. package/dist/test/graphql.test.d.ts.map +0 -1
  225. package/dist/test/graphql.test.js +0 -10
  226. package/dist/test/graphql.test.js.map +0 -1
  227. package/dist/test/internal-listener.test.d.ts +0 -2
  228. package/dist/test/internal-listener.test.d.ts.map +0 -1
  229. package/dist/test/internal-listener.test.js +0 -277
  230. package/dist/test/internal-listener.test.js.map +0 -1
  231. package/dist/test/queue.test.d.ts +0 -2
  232. package/dist/test/queue.test.d.ts.map +0 -1
  233. package/dist/test/queue.test.js +0 -338
  234. package/dist/test/queue.test.js.map +0 -1
  235. package/dist/test/read-mode.test.d.ts +0 -2
  236. package/dist/test/read-mode.test.d.ts.map +0 -1
  237. package/dist/test/read-mode.test.js +0 -578
  238. package/dist/test/read-mode.test.js.map +0 -1
  239. package/dist/test/server/driveOperationsConflictResolution.test.d.ts +0 -2
  240. package/dist/test/server/driveOperationsConflictResolution.test.d.ts.map +0 -1
  241. package/dist/test/server/driveOperationsConflictResolution.test.js +0 -460
  242. package/dist/test/server/driveOperationsConflictResolution.test.js.map +0 -1
  243. package/dist/test/server/mergeOperations.test.d.ts +0 -2
  244. package/dist/test/server/mergeOperations.test.d.ts.map +0 -1
  245. package/dist/test/server/mergeOperations.test.js +0 -107
  246. package/dist/test/server/mergeOperations.test.js.map +0 -1
  247. package/dist/test/server/processOperations.test.d.ts +0 -2
  248. package/dist/test/server/processOperations.test.d.ts.map +0 -1
  249. package/dist/test/server/processOperations.test.js +0 -380
  250. package/dist/test/server/processOperations.test.js.map +0 -1
  251. package/dist/test/server.test.d.ts +0 -2
  252. package/dist/test/server.test.d.ts.map +0 -1
  253. package/dist/test/server.test.js +0 -899
  254. package/dist/test/server.test.js.map +0 -1
  255. package/dist/test/signature-migration.test.d.ts +0 -2
  256. package/dist/test/signature-migration.test.d.ts.map +0 -1
  257. package/dist/test/signature-migration.test.js +0 -239
  258. package/dist/test/signature-migration.test.js.map +0 -1
  259. package/dist/test/storage.test.d.ts +0 -2
  260. package/dist/test/storage.test.d.ts.map +0 -1
  261. package/dist/test/storage.test.js +0 -523
  262. package/dist/test/storage.test.js.map +0 -1
  263. package/dist/test/utils.d.ts +0 -48
  264. package/dist/test/utils.d.ts.map +0 -1
  265. package/dist/test/utils.js +0 -133
  266. package/dist/test/utils.js.map +0 -1
  267. package/dist/test/utils.test.d.ts +0 -2
  268. package/dist/test/utils.test.d.ts.map +0 -1
  269. package/dist/test/utils.test.js +0 -89
  270. package/dist/test/utils.test.js.map +0 -1
  271. package/dist/test/vitest-setup.d.ts +0 -2
  272. package/dist/test/vitest-setup.d.ts.map +0 -1
  273. package/dist/test/vitest-setup.js +0 -5
  274. package/dist/test/vitest-setup.js.map +0 -1
  275. package/dist/tsconfig.tsbuildinfo +0 -1
  276. package/dist/vitest.config.d.ts +0 -3
  277. package/dist/vitest.config.d.ts.map +0 -1
  278. package/dist/vitest.config.js +0 -27
  279. package/dist/vitest.config.js.map +0 -1
@@ -0,0 +1,137 @@
1
+ import { type SynchronizationUnitId } from "./types.js";
2
+ /**
3
+ * Interface for a specialized Map implementation that manages synchronization units.
4
+ * Each unit is identified by a SynchronizationUnitId which consists of documentId, scope, and branch.
5
+ */
6
+ export interface ISyncUnitMap<Value> {
7
+ set(id: SynchronizationUnitId, state: Value): this;
8
+ get(id: SynchronizationUnitId): Value | undefined;
9
+ has(id: SynchronizationUnitId): boolean;
10
+ delete(id: SynchronizationUnitId): boolean;
11
+ clear(): void;
12
+ get size(): number;
13
+ keys(): IterableIterator<SynchronizationUnitId>;
14
+ values(): IterableIterator<Value>;
15
+ entries(): IterableIterator<[SynchronizationUnitId, Value]>;
16
+ [Symbol.iterator](): IterableIterator<[SynchronizationUnitId, Value]>;
17
+ forEach(callbackfn: (value: Value, key: SynchronizationUnitId, map: ISyncUnitMap<Value>) => void, thisArg?: any): void;
18
+ deleteByDocumentId(documentId: string): void;
19
+ deleteByDocumentIdAndScope(documentId: string, scope: string): void;
20
+ getAllByDocumentId(documentId: string): [SynchronizationUnitId, Value][];
21
+ getAllByDocumentIdAndScope(documentId: string, scope: string): [SynchronizationUnitId, Value][];
22
+ }
23
+ /** Separator character used to join synchronization unit key parts */
24
+ type SyncUnitKeySeparator = "|";
25
+ /**
26
+ * Internal key format used to store synchronization units.
27
+ * Composed of documentId, scope, and branch joined by the separator.
28
+ */
29
+ type SyncUnitKey = `${SynchronizationUnitId["documentId"]}${SyncUnitKeySeparator}${SynchronizationUnitId["scope"]}${SyncUnitKeySeparator}${SynchronizationUnitId["branch"]}`;
30
+ /**
31
+ * A specialized Map implementation for managing synchronization units that uses a "documentId - scope - branch" tuple as key.
32
+ * It provides methods to store, retrieve, and delete synchronization units of a certain documentId, optionally a scope and a branch.
33
+ * The implementation uses an internal Map with string keys created by combining documentId, scope, and branch with a separator character.
34
+ */
35
+ export declare class SyncUnitMap<Value> implements ISyncUnitMap<Value> {
36
+ /** Internal storage using concatenated string keys */
37
+ private internalMap;
38
+ /** Character used to separate key components */
39
+ static keySeparator: SyncUnitKeySeparator;
40
+ /**
41
+ * Escapes the separator character in a string by prefixing it with a backslash
42
+ * @param str String to escape
43
+ */
44
+ private static escape;
45
+ /**
46
+ * Unescapes the separator character in a string by removing the prefix backslash
47
+ * @param str String to unescape
48
+ */
49
+ private static unescape;
50
+ /**
51
+ * Creates a composite key from a SynchronizationUnitId
52
+ * Escapes any separator characters in the components
53
+ * @param id The synchronization unit identifier
54
+ * @returns A string key combining documentId, scope, and branch
55
+ */
56
+ static buildKey(id: SynchronizationUnitId): SyncUnitKey;
57
+ /**
58
+ * Parses a composite key back into a SynchronizationUnitId
59
+ * Unescapes any separator characters in the components
60
+ * @param key The composite key string
61
+ * @returns The parsed synchronization unit identifier
62
+ */
63
+ static parseKey(key: SyncUnitKey): SynchronizationUnitId;
64
+ /**
65
+ * Stores a value with the given synchronization unit identifier
66
+ * @throws Error if any part of the id contains the separator character
67
+ */
68
+ set(id: SynchronizationUnitId, state: Value): this;
69
+ /** Retrieves a value by its synchronization unit identifier */
70
+ get(id: SynchronizationUnitId): Value | undefined;
71
+ /** Checks if a value exists for the given synchronization unit identifier */
72
+ has(id: SynchronizationUnitId): boolean;
73
+ /** Removes a value by its synchronization unit identifier */
74
+ delete(id: SynchronizationUnitId): boolean;
75
+ /** Removes all entries from the map */
76
+ clear(): void;
77
+ /** Returns the number of entries in the map */
78
+ get size(): number;
79
+ /**
80
+ * Returns an iterator of synchronization unit identifiers
81
+ * @param filter Optional filter by documentId and scope
82
+ */
83
+ keys(filter?: {
84
+ documentId: string;
85
+ scope?: string;
86
+ } | undefined): IterableIterator<SynchronizationUnitId>;
87
+ /**
88
+ * Returns an iterator of stored values
89
+ * @param filter Optional filter by documentId and scope
90
+ */
91
+ values(filter?: {
92
+ documentId: string;
93
+ scope?: string;
94
+ } | undefined): IterableIterator<Value>;
95
+ /**
96
+ * Returns an iterator of [id, value] pairs
97
+ * @param filter Optional filter by documentId and scope
98
+ */
99
+ entries(filter?: {
100
+ documentId: string;
101
+ scope?: string;
102
+ } | undefined): IterableIterator<[SynchronizationUnitId, Value]>;
103
+ /** Makes the map iterable */
104
+ [Symbol.iterator](): IterableIterator<[SynchronizationUnitId, Value]>;
105
+ /**
106
+ * Executes a callback for each entry in the map
107
+ * @param callbackfn Function to execute for each entry
108
+ * @param thisArg Value to use as 'this' in the callback
109
+ */
110
+ forEach(callbackfn: (value: Value, key: SynchronizationUnitId, map: ISyncUnitMap<Value>) => void, thisArg?: any): void;
111
+ /**
112
+ * Removes all entries associated with a specific document
113
+ * @param documentId The document identifier
114
+ */
115
+ deleteByDocumentId(documentId: string): void;
116
+ /**
117
+ * Removes all entries for a specific document and scope combination
118
+ * @param documentId The document identifier
119
+ * @param scope The scope identifier
120
+ */
121
+ deleteByDocumentIdAndScope(documentId: string, scope: string): void;
122
+ /**
123
+ * Retrieves all entries associated with a specific document
124
+ * @param documentId The document identifier
125
+ * @returns Array of [id, value] pairs
126
+ */
127
+ getAllByDocumentId(documentId: string): [SynchronizationUnitId, Value][];
128
+ /**
129
+ * Retrieves all entries for a specific document and scope combination
130
+ * @param documentId The document identifier
131
+ * @param scope The scope identifier
132
+ * @returns Array of [id, value] pairs
133
+ */
134
+ getAllByDocumentIdAndScope(documentId: string, scope: string): [SynchronizationUnitId, Value][];
135
+ }
136
+ export {};
137
+ //# sourceMappingURL=sync-unit-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-unit-map.d.ts","sourceRoot":"","sources":["../../../src/server/sync-unit-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;GAGG;AACH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E;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,GAC1D,gBAAgB,CAAC,KAAK,CAAC;IAwB1B;;;OAGG;IACH,OAAO,CACL,MAAM,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,GAC1D,gBAAgB,CAAC,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;IA0BnD,6BAA6B;IAC7B,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIjB;;;;OAIG;IACH,OAAO,CACL,UAAU,EAAE,CACV,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,qBAAqB,EAC1B,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,KACrB,IAAI,EACT,OAAO,CAAC,EAAE,GAAG,GACZ,IAAI;IAQP;;;OAGG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAQ5C;;;;OAIG;IACH,0BAA0B,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IASnE;;;;OAIG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,CAAC,qBAAqB,EAAE,KAAK,CAAC,EAAE;IAUxE;;;;;OAKG;IACH,0BAA0B,CACxB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GACZ,CAAC,qBAAqB,EAAE,KAAK,CAAC,EAAE;CAUpC"}
@@ -0,0 +1,234 @@
1
+ /**
2
+ * A specialized Map implementation for managing synchronization units that uses a "documentId - scope - branch" tuple as key.
3
+ * It provides methods to store, retrieve, and delete synchronization units of a certain documentId, optionally a scope and a branch.
4
+ * The implementation uses an internal Map with string keys created by combining documentId, scope, and branch with a separator character.
5
+ */
6
+ export class SyncUnitMap {
7
+ /** Internal storage using concatenated string keys */
8
+ internalMap = new Map();
9
+ /** Character used to separate key components */
10
+ static keySeparator = "|";
11
+ /**
12
+ * Escapes the separator character in a string by prefixing it with a backslash
13
+ * @param str String to escape
14
+ */
15
+ static escape(str) {
16
+ return str.replace(/\|/g, "\\|");
17
+ }
18
+ /**
19
+ * Unescapes the separator character in a string by removing the prefix backslash
20
+ * @param str String to unescape
21
+ */
22
+ static unescape(str) {
23
+ return str.replace(/\\\|/g, "|");
24
+ }
25
+ /**
26
+ * Creates a composite key from a SynchronizationUnitId
27
+ * Escapes any separator characters in the components
28
+ * @param id The synchronization unit identifier
29
+ * @returns A string key combining documentId, scope, and branch
30
+ */
31
+ static buildKey(id) {
32
+ return `${SyncUnitMap.escape(id.documentId)}${SyncUnitMap.keySeparator}${SyncUnitMap.escape(id.scope)}${SyncUnitMap.keySeparator}${SyncUnitMap.escape(id.branch)}`;
33
+ }
34
+ /**
35
+ * Parses a composite key back into a SynchronizationUnitId
36
+ * Unescapes any separator characters in the components
37
+ * @param key The composite key string
38
+ * @returns The parsed synchronization unit identifier
39
+ */
40
+ static parseKey(key) {
41
+ const parts = key
42
+ .split(/(?<!\\)\|/)
43
+ .map((part) => SyncUnitMap.unescape(part));
44
+ const [documentId, scope, branch] = parts;
45
+ return { documentId, scope, branch };
46
+ }
47
+ // Map API implementation
48
+ /**
49
+ * Stores a value with the given synchronization unit identifier
50
+ * @throws Error if any part of the id contains the separator character
51
+ */
52
+ set(id, state) {
53
+ this.internalMap.set(SyncUnitMap.buildKey(id), state);
54
+ return this;
55
+ }
56
+ /** Retrieves a value by its synchronization unit identifier */
57
+ get(id) {
58
+ return this.internalMap.get(SyncUnitMap.buildKey(id));
59
+ }
60
+ /** Checks if a value exists for the given synchronization unit identifier */
61
+ has(id) {
62
+ return this.internalMap.has(SyncUnitMap.buildKey(id));
63
+ }
64
+ /** Removes a value by its synchronization unit identifier */
65
+ delete(id) {
66
+ return this.internalMap.delete(SyncUnitMap.buildKey(id));
67
+ }
68
+ /** Removes all entries from the map */
69
+ clear() {
70
+ this.internalMap.clear();
71
+ }
72
+ /** Returns the number of entries in the map */
73
+ get size() {
74
+ return this.internalMap.size;
75
+ }
76
+ /**
77
+ * Returns an iterator of synchronization unit identifiers
78
+ * @param filter Optional filter by documentId and scope
79
+ */
80
+ keys(filter) {
81
+ const iter = this.internalMap.keys();
82
+ return {
83
+ [Symbol.iterator]() {
84
+ return this;
85
+ },
86
+ next() {
87
+ while (true) {
88
+ const result = iter.next();
89
+ if (result.done)
90
+ return { done: true, value: undefined };
91
+ const key = result.value;
92
+ const id = SyncUnitMap.parseKey(key);
93
+ if (filter) {
94
+ if (id.documentId !== filter.documentId)
95
+ continue;
96
+ if (filter.scope !== undefined && id.scope !== filter.scope)
97
+ continue;
98
+ }
99
+ return { done: false, value: id };
100
+ }
101
+ },
102
+ };
103
+ }
104
+ /**
105
+ * Returns an iterator of stored values
106
+ * @param filter Optional filter by documentId and scope
107
+ */
108
+ values(filter) {
109
+ const iter = this.internalMap.entries();
110
+ return {
111
+ [Symbol.iterator]() {
112
+ return this;
113
+ },
114
+ next() {
115
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
116
+ while (true) {
117
+ const result = iter.next();
118
+ if (result.done)
119
+ return { done: true, value: undefined };
120
+ const [key, value] = result.value;
121
+ const id = SyncUnitMap.parseKey(key);
122
+ if (filter) {
123
+ if (id.documentId !== filter.documentId)
124
+ continue;
125
+ if (filter.scope !== undefined && id.scope !== filter.scope)
126
+ continue;
127
+ }
128
+ return { done: false, value };
129
+ }
130
+ },
131
+ };
132
+ }
133
+ /**
134
+ * Returns an iterator of [id, value] pairs
135
+ * @param filter Optional filter by documentId and scope
136
+ */
137
+ entries(filter) {
138
+ const iter = this.internalMap.entries();
139
+ return {
140
+ [Symbol.iterator]() {
141
+ return this;
142
+ },
143
+ next() {
144
+ while (true) {
145
+ const result = iter.next();
146
+ if (result.done)
147
+ return { done: true, value: undefined };
148
+ const [key, value] = result.value;
149
+ const id = SyncUnitMap.parseKey(key);
150
+ if (filter) {
151
+ if (id.documentId !== filter.documentId)
152
+ continue;
153
+ if (filter.scope !== undefined && id.scope !== filter.scope)
154
+ continue;
155
+ }
156
+ return {
157
+ done: false,
158
+ value: [id, value],
159
+ };
160
+ }
161
+ },
162
+ };
163
+ }
164
+ /** Makes the map iterable */
165
+ [Symbol.iterator]() {
166
+ return this.entries();
167
+ }
168
+ /**
169
+ * Executes a callback for each entry in the map
170
+ * @param callbackfn Function to execute for each entry
171
+ * @param thisArg Value to use as 'this' in the callback
172
+ */
173
+ forEach(callbackfn, thisArg) {
174
+ for (const [k, v] of this.entries()) {
175
+ callbackfn.call(thisArg, v, k, this);
176
+ }
177
+ }
178
+ // Custom API methods
179
+ /**
180
+ * Removes all entries associated with a specific document
181
+ * @param documentId The document identifier
182
+ */
183
+ deleteByDocumentId(documentId) {
184
+ for (const key of this.internalMap.keys()) {
185
+ if (key.startsWith(documentId + SyncUnitMap.keySeparator)) {
186
+ this.internalMap.delete(key);
187
+ }
188
+ }
189
+ }
190
+ /**
191
+ * Removes all entries for a specific document and scope combination
192
+ * @param documentId The document identifier
193
+ * @param scope The scope identifier
194
+ */
195
+ deleteByDocumentIdAndScope(documentId, scope) {
196
+ const prefix = `${documentId}${SyncUnitMap.keySeparator}${scope}${SyncUnitMap.keySeparator}`;
197
+ for (const key of this.internalMap.keys()) {
198
+ if (key.startsWith(prefix)) {
199
+ this.internalMap.delete(key);
200
+ }
201
+ }
202
+ }
203
+ /**
204
+ * Retrieves all entries associated with a specific document
205
+ * @param documentId The document identifier
206
+ * @returns Array of [id, value] pairs
207
+ */
208
+ getAllByDocumentId(documentId) {
209
+ const results = [];
210
+ for (const [key, value] of this.internalMap.entries()) {
211
+ if (key.startsWith(documentId + SyncUnitMap.keySeparator)) {
212
+ results.push([SyncUnitMap.parseKey(key), value]);
213
+ }
214
+ }
215
+ return results;
216
+ }
217
+ /**
218
+ * Retrieves all entries for a specific document and scope combination
219
+ * @param documentId The document identifier
220
+ * @param scope The scope identifier
221
+ * @returns Array of [id, value] pairs
222
+ */
223
+ getAllByDocumentIdAndScope(documentId, scope) {
224
+ const prefix = `${documentId}${SyncUnitMap.keySeparator}${scope}${SyncUnitMap.keySeparator}`;
225
+ const results = [];
226
+ for (const [key, value] of this.internalMap.entries()) {
227
+ if (key.startsWith(prefix)) {
228
+ results.push([SyncUnitMap.parseKey(key), value]);
229
+ }
230
+ }
231
+ return results;
232
+ }
233
+ }
234
+ //# sourceMappingURL=sync-unit-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-unit-map.js","sourceRoot":"","sources":["../../../src/server/sync-unit-map.ts"],"names":[],"mappings":"AA4CA;;;;GAIG;AACH,MAAM,OAAO,WAAW;IACtB,sDAAsD;IAC9C,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAC;IAEpD,gDAAgD;IAChD,MAAM,CAAC,YAAY,GAAyB,GAAG,CAAC;IAEhD;;;OAGG;IACK,MAAM,CAAC,MAAM,CAAC,GAAW;QAC/B,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,QAAQ,CAAC,GAAW;QACjC,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,EAAyB;QACvC,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;IACrK,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,GAAgB;QAC9B,MAAM,KAAK,GAAG,GAAG;aACd,KAAK,CAAC,WAAW,CAAC;aAClB,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAA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AW,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,0BAA0B,CACxB,UAAkB,EAClB,KAAa;QAEb,MAAM,MAAM,GAAG,GAAG,UAAU,GAAG,WAAW,CAAC,YAAY,GAAG,KAAK,GAAG,WAAW,CAAC,YAAY,EAAE,CAAC;QAC7F,MAAM,OAAO,GAAqC,EAAE,CAAC;QACrD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YACtD,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC"}
@@ -1,13 +1,15 @@
1
- import { type DocumentDriveAction, type DocumentDriveDocument, type DocumentDriveLocalState, type ListenerCallInfo, type ListenerFilter, type Trigger } from "#drive-document-model/gen/types";
1
+ import { type DocumentDriveAction, type DocumentDriveDocument, type DocumentDriveLocalState, type LegacyAddFileAction, type ListenerCallInfo, type ListenerFilter, type Trigger } from "#drive-document-model/gen/types";
2
2
  import { type IReadModeDriveServer } from "#read-mode/types";
3
3
  import { type IDefaultDrivesManager } from "#utils/default-drives-manager";
4
4
  import { type DriveInfo } from "#utils/graphql";
5
5
  import { type RunAsap } from "#utils/run-asap";
6
- import { type Action, type ActionContext, type CreateChildDocumentInput, type DocumentModelModule, type Operation, type OperationFromDocument, type OperationScope, type PHDocument, type ReducerOptions, type Signal } from "document-model";
6
+ import { type Action, type ActionContext, type DocumentModelModule, type Operation, type PHDocument, type PHDocumentHeader, type PHDocumentMeta, type ReducerOptions } from "document-model";
7
7
  import { type Unsubscribe } from "nanoevents";
8
+ import { type SignalResult } from "../../../document-model/src/document/signal.js";
8
9
  import { type BaseDocumentDriveServer } from "./base-server.js";
9
10
  import { type OperationError, type SynchronizationUnitNotFoundError } from "./error.js";
10
11
  import { type ITransmitter, type StrandUpdateSource } from "./listener/transmitter/types.js";
12
+ import { type ISyncUnitMap } from "./sync-unit-map.js";
11
13
  export type Constructor<T = object> = new (...args: any[]) => T;
12
14
  export type Mixin<T extends Constructor, I> = T & Constructor<InstanceType<T> & I>;
13
15
  export type DocumentDriveServerMixin<I> = Mixin<typeof BaseDocumentDriveServer, I>;
@@ -28,25 +30,41 @@ export type RemoteDriveOptions = DocumentDriveLocalState & {
28
30
  expectedDriveInfo?: DriveInfo;
29
31
  accessLevel?: RemoteDriveAccessLevel;
30
32
  };
31
- export type CreateDocumentInput<TDocument extends PHDocument> = CreateChildDocumentInput<TDocument>;
32
- export type SignalResult = {
33
- signal: Signal;
34
- result: unknown;
33
+ /**
34
+ * @deprecated In the future we will disallow this. Use the header field instead.
35
+ */
36
+ export type LegacyCreateDocumentInput = {
37
+ /**
38
+ * @deprecated In the future we will disallow this. Use the header field instead.
39
+ */
40
+ id: string;
41
+ documentType: string;
42
+ };
43
+ export type CreateDocumentInputWithDocument<TDocument extends PHDocument> = {
44
+ document: TDocument;
45
+ };
46
+ export type CreateDocumentInputWithHeader = {
47
+ header: PHDocumentHeader;
48
+ };
49
+ export type CreateDocumentInputWithDocumentType = {
50
+ documentType: string;
35
51
  };
52
+ export type CreateDocumentInput<TDocument extends PHDocument> = LegacyCreateDocumentInput | CreateDocumentInputWithDocument<TDocument> | CreateDocumentInputWithHeader | CreateDocumentInputWithDocumentType;
36
53
  export type IOperationResult<TDocument extends PHDocument = PHDocument> = {
37
54
  status: UpdateStatus;
38
55
  error?: OperationError;
39
- operations: OperationFromDocument<TDocument>[];
56
+ operations: Operation[];
40
57
  document: TDocument | undefined;
41
58
  signals: SignalResult[];
42
59
  };
43
60
  export type DriveOperationResult = IOperationResult<DocumentDriveDocument>;
44
- export type SynchronizationUnit = {
45
- syncId: string;
61
+ export type SynchronizationUnitId = {
46
62
  documentId: string;
47
- documentType: string;
48
63
  scope: string;
49
64
  branch: string;
65
+ };
66
+ export type SynchronizationUnit = SynchronizationUnitId & {
67
+ documentType: string;
50
68
  lastUpdated: string;
51
69
  revision: number;
52
70
  };
@@ -80,6 +98,7 @@ export declare enum TransmitterType {
80
98
  export type ListenerRevision = {
81
99
  driveId: string;
82
100
  documentId: string;
101
+ documentType: string;
83
102
  scope: string;
84
103
  branch: string;
85
104
  status: UpdateStatus;
@@ -108,7 +127,8 @@ export type OperationUpdate = {
108
127
  export type StrandUpdate = {
109
128
  driveId: string;
110
129
  documentId: string;
111
- scope: OperationScope;
130
+ documentType: string;
131
+ scope: string;
112
132
  branch: string;
113
133
  operations: OperationUpdate[];
114
134
  };
@@ -121,21 +141,21 @@ export type SyncUnitStatusObject = {
121
141
  };
122
142
  export type AddRemoteDriveStatus = "SUCCESS" | "ERROR" | "PENDING" | "ADDING" | "ALREADY_ADDED";
123
143
  export interface DriveEvents {
124
- syncStatus: (driveId: string, status: SyncStatus, error?: Error, syncUnitStatus?: SyncUnitStatusObject) => void;
144
+ syncStatus: (driveId: string, status: SyncStatus, error?: Error, syncUnitStatus?: SyncUnitStatusObject, scope?: string, branch?: string) => void;
125
145
  defaultRemoteDrive: (status: AddRemoteDriveStatus, defaultDrives: Map<string, DefaultRemoteDriveInfo>, driveInput: DefaultRemoteDriveInput, driveId?: string, driveName?: string, error?: Error) => void;
126
146
  strandUpdate: (update: StrandUpdate) => void;
127
147
  clientStrandsError: (driveId: string, trigger: Trigger, status: number, errorMessage: string) => void;
128
148
  documentModelModules: (documentModelModules: DocumentModelModule[]) => void;
129
149
  driveAdded: (drive: DocumentDriveDocument) => void;
130
150
  driveDeleted: (driveId: string) => void;
131
- documentOperationsAdded: (driveId: string, documentId: string, operations: Operation[]) => void;
151
+ documentOperationsAdded: (documentId: string, operations: Operation[]) => void;
132
152
  driveOperationsAdded: (driveId: string, operations: Operation[]) => void;
133
- operationsAdded: (driveId: string, documentId: string | undefined | null, operations: Operation[]) => void;
153
+ operationsAdded: (documentId: string, operations: Operation[]) => void;
134
154
  }
135
155
  export type PartialRecord<K extends keyof any, T> = {
136
156
  [P in K]?: T;
137
157
  };
138
- export type RevisionsFilter = PartialRecord<OperationScope, number>;
158
+ export type RevisionsFilter = PartialRecord<string, number>;
139
159
  export type GetDocumentOptions = ReducerOptions & {
140
160
  revisions?: RevisionsFilter;
141
161
  checkHashes?: boolean;
@@ -234,30 +254,93 @@ export interface IBaseDocumentDriveServer {
234
254
  getDrive(driveId: string, options?: GetDocumentOptions): Promise<DocumentDriveDocument>;
235
255
  getDriveBySlug(slug: string): Promise<DocumentDriveDocument>;
236
256
  getDriveIdBySlug(slug: string): Promise<DocumentDriveDocument["header"]["id"]>;
237
- getDocuments(driveId: string): Promise<string[]>;
257
+ addDocument<TDocument extends PHDocument>(input: TDocument, meta?: PHDocumentMeta): Promise<TDocument>;
258
+ addDocument<TDocument extends PHDocument>(documentType: string, meta?: PHDocumentMeta): Promise<TDocument>;
259
+ deleteDocument(documentId: string): Promise<void>;
260
+ getDocuments(parentId: string): Promise<string[]>;
261
+ /**
262
+ * @deprecated Use getDocument(documentId, options) instead. This method will be removed in the future.
263
+ */
238
264
  getDocument<TDocument extends PHDocument>(driveId: string, documentId: string, options?: GetDocumentOptions): Promise<TDocument>;
265
+ getDocument<TDocument extends PHDocument>(documentId: string, options?: GetDocumentOptions): Promise<TDocument>;
266
+ queueDocument<TDocument extends PHDocument>(input: CreateDocumentInput<TDocument>, options?: AddOperationOptions): Promise<IOperationResult>;
267
+ /**
268
+ * @deprecated Use addOperation(documentId, operation, options) instead. This method will be removed in the future.
269
+ */
239
270
  addOperation(driveId: string, documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
271
+ addOperation(documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
272
+ /**
273
+ * @deprecated Use addOperations(documentId, operations, options) instead. This method will be removed in the future.
274
+ */
240
275
  addOperations(driveId: string, documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
276
+ addOperations(documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
277
+ /**
278
+ * @deprecated Use queueOperation(documentId, operation, options) instead. This method will be removed in the future.
279
+ */
241
280
  queueOperation(driveId: string, documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
281
+ queueOperation(documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
282
+ /**
283
+ * @deprecated Use queueOperations(documentId, operations, options) instead. This method will be removed in the future.
284
+ */
242
285
  queueOperations(driveId: string, documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
286
+ queueOperations(documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
287
+ /**
288
+ * @deprecated Use queueAction(documentId, action, options) instead. This method will be removed in the future.
289
+ */
243
290
  queueAction(driveId: string, documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
291
+ queueAction(documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
292
+ /**
293
+ * @deprecated Use queueActions(documentId, actions, options) instead. This method will be removed in the future.
294
+ */
244
295
  queueActions(driveId: string, documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
245
- addDriveOperation(driveId: string, operation: Operation<DocumentDriveAction>, options?: AddOperationOptions): Promise<DriveOperationResult>;
246
- addDriveOperations(driveId: string, operations: Operation<DocumentDriveAction>[], options?: AddOperationOptions): Promise<DriveOperationResult>;
247
- queueDriveOperation(driveId: string, operation: Operation<DocumentDriveAction>, options?: AddOperationOptions): Promise<DriveOperationResult>;
248
- queueDriveOperations(driveId: string, operations: Operation<DocumentDriveAction>[], options?: AddOperationOptions): Promise<DriveOperationResult>;
296
+ queueActions(documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
297
+ /**
298
+ * @deprecated Use the {@link addOperation} method instead.
299
+ */
300
+ addDriveOperation(driveId: string, operation: Operation, options?: AddOperationOptions): Promise<DriveOperationResult>;
301
+ /**
302
+ * @deprecated Use the {@link addOperations} method instead.
303
+ */
304
+ addDriveOperations(driveId: string, operations: Operation[], options?: AddOperationOptions): Promise<DriveOperationResult>;
305
+ /**
306
+ * @deprecated Use the {@link queueOperation} method instead.
307
+ */
308
+ queueDriveOperation(driveId: string, operation: Operation, options?: AddOperationOptions): Promise<DriveOperationResult>;
309
+ /**
310
+ * @deprecated Use the {@link queueOperations} method instead.
311
+ */
312
+ queueDriveOperations(driveId: string, operations: Operation[], options?: AddOperationOptions): Promise<DriveOperationResult>;
313
+ /**
314
+ * @deprecated Use the {@link queueAction} method instead.
315
+ */
249
316
  queueDriveAction(driveId: string, action: DocumentDriveAction, options?: AddOperationOptions): Promise<IOperationResult>;
317
+ /**
318
+ * @deprecated Use the {@link queueActions} method instead.
319
+ */
250
320
  queueDriveActions(driveId: string, actions: DocumentDriveAction[], options?: AddOperationOptions): Promise<IOperationResult>;
321
+ /**
322
+ * @deprecated Use addAction(documentId, action, options) method instead. This method will be removed in the future.
323
+ */
251
324
  addAction(driveId: string, documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
325
+ addAction(documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
326
+ /**
327
+ * @deprecated Use addActions(documentId, actions, options) instead. This method will be removed in the future.
328
+ */
252
329
  addActions(driveId: string, documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
330
+ addActions(documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
331
+ /**
332
+ * @deprecated Use the {@link addAction} method with a {@link AddFileAction} and call {@link addDocument} if the document needs to be created.
333
+ */
334
+ addDriveAction(driveId: string, action: LegacyAddFileAction, options?: AddOperationOptions): Promise<DriveOperationResult>;
335
+ /**
336
+ * @deprecated Use the {@link addAction} method instead.
337
+ */
253
338
  addDriveAction(driveId: string, action: DocumentDriveAction, options?: AddOperationOptions): Promise<DriveOperationResult>;
339
+ /**
340
+ * @deprecated Use the {@link addActions} method instead.
341
+ */
254
342
  addDriveActions(driveId: string, actions: DocumentDriveAction[], options?: AddOperationOptions): Promise<DriveOperationResult>;
255
- getSyncStatus(syncUnitId: string): SyncStatus | SynchronizationUnitNotFoundError;
256
- /** Synchronization methods */
257
- getSynchronizationUnits(driveId: string, documentId?: string[], scope?: string[], branch?: string[], documentType?: string[]): Promise<SynchronizationUnit[]>;
258
- getSynchronizationUnit(driveId: string, syncId: string, loadedDrive?: DocumentDriveDocument): Promise<SynchronizationUnit | undefined>;
259
- getSynchronizationUnitsIds(driveId: string, documentId?: string[], scope?: string[], branch?: string[], documentType?: string[]): Promise<SynchronizationUnitQuery[]>;
260
- getOperationData(driveId: string, syncId: string, filter: GetStrandsOptions): Promise<OperationUpdate[]>;
343
+ getSyncStatus(documentId: string, scope?: string, branch?: string): SyncStatus | SynchronizationUnitNotFoundError;
261
344
  /** Internal methods **/
262
345
  getDocumentModelModules(): DocumentModelModule[];
263
346
  on<K extends keyof DriveEvents>(event: K, cb: DriveEvents[K]): Unsubscribe;
@@ -275,21 +358,21 @@ export interface IListenerManager {
275
358
  removeListener(driveId: string, listenerId: string): Promise<boolean>;
276
359
  getListenerState(driveId: string, listenerId: string): ListenerState;
277
360
  getStrands(driveId: string, listenerId: string, options?: GetStrandsOptions): Promise<StrandUpdate[]>;
278
- updateSynchronizationRevisions(driveId: string, syncUnits: SynchronizationUnit[], source: StrandUpdateSource, willUpdate?: (listeners: Listener[]) => void, onError?: (error: Error, driveId: string, listener: ListenerState) => void, forceSync?: boolean): Promise<ListenerUpdate[]>;
279
- updateListenerRevision(listenerId: string, driveId: string, syncId: string, listenerRev: number): Promise<void>;
280
- getListenerSyncUnitIds(driveId: string, listenerId: string): Promise<SynchronizationUnitQuery[]>;
281
- removeSyncUnits(driveId: string, syncUnits: Pick<SynchronizationUnit, "syncId">[]): Promise<void>;
361
+ updateSynchronizationRevisions(syncUnits: SynchronizationUnit[], source: StrandUpdateSource, willUpdate?: (listeners: Listener[]) => void, onError?: (error: Error, driveId: string, listener: ListenerState) => void, forceSync?: boolean): Promise<ListenerUpdate[]>;
362
+ updateListenerRevision(listenerId: string, driveId: string, syncUnitId: SynchronizationUnitId, listenerRev: number): Promise<void>;
363
+ removeSyncUnits(parentId: string, syncUnits: SynchronizationUnitId[]): Promise<void>;
282
364
  setGenerateJwtHandler(handler: (driveUrl: string) => Promise<string>): void;
283
365
  removeJwtHandler(): void;
284
366
  generateJwtHandler?: (driveUrl: string) => Promise<string>;
285
367
  }
286
368
  export type ListenerStatus = "CREATED" | "PENDING" | "SUCCESS" | "MISSING" | "CONFLICT" | "ERROR";
369
+ export type SynchronizationUnitMap = ISyncUnitMap<SyncronizationUnitState>;
287
370
  export interface ListenerState {
288
371
  driveId: string;
289
372
  block: boolean;
290
373
  pendingTimeout: string;
291
374
  listener: Listener;
292
- syncUnits: Map<SynchronizationUnit["syncId"], SyncronizationUnitState>;
375
+ syncUnits: SynchronizationUnitMap;
293
376
  listenerStatus: ListenerStatus;
294
377
  }
295
378
  export interface SyncronizationUnitState {
@@ -305,13 +388,14 @@ export interface IEventEmitter {
305
388
  }
306
389
  export interface ISynchronizationManager {
307
390
  setDocumentModelModules(arg0: DocumentModelModule[]): void;
308
- getSynchronizationUnits(driveId: string, documentId?: string[], scope?: string[], branch?: string[], documentType?: string[]): Promise<SynchronizationUnit[]>;
309
- getSynchronizationUnitsIds(driveId: string, documentId?: string[], scope?: string[], branch?: string[], documentType?: string[]): Promise<SynchronizationUnitQuery[]>;
310
- getSynchronizationUnit(driveId: string, syncId: string): Promise<SynchronizationUnit | undefined>;
311
- getOperationData(driveId: string, syncId: string, filter: GetStrandsOptions): Promise<OperationUpdate[]>;
312
- getSynchronizationUnitsRevision(driveId: string, syncUnitsQuery: SynchronizationUnitQuery[]): Promise<SynchronizationUnit[]>;
313
- getSyncStatus(syncUnitId: string): SyncStatus | SynchronizationUnitNotFoundError;
314
- updateSyncStatus(syncUnitId: string, status: Partial<SyncUnitStatusObject> | null, error?: Error): void;
391
+ getSynchronizationUnits(parentId?: string, documentId?: string[], scope?: string[], branch?: string[], documentType?: string[]): Promise<SynchronizationUnit[]>;
392
+ getSynchronizationUnitsIds(parentId?: string, documentId?: string[], scope?: string[], branch?: string[], documentType?: string[]): Promise<SynchronizationUnitQuery[]>;
393
+ getSynchronizationUnit(syncId: SynchronizationUnitId): Promise<SynchronizationUnit | undefined>;
394
+ getOperationData(syncId: SynchronizationUnitId, filter: GetStrandsOptions): Promise<OperationUpdate[]>;
395
+ getSyncStatus(documentId: string, scope?: string, branch?: string): SyncStatus | SynchronizationUnitNotFoundError;
396
+ getSyncStatus(syncId: SynchronizationUnitId): SyncStatus | SynchronizationUnitNotFoundError;
397
+ updateSyncStatus(documentId: string, status: Partial<SyncUnitStatusObject> | null, error?: Error, scope?: string, branch?: string): void;
398
+ updateSyncStatus(syncId: SynchronizationUnitId, status: Partial<SyncUnitStatusObject> | null, error?: Error): void;
315
399
  initializeDriveSyncStatus(driveId: string, drive: DocumentDriveDocument): Promise<void>;
316
400
  getCombinedSyncUnitStatus(syncUnitStatus: SyncUnitStatusObject): SyncStatus;
317
401
  }