mindoodb 0.0.3 → 0.0.5

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 (214) hide show
  1. package/README-server.md +1030 -0
  2. package/README.md +14 -26
  3. package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts +27 -0
  4. package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts.map +1 -1
  5. package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js +270 -121
  6. package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js.map +1 -1
  7. package/dist/appendonlystores/network/HttpTransport.d.ts +15 -0
  8. package/dist/appendonlystores/network/HttpTransport.d.ts.map +1 -1
  9. package/dist/appendonlystores/network/HttpTransport.js +235 -10
  10. package/dist/appendonlystores/network/HttpTransport.js.map +1 -1
  11. package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts +5 -0
  12. package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts.map +1 -1
  13. package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js +40 -4
  14. package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js.map +1 -1
  15. package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.d.ts +10 -3
  16. package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.d.ts.map +1 -1
  17. package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.js +138 -13
  18. package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.js.map +1 -1
  19. package/dist/browser/cache/IndexedDBLocalCacheStore.d.ts +21 -0
  20. package/dist/browser/cache/IndexedDBLocalCacheStore.d.ts.map +1 -0
  21. package/dist/browser/cache/IndexedDBLocalCacheStore.js +106 -0
  22. package/dist/browser/cache/IndexedDBLocalCacheStore.js.map +1 -0
  23. package/dist/browser/index.d.ts +3 -0
  24. package/dist/browser/index.d.ts.map +1 -1
  25. package/dist/browser/index.js +9 -1
  26. package/dist/browser/index.js.map +1 -1
  27. package/dist/core/BaseMindooDB.d.ts +108 -13
  28. package/dist/core/BaseMindooDB.d.ts.map +1 -1
  29. package/dist/core/BaseMindooDB.js +1268 -292
  30. package/dist/core/BaseMindooDB.js.map +1 -1
  31. package/dist/core/BaseMindooTenant.d.ts +31 -1
  32. package/dist/core/BaseMindooTenant.d.ts.map +1 -1
  33. package/dist/core/BaseMindooTenant.js +212 -129
  34. package/dist/core/BaseMindooTenant.js.map +1 -1
  35. package/dist/core/BaseMindooTenantDirectory.d.ts +13 -10
  36. package/dist/core/BaseMindooTenantDirectory.d.ts.map +1 -1
  37. package/dist/core/BaseMindooTenantDirectory.js +134 -27
  38. package/dist/core/BaseMindooTenantDirectory.js.map +1 -1
  39. package/dist/core/BaseMindooTenantFactory.d.ts +5 -1
  40. package/dist/core/BaseMindooTenantFactory.d.ts.map +1 -1
  41. package/dist/core/BaseMindooTenantFactory.js +46 -69
  42. package/dist/core/BaseMindooTenantFactory.js.map +1 -1
  43. package/dist/core/MindooDBServerAdmin.d.ts +241 -0
  44. package/dist/core/MindooDBServerAdmin.d.ts.map +1 -0
  45. package/dist/core/MindooDBServerAdmin.js +401 -0
  46. package/dist/core/MindooDBServerAdmin.js.map +1 -0
  47. package/dist/core/appendonlystores/AttachmentReadPlanner.d.ts +22 -0
  48. package/dist/core/appendonlystores/AttachmentReadPlanner.d.ts.map +1 -0
  49. package/dist/core/appendonlystores/AttachmentReadPlanner.js +124 -0
  50. package/dist/core/appendonlystores/AttachmentReadPlanner.js.map +1 -0
  51. package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts +10 -4
  52. package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts.map +1 -1
  53. package/dist/core/appendonlystores/InMemoryContentAddressedStore.js +44 -9
  54. package/dist/core/appendonlystores/InMemoryContentAddressedStore.js.map +1 -1
  55. package/dist/core/appendonlystores/MaterializationPlanner.d.ts +84 -0
  56. package/dist/core/appendonlystores/MaterializationPlanner.d.ts.map +1 -0
  57. package/dist/core/appendonlystores/MaterializationPlanner.js +326 -0
  58. package/dist/core/appendonlystores/MaterializationPlanner.js.map +1 -0
  59. package/dist/core/appendonlystores/network/NetworkTransport.d.ts +33 -0
  60. package/dist/core/appendonlystores/network/NetworkTransport.d.ts.map +1 -1
  61. package/dist/core/appendonlystores/network/types.d.ts +35 -0
  62. package/dist/core/appendonlystores/network/types.d.ts.map +1 -1
  63. package/dist/core/appendonlystores/network/types.js +2 -0
  64. package/dist/core/appendonlystores/network/types.js.map +1 -1
  65. package/dist/core/appendonlystores/types.d.ts +174 -3
  66. package/dist/core/appendonlystores/types.d.ts.map +1 -1
  67. package/dist/core/cache/CacheManager.d.ts +75 -0
  68. package/dist/core/cache/CacheManager.d.ts.map +1 -0
  69. package/dist/core/cache/CacheManager.js +101 -0
  70. package/dist/core/cache/CacheManager.js.map +1 -0
  71. package/dist/core/cache/EncryptedLocalCacheStore.d.ts +41 -0
  72. package/dist/core/cache/EncryptedLocalCacheStore.d.ts.map +1 -0
  73. package/dist/core/cache/EncryptedLocalCacheStore.js +120 -0
  74. package/dist/core/cache/EncryptedLocalCacheStore.js.map +1 -0
  75. package/dist/core/cache/LocalCacheStore.d.ts +50 -0
  76. package/dist/core/cache/LocalCacheStore.d.ts.map +1 -0
  77. package/dist/core/cache/LocalCacheStore.js +39 -0
  78. package/dist/core/cache/LocalCacheStore.js.map +1 -0
  79. package/dist/core/crypto/privateKeyEncryption.d.ts +5 -0
  80. package/dist/core/crypto/privateKeyEncryption.d.ts.map +1 -0
  81. package/dist/core/crypto/privateKeyEncryption.js +87 -0
  82. package/dist/core/crypto/privateKeyEncryption.js.map +1 -0
  83. package/dist/core/index.d.ts +13 -6
  84. package/dist/core/index.d.ts.map +1 -1
  85. package/dist/core/index.js +13 -1
  86. package/dist/core/index.js.map +1 -1
  87. package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.d.ts +4 -1
  88. package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.d.ts.map +1 -1
  89. package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js +39 -11
  90. package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js.map +1 -1
  91. package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.d.ts +1 -0
  92. package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.d.ts.map +1 -1
  93. package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.js +3 -0
  94. package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.js.map +1 -1
  95. package/dist/core/indexing/virtualviews/VirtualView.d.ts +43 -0
  96. package/dist/core/indexing/virtualviews/VirtualView.d.ts.map +1 -1
  97. package/dist/core/indexing/virtualviews/VirtualView.js +173 -0
  98. package/dist/core/indexing/virtualviews/VirtualView.js.map +1 -1
  99. package/dist/core/indexing/virtualviews/VirtualViewEntryData.d.ts +7 -0
  100. package/dist/core/indexing/virtualviews/VirtualViewEntryData.d.ts.map +1 -1
  101. package/dist/core/indexing/virtualviews/VirtualViewEntryData.js +28 -0
  102. package/dist/core/indexing/virtualviews/VirtualViewEntryData.js.map +1 -1
  103. package/dist/core/keys/KeyBag.d.ts +38 -14
  104. package/dist/core/keys/KeyBag.d.ts.map +1 -1
  105. package/dist/core/keys/KeyBag.js +102 -76
  106. package/dist/core/keys/KeyBag.js.map +1 -1
  107. package/dist/core/keys/KeyContext.d.ts +3 -3
  108. package/dist/core/keys/KeyContext.d.ts.map +1 -1
  109. package/dist/core/keys/KeyContext.js +10 -4
  110. package/dist/core/keys/KeyContext.js.map +1 -1
  111. package/dist/core/types.d.ts +341 -22
  112. package/dist/core/types.d.ts.map +1 -1
  113. package/dist/core/types.js +7 -1
  114. package/dist/core/types.js.map +1 -1
  115. package/dist/core/utils/idGeneration.d.ts.map +1 -1
  116. package/dist/core/utils/idGeneration.js +37 -3
  117. package/dist/core/utils/idGeneration.js.map +1 -1
  118. package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.d.ts +31 -7
  119. package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.d.ts.map +1 -1
  120. package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.js +139 -17
  121. package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.js.map +1 -1
  122. package/dist/node/attachments/writeAttachmentToFile.d.ts +15 -0
  123. package/dist/node/attachments/writeAttachmentToFile.d.ts.map +1 -0
  124. package/dist/node/attachments/writeAttachmentToFile.js +73 -0
  125. package/dist/node/attachments/writeAttachmentToFile.js.map +1 -0
  126. package/dist/node/cache/FileSystemLocalCacheStore.d.ts +17 -0
  127. package/dist/node/cache/FileSystemLocalCacheStore.d.ts.map +1 -0
  128. package/dist/node/cache/FileSystemLocalCacheStore.js +128 -0
  129. package/dist/node/cache/FileSystemLocalCacheStore.js.map +1 -0
  130. package/dist/node/cli/change-identity-password.d.ts +7 -0
  131. package/dist/node/cli/change-identity-password.d.ts.map +1 -0
  132. package/dist/node/cli/change-identity-password.js +67 -0
  133. package/dist/node/cli/change-identity-password.js.map +1 -0
  134. package/dist/node/cli/cli-utils.d.ts +16 -0
  135. package/dist/node/cli/cli-utils.d.ts.map +1 -0
  136. package/dist/node/cli/cli-utils.js +113 -0
  137. package/dist/node/cli/cli-utils.js.map +1 -0
  138. package/dist/node/cli/identity-export-public.d.ts +4 -0
  139. package/dist/node/cli/identity-export-public.d.ts.map +1 -0
  140. package/dist/node/cli/identity-export-public.js +55 -0
  141. package/dist/node/cli/identity-export-public.js.map +1 -0
  142. package/dist/node/cli/identity-info.d.ts +4 -0
  143. package/dist/node/cli/identity-info.d.ts.map +1 -0
  144. package/dist/node/cli/identity-info.js +57 -0
  145. package/dist/node/cli/identity-info.js.map +1 -0
  146. package/dist/node/index.d.ts +1 -0
  147. package/dist/node/index.d.ts.map +1 -1
  148. package/dist/node/index.js +4 -1
  149. package/dist/node/index.js.map +1 -1
  150. package/dist/node/server/CapabilityMatcher.d.ts +45 -0
  151. package/dist/node/server/CapabilityMatcher.d.ts.map +1 -0
  152. package/dist/node/server/CapabilityMatcher.js +117 -0
  153. package/dist/node/server/CapabilityMatcher.js.map +1 -0
  154. package/dist/node/server/MindooDBServer.d.ts +94 -0
  155. package/dist/node/server/MindooDBServer.d.ts.map +1 -0
  156. package/dist/node/server/MindooDBServer.js +1256 -0
  157. package/dist/node/server/MindooDBServer.js.map +1 -0
  158. package/dist/node/server/ServerSync.d.ts +41 -0
  159. package/dist/node/server/ServerSync.d.ts.map +1 -0
  160. package/dist/node/server/ServerSync.js +187 -0
  161. package/dist/node/server/ServerSync.js.map +1 -0
  162. package/dist/node/server/StoreFactory.d.ts +45 -0
  163. package/dist/node/server/StoreFactory.d.ts.map +1 -0
  164. package/dist/node/server/StoreFactory.js +89 -0
  165. package/dist/node/server/StoreFactory.js.map +1 -0
  166. package/dist/node/server/SystemAdminAuth.d.ts +65 -0
  167. package/dist/node/server/SystemAdminAuth.d.ts.map +1 -0
  168. package/dist/node/server/SystemAdminAuth.js +200 -0
  169. package/dist/node/server/SystemAdminAuth.js.map +1 -0
  170. package/dist/node/server/SystemIpAllowlist.d.ts +21 -0
  171. package/dist/node/server/SystemIpAllowlist.d.ts.map +1 -0
  172. package/dist/node/server/SystemIpAllowlist.js +210 -0
  173. package/dist/node/server/SystemIpAllowlist.js.map +1 -0
  174. package/dist/node/server/TenantManager.d.ts +100 -0
  175. package/dist/node/server/TenantManager.d.ts.map +1 -0
  176. package/dist/node/server/TenantManager.js +615 -0
  177. package/dist/node/server/TenantManager.js.map +1 -0
  178. package/dist/node/server/add-to-network.d.ts +20 -0
  179. package/dist/node/server/add-to-network.d.ts.map +1 -0
  180. package/dist/node/server/add-to-network.js +275 -0
  181. package/dist/node/server/add-to-network.js.map +1 -0
  182. package/dist/node/server/config.d.ts +51 -0
  183. package/dist/node/server/config.d.ts.map +1 -0
  184. package/dist/node/server/config.js +218 -0
  185. package/dist/node/server/config.js.map +1 -0
  186. package/dist/node/server/resolveServerPassword.d.ts +7 -0
  187. package/dist/node/server/resolveServerPassword.d.ts.map +1 -0
  188. package/dist/node/server/resolveServerPassword.js +25 -0
  189. package/dist/node/server/resolveServerPassword.js.map +1 -0
  190. package/dist/node/server/server.d.ts +22 -0
  191. package/dist/node/server/server.d.ts.map +1 -0
  192. package/dist/node/server/server.js +225 -0
  193. package/dist/node/server/server.js.map +1 -0
  194. package/dist/node/server/serverinit.d.ts +21 -0
  195. package/dist/node/server/serverinit.d.ts.map +1 -0
  196. package/dist/node/server/serverinit.js +317 -0
  197. package/dist/node/server/serverinit.js.map +1 -0
  198. package/dist/node/server/types.d.ts +167 -0
  199. package/dist/node/server/types.d.ts.map +1 -0
  200. package/dist/node/server/types.js +24 -0
  201. package/dist/node/server/types.js.map +1 -0
  202. package/dist/node/server/validation.d.ts +47 -0
  203. package/dist/node/server/validation.d.ts.map +1 -0
  204. package/dist/node/server/validation.js +114 -0
  205. package/dist/node/server/validation.js.map +1 -0
  206. package/dist/reactnative/cache/MMKVLocalCacheStore.d.ts +48 -0
  207. package/dist/reactnative/cache/MMKVLocalCacheStore.d.ts.map +1 -0
  208. package/dist/reactnative/cache/MMKVLocalCacheStore.js +113 -0
  209. package/dist/reactnative/cache/MMKVLocalCacheStore.js.map +1 -0
  210. package/dist/reactnative/index.d.ts +1 -0
  211. package/dist/reactnative/index.d.ts.map +1 -1
  212. package/dist/reactnative/index.js +4 -1
  213. package/dist/reactnative/index.js.map +1 -1
  214. package/package.json +15 -3
@@ -35,7 +35,9 @@ class ClientNetworkContentAddressedStore {
35
35
  // Cached access token
36
36
  this.accessToken = null;
37
37
  this.tokenExpiry = 0;
38
+ this.authenticationPromise = null;
38
39
  this.capabilitiesCache = null;
40
+ this.syncAuthOverride = null;
39
41
  this.dbId = dbId;
40
42
  this.transport = transport;
41
43
  this.cryptoAdapter = cryptoAdapter;
@@ -51,6 +53,10 @@ class ClientNetworkContentAddressedStore {
51
53
  getId() {
52
54
  return this.dbId;
53
55
  }
56
+ getCacheIdentity() {
57
+ const transportId = this.transport.getIdentity?.() ?? "unknown";
58
+ return `net:${transportId}/${this.dbId}`;
59
+ }
54
60
  /**
55
61
  * Store entries to the remote store.
56
62
  * The entries are pushed to the server immediately.
@@ -59,10 +65,12 @@ class ClientNetworkContentAddressedStore {
59
65
  if (entries.length === 0) {
60
66
  return;
61
67
  }
62
- this.logger.debug(`Pushing ${entries.length} entries to remote`);
63
- const token = await this.ensureAuthenticated();
64
- await this.transport.putEntries(token, entries);
65
- this.logger.debug(`Successfully pushed ${entries.length} entries`);
68
+ await this.withTransparentReauth("putEntries", async () => {
69
+ this.logger.debug(`Pushing ${entries.length} entries to remote`);
70
+ const token = await this.ensureAuthenticated();
71
+ await this.transport.putEntries(token, entries);
72
+ this.logger.debug(`Successfully pushed ${entries.length} entries`);
73
+ });
66
74
  }
67
75
  /**
68
76
  * Get entries from the remote store by their IDs.
@@ -71,17 +79,36 @@ class ClientNetworkContentAddressedStore {
71
79
  * @returns The entries with decrypted payloads
72
80
  */
73
81
  async getEntries(ids) {
74
- this.logger.debug(`Getting ${ids.length} entries from remote`);
75
82
  if (ids.length === 0) {
76
83
  return [];
77
84
  }
78
- const token = await this.ensureAuthenticated();
79
- const encryptedEntries = await this.transport.getEntries(token, ids);
80
- this.logger.debug(`Received ${encryptedEntries.length} encrypted entries from remote`);
81
- // Decrypt the RSA layer for each entry
82
- const entries = await this.decryptNetworkEntries(encryptedEntries);
83
- this.logger.debug(`Decrypted ${entries.length} entries`);
84
- return entries;
85
+ return this.withTransparentReauth("getEntries", async () => {
86
+ this.logger.debug(`Getting ${ids.length} entries from remote`);
87
+ const token = await this.ensureAuthenticated();
88
+ const encryptedEntries = await this.transport.getEntries(token, ids);
89
+ this.logger.debug(`Received ${encryptedEntries.length} encrypted entries from remote`);
90
+ // Decrypt the RSA layer for each entry
91
+ const entries = await this.decryptNetworkEntries(encryptedEntries);
92
+ this.logger.debug(`Decrypted ${entries.length} entries`);
93
+ return entries;
94
+ });
95
+ }
96
+ async getEntryMetadata(id) {
97
+ return this.withTransparentReauth("getEntryMetadata", async () => {
98
+ this.logger.debug(`Getting metadata for entry ${id} from remote`);
99
+ const token = await this.ensureAuthenticated();
100
+ return this.transport.getEntryMetadata(token, id);
101
+ });
102
+ }
103
+ async planAttachmentReadByWalkingMetadata(lastChunkId, attachmentSize, options) {
104
+ return this.withTransparentReauth("planAttachmentReadByWalkingMetadata", async () => {
105
+ const capabilities = await this.getCapabilities();
106
+ if (!capabilities.supportsAttachmentReadPlanning || !this.transport.planAttachmentReadByWalkingMetadata) {
107
+ throw new Error("Remote server does not support required attachment read planning protocol");
108
+ }
109
+ const token = await this.ensureAuthenticated();
110
+ return this.transport.planAttachmentReadByWalkingMetadata(token, lastChunkId, attachmentSize, options);
111
+ });
85
112
  }
86
113
  /**
87
114
  * Check which IDs exist in the remote store.
@@ -90,14 +117,16 @@ class ClientNetworkContentAddressedStore {
90
117
  * @returns List of IDs that exist in the remote store
91
118
  */
92
119
  async hasEntries(ids) {
93
- this.logger.debug(`Checking ${ids.length} IDs in remote`);
94
120
  if (ids.length === 0) {
95
121
  return [];
96
122
  }
97
- const token = await this.ensureAuthenticated();
98
- const existingIds = await this.transport.hasEntries(token, ids);
99
- this.logger.debug(`Found ${existingIds.length} existing entries`);
100
- return existingIds;
123
+ return this.withTransparentReauth("hasEntries", async () => {
124
+ this.logger.debug(`Checking ${ids.length} IDs in remote`);
125
+ const token = await this.ensureAuthenticated();
126
+ const existingIds = await this.transport.hasEntries(token, ids);
127
+ this.logger.debug(`Found ${existingIds.length} existing entries`);
128
+ return existingIds;
129
+ });
101
130
  }
102
131
  /**
103
132
  * Find new entries from the remote store.
@@ -106,134 +135,187 @@ class ClientNetworkContentAddressedStore {
106
135
  * @returns List of new entry metadata from the remote store
107
136
  */
108
137
  async findNewEntries(knownIds) {
109
- this.logger.debug(`Finding new entries from remote`);
110
- const token = await this.ensureAuthenticated();
111
- //TODO improve this by using a bloom filter
112
- const newEntries = await this.transport.findNewEntries(token, knownIds);
113
- this.logger.debug(`Found ${newEntries.length} new entries from remote`);
114
- return newEntries;
138
+ return this.withTransparentReauth("findNewEntries", async () => {
139
+ this.logger.debug(`Finding new entries from remote`);
140
+ const token = await this.ensureAuthenticated();
141
+ //TODO improve this by using a bloom filter
142
+ const newEntries = await this.transport.findNewEntries(token, knownIds);
143
+ this.logger.debug(`Found ${newEntries.length} new entries from remote`);
144
+ return newEntries;
145
+ });
115
146
  }
116
147
  /**
117
148
  * Find new entries for a specific document from the remote store.
118
149
  */
119
150
  async findNewEntriesForDoc(knownIds, docId) {
120
- this.logger.debug(`Finding new entries for doc ${docId} from remote`);
121
- const token = await this.ensureAuthenticated();
122
- const newEntries = await this.transport.findNewEntriesForDoc(token, knownIds, docId);
123
- this.logger.debug(`Found ${newEntries.length} new entries for doc ${docId}`);
124
- return newEntries;
151
+ return this.withTransparentReauth("findNewEntriesForDoc", async () => {
152
+ this.logger.debug(`Finding new entries for doc ${docId} from remote`);
153
+ const token = await this.ensureAuthenticated();
154
+ const newEntries = await this.transport.findNewEntriesForDoc(token, knownIds, docId);
155
+ this.logger.debug(`Found ${newEntries.length} new entries for doc ${docId}`);
156
+ return newEntries;
157
+ });
125
158
  }
126
159
  /**
127
160
  * Find entries by type and creation date range from the remote store.
128
161
  */
129
162
  async findEntries(type, creationDateFrom, creationDateUntil) {
130
- this.logger.debug(`Finding entries of type ${type} from remote`);
131
- const token = await this.ensureAuthenticated();
132
- const entries = await this.transport.findEntries(token, type, creationDateFrom, creationDateUntil);
133
- this.logger.debug(`Found ${entries.length} entries of type ${type}`);
134
- return entries;
163
+ return this.withTransparentReauth("findEntries", async () => {
164
+ this.logger.debug(`Finding entries of type ${type} from remote`);
165
+ const token = await this.ensureAuthenticated();
166
+ const entries = await this.transport.findEntries(token, type, creationDateFrom, creationDateUntil);
167
+ this.logger.debug(`Found ${entries.length} entries of type ${type}`);
168
+ return entries;
169
+ });
170
+ }
171
+ supportsReceiptOrderCursorProtocol(capabilities) {
172
+ const match = /^sync-v(\d+)$/.exec(capabilities.protocolVersion);
173
+ const version = match ? Number(match[1]) : 0;
174
+ return version >= 4;
135
175
  }
136
176
  /**
137
177
  * Get all entry IDs from the remote store.
138
178
  * Used for synchronization to identify which entries the remote has.
139
179
  */
140
180
  async getAllIds() {
141
- this.logger.debug(`Getting all entry IDs from remote`);
142
- const token = await this.ensureAuthenticated();
143
- const allIds = await this.transport.getAllIds(token);
144
- this.logger.debug(`Remote has ${allIds.length} entry IDs`);
145
- return allIds;
181
+ return this.withTransparentReauth("getAllIds", async () => {
182
+ this.logger.debug(`Getting all entry IDs from remote`);
183
+ const token = await this.ensureAuthenticated();
184
+ const allIds = await this.transport.getAllIds(token);
185
+ this.logger.debug(`Remote has ${allIds.length} entry IDs`);
186
+ return allIds;
187
+ });
146
188
  }
147
189
  /**
148
190
  * Cursor-based metadata scan from the remote store.
149
191
  * Uses transport-native scan support when available, with a compatibility fallback.
150
192
  */
151
193
  async scanEntriesSince(cursor, limit = Number.MAX_SAFE_INTEGER, filters) {
152
- const token = await this.ensureAuthenticated();
153
- const capabilities = await this.getCapabilities();
154
- if (capabilities.supportsCursorScan && this.transport.scanEntriesSince) {
155
- return this.transport.scanEntriesSince(token, cursor, limit, filters);
156
- }
157
- // Compatibility fallback: fetch metadata via legacy endpoint and paginate client-side.
158
- const all = await this.findNewEntries([]);
159
- const filtered = all
160
- .filter((meta) => {
161
- if (filters?.docId && meta.docId !== filters.docId) {
162
- return false;
194
+ return this.withTransparentReauth("scanEntriesSince", async () => {
195
+ const capabilities = await this.getCapabilities();
196
+ if (capabilities.supportsCursorScan &&
197
+ this.transport.scanEntriesSince &&
198
+ this.supportsReceiptOrderCursorProtocol(capabilities)) {
199
+ const token = await this.ensureAuthenticated();
200
+ return this.transport.scanEntriesSince(token, cursor, limit, filters);
163
201
  }
164
- if (filters?.entryTypes && filters.entryTypes.length > 0 && !filters.entryTypes.includes(meta.entryType)) {
165
- return false;
202
+ // Compatibility fallback: fetch metadata via legacy endpoint and paginate client-side.
203
+ const all = await this.findNewEntries([]);
204
+ const filtered = all
205
+ .filter((meta) => {
206
+ if (filters?.docId && meta.docId !== filters.docId) {
207
+ return false;
208
+ }
209
+ if (filters?.entryTypes && filters.entryTypes.length > 0 && !filters.entryTypes.includes(meta.entryType)) {
210
+ return false;
211
+ }
212
+ if (filters?.creationDateFrom !== undefined && filters.creationDateFrom !== null && meta.createdAt < filters.creationDateFrom) {
213
+ return false;
214
+ }
215
+ if (filters?.creationDateUntil !== undefined && filters.creationDateUntil !== null && meta.createdAt >= filters.creationDateUntil) {
216
+ return false;
217
+ }
218
+ return true;
219
+ })
220
+ .sort((a, b) => {
221
+ const leftReceiptOrder = a.receiptOrder ?? 0;
222
+ const rightReceiptOrder = b.receiptOrder ?? 0;
223
+ return leftReceiptOrder === rightReceiptOrder
224
+ ? a.id.localeCompare(b.id)
225
+ : leftReceiptOrder - rightReceiptOrder;
226
+ });
227
+ const startIndex = cursor === null
228
+ ? 0
229
+ : filtered.findIndex((meta) => (meta.receiptOrder ?? 0) > cursor.receiptOrder ||
230
+ ((meta.receiptOrder ?? 0) === cursor.receiptOrder && meta.id > cursor.id));
231
+ if (startIndex === -1) {
232
+ return { entries: [], nextCursor: cursor, hasMore: false };
166
233
  }
167
- if (filters?.creationDateFrom !== undefined && filters.creationDateFrom !== null && meta.createdAt < filters.creationDateFrom) {
168
- return false;
169
- }
170
- if (filters?.creationDateUntil !== undefined && filters.creationDateUntil !== null && meta.createdAt >= filters.creationDateUntil) {
171
- return false;
172
- }
173
- return true;
174
- })
175
- .sort((a, b) => (a.createdAt === b.createdAt ? a.id.localeCompare(b.id) : a.createdAt - b.createdAt));
176
- const startIndex = cursor === null
177
- ? 0
178
- : filtered.findIndex((meta) => meta.createdAt > cursor.createdAt || (meta.createdAt === cursor.createdAt && meta.id > cursor.id));
179
- if (startIndex === -1) {
180
- return { entries: [], nextCursor: cursor, hasMore: false };
181
- }
182
- const page = filtered.slice(startIndex, startIndex + limit);
183
- const last = page.length > 0 ? page[page.length - 1] : null;
184
- return {
185
- entries: page,
186
- nextCursor: last ? { createdAt: last.createdAt, id: last.id } : cursor,
187
- hasMore: startIndex + page.length < filtered.length,
188
- };
234
+ const page = filtered.slice(startIndex, startIndex + limit);
235
+ const last = page.length > 0 ? page[page.length - 1] : null;
236
+ return {
237
+ entries: page,
238
+ nextCursor: last ? { receiptOrder: last.receiptOrder ?? 0, id: last.id } : cursor,
239
+ hasMore: startIndex + page.length < filtered.length,
240
+ };
241
+ });
189
242
  }
190
243
  async getIdBloomSummary() {
191
- const token = await this.ensureAuthenticated();
192
- const capabilities = await this.getCapabilities();
193
- if (capabilities.supportsIdBloomSummary && this.transport.getIdBloomSummary) {
194
- return this.transport.getIdBloomSummary(token);
195
- }
196
- // Compatibility fallback for older transports.
197
- const ids = await this.getAllIds();
198
- return (0, bloom_1.createIdBloomSummary)(ids);
244
+ return this.withTransparentReauth("getIdBloomSummary", async () => {
245
+ const capabilities = await this.getCapabilities();
246
+ if (capabilities.supportsIdBloomSummary && this.transport.getIdBloomSummary) {
247
+ const token = await this.ensureAuthenticated();
248
+ return this.transport.getIdBloomSummary(token);
249
+ }
250
+ // Compatibility fallback for older transports.
251
+ const ids = await this.getAllIds();
252
+ return (0, bloom_1.createIdBloomSummary)(ids);
253
+ });
199
254
  }
200
255
  async getCapabilities() {
201
256
  if (this.capabilitiesCache) {
202
257
  return this.capabilitiesCache;
203
258
  }
204
- const token = await this.ensureAuthenticated();
205
- if (this.transport.getCapabilities) {
206
- this.capabilitiesCache = await this.transport.getCapabilities(token);
259
+ return this.withTransparentReauth("getCapabilities", async () => {
260
+ const token = await this.ensureAuthenticated();
261
+ if (this.transport.getCapabilities) {
262
+ this.capabilitiesCache = await this.transport.getCapabilities(token);
263
+ return this.capabilitiesCache;
264
+ }
265
+ this.capabilitiesCache = {
266
+ protocolVersion: "sync-v1",
267
+ supportsCursorScan: false,
268
+ supportsIdBloomSummary: false,
269
+ supportsCompactionStatus: false,
270
+ supportsMaterializationPlanning: false,
271
+ supportsBatchMaterializationPlanning: false,
272
+ supportsAttachmentReadPlanning: false,
273
+ };
207
274
  return this.capabilitiesCache;
208
- }
209
- this.capabilitiesCache = {
210
- protocolVersion: "sync-v1",
211
- supportsCursorScan: false,
212
- supportsIdBloomSummary: false,
213
- supportsCompactionStatus: false,
214
- };
215
- return this.capabilitiesCache;
275
+ });
216
276
  }
217
277
  async getCompactionStatus() {
218
- const token = await this.ensureAuthenticated();
219
- const capabilities = await this.getCapabilities();
220
- if (capabilities.supportsCompactionStatus && this.transport.getCompactionStatus) {
221
- return this.transport.getCompactionStatus(token);
222
- }
223
- // Compatibility fallback for older transports.
224
- return {
225
- enabled: false,
226
- compactionMinFiles: 0,
227
- compactionMaxBytes: 0,
228
- totalCompactions: 0,
229
- totalCompactedFiles: 0,
230
- totalCompactedBytes: 0,
231
- totalCompactionDurationMs: 0,
232
- lastCompactionAt: null,
233
- lastCompactedFiles: 0,
234
- lastCompactedBytes: 0,
235
- lastCompactionDurationMs: 0,
236
- };
278
+ return this.withTransparentReauth("getCompactionStatus", async () => {
279
+ const capabilities = await this.getCapabilities();
280
+ if (capabilities.supportsCompactionStatus && this.transport.getCompactionStatus) {
281
+ const token = await this.ensureAuthenticated();
282
+ return this.transport.getCompactionStatus(token);
283
+ }
284
+ // Compatibility fallback for older transports.
285
+ return {
286
+ enabled: false,
287
+ compactionMinFiles: 0,
288
+ compactionMaxBytes: 0,
289
+ totalCompactions: 0,
290
+ totalCompactedFiles: 0,
291
+ totalCompactedBytes: 0,
292
+ totalCompactionDurationMs: 0,
293
+ lastCompactionAt: null,
294
+ lastCompactedFiles: 0,
295
+ lastCompactedBytes: 0,
296
+ lastCompactionDurationMs: 0,
297
+ };
298
+ });
299
+ }
300
+ async planDocumentMaterialization(docId, options) {
301
+ return this.withTransparentReauth("planDocumentMaterialization", async () => {
302
+ const capabilities = await this.getCapabilities();
303
+ if (!capabilities.supportsMaterializationPlanning || !this.transport.planDocumentMaterialization) {
304
+ throw new Error("Remote server does not support required materialization planning protocol");
305
+ }
306
+ const token = await this.ensureAuthenticated();
307
+ return this.transport.planDocumentMaterialization(token, docId, options);
308
+ });
309
+ }
310
+ async planDocumentMaterializationBatch(docIds, options) {
311
+ return this.withTransparentReauth("planDocumentMaterializationBatch", async () => {
312
+ const capabilities = await this.getCapabilities();
313
+ if (!capabilities.supportsBatchMaterializationPlanning || !this.transport.planDocumentMaterializationBatch) {
314
+ throw new Error("Remote server does not support required batch materialization planning protocol");
315
+ }
316
+ const token = await this.ensureAuthenticated();
317
+ return this.transport.planDocumentMaterializationBatch(token, docIds, options);
318
+ });
237
319
  }
238
320
  /**
239
321
  * Resolve dependencies for an entry.
@@ -241,11 +323,13 @@ class ClientNetworkContentAddressedStore {
241
323
  * Delegates to the remote server for efficient server-side traversal.
242
324
  */
243
325
  async resolveDependencies(startId, options) {
244
- this.logger.debug(`Resolving dependencies for ${startId}`);
245
- const token = await this.ensureAuthenticated();
246
- const resolvedIds = await this.transport.resolveDependencies(token, startId, options);
247
- this.logger.debug(`Resolved ${resolvedIds.length} dependencies`);
248
- return resolvedIds;
326
+ return this.withTransparentReauth("resolveDependencies", async () => {
327
+ this.logger.debug(`Resolving dependencies for ${startId}`);
328
+ const token = await this.ensureAuthenticated();
329
+ const resolvedIds = await this.transport.resolveDependencies(token, startId, options);
330
+ this.logger.debug(`Resolved ${resolvedIds.length} dependencies`);
331
+ return resolvedIds;
332
+ });
249
333
  }
250
334
  /**
251
335
  * Purge document history from the store.
@@ -269,12 +353,28 @@ class ClientNetworkContentAddressedStore {
269
353
  if (this.accessToken && this.tokenExpiry > now + 60000) { // 1 minute buffer
270
354
  return this.accessToken;
271
355
  }
272
- this.logger.debug(`Authenticating user: ${this.username}`);
356
+ if (this.authenticationPromise) {
357
+ return this.authenticationPromise;
358
+ }
359
+ this.authenticationPromise = this.performAuthentication();
360
+ try {
361
+ return await this.authenticationPromise;
362
+ }
363
+ finally {
364
+ if (this.authenticationPromise) {
365
+ this.authenticationPromise = null;
366
+ }
367
+ }
368
+ }
369
+ async performAuthentication() {
370
+ const now = Date.now();
371
+ const authUsername = this.getActiveAuthUsername();
372
+ this.logger.debug(`Authenticating user: ${authUsername}`);
273
373
  // Request a challenge
274
- const challenge = await this.transport.requestChallenge(this.username);
374
+ const challenge = await this.transport.requestChallenge(authUsername);
275
375
  this.logger.debug(`Received challenge: ${challenge}`);
276
376
  // Sign the challenge
277
- const signature = await this.signChallenge(challenge);
377
+ const signature = await this.signChallengeWithKey(challenge, this.getActiveSigningKey());
278
378
  this.logger.debug(`Signed challenge`);
279
379
  // Authenticate
280
380
  const result = await this.transport.authenticate(challenge, signature);
@@ -301,9 +401,12 @@ class ClientNetworkContentAddressedStore {
301
401
  * Sign a challenge with the user's private signing key.
302
402
  */
303
403
  async signChallenge(challenge) {
404
+ return this.signChallengeWithKey(challenge, this.signingKey);
405
+ }
406
+ async signChallengeWithKey(challenge, signingKey) {
304
407
  const subtle = this.cryptoAdapter.getSubtle();
305
408
  const messageBytes = new TextEncoder().encode(challenge);
306
- const signature = await subtle.sign({ name: "Ed25519" }, this.signingKey, messageBytes);
409
+ const signature = await subtle.sign({ name: "Ed25519" }, signingKey, messageBytes);
307
410
  return new Uint8Array(signature);
308
411
  }
309
412
  /**
@@ -314,7 +417,7 @@ class ClientNetworkContentAddressedStore {
314
417
  const results = [];
315
418
  for (const enc of encryptedEntries) {
316
419
  // Decrypt the RSA layer to get the original symmetric-encrypted payload
317
- const encryptedData = await this.rsaEncryption.decrypt(enc.rsaEncryptedPayload, this.privateEncryptionKey);
420
+ const encryptedData = await this.rsaEncryption.decrypt(enc.rsaEncryptedPayload, this.getActivePrivateEncryptionKey());
318
421
  // Create the full StoreEntry using metadata from the network entry
319
422
  const entry = {
320
423
  entryType: enc.entryType,
@@ -325,6 +428,8 @@ class ClientNetworkContentAddressedStore {
325
428
  createdAt: enc.createdAt,
326
429
  createdByPublicKey: enc.createdByPublicKey,
327
430
  decryptionKeyId: enc.decryptionKeyId,
431
+ snapshotHeadHashes: enc.snapshotHeadHashes,
432
+ snapshotHeadEntryIds: enc.snapshotHeadEntryIds,
328
433
  signature: enc.signature,
329
434
  originalSize: enc.originalSize,
330
435
  encryptedSize: enc.encryptedSize,
@@ -343,6 +448,50 @@ class ClientNetworkContentAddressedStore {
343
448
  this.tokenExpiry = 0;
344
449
  this.capabilitiesCache = null;
345
450
  }
451
+ async refreshAuthentication() {
452
+ this.clearAuthCache();
453
+ return this.ensureAuthenticated();
454
+ }
455
+ isInvalidTokenError(error) {
456
+ return error instanceof types_1.NetworkError && error.type === types_1.NetworkErrorType.INVALID_TOKEN;
457
+ }
458
+ async withTransparentReauth(operationName, operation) {
459
+ try {
460
+ return await operation();
461
+ }
462
+ catch (error) {
463
+ if (!this.isInvalidTokenError(error)) {
464
+ throw error;
465
+ }
466
+ this.logger.warn(`Received invalid token during ${operationName}, refreshing authentication and retrying once`);
467
+ await this.refreshAuthentication();
468
+ return operation();
469
+ }
470
+ }
471
+ /**
472
+ * Set or clear a temporary per-sync authentication override.
473
+ * Intended for bootstrap scenarios (for example authenticating as admin).
474
+ */
475
+ setSyncAuthOverride(override) {
476
+ this.syncAuthOverride = override;
477
+ // Changing auth identity requires token refresh.
478
+ this.clearAuthCache();
479
+ }
480
+ clearSyncAuthOverride() {
481
+ if (this.syncAuthOverride) {
482
+ this.syncAuthOverride = null;
483
+ this.clearAuthCache();
484
+ }
485
+ }
486
+ getActiveAuthUsername() {
487
+ return this.syncAuthOverride?.username ?? this.username;
488
+ }
489
+ getActiveSigningKey() {
490
+ return this.syncAuthOverride?.signingKey ?? this.signingKey;
491
+ }
492
+ getActivePrivateEncryptionKey() {
493
+ return this.syncAuthOverride?.privateEncryptionKey ?? this.privateEncryptionKey;
494
+ }
346
495
  }
347
496
  exports.ClientNetworkContentAddressedStore = ClientNetworkContentAddressedStore;
348
497
  //# sourceMappingURL=ClientNetworkContentAddressedStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClientNetworkContentAddressedStore.js","sourceRoot":"","sources":["../../../src/appendonlystores/network/ClientNetwork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CACF;AA7aD,gFA6aC"}
1
+ {"version":3,"file":"ClientNetworkContentAddressedStore.js","sourceRoot":"","sources":["../../../src/appendonlystores/network/ClientNetworkContentAddressedStore.ts"],"names":[],"mappings":";;;AAwBA,qEAA2F;AAC3F,mEAAgE;AAChE,gDAA8E;AAC9E,6DAAyE;AAEzE;;;;;;;;;;;;;GAaG;AACH,MAAa,kCAAkC;IAqB7C;;;;;;;;;;OAUG;IACH,YACE,IAAY,EACZ,SAA2B,EAC3B,aAA4B,EAC5B,QAAgB,EAChB,UAAqB,EACrB,oBAAwC,EACxC,MAAe;QA9BjB,sBAAsB;QACd,gBAAW,GAAkB,IAAI,CAAC;QAClC,gBAAW,GAAW,CAAC,CAAC;QACxB,0BAAqB,GAA2B,IAAI,CAAC;QAErD,sBAAiB,GAAmC,IAAI,CAAC;QACzD,qBAAgB,GAIb,IAAI,CAAC;QAsBd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACjD,IAAI,CAAC,MAAM;YACT,MAAM;gBACN,IAAI,sBAAY,CAAC,IAAA,4BAAkB,GAAE,EAAE,sBAAsB,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;QAC7E,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,GAAG,IAAI,6BAAa,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IACnE,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,gBAAgB;QACd,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,WAA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1
  import type { StoreEntry, StoreEntryMetadata, StoreEntryType, StoreScanCursor, StoreScanFilters, StoreScanResult, StoreIdBloomSummary, StoreCompactionStatus } from "../../core/types";
2
+ import type { AttachmentReadPlan, AttachmentReadPlanOptions, DocumentMaterializationBatchPlan, DocumentMaterializationPlan, MaterializationPlanOptions } from "../../core/appendonlystores/types";
2
3
  import type { NetworkTransport, NetworkTransportConfig } from "../../core/appendonlystores/network/NetworkTransport";
3
4
  import type { NetworkEncryptedEntry, AuthResult, NetworkSyncCapabilities } from "../../core/appendonlystores/network/types";
4
5
  import { Logger } from "../../core/logging";
@@ -21,7 +22,9 @@ export declare class HttpTransport implements NetworkTransport {
21
22
  private config;
22
23
  private baseUrl;
23
24
  private logger;
25
+ private remoteJsonBodyLimitBytesPromise;
24
26
  constructor(config: NetworkTransportConfig, logger?: Logger);
27
+ getIdentity(): string;
25
28
  /**
26
29
  * Request a challenge string for authentication.
27
30
  */
@@ -52,10 +55,14 @@ export declare class HttpTransport implements NetworkTransport {
52
55
  */
53
56
  getIdBloomSummary(token: string): Promise<StoreIdBloomSummary>;
54
57
  getCompactionStatus(token: string): Promise<StoreCompactionStatus>;
58
+ planDocumentMaterialization(token: string, docId: string, options?: MaterializationPlanOptions): Promise<DocumentMaterializationPlan>;
59
+ planDocumentMaterializationBatch(token: string, docIds: string[], options?: MaterializationPlanOptions): Promise<DocumentMaterializationBatchPlan>;
60
+ planAttachmentReadByWalkingMetadata(token: string, lastChunkId: string, attachmentSize: number, options: AttachmentReadPlanOptions): Promise<AttachmentReadPlan>;
55
61
  /**
56
62
  * Get entries from the remote store.
57
63
  */
58
64
  getEntries(token: string, ids: string[]): Promise<NetworkEncryptedEntry[]>;
65
+ getEntryMetadata(token: string, id: string): Promise<StoreEntryMetadata | null>;
59
66
  /**
60
67
  * Push entries to the remote store.
61
68
  */
@@ -77,6 +84,14 @@ export declare class HttpTransport implements NetworkTransport {
77
84
  */
78
85
  private fetchWithRetry;
79
86
  private sleep;
87
+ private getRemoteJsonBodyLimitBytes;
88
+ private fetchRemoteJsonBodyLimitBytes;
89
+ private parseByteSizeLimit;
90
+ private pushSerializedEntries;
91
+ private sendSerializedEntriesBatch;
92
+ private partitionSerializedEntriesForMaxBodySize;
93
+ private postSerializedEntries;
94
+ private measureBodyBytes;
80
95
  private uint8ArrayToBase64;
81
96
  private base64ToUint8Array;
82
97
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"HttpTransport.d.ts","sourceRoot":"","sources":["../../../src/appendonlystores/network/HttpTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AACrH,OAAO,KAAK,EACV,qBAAqB,EACrB,UAAU,EACV,uBAAuB,EACxB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAoC,MAAM,oBAAoB,CAAC;AAE9E;;;;;;;;;;;;;;GAcG;AACH,qBAAa,aAAc,YAAW,gBAAgB;IACpD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,MAAM;IAmB3D;;OAEG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA2BzD;;OAEG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IA2B3E,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IA4BtE;;OAEG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,M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AO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,MAAM,EAAE,CAAC;IA2BpB;;OAEG;YACW,cAAc;IAuF5B,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,kBAAkB;IAS1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAgB9B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAgBhC;;OAEG;IACH,OAAO,CAAC,cAAc;CAMvB"}
1
+ {"version":3,"file":"HttpTransport.d.ts","sourceRoot":"","sources":["../../../src/appendonlystores/network/HttpTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,gCAAgC,EAChC,2BAA2B,EAC3B,0BAA0B,EAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AACrH,OAAO,KAAK,EACV,qBAAqB,EACrB,UAAU,EACV,uBAAuB,EACxB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAoC,MAAM,oBAAoB,CAAC;AAE9E;;;;;;;;;;;;;;GAcG;AACH,qBAAa,aAAc,YAAW,gBAAgB;IACpD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,+BAA+B,CAAuC;gBAElE,MAAM,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,MAAM;IAmB3D,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,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