supastash 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (562) hide show
  1. package/README.md +20 -3
  2. package/dist/desktop/adapters/appstate.d.ts +2 -0
  3. package/dist/desktop/adapters/appstate.d.ts.map +1 -0
  4. package/dist/desktop/adapters/appstate.js +10 -0
  5. package/dist/desktop/adapters/crypto.d.ts +3 -0
  6. package/dist/desktop/adapters/crypto.d.ts.map +1 -0
  7. package/dist/desktop/adapters/crypto.js +16 -0
  8. package/dist/{core → desktop/core}/schemaManager/index.d.ts +1 -1
  9. package/dist/desktop/core/schemaManager/index.d.ts.map +1 -0
  10. package/dist/{core → desktop/core}/schemaManager/index.js +3 -3
  11. package/dist/{hooks/supastashData/index.d.ts → desktop/hooks/supastashData.d.ts} +2 -2
  12. package/dist/desktop/hooks/supastashData.d.ts.map +1 -0
  13. package/dist/desktop/hooks/supastashData.js +139 -0
  14. package/dist/{hooks → desktop/hooks}/supastashLogic.d.ts +1 -1
  15. package/dist/desktop/hooks/supastashLogic.d.ts.map +1 -0
  16. package/dist/{hooks → desktop/hooks}/supastashLogic.js +11 -12
  17. package/dist/{hooks/syncEngine/index.d.ts → desktop/hooks/syncEngine.d.ts} +1 -1
  18. package/dist/desktop/hooks/syncEngine.d.ts.map +1 -0
  19. package/dist/desktop/hooks/syncEngine.js +233 -0
  20. package/dist/desktop/index.d.ts +28 -0
  21. package/dist/desktop/index.d.ts.map +1 -0
  22. package/dist/desktop/index.js +21 -0
  23. package/dist/{hooks/supastashData → desktop/utils/fetchData}/eventQueues.d.ts +2 -2
  24. package/dist/desktop/utils/fetchData/eventQueues.d.ts.map +1 -0
  25. package/dist/{hooks/supastashData → desktop/utils/fetchData}/eventQueues.js +3 -3
  26. package/dist/{hooks/supastashData → desktop/utils/fetchData}/fetchCalls.d.ts +1 -1
  27. package/dist/desktop/utils/fetchData/fetchCalls.d.ts.map +1 -0
  28. package/dist/{hooks/supastashData → desktop/utils/fetchData}/fetchCalls.js +5 -5
  29. package/dist/{utils → desktop/utils}/fetchData/initialFetch.d.ts +1 -1
  30. package/dist/desktop/utils/fetchData/initialFetch.d.ts.map +1 -0
  31. package/dist/{utils → desktop/utils}/fetchData/initialFetch.js +2 -2
  32. package/dist/{utils → desktop/utils}/fetchData/receiveData.d.ts +1 -1
  33. package/dist/desktop/utils/fetchData/receiveData.d.ts.map +1 -0
  34. package/dist/{utils → desktop/utils}/fetchData/receiveData.js +6 -6
  35. package/dist/desktop/utils/query/index.d.ts +73 -0
  36. package/dist/desktop/utils/query/index.d.ts.map +1 -0
  37. package/dist/desktop/utils/query/index.js +139 -0
  38. package/dist/desktop/utils/schema/wipeTables.d.ts.map +1 -0
  39. package/dist/{utils → desktop/utils}/schema/wipeTables.js +4 -4
  40. package/dist/{utils → desktop/utils}/sync/pullFromRemote/fetchOlder.d.ts +2 -2
  41. package/dist/desktop/utils/sync/pullFromRemote/fetchOlder.d.ts.map +1 -0
  42. package/dist/{utils → desktop/utils}/sync/pullFromRemote/fetchOlder.js +2 -2
  43. package/dist/{utils → desktop/utils}/sync/pullFromRemote/fetchOlderHelpers.d.ts +3 -3
  44. package/dist/desktop/utils/sync/pullFromRemote/fetchOlderHelpers.d.ts.map +1 -0
  45. package/dist/{utils → desktop/utils}/sync/pullFromRemote/fetchOlderHelpers.js +8 -14
  46. package/dist/desktop/utils/sync/pullFromRemote/index.d.ts.map +1 -0
  47. package/dist/{hooks/syncEngine → desktop/utils/sync}/pullFromRemote/index.js +7 -7
  48. package/dist/{utils → desktop/utils}/sync/pullFromRemote/pullData.d.ts +2 -2
  49. package/dist/desktop/utils/sync/pullFromRemote/pullData.d.ts.map +1 -0
  50. package/dist/{utils → desktop/utils}/sync/pullFromRemote/pullData.js +6 -6
  51. package/dist/desktop/utils/sync/pullFromRemote/updateLocalDb.d.ts +46 -0
  52. package/dist/desktop/utils/sync/pullFromRemote/updateLocalDb.d.ts.map +1 -0
  53. package/dist/desktop/utils/sync/pullFromRemote/updateLocalDb.js +284 -0
  54. package/dist/desktop/utils/sync/pushLocal/index.d.ts.map +1 -0
  55. package/dist/{hooks/syncEngine → desktop/utils/sync}/pushLocal/index.js +7 -10
  56. package/dist/desktop/utils/sync/pushLocal/sendUnsyncedToSupabase.d.ts.map +1 -0
  57. package/dist/{utils → desktop/utils}/sync/pushLocal/sendUnsyncedToSupabase.js +5 -8
  58. package/dist/{utils → desktop/utils}/sync/pushLocal/uploadChunk.d.ts +1 -1
  59. package/dist/desktop/utils/sync/pushLocal/uploadChunk.d.ts.map +1 -0
  60. package/dist/{utils → desktop/utils}/sync/pushLocal/uploadChunk.js +8 -12
  61. package/dist/{utils → desktop/utils}/sync/pushLocal/uploadHelpers.d.ts +2 -2
  62. package/dist/desktop/utils/sync/pushLocal/uploadHelpers.d.ts.map +1 -0
  63. package/dist/{utils → desktop/utils}/sync/pushLocal/uploadHelpers.js +6 -6
  64. package/dist/{utils → desktop/utils}/sync/status/filterKey.d.ts +1 -1
  65. package/dist/desktop/utils/sync/status/filterKey.d.ts.map +1 -0
  66. package/dist/desktop/utils/sync/status/filterKey.js +48 -0
  67. package/dist/{utils → desktop/utils}/sync/status/repo.d.ts +3 -3
  68. package/dist/desktop/utils/sync/status/repo.d.ts.map +1 -0
  69. package/dist/{utils → desktop/utils}/sync/status/repo.js +3 -3
  70. package/dist/{utils → desktop/utils}/sync/status/services.d.ts +2 -2
  71. package/dist/desktop/utils/sync/status/services.d.ts.map +1 -0
  72. package/dist/{utils → desktop/utils}/sync/status/services.js +3 -3
  73. package/dist/{utils → desktop/utils}/sync/status/syncStatus.d.ts +2 -2
  74. package/dist/desktop/utils/sync/status/syncStatus.d.ts.map +1 -0
  75. package/dist/{utils → desktop/utils}/sync/status/syncStatus.js +4 -4
  76. package/dist/index.d.ts +18 -25
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +12 -22
  79. package/dist/native/core/schemaManager/index.d.ts +40 -0
  80. package/dist/native/core/schemaManager/index.d.ts.map +1 -0
  81. package/dist/native/core/schemaManager/index.js +141 -0
  82. package/dist/native/hooks/supastashData.d.ts +67 -0
  83. package/dist/native/hooks/supastashData.d.ts.map +1 -0
  84. package/dist/{hooks/supastashData/index.js → native/hooks/supastashData.js} +12 -10
  85. package/dist/native/hooks/supastashLogic.d.ts +19 -0
  86. package/dist/native/hooks/supastashLogic.d.ts.map +1 -0
  87. package/dist/native/hooks/supastashLogic.js +101 -0
  88. package/dist/native/hooks/syncEngine.d.ts +28 -0
  89. package/dist/native/hooks/syncEngine.d.ts.map +1 -0
  90. package/dist/{hooks/syncEngine/index.js → native/hooks/syncEngine.js} +18 -18
  91. package/dist/native/index.d.ts +28 -0
  92. package/dist/native/index.d.ts.map +1 -0
  93. package/dist/native/index.js +21 -0
  94. package/dist/native/utils/fetchData/eventQueues.d.ts +5 -0
  95. package/dist/native/utils/fetchData/eventQueues.d.ts.map +1 -0
  96. package/dist/native/utils/fetchData/eventQueues.js +52 -0
  97. package/dist/native/utils/fetchData/fetchCalls.d.ts +9 -0
  98. package/dist/native/utils/fetchData/fetchCalls.d.ts.map +1 -0
  99. package/dist/native/utils/fetchData/fetchCalls.js +88 -0
  100. package/dist/native/utils/fetchData/initialFetch.d.ts +3 -0
  101. package/dist/native/utils/fetchData/initialFetch.d.ts.map +1 -0
  102. package/dist/native/utils/fetchData/initialFetch.js +21 -0
  103. package/dist/native/utils/fetchData/receiveData.d.ts +3 -0
  104. package/dist/native/utils/fetchData/receiveData.d.ts.map +1 -0
  105. package/dist/native/utils/fetchData/receiveData.js +39 -0
  106. package/dist/native/utils/query/index.d.ts +73 -0
  107. package/dist/native/utils/query/index.d.ts.map +1 -0
  108. package/dist/native/utils/query/index.js +139 -0
  109. package/dist/native/utils/schema/wipeTables.d.ts +98 -0
  110. package/dist/native/utils/schema/wipeTables.d.ts.map +1 -0
  111. package/dist/native/utils/schema/wipeTables.js +188 -0
  112. package/dist/native/utils/sync/pullFromRemote/fetchOlder.d.ts +44 -0
  113. package/dist/native/utils/sync/pullFromRemote/fetchOlder.d.ts.map +1 -0
  114. package/dist/native/utils/sync/pullFromRemote/fetchOlder.js +55 -0
  115. package/dist/native/utils/sync/pullFromRemote/fetchOlderHelpers.d.ts +33 -0
  116. package/dist/native/utils/sync/pullFromRemote/fetchOlderHelpers.d.ts.map +1 -0
  117. package/dist/native/utils/sync/pullFromRemote/fetchOlderHelpers.js +104 -0
  118. package/dist/native/utils/sync/pullFromRemote/index.d.ts +5 -0
  119. package/dist/native/utils/sync/pullFromRemote/index.d.ts.map +1 -0
  120. package/dist/native/utils/sync/pullFromRemote/index.js +73 -0
  121. package/dist/native/utils/sync/pullFromRemote/pullData.d.ts +21 -0
  122. package/dist/native/utils/sync/pullFromRemote/pullData.d.ts.map +1 -0
  123. package/dist/native/utils/sync/pullFromRemote/pullData.js +80 -0
  124. package/dist/native/utils/sync/pullFromRemote/updateLocalDb.d.ts +46 -0
  125. package/dist/native/utils/sync/pullFromRemote/updateLocalDb.d.ts.map +1 -0
  126. package/dist/{utils → native/utils}/sync/pullFromRemote/updateLocalDb.js +120 -47
  127. package/dist/native/utils/sync/pushLocal/index.d.ts +5 -0
  128. package/dist/native/utils/sync/pushLocal/index.d.ts.map +1 -0
  129. package/dist/native/utils/sync/pushLocal/index.js +101 -0
  130. package/dist/native/utils/sync/pushLocal/sendUnsyncedToSupabase.d.ts +6 -0
  131. package/dist/native/utils/sync/pushLocal/sendUnsyncedToSupabase.d.ts.map +1 -0
  132. package/dist/native/utils/sync/pushLocal/sendUnsyncedToSupabase.js +57 -0
  133. package/dist/native/utils/sync/pushLocal/uploadChunk.d.ts +8 -0
  134. package/dist/native/utils/sync/pushLocal/uploadChunk.d.ts.map +1 -0
  135. package/dist/native/utils/sync/pushLocal/uploadChunk.js +173 -0
  136. package/dist/native/utils/sync/pushLocal/uploadHelpers.d.ts +41 -0
  137. package/dist/native/utils/sync/pushLocal/uploadHelpers.d.ts.map +1 -0
  138. package/dist/native/utils/sync/pushLocal/uploadHelpers.js +243 -0
  139. package/dist/native/utils/sync/status/filterKey.d.ts +15 -0
  140. package/dist/native/utils/sync/status/filterKey.d.ts.map +1 -0
  141. package/dist/{utils → native/utils}/sync/status/filterKey.js +0 -14
  142. package/dist/native/utils/sync/status/repo.d.ts +10 -0
  143. package/dist/native/utils/sync/status/repo.d.ts.map +1 -0
  144. package/dist/native/utils/sync/status/repo.js +97 -0
  145. package/dist/native/utils/sync/status/services.d.ts +31 -0
  146. package/dist/native/utils/sync/status/services.d.ts.map +1 -0
  147. package/dist/native/utils/sync/status/services.js +107 -0
  148. package/dist/native/utils/sync/status/syncStatus.d.ts +109 -0
  149. package/dist/native/utils/sync/status/syncStatus.d.ts.map +1 -0
  150. package/dist/native/utils/sync/status/syncStatus.js +161 -0
  151. package/dist/shared/constants/syncDefaults.d.ts.map +1 -0
  152. package/dist/{core → shared/core}/config/index.d.ts +2 -0
  153. package/dist/shared/core/config/index.d.ts.map +1 -0
  154. package/dist/{core → shared/core}/config/index.js +4 -0
  155. package/dist/shared/core/platform/appState.d.ts +12 -0
  156. package/dist/shared/core/platform/appState.d.ts.map +1 -0
  157. package/dist/shared/core/platform/appState.js +11 -0
  158. package/dist/shared/db/adapters/expo_sqlite.d.ts +3 -0
  159. package/dist/shared/db/adapters/expo_sqlite.d.ts.map +1 -0
  160. package/dist/shared/db/adapters/expo_sqlite.js +72 -0
  161. package/dist/shared/db/adapters/rn_nitro.d.ts +3 -0
  162. package/dist/shared/db/adapters/rn_nitro.d.ts.map +1 -0
  163. package/dist/shared/db/adapters/rn_nitro.js +111 -0
  164. package/dist/shared/db/adapters/rn_sqlite_storage.d.ts +3 -0
  165. package/dist/shared/db/adapters/rn_sqlite_storage.d.ts.map +1 -0
  166. package/dist/{db → shared/db}/adapters/rn_sqlite_storage.js +41 -0
  167. package/dist/shared/db/adapters/tauri.d.ts +3 -0
  168. package/dist/shared/db/adapters/tauri.d.ts.map +1 -0
  169. package/dist/shared/db/adapters/tauri.js +100 -0
  170. package/dist/shared/db/dbErrorMsg.d.ts.map +1 -0
  171. package/dist/{db → shared/db}/dbErrorMsg.js +7 -0
  172. package/dist/{db → shared/db}/dbInitializer.d.ts +1 -1
  173. package/dist/shared/db/dbInitializer.d.ts.map +1 -0
  174. package/dist/{db → shared/db}/dbInitializer.js +28 -15
  175. package/dist/shared/db/normalizer.d.ts +6 -0
  176. package/dist/shared/db/normalizer.d.ts.map +1 -0
  177. package/dist/shared/db/normalizer.js +26 -0
  178. package/dist/{hooks → shared/hooks}/supastashFilters/index.d.ts +1 -1
  179. package/dist/shared/hooks/supastashFilters/index.d.ts.map +1 -0
  180. package/dist/{hooks → shared/hooks}/syncStatus/index.d.ts +1 -1
  181. package/dist/shared/hooks/syncStatus/index.d.ts.map +1 -0
  182. package/dist/shared/store/localCache.d.ts.map +1 -0
  183. package/dist/shared/store/sharedDb.d.ts +6 -0
  184. package/dist/shared/store/sharedDb.d.ts.map +1 -0
  185. package/dist/shared/store/sharedDb.js +17 -0
  186. package/dist/shared/store/syncCalls.d.ts.map +1 -0
  187. package/dist/{store → shared/store}/syncStatus.d.ts +1 -1
  188. package/dist/shared/store/syncStatus.d.ts.map +1 -0
  189. package/dist/shared/store/tableFilters.d.ts.map +1 -0
  190. package/dist/shared/store/tableSchemaData.d.ts.map +1 -0
  191. package/dist/shared/store/tx.d.ts.map +1 -0
  192. package/dist/shared/types/adapters.types.d.ts +8 -0
  193. package/dist/shared/types/index.d.ts.map +1 -0
  194. package/dist/{types → shared/types}/supastashConfig.types.d.ts +180 -2
  195. package/dist/shared/utils/connection.d.ts.map +1 -0
  196. package/dist/{utils → shared/utils}/connection.js +6 -6
  197. package/dist/shared/utils/errorHandler.d.ts.map +1 -0
  198. package/dist/shared/utils/events/eventBus.d.ts.map +1 -0
  199. package/dist/shared/utils/fetchData/addPayloadToUI.d.ts.map +1 -0
  200. package/dist/shared/utils/fetchData/createTable.d.ts.map +1 -0
  201. package/dist/shared/utils/fetchData/dataState.d.ts.map +1 -0
  202. package/dist/{hooks/supastashData → shared/utils/fetchData}/dataState.js +1 -1
  203. package/dist/shared/utils/fetchData/deleteData.d.ts.map +1 -0
  204. package/dist/{utils → shared/utils}/fetchData/deleteData.js +2 -2
  205. package/dist/shared/utils/fetchData/fetchLocalData.d.ts.map +1 -0
  206. package/dist/shared/utils/fetchData/getKeyType.d.ts.map +1 -0
  207. package/dist/shared/utils/fetchData/liteHelpers.d.ts.map +1 -0
  208. package/dist/shared/utils/fetchData/realTimeCall.d.ts.map +1 -0
  209. package/dist/shared/utils/fetchData/realTimeManager.d.ts.map +1 -0
  210. package/dist/shared/utils/fetchData/registerSub.d.ts.map +1 -0
  211. package/dist/{hooks/supastashData → shared/utils/fetchData}/registerSub.js +1 -1
  212. package/dist/shared/utils/fetchData/setDataInBatches.d.ts.map +1 -0
  213. package/dist/shared/utils/fetchData/snapShot.d.ts.map +1 -0
  214. package/dist/shared/utils/fetchData/validatePayload.d.ts.map +1 -0
  215. package/dist/shared/utils/genUUID.d.ts.map +1 -0
  216. package/dist/shared/utils/getSafeValues.d.ts.map +1 -0
  217. package/dist/shared/utils/getTableSchema.d.ts.map +1 -0
  218. package/dist/{utils → shared/utils}/logs.d.ts +1 -0
  219. package/dist/shared/utils/logs.d.ts.map +1 -0
  220. package/dist/{utils → shared/utils}/logs.js +6 -1
  221. package/dist/shared/utils/query/builder/crud.d.ts.map +1 -0
  222. package/dist/shared/utils/query/builder/filters.d.ts.map +1 -0
  223. package/dist/{utils → shared/utils}/query/builder/filters.js +1 -1
  224. package/dist/shared/utils/query/builder/index.d.ts.map +1 -0
  225. package/dist/shared/utils/query/builder/mainQuery.d.ts.map +1 -0
  226. package/dist/shared/utils/query/helpers/localDb/getLocalMethod.d.ts.map +1 -0
  227. package/dist/shared/utils/query/helpers/localDb/insertMany.d.ts.map +1 -0
  228. package/dist/shared/utils/query/helpers/localDb/localQueryBuilder.d.ts.map +1 -0
  229. package/dist/shared/utils/query/helpers/localDb/upsertMany.d.ts.map +1 -0
  230. package/dist/shared/utils/query/helpers/mainQueryHelpers.d.ts.map +1 -0
  231. package/dist/{utils → shared/utils}/query/helpers/mainQueryHelpers.js +1 -1
  232. package/dist/shared/utils/query/helpers/queryValidator.d.ts.map +1 -0
  233. package/dist/shared/utils/query/helpers/queueRemote.d.ts.map +1 -0
  234. package/dist/{utils → shared/utils}/query/helpers/queueRemote.js +4 -4
  235. package/dist/shared/utils/query/helpers/remoteDb/queryFilterBuilder.d.ts.map +1 -0
  236. package/dist/shared/utils/query/helpers/remoteDb/queryUtils.d.ts.map +1 -0
  237. package/dist/shared/utils/query/localDbQuery/delete.d.ts.map +1 -0
  238. package/dist/shared/utils/query/localDbQuery/index.d.ts.map +1 -0
  239. package/dist/shared/utils/query/localDbQuery/insert.d.ts.map +1 -0
  240. package/dist/shared/utils/query/localDbQuery/select.d.ts.map +1 -0
  241. package/dist/shared/utils/query/localDbQuery/update.d.ts.map +1 -0
  242. package/dist/{utils → shared/utils}/query/localDbQuery/update.js +2 -2
  243. package/dist/shared/utils/query/localDbQuery/upsert.d.ts.map +1 -0
  244. package/dist/shared/utils/query/remoteQuery/supabaseQuery.d.ts.map +1 -0
  245. package/dist/{utils → shared/utils}/query/remoteQuery/supabaseQuery.js +1 -1
  246. package/dist/shared/utils/refreshScreenCalls.d.ts.map +1 -0
  247. package/dist/shared/utils/reusedHelpers.d.ts.map +1 -0
  248. package/dist/shared/utils/schema/createSyncStatus.d.ts.map +1 -0
  249. package/dist/shared/utils/serializer.d.ts.map +1 -0
  250. package/dist/shared/utils/supabaseClientErr.d.ts.map +1 -0
  251. package/dist/shared/utils/supastashMode.d.ts.map +1 -0
  252. package/dist/shared/utils/sync/getAllTables.d.ts.map +1 -0
  253. package/dist/{utils → shared/utils}/sync/getAllTables.js +1 -1
  254. package/dist/shared/utils/sync/pullFromRemote/getLastCreatedInfo.d.ts.map +1 -0
  255. package/dist/shared/utils/sync/pullFromRemote/getLastDeletedInfo.d.ts.map +1 -0
  256. package/dist/shared/utils/sync/pullFromRemote/getLastPulledInfo.d.ts.map +1 -0
  257. package/dist/shared/utils/sync/pullFromRemote/helpers.d.ts.map +1 -0
  258. package/dist/shared/utils/sync/pullFromRemote/runLimitedConcurrency.d.ts.map +1 -0
  259. package/dist/{utils → shared/utils}/sync/pullFromRemote/runLimitedConcurrency.js +1 -1
  260. package/dist/shared/utils/sync/pullFromRemote/stringifyFields.d.ts.map +1 -0
  261. package/dist/shared/utils/sync/pullFromRemote/updateFilter.d.ts.map +1 -0
  262. package/dist/shared/utils/sync/pullFromRemote/validateFilters.d.ts.map +1 -0
  263. package/dist/shared/utils/sync/pushLocal/deleteChunks.d.ts.map +1 -0
  264. package/dist/shared/utils/sync/pushLocal/getAllUnsyncedData.d.ts.map +1 -0
  265. package/dist/{utils → shared/utils}/sync/pushLocal/getAllUnsyncedData.js +2 -2
  266. package/dist/shared/utils/sync/pushLocal/normalize.d.ts.map +1 -0
  267. package/dist/shared/utils/sync/pushLocal/parseFields.d.ts.map +1 -0
  268. package/dist/{utils → shared/utils}/sync/queryStatus.d.ts +1 -1
  269. package/dist/shared/utils/sync/queryStatus.d.ts.map +1 -0
  270. package/dist/shared/utils/sync/refreshTables.d.ts.map +1 -0
  271. package/dist/shared/utils/sync/registration/syncCalls.d.ts.map +1 -0
  272. package/dist/{utils → shared/utils}/sync/registration/syncCalls.js +1 -1
  273. package/dist/shared/utils/sync/status/remoteSchema.d.ts.map +1 -0
  274. package/dist/shared/utils/sync/status/syncUpdate.d.ts.map +1 -0
  275. package/dist/shared/utils/tableValidator.d.ts.map +1 -0
  276. package/package.json +28 -11
  277. package/dist/constants/syncDefaults.d.ts.map +0 -1
  278. package/dist/core/config/index.d.ts.map +0 -1
  279. package/dist/core/schemaManager/index.d.ts.map +0 -1
  280. package/dist/db/adapters/expo_sqlite.d.ts +0 -3
  281. package/dist/db/adapters/expo_sqlite.d.ts.map +0 -1
  282. package/dist/db/adapters/expo_sqlite.js +0 -35
  283. package/dist/db/adapters/rn_nitro.d.ts +0 -3
  284. package/dist/db/adapters/rn_nitro.d.ts.map +0 -1
  285. package/dist/db/adapters/rn_nitro.js +0 -54
  286. package/dist/db/adapters/rn_sqlite_storage.d.ts +0 -3
  287. package/dist/db/adapters/rn_sqlite_storage.d.ts.map +0 -1
  288. package/dist/db/dbErrorMsg.d.ts.map +0 -1
  289. package/dist/db/dbInitializer.d.ts.map +0 -1
  290. package/dist/hooks/supastashData/addPayloadToUI.d.ts.map +0 -1
  291. package/dist/hooks/supastashData/dataState.d.ts.map +0 -1
  292. package/dist/hooks/supastashData/eventQueues.d.ts.map +0 -1
  293. package/dist/hooks/supastashData/fetchCalls.d.ts.map +0 -1
  294. package/dist/hooks/supastashData/index.d.ts.map +0 -1
  295. package/dist/hooks/supastashData/realtimeSubscription.d.ts +0 -5
  296. package/dist/hooks/supastashData/realtimeSubscription.d.ts.map +0 -1
  297. package/dist/hooks/supastashData/realtimeSubscription.js +0 -96
  298. package/dist/hooks/supastashData/registerSub.d.ts.map +0 -1
  299. package/dist/hooks/supastashFilters/index.d.ts.map +0 -1
  300. package/dist/hooks/supastashLiteQuery/fetchCalls.d.ts +0 -1
  301. package/dist/hooks/supastashLiteQuery/fetchCalls.d.ts.map +0 -1
  302. package/dist/hooks/supastashLiteQuery/fetchCalls.js +0 -122
  303. package/dist/hooks/supastashLiteQuery/index.d.ts +0 -53
  304. package/dist/hooks/supastashLiteQuery/index.d.ts.map +0 -1
  305. package/dist/hooks/supastashLiteQuery/index.js +0 -127
  306. package/dist/hooks/supastashLiteQuery/loadCacheOnMount.d.ts +0 -1
  307. package/dist/hooks/supastashLiteQuery/loadCacheOnMount.d.ts.map +0 -1
  308. package/dist/hooks/supastashLiteQuery/loadCacheOnMount.js +0 -1
  309. package/dist/hooks/supastashLogic.d.ts.map +0 -1
  310. package/dist/hooks/syncEngine/index.d.ts.map +0 -1
  311. package/dist/hooks/syncEngine/pullFromRemote/index.d.ts.map +0 -1
  312. package/dist/hooks/syncEngine/pushLocal/index.d.ts.map +0 -1
  313. package/dist/hooks/syncStatus/index.d.ts.map +0 -1
  314. package/dist/store/localCache.d.ts.map +0 -1
  315. package/dist/store/syncCalls.d.ts.map +0 -1
  316. package/dist/store/syncStatus.d.ts.map +0 -1
  317. package/dist/store/tableFilters.d.ts.map +0 -1
  318. package/dist/store/tableSchemaData.d.ts.map +0 -1
  319. package/dist/store/tx.d.ts.map +0 -1
  320. package/dist/types/index.d.ts.map +0 -1
  321. package/dist/utils/connection.d.ts.map +0 -1
  322. package/dist/utils/createIndexes.d.ts +0 -9
  323. package/dist/utils/createIndexes.d.ts.map +0 -1
  324. package/dist/utils/createIndexes.js +0 -74
  325. package/dist/utils/errorHandler.d.ts.map +0 -1
  326. package/dist/utils/events/eventBus.d.ts.map +0 -1
  327. package/dist/utils/fetchData/buildFilter.d.ts +0 -8
  328. package/dist/utils/fetchData/buildFilter.d.ts.map +0 -1
  329. package/dist/utils/fetchData/buildFilter.js +0 -58
  330. package/dist/utils/fetchData/createTable.d.ts.map +0 -1
  331. package/dist/utils/fetchData/deleteData.d.ts.map +0 -1
  332. package/dist/utils/fetchData/fetchLocalData.d.ts.map +0 -1
  333. package/dist/utils/fetchData/getKeyType.d.ts.map +0 -1
  334. package/dist/utils/fetchData/initialFetch.d.ts.map +0 -1
  335. package/dist/utils/fetchData/liteHelpers.d.ts.map +0 -1
  336. package/dist/utils/fetchData/liteReducer.d.ts +0 -3
  337. package/dist/utils/fetchData/liteReducer.d.ts.map +0 -1
  338. package/dist/utils/fetchData/liteReducer.js +0 -103
  339. package/dist/utils/fetchData/realTimeCall.d.ts.map +0 -1
  340. package/dist/utils/fetchData/realTimeManager.d.ts.map +0 -1
  341. package/dist/utils/fetchData/receiveData.d.ts.map +0 -1
  342. package/dist/utils/fetchData/setDataInBatches.d.ts.map +0 -1
  343. package/dist/utils/fetchData/snapShot.d.ts.map +0 -1
  344. package/dist/utils/fetchData/validatePayload.d.ts.map +0 -1
  345. package/dist/utils/genUUID.d.ts.map +0 -1
  346. package/dist/utils/getSafeValues.d.ts.map +0 -1
  347. package/dist/utils/getTableSchema.d.ts.map +0 -1
  348. package/dist/utils/logs.d.ts.map +0 -1
  349. package/dist/utils/query/builder/crud.d.ts.map +0 -1
  350. package/dist/utils/query/builder/filters.d.ts.map +0 -1
  351. package/dist/utils/query/builder/index.d.ts.map +0 -1
  352. package/dist/utils/query/builder/mainQuery.d.ts.map +0 -1
  353. package/dist/utils/query/helpers/localDb/getLocalMethod.d.ts.map +0 -1
  354. package/dist/utils/query/helpers/localDb/insertMany.d.ts.map +0 -1
  355. package/dist/utils/query/helpers/localDb/localQueryBuilder.d.ts.map +0 -1
  356. package/dist/utils/query/helpers/localDb/upsertMany.d.ts.map +0 -1
  357. package/dist/utils/query/helpers/mainQueryHelpers.d.ts.map +0 -1
  358. package/dist/utils/query/helpers/queryValidator.d.ts.map +0 -1
  359. package/dist/utils/query/helpers/queueRemote.d.ts.map +0 -1
  360. package/dist/utils/query/helpers/remoteDb/queryFilterBuilder.d.ts.map +0 -1
  361. package/dist/utils/query/helpers/remoteDb/queryUtils.d.ts.map +0 -1
  362. package/dist/utils/query/localDbQuery/delete.d.ts.map +0 -1
  363. package/dist/utils/query/localDbQuery/index.d.ts.map +0 -1
  364. package/dist/utils/query/localDbQuery/insert.d.ts.map +0 -1
  365. package/dist/utils/query/localDbQuery/select.d.ts.map +0 -1
  366. package/dist/utils/query/localDbQuery/update.d.ts.map +0 -1
  367. package/dist/utils/query/localDbQuery/upsert.d.ts.map +0 -1
  368. package/dist/utils/query/remoteQuery/supabaseQuery.d.ts.map +0 -1
  369. package/dist/utils/refreshScreenCalls.d.ts.map +0 -1
  370. package/dist/utils/reusedHelpers.d.ts.map +0 -1
  371. package/dist/utils/schema/createSyncStatus.d.ts.map +0 -1
  372. package/dist/utils/schema/wipeTables.d.ts.map +0 -1
  373. package/dist/utils/serializer.d.ts.map +0 -1
  374. package/dist/utils/supabaseClientErr.d.ts.map +0 -1
  375. package/dist/utils/supastashMode.d.ts.map +0 -1
  376. package/dist/utils/sync/getAllTables.d.ts.map +0 -1
  377. package/dist/utils/sync/pullFromRemote/fetchOlder.d.ts.map +0 -1
  378. package/dist/utils/sync/pullFromRemote/fetchOlderHelpers.d.ts.map +0 -1
  379. package/dist/utils/sync/pullFromRemote/getLastCreatedInfo.d.ts.map +0 -1
  380. package/dist/utils/sync/pullFromRemote/getLastDeletedInfo.d.ts.map +0 -1
  381. package/dist/utils/sync/pullFromRemote/getLastPulledInfo.d.ts.map +0 -1
  382. package/dist/utils/sync/pullFromRemote/helpers.d.ts.map +0 -1
  383. package/dist/utils/sync/pullFromRemote/pullData.d.ts.map +0 -1
  384. package/dist/utils/sync/pullFromRemote/pullDeletedData.d.ts +0 -15
  385. package/dist/utils/sync/pullFromRemote/pullDeletedData.d.ts.map +0 -1
  386. package/dist/utils/sync/pullFromRemote/pullDeletedData.js +0 -51
  387. package/dist/utils/sync/pullFromRemote/runLimitedConcurrency.d.ts.map +0 -1
  388. package/dist/utils/sync/pullFromRemote/stringifyFields.d.ts.map +0 -1
  389. package/dist/utils/sync/pullFromRemote/updateFilter.d.ts.map +0 -1
  390. package/dist/utils/sync/pullFromRemote/updateLocalDb.d.ts +0 -15
  391. package/dist/utils/sync/pullFromRemote/updateLocalDb.d.ts.map +0 -1
  392. package/dist/utils/sync/pullFromRemote/validateFilters.d.ts.map +0 -1
  393. package/dist/utils/sync/pushLocal/deleteChunks.d.ts.map +0 -1
  394. package/dist/utils/sync/pushLocal/getAllUnsyncedData.d.ts.map +0 -1
  395. package/dist/utils/sync/pushLocal/normalize.d.ts.map +0 -1
  396. package/dist/utils/sync/pushLocal/parseFields.d.ts.map +0 -1
  397. package/dist/utils/sync/pushLocal/sendUnsyncedToSupabase.d.ts.map +0 -1
  398. package/dist/utils/sync/pushLocal/uploadChunk.d.ts.map +0 -1
  399. package/dist/utils/sync/pushLocal/uploadHelpers.d.ts.map +0 -1
  400. package/dist/utils/sync/queryStatus.d.ts.map +0 -1
  401. package/dist/utils/sync/refreshTables.d.ts.map +0 -1
  402. package/dist/utils/sync/registration/syncCalls.d.ts.map +0 -1
  403. package/dist/utils/sync/status/filterKey.d.ts.map +0 -1
  404. package/dist/utils/sync/status/remoteSchema.d.ts.map +0 -1
  405. package/dist/utils/sync/status/repo.d.ts.map +0 -1
  406. package/dist/utils/sync/status/services.d.ts.map +0 -1
  407. package/dist/utils/sync/status/syncStatus.d.ts.map +0 -1
  408. package/dist/utils/sync/status/syncUpdate.d.ts.map +0 -1
  409. package/dist/utils/syncStatus.d.ts +0 -69
  410. package/dist/utils/syncStatus.d.ts.map +0 -1
  411. package/dist/utils/syncStatus.js +0 -129
  412. package/dist/utils/syncUpdate.d.ts +0 -7
  413. package/dist/utils/syncUpdate.d.ts.map +0 -1
  414. package/dist/utils/syncUpdate.js +0 -18
  415. package/dist/utils/tableValidator.d.ts.map +0 -1
  416. package/dist/utils/toggleSupastashMode.d.ts +0 -28
  417. package/dist/utils/toggleSupastashMode.d.ts.map +0 -1
  418. package/dist/utils/toggleSupastashMode.js +0 -46
  419. /package/dist/{utils → desktop/utils}/schema/wipeTables.d.ts +0 -0
  420. /package/dist/{hooks/syncEngine → desktop/utils/sync}/pullFromRemote/index.d.ts +0 -0
  421. /package/dist/{hooks/syncEngine → desktop/utils/sync}/pushLocal/index.d.ts +0 -0
  422. /package/dist/{utils → desktop/utils}/sync/pushLocal/sendUnsyncedToSupabase.d.ts +0 -0
  423. /package/dist/{constants → shared/constants}/syncDefaults.d.ts +0 -0
  424. /package/dist/{constants → shared/constants}/syncDefaults.js +0 -0
  425. /package/dist/{db → shared/db}/dbErrorMsg.d.ts +0 -0
  426. /package/dist/{hooks → shared/hooks}/supastashFilters/index.js +0 -0
  427. /package/dist/{hooks → shared/hooks}/syncStatus/index.js +0 -0
  428. /package/dist/{store → shared/store}/localCache.d.ts +0 -0
  429. /package/dist/{store → shared/store}/localCache.js +0 -0
  430. /package/dist/{store → shared/store}/syncCalls.d.ts +0 -0
  431. /package/dist/{store → shared/store}/syncCalls.js +0 -0
  432. /package/dist/{store → shared/store}/syncStatus.js +0 -0
  433. /package/dist/{store → shared/store}/tableFilters.d.ts +0 -0
  434. /package/dist/{store → shared/store}/tableFilters.js +0 -0
  435. /package/dist/{store → shared/store}/tableSchemaData.d.ts +0 -0
  436. /package/dist/{store → shared/store}/tableSchemaData.js +0 -0
  437. /package/dist/{store → shared/store}/tx.d.ts +0 -0
  438. /package/dist/{store → shared/store}/tx.js +0 -0
  439. /package/dist/{types → shared/types}/expoSqlite.types.d.ts +0 -0
  440. /package/dist/{types → shared/types}/index.d.ts +0 -0
  441. /package/dist/{types → shared/types}/index.js +0 -0
  442. /package/dist/{types → shared/types}/liteQuery.types.d.ts +0 -0
  443. /package/dist/{types → shared/types}/query.types.d.ts +0 -0
  444. /package/dist/{types → shared/types}/realtimeData.types.d.ts +0 -0
  445. /package/dist/{types → shared/types}/rnNitroSqlite.types.d.ts +0 -0
  446. /package/dist/{types → shared/types}/rnSqliteStorage.types.d.ts +0 -0
  447. /package/dist/{types → shared/types}/schemaManager.types.d.ts +0 -0
  448. /package/dist/{types → shared/types}/syncEngine.types.d.ts +0 -0
  449. /package/dist/{utils → shared/utils}/connection.d.ts +0 -0
  450. /package/dist/{utils → shared/utils}/errorHandler.d.ts +0 -0
  451. /package/dist/{utils → shared/utils}/errorHandler.js +0 -0
  452. /package/dist/{utils → shared/utils}/events/eventBus.d.ts +0 -0
  453. /package/dist/{utils → shared/utils}/events/eventBus.js +0 -0
  454. /package/dist/{hooks/supastashData → shared/utils/fetchData}/addPayloadToUI.d.ts +0 -0
  455. /package/dist/{hooks/supastashData → shared/utils/fetchData}/addPayloadToUI.js +0 -0
  456. /package/dist/{utils → shared/utils}/fetchData/createTable.d.ts +0 -0
  457. /package/dist/{utils → shared/utils}/fetchData/createTable.js +0 -0
  458. /package/dist/{hooks/supastashData → shared/utils/fetchData}/dataState.d.ts +0 -0
  459. /package/dist/{utils → shared/utils}/fetchData/deleteData.d.ts +0 -0
  460. /package/dist/{utils → shared/utils}/fetchData/fetchLocalData.d.ts +0 -0
  461. /package/dist/{utils → shared/utils}/fetchData/fetchLocalData.js +0 -0
  462. /package/dist/{utils → shared/utils}/fetchData/getKeyType.d.ts +0 -0
  463. /package/dist/{utils → shared/utils}/fetchData/getKeyType.js +0 -0
  464. /package/dist/{utils → shared/utils}/fetchData/liteHelpers.d.ts +0 -0
  465. /package/dist/{utils → shared/utils}/fetchData/liteHelpers.js +0 -0
  466. /package/dist/{utils → shared/utils}/fetchData/realTimeCall.d.ts +0 -0
  467. /package/dist/{utils → shared/utils}/fetchData/realTimeCall.js +0 -0
  468. /package/dist/{utils → shared/utils}/fetchData/realTimeManager.d.ts +0 -0
  469. /package/dist/{utils → shared/utils}/fetchData/realTimeManager.js +0 -0
  470. /package/dist/{hooks/supastashData → shared/utils/fetchData}/registerSub.d.ts +0 -0
  471. /package/dist/{utils → shared/utils}/fetchData/setDataInBatches.d.ts +0 -0
  472. /package/dist/{utils → shared/utils}/fetchData/setDataInBatches.js +0 -0
  473. /package/dist/{utils → shared/utils}/fetchData/snapShot.d.ts +0 -0
  474. /package/dist/{utils → shared/utils}/fetchData/snapShot.js +0 -0
  475. /package/dist/{utils → shared/utils}/fetchData/validatePayload.d.ts +0 -0
  476. /package/dist/{utils → shared/utils}/fetchData/validatePayload.js +0 -0
  477. /package/dist/{utils → shared/utils}/genUUID.d.ts +0 -0
  478. /package/dist/{utils → shared/utils}/genUUID.js +0 -0
  479. /package/dist/{utils → shared/utils}/getSafeValues.d.ts +0 -0
  480. /package/dist/{utils → shared/utils}/getSafeValues.js +0 -0
  481. /package/dist/{utils → shared/utils}/getTableSchema.d.ts +0 -0
  482. /package/dist/{utils → shared/utils}/getTableSchema.js +0 -0
  483. /package/dist/{utils → shared/utils}/query/builder/crud.d.ts +0 -0
  484. /package/dist/{utils → shared/utils}/query/builder/crud.js +0 -0
  485. /package/dist/{utils → shared/utils}/query/builder/filters.d.ts +0 -0
  486. /package/dist/{utils → shared/utils}/query/builder/index.d.ts +0 -0
  487. /package/dist/{utils → shared/utils}/query/builder/index.js +0 -0
  488. /package/dist/{utils → shared/utils}/query/builder/mainQuery.d.ts +0 -0
  489. /package/dist/{utils → shared/utils}/query/builder/mainQuery.js +0 -0
  490. /package/dist/{utils → shared/utils}/query/helpers/localDb/getLocalMethod.d.ts +0 -0
  491. /package/dist/{utils → shared/utils}/query/helpers/localDb/getLocalMethod.js +0 -0
  492. /package/dist/{utils → shared/utils}/query/helpers/localDb/insertMany.d.ts +0 -0
  493. /package/dist/{utils → shared/utils}/query/helpers/localDb/insertMany.js +0 -0
  494. /package/dist/{utils → shared/utils}/query/helpers/localDb/localQueryBuilder.d.ts +0 -0
  495. /package/dist/{utils → shared/utils}/query/helpers/localDb/localQueryBuilder.js +0 -0
  496. /package/dist/{utils → shared/utils}/query/helpers/localDb/upsertMany.d.ts +0 -0
  497. /package/dist/{utils → shared/utils}/query/helpers/localDb/upsertMany.js +0 -0
  498. /package/dist/{utils → shared/utils}/query/helpers/mainQueryHelpers.d.ts +0 -0
  499. /package/dist/{utils → shared/utils}/query/helpers/queryValidator.d.ts +0 -0
  500. /package/dist/{utils → shared/utils}/query/helpers/queryValidator.js +0 -0
  501. /package/dist/{utils → shared/utils}/query/helpers/queueRemote.d.ts +0 -0
  502. /package/dist/{utils → shared/utils}/query/helpers/remoteDb/queryFilterBuilder.d.ts +0 -0
  503. /package/dist/{utils → shared/utils}/query/helpers/remoteDb/queryFilterBuilder.js +0 -0
  504. /package/dist/{utils → shared/utils}/query/helpers/remoteDb/queryUtils.d.ts +0 -0
  505. /package/dist/{utils → shared/utils}/query/helpers/remoteDb/queryUtils.js +0 -0
  506. /package/dist/{utils → shared/utils}/query/localDbQuery/delete.d.ts +0 -0
  507. /package/dist/{utils → shared/utils}/query/localDbQuery/delete.js +0 -0
  508. /package/dist/{utils → shared/utils}/query/localDbQuery/index.d.ts +0 -0
  509. /package/dist/{utils → shared/utils}/query/localDbQuery/index.js +0 -0
  510. /package/dist/{utils → shared/utils}/query/localDbQuery/insert.d.ts +0 -0
  511. /package/dist/{utils → shared/utils}/query/localDbQuery/insert.js +0 -0
  512. /package/dist/{utils → shared/utils}/query/localDbQuery/select.d.ts +0 -0
  513. /package/dist/{utils → shared/utils}/query/localDbQuery/select.js +0 -0
  514. /package/dist/{utils → shared/utils}/query/localDbQuery/update.d.ts +0 -0
  515. /package/dist/{utils → shared/utils}/query/localDbQuery/upsert.d.ts +0 -0
  516. /package/dist/{utils → shared/utils}/query/localDbQuery/upsert.js +0 -0
  517. /package/dist/{utils → shared/utils}/query/remoteQuery/supabaseQuery.d.ts +0 -0
  518. /package/dist/{utils → shared/utils}/refreshScreenCalls.d.ts +0 -0
  519. /package/dist/{utils → shared/utils}/refreshScreenCalls.js +0 -0
  520. /package/dist/{utils → shared/utils}/reusedHelpers.d.ts +0 -0
  521. /package/dist/{utils → shared/utils}/reusedHelpers.js +0 -0
  522. /package/dist/{utils → shared/utils}/schema/createSyncStatus.d.ts +0 -0
  523. /package/dist/{utils → shared/utils}/schema/createSyncStatus.js +0 -0
  524. /package/dist/{utils → shared/utils}/serializer.d.ts +0 -0
  525. /package/dist/{utils → shared/utils}/serializer.js +0 -0
  526. /package/dist/{utils → shared/utils}/supabaseClientErr.d.ts +0 -0
  527. /package/dist/{utils → shared/utils}/supabaseClientErr.js +0 -0
  528. /package/dist/{utils → shared/utils}/supastashMode.d.ts +0 -0
  529. /package/dist/{utils → shared/utils}/supastashMode.js +0 -0
  530. /package/dist/{utils → shared/utils}/sync/getAllTables.d.ts +0 -0
  531. /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastCreatedInfo.d.ts +0 -0
  532. /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastCreatedInfo.js +0 -0
  533. /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastDeletedInfo.d.ts +0 -0
  534. /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastDeletedInfo.js +0 -0
  535. /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastPulledInfo.d.ts +0 -0
  536. /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastPulledInfo.js +0 -0
  537. /package/dist/{utils → shared/utils}/sync/pullFromRemote/helpers.d.ts +0 -0
  538. /package/dist/{utils → shared/utils}/sync/pullFromRemote/helpers.js +0 -0
  539. /package/dist/{utils → shared/utils}/sync/pullFromRemote/runLimitedConcurrency.d.ts +0 -0
  540. /package/dist/{utils → shared/utils}/sync/pullFromRemote/stringifyFields.d.ts +0 -0
  541. /package/dist/{utils → shared/utils}/sync/pullFromRemote/stringifyFields.js +0 -0
  542. /package/dist/{utils → shared/utils}/sync/pullFromRemote/updateFilter.d.ts +0 -0
  543. /package/dist/{utils → shared/utils}/sync/pullFromRemote/updateFilter.js +0 -0
  544. /package/dist/{utils → shared/utils}/sync/pullFromRemote/validateFilters.d.ts +0 -0
  545. /package/dist/{utils → shared/utils}/sync/pullFromRemote/validateFilters.js +0 -0
  546. /package/dist/{utils → shared/utils}/sync/pushLocal/deleteChunks.d.ts +0 -0
  547. /package/dist/{utils → shared/utils}/sync/pushLocal/deleteChunks.js +0 -0
  548. /package/dist/{utils → shared/utils}/sync/pushLocal/getAllUnsyncedData.d.ts +0 -0
  549. /package/dist/{utils → shared/utils}/sync/pushLocal/normalize.d.ts +0 -0
  550. /package/dist/{utils → shared/utils}/sync/pushLocal/normalize.js +0 -0
  551. /package/dist/{utils → shared/utils}/sync/pushLocal/parseFields.d.ts +0 -0
  552. /package/dist/{utils → shared/utils}/sync/pushLocal/parseFields.js +0 -0
  553. /package/dist/{utils → shared/utils}/sync/queryStatus.js +0 -0
  554. /package/dist/{utils → shared/utils}/sync/refreshTables.d.ts +0 -0
  555. /package/dist/{utils → shared/utils}/sync/refreshTables.js +0 -0
  556. /package/dist/{utils → shared/utils}/sync/registration/syncCalls.d.ts +0 -0
  557. /package/dist/{utils → shared/utils}/sync/status/remoteSchema.d.ts +0 -0
  558. /package/dist/{utils → shared/utils}/sync/status/remoteSchema.js +0 -0
  559. /package/dist/{utils → shared/utils}/sync/status/syncUpdate.d.ts +0 -0
  560. /package/dist/{utils → shared/utils}/sync/status/syncUpdate.js +0 -0
  561. /package/dist/{utils → shared/utils}/tableValidator.d.ts +0 -0
  562. /package/dist/{utils → shared/utils}/tableValidator.js +0 -0
@@ -0,0 +1,284 @@
1
+ import { getSupastashConfig } from "../../../../shared/core/config";
2
+ import { getSupastashDb } from "../../../../shared/db/dbInitializer";
3
+ import { DEFAULT_RECEIVED_DATA_COMPLETED, RECEIVED_DATA_COMPLETED_MAP, } from "../../../../shared/store/syncStatus";
4
+ import { generateUUIDv4 } from "../../../../shared/utils/genUUID";
5
+ import { getTableSchema } from "../../../../shared/utils/getTableSchema";
6
+ import log, { logError, logWarn } from "../../../../shared/utils/logs";
7
+ import { refreshScreen } from "../../../../shared/utils/refreshScreenCalls";
8
+ import { deleteReceivedDataCompleted } from "../../../../shared/utils/sync/pullFromRemote/helpers";
9
+ import { stringifyValue } from "../../../../shared/utils/sync/pullFromRemote/stringifyFields";
10
+ import { SyncInfoUpdater } from "../../../../shared/utils/sync/queryStatus";
11
+ import { updateLocalSyncedAt } from "../../../../shared/utils/sync/status/syncUpdate";
12
+ import { setSupastashSyncStatus } from "../status/services";
13
+ import { pullData } from "./pullData";
14
+ let isInSync = new Map();
15
+ const DEFAULT_DATE = "1970-01-01T00:00:00Z";
16
+ const BATCH_SIZE = 500;
17
+ const CHUNK_SIZE = 999;
18
+ /**
19
+ * Updates the local database with the remote changes
20
+ * @param table - The table to update
21
+ */
22
+ export async function updateLocalDb(table, filters, onReceiveData) {
23
+ if (isInSync.get(table))
24
+ return;
25
+ const cfg = getSupastashConfig();
26
+ if (cfg.supastashMode === "ghost")
27
+ return;
28
+ isInSync.set(table, true);
29
+ const batchId = generateUUIDv4();
30
+ try {
31
+ const db = await getSupastashDb();
32
+ // Initialize the batch completed map
33
+ RECEIVED_DATA_COMPLETED_MAP[batchId] = {
34
+ arrived_at: DEFAULT_RECEIVED_DATA_COMPLETED,
35
+ updated_at: DEFAULT_RECEIVED_DATA_COMPLETED,
36
+ };
37
+ let refreshNeeded = false;
38
+ while (true) {
39
+ const dataResult = await pullData({ table, filters, batchId });
40
+ if (!dataResult)
41
+ break;
42
+ const data = dataResult?.data;
43
+ const timestamps = dataResult.timestamps;
44
+ const deletedIds = dataResult.deletedIds;
45
+ const deletedIdSet = new Set(deletedIds ?? []);
46
+ SyncInfoUpdater.setUnsyncedDataCount({
47
+ amount: data?.length ?? 0,
48
+ type: "pull",
49
+ table,
50
+ });
51
+ SyncInfoUpdater.setUnsyncedDeletedCount({
52
+ amount: deletedIds?.length ?? 0,
53
+ type: "pull",
54
+ table,
55
+ });
56
+ refreshNeeded = !!data?.length || !!deletedIds?.length;
57
+ // Delete records that are no longer in the remote data
58
+ await db.withTransaction(async (tx) => {
59
+ if (deletedIds && deletedIds.length > 0) {
60
+ const ids = deletedIds;
61
+ for (let i = 0; i < ids.length; i += CHUNK_SIZE) {
62
+ const slice = ids.slice(i, i + CHUNK_SIZE);
63
+ const placeholders = slice.map(() => "?").join(", ");
64
+ await tx.runAsync(`DELETE FROM ${table} WHERE id IN (${placeholders})`, slice);
65
+ }
66
+ }
67
+ // Get the local stamp of the records
68
+ let localStamp = new Map();
69
+ if (data?.length) {
70
+ const ids = data.map((r) => r.id).filter(Boolean);
71
+ for (let i = 0; i < ids.length; i += CHUNK_SIZE) {
72
+ const slice = ids.slice(i, i + CHUNK_SIZE);
73
+ const placeholders = slice.map(() => "?").join(", ");
74
+ const rows = await db.getAllAsync(`SELECT id, updated_at FROM ${table} WHERE id IN (${placeholders})`, slice);
75
+ for (const row of rows ?? []) {
76
+ localStamp.set(row.id, row.updated_at ?? null);
77
+ }
78
+ }
79
+ }
80
+ // Update local database with remote changes
81
+ if (data?.length) {
82
+ await upsertChunkData({
83
+ tx,
84
+ table,
85
+ records: data,
86
+ });
87
+ }
88
+ });
89
+ if (timestamps) {
90
+ await setSupastashSyncStatus(table, filters, {
91
+ lastSyncedAt: timestamps.updatedMax,
92
+ lastDeletedAt: timestamps.deletedMax,
93
+ lastSyncedAtPk: timestamps.updatedMaxPk,
94
+ filterNamespace: "global",
95
+ });
96
+ }
97
+ const completedSet = RECEIVED_DATA_COMPLETED_MAP[batchId];
98
+ if (Object.values(completedSet ?? {}).every(Boolean)) {
99
+ break;
100
+ }
101
+ }
102
+ if (refreshNeeded)
103
+ refreshScreen(table);
104
+ }
105
+ catch (error) {
106
+ logWarn(`[Supastash] Error updating local db for ${table}`, error);
107
+ throw error;
108
+ }
109
+ finally {
110
+ isInSync.delete(table);
111
+ deleteReceivedDataCompleted(batchId);
112
+ }
113
+ }
114
+ const warned = new Map();
115
+ /**
116
+ * Upserts a record into the local database
117
+ * @param table - The table to upsert the record into
118
+ * @param record - The record to upsert
119
+ * @param exists - Whether the record already exists in the database
120
+ */
121
+ export async function upsertData({ tx, table, record, doesExist, }) {
122
+ if (!record?.id)
123
+ return;
124
+ let itemExists = !!doesExist;
125
+ const cfg = getSupastashConfig();
126
+ if (cfg.supastashMode === "ghost")
127
+ return;
128
+ if (doesExist === undefined) {
129
+ const { doesExist: exists } = await checkIfRecordExistsAndIsNewer(table, record);
130
+ itemExists = exists;
131
+ }
132
+ try {
133
+ const db = tx ?? (await getSupastashDb());
134
+ const columns = await getTableSchema(table);
135
+ const recordToSave = {
136
+ ...record,
137
+ synced_at: new Date().toISOString(),
138
+ };
139
+ if (getSupastashConfig().debugMode) {
140
+ const unknownKeys = Object.keys(record).filter((key) => !columns.includes(key));
141
+ if (unknownKeys.length > 0 && !warned.get(table)) {
142
+ warned.set(table, true);
143
+ logWarn(`⚠️ [Supastash] '${table}' payload contains keys not in local schema: ${unknownKeys.join(", ")}. ` + `They will be ignored locally.`);
144
+ }
145
+ }
146
+ // Prep for upsert
147
+ const keys = columns;
148
+ const placeholders = keys.map(() => "?").join(", ");
149
+ const updateColumns = keys.filter((key) => key !== "id");
150
+ const updateParts = updateColumns.map((key) => `${key} = ?`);
151
+ const updatePlaceholders = updateParts.join(", ");
152
+ const values = keys.map((key) => stringifyValue(recordToSave[key]));
153
+ const updateValues = updateColumns.map((key) => stringifyValue(recordToSave[key]));
154
+ if (itemExists) {
155
+ // Update existing record
156
+ await db.runAsync(`UPDATE ${table} SET ${updatePlaceholders} WHERE id = ?`, [...updateValues, record.id]);
157
+ }
158
+ else {
159
+ // Insert new record
160
+ await db.runAsync(`INSERT INTO ${table} (${keys.join(", ")}) VALUES (${placeholders})`, values);
161
+ }
162
+ await updateLocalSyncedAt(table, [record.id]);
163
+ }
164
+ catch (error) {
165
+ logError(`[Supastash] Error upserting data for ${table}`, error);
166
+ }
167
+ }
168
+ /**
169
+ • Bulk upserts records into a local SQLite table using a batched, conflict-aware strategy.
170
+
171
+ • This function:
172
+ • • Fetches existing id and updated_at values in bulk to avoid per-row queries
173
+ • • Filters incoming records to only include new or more recent entries
174
+ • • Performs batched INSERT ... ON CONFLICT(id) DO UPDATE operations
175
+ • while respecting SQLite parameter limits
176
+ • • Updates synced_at for successfully written records
177
+
178
+ • Designed for high-performance sync scenarios in offline-first apps.
179
+
180
+ • Key guarantees:
181
+ • • Avoids N+1 query patterns (no per-row existence checks)
182
+ • • Minimizes disk I/O pressure via batching
183
+ • • Safe for large datasets when used with chunking
184
+
185
+ • Notes:
186
+ • • Assumes id is the primary or unique key
187
+ • • Requires updated_at for conflict resolution (falls back if missing)
188
+ • • Respects SQLite parameter limit (~999 variables per query)
189
+
190
+ • @param tx Optional transaction instance. If not provided, a connection is used directly.
191
+ • @param table Target table name
192
+ • @param records Array of records to upsert
193
+ */
194
+ export async function upsertChunkData({ tx, table, records, }) {
195
+ if (!records?.length)
196
+ return;
197
+ const cfg = getSupastashConfig();
198
+ if (cfg.supastashMode === "ghost")
199
+ return;
200
+ const db = tx ?? (await getSupastashDb());
201
+ const columns = await getTableSchema(table);
202
+ const syncedAt = new Date().toISOString();
203
+ if (cfg.debugMode) {
204
+ const unknownKeys = Object.keys(records[0]).filter((key) => !columns.includes(key));
205
+ if (unknownKeys.length > 0 && !warned.get(table)) {
206
+ warned.set(table, true);
207
+ logWarn(`⚠️ [Supastash] '${table}' payload contains keys not in local schema: ${unknownKeys.join(", ")}. ` + `They will be ignored locally.`);
208
+ }
209
+ }
210
+ // Step 1: Fetch existing id + updated_at for all incoming ids in bulk
211
+ const incomingIds = records.map((r) => r.id).filter(Boolean);
212
+ const localStamp = new Map();
213
+ for (let i = 0; i < incomingIds.length; i += CHUNK_SIZE) {
214
+ const slice = incomingIds.slice(i, i + CHUNK_SIZE);
215
+ const placeholders = slice.map(() => "?").join(", ");
216
+ const rows = await db.getAllAsync(`SELECT id, updated_at FROM ${table} WHERE id IN (${placeholders})`, slice);
217
+ console.log("rows", rows.length);
218
+ for (const row of rows ?? []) {
219
+ localStamp.set(row.id, row.updated_at ?? null);
220
+ }
221
+ }
222
+ // Step 2: Keep only records that are new or have a newer remote updated_at
223
+ const toUpsert = records.filter((record) => {
224
+ if (!record?.id)
225
+ return false;
226
+ const remoteUpdated = record.updated_at;
227
+ if (!remoteUpdated)
228
+ return false;
229
+ const localUpdated = localStamp.get(record.id);
230
+ if (!localUpdated)
231
+ return true;
232
+ return new Date(remoteUpdated) > new Date(localUpdated);
233
+ });
234
+ console.log("toUpsert", toUpsert.length);
235
+ if (!toUpsert.length)
236
+ return;
237
+ // Step 3: Build INSERT … ON CONFLICT(id) DO UPDATE in param-limit-safe chunks
238
+ const colList = columns.join(", ");
239
+ const updateSet = columns
240
+ .filter((key) => key !== "id")
241
+ .map((key) => `${key} = excluded.${key}`)
242
+ .join(", ");
243
+ const paramsPerRow = columns.length;
244
+ const rowsPerChunk = Math.max(1, Math.floor(999 / paramsPerRow));
245
+ const successfulIds = [];
246
+ for (let i = 0; i < toUpsert.length; i += rowsPerChunk) {
247
+ const chunk = toUpsert.slice(i, i + rowsPerChunk);
248
+ const rowPlaceholders = chunk
249
+ .map(() => `(${columns.map(() => "?").join(", ")})`)
250
+ .join(", ");
251
+ const values = [];
252
+ for (const record of chunk) {
253
+ const recordToSave = { ...record, synced_at: syncedAt };
254
+ for (const col of columns) {
255
+ values.push(stringifyValue(recordToSave[col]));
256
+ }
257
+ }
258
+ try {
259
+ await db.runAsync(`INSERT INTO ${table} (${colList}) VALUES ${rowPlaceholders} ON CONFLICT(id) DO UPDATE SET ${updateSet}`, values);
260
+ for (const record of chunk) {
261
+ successfulIds.push(record.id);
262
+ }
263
+ }
264
+ catch (error) {
265
+ logError(`[Supastash] Error upserting chunk for ${table}`, error);
266
+ }
267
+ }
268
+ if (successfulIds.length) {
269
+ await updateLocalSyncedAt(table, successfulIds);
270
+ }
271
+ }
272
+ async function checkIfRecordExistsAndIsNewer(table, item) {
273
+ if (!item?.id)
274
+ return { doesExist: false, newer: false };
275
+ const db = await getSupastashDb();
276
+ const record = await db.getFirstAsync(`SELECT id, updated_at FROM ${table} WHERE id = ?`, [item.id]);
277
+ if (record &&
278
+ new Date(record.updated_at || DEFAULT_DATE) >=
279
+ new Date(item.updated_at || DEFAULT_DATE)) {
280
+ log(`Skipping ${table}:${record.id} - local is newer`);
281
+ return { doesExist: true, newer: false };
282
+ }
283
+ return { doesExist: !!record, newer: true };
284
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/desktop/utils/sync/pushLocal/index.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,wBAAsB,aAAa,kBAiGlC"}
@@ -1,11 +1,10 @@
1
- import { getSupastashConfig } from "../../../core/config";
2
- import { syncCalls } from "../../../store/syncCalls";
3
- import { isOnline } from "../../../utils/connection";
4
- import log from "../../../utils/logs";
5
- import { getAllTables } from "../../../utils/sync/getAllTables";
6
- import { runLimitedConcurrency } from "../../../utils/sync/pullFromRemote/runLimitedConcurrency";
7
- import { pushLocalDataToRemote } from "../../../utils/sync/pushLocal/sendUnsyncedToSupabase";
8
- import { SyncInfoUpdater } from "../../../utils/sync/queryStatus";
1
+ import { getSupastashConfig } from "../../../../shared/core/config";
2
+ import { syncCalls } from "../../../../shared/store/syncCalls";
3
+ import log from "../../../../shared/utils/logs";
4
+ import { getAllTables } from "../../../../shared/utils/sync/getAllTables";
5
+ import { runLimitedConcurrency } from "../../../../shared/utils/sync/pullFromRemote/runLimitedConcurrency";
6
+ import { SyncInfoUpdater } from "../../../../shared/utils/sync/queryStatus";
7
+ import { pushLocalDataToRemote } from "./sendUnsyncedToSupabase";
9
8
  let emptyPassCount = 0;
10
9
  let lastEmptyPassAt = 0;
11
10
  const tablePushLock = new Map();
@@ -21,8 +20,6 @@ export async function pushLocalData() {
21
20
  log("[Supastash] No tables found");
22
21
  return;
23
22
  }
24
- if (!(await isOnline()))
25
- return;
26
23
  const excludeTables = getSupastashConfig()?.excludeTables?.push || [];
27
24
  const tablesToPush = tables.filter((table) => !excludeTables?.includes(table));
28
25
  numberOfTables = tablesToPush.length;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendUnsyncedToSupabase.d.ts","sourceRoot":"","sources":["../../../../../src/desktop/utils/sync/pushLocal/sendUnsyncedToSupabase.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,MAAM,EACb,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EACrD,MAAM,CAAC,EAAE,MAAM,EAAE,gCA+ClB"}
@@ -1,9 +1,8 @@
1
- import { getSupastashConfig } from "../../../core/config";
2
- import { isOnline } from "../../connection";
3
- import { refreshScreen } from "../../refreshScreenCalls";
4
- import { SyncInfoUpdater } from "../queryStatus";
5
- import { deleteData } from "./deleteChunks";
6
- import { getAllDeletedData, getAllUnsyncedData } from "./getAllUnsyncedData";
1
+ import { getSupastashConfig } from "../../../../shared/core/config";
2
+ import { refreshScreen } from "../../../../shared/utils/refreshScreenCalls";
3
+ import { deleteData } from "../../../../shared/utils/sync/pushLocal/deleteChunks";
4
+ import { getAllDeletedData, getAllUnsyncedData, } from "../../../../shared/utils/sync/pushLocal/getAllUnsyncedData";
5
+ import { SyncInfoUpdater } from "../../../../shared/utils/sync/queryStatus";
7
6
  import { uploadData } from "./uploadChunk";
8
7
  let isInSync = new Map();
9
8
  /**
@@ -16,8 +15,6 @@ export async function pushLocalDataToRemote(table, onPushToRemote, noSync) {
16
15
  const cfg = getSupastashConfig();
17
16
  if (cfg.supastashMode === "ghost")
18
17
  return false;
19
- if (!(await isOnline()))
20
- return false;
21
18
  isInSync.set(table, true);
22
19
  try {
23
20
  const data = await getAllUnsyncedData(table);
@@ -1,4 +1,4 @@
1
- import { PayloadData } from "../../../types/query.types";
1
+ import { PayloadData } from "../../../../shared/types/query.types";
2
2
  /**
3
3
  * Uploads a chunk of data to the remote database
4
4
  * @param table - The table to upload to
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadChunk.d.ts","sourceRoot":"","sources":["../../../../../src/desktop/utils/sync/pushLocal/uploadChunk.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAgMnE;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,WAAW,EAAE,EAC9B,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,iBAetD"}
@@ -1,11 +1,10 @@
1
- import { DEFAULT_CHUNK_SIZE } from "../../../constants/syncDefaults";
2
- import { getSupastashConfig } from "../../../core/config";
3
- import { isOnline } from "../../../utils/connection";
4
- import { normalizeForSupabase } from "../../getSafeValues";
5
- import log from "../../logs";
6
- import { supabaseClientErr } from "../../supabaseClientErr";
7
- import { setQueryStatus, SyncInfoUpdater } from "../queryStatus";
8
- import { enforceTimestamps } from "./normalize";
1
+ import { DEFAULT_CHUNK_SIZE } from "../../../../shared/constants/syncDefaults";
2
+ import { getSupastashConfig } from "../../../../shared/core/config";
3
+ import { normalizeForSupabase } from "../../../../shared/utils/getSafeValues";
4
+ import log from "../../../../shared/utils/logs";
5
+ import { supabaseClientErr } from "../../../../shared/utils/supabaseClientErr";
6
+ import { enforceTimestamps } from "../../../../shared/utils/sync/pushLocal/normalize";
7
+ import { setQueryStatus, SyncInfoUpdater, } from "../../../../shared/utils/sync/queryStatus";
9
8
  import { backoff, batchUpsert, fetchRemoteHeadsChunked, filterRowsByUpdatedAt, handleRowFailure, markSynced, rpcUpsert, rpcUpsertSingle, singleUpsert, } from "./uploadHelpers";
10
9
  /**
11
10
  * Uploads a chunk of data to the remote database
@@ -23,9 +22,6 @@ async function uploadChunk(table, chunk, onPushToRemote) {
23
22
  if (!supabase) {
24
23
  throw new Error(supabaseClientErr);
25
24
  }
26
- const online = await isOnline();
27
- if (!online)
28
- return;
29
25
  let errorCount = 0;
30
26
  let lastError = null;
31
27
  let pending = [];
@@ -165,7 +161,7 @@ export async function uploadData(table, unsyncedRecords, onPushToRemote) {
165
161
  const supabase = cfg.supabaseClient;
166
162
  if (!supabase)
167
163
  throw new Error("[Supastash] Supabase client not configured");
168
- const cleaned = unsyncedRecords.map(({ synced_at, deleted_at, ...rest }) => enforceTimestamps(normalizeForSupabase(rest)));
164
+ const cleaned = unsyncedRecords.map(({ synced_at, deleted_at, arrived_at, ...rest }) => enforceTimestamps(normalizeForSupabase(rest)));
169
165
  for (let i = 0; i < cleaned.length; i += DEFAULT_CHUNK_SIZE) {
170
166
  const chunk = cleaned.slice(i, i + DEFAULT_CHUNK_SIZE);
171
167
  await uploadChunk(table, chunk, onPushToRemote);
@@ -1,5 +1,5 @@
1
- import { SupastashConfig } from "../../../types/supastashConfig.types";
2
- import { RowLike } from "../../../types/syncEngine.types";
1
+ import { SupastashConfig } from "../../../../shared/types/supastashConfig.types";
2
+ import { RowLike } from "../../../../shared/types/syncEngine.types";
3
3
  export declare function classifyFailure(cfg: SupastashConfig<any>, code?: string | number): "HTTP" | "UNKNOWN" | "NON_RETRYABLE" | "FK_BLOCK" | "RETRYABLE";
4
4
  declare function batchUpsert(table: string, rows: RowLike[], supabase: any): Promise<any>;
5
5
  declare function singleUpsert(table: string, row: RowLike, supabase: any): Promise<any>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadHelpers.d.ts","sourceRoot":"","sources":["../../../../../src/desktop/utils/sync/pushLocal/uploadHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AAOpE,wBAAgB,eAAe,CAC7B,GAAG,EAAE,eAAe,CAAC,GAAG,CAAC,EACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,mEAWvB;AAED,iBAAe,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,gBAEvE;AAED,iBAAe,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,gBAErE;AAED,iBAAe,OAAO,CAAC,QAAQ,EAAE,MAAM,iBAOtC;AAmBD,iBAAe,SAAS,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,QAAQ,EAAE,GAAG,CAAC;CACf;;;;;;;GA+CA;AAED,iBAAe,eAAe,CAAC,EAC7B,KAAK,EACL,GAAG,EACH,QAAQ,EACR,SAAS,GACV,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;;;;;;GAaA;AAMD,iBAAe,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,iBAIrD;AAWD,iBAAS,qBAAqB,CAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,EAAE,EAChB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,aAiCjC;AAMD,iBAAe,gBAAgB,CAC7B,GAAG,EAAE,eAAe,CAAC,GAAG,CAAC,EACzB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,GAAG,GACZ,OAAO,CAAC,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC,CAkDvC;AAgBD,OAAO,EACL,OAAO,EACP,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,eAAe,EACf,YAAY,GACb,CAAC;AAEF;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,GAAG,iBAkBd;AASD,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EAAE,EACb,QAAQ,EAAE,GAAG,gCAcd"}
@@ -1,10 +1,10 @@
1
- import { getSupastashConfig } from "../../../core/config";
2
- import { getSupastashDb } from "../../../db/dbInitializer";
3
- import { supastashEventBus } from "../../../utils/events/eventBus";
4
- import log, { logWarn } from "../../../utils/logs";
1
+ import { getSupastashConfig } from "../../../../shared/core/config";
2
+ import { getSupastashDb } from "../../../../shared/db/dbInitializer";
3
+ import { supastashEventBus } from "../../../../shared/utils/events/eventBus";
4
+ import log, { logWarn } from "../../../../shared/utils/logs";
5
+ import { setQueryStatus } from "../../../../shared/utils/sync/queryStatus";
6
+ import { updateLocalSyncedAt } from "../../../../shared/utils/sync/status/syncUpdate";
5
7
  import { upsertData } from "../pullFromRemote/updateLocalDb";
6
- import { setQueryStatus } from "../queryStatus";
7
- import { updateLocalSyncedAt } from "../status/syncUpdate";
8
8
  export function classifyFailure(cfg, code) {
9
9
  const p = cfg.syncPolicy ?? {};
10
10
  const n = Number(code);
@@ -1,4 +1,4 @@
1
- import { SupastashFilter } from "../../../types/realtimeData.types";
1
+ import { SupastashFilter } from "../../../../shared/types/realtimeData.types";
2
2
  /**
3
3
  * Canonicalizes a set of filters
4
4
  * @param filters - The filters to canonicalize
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterKey.d.ts","sourceRoot":"","sources":["../../../../../src/desktop/utils/sync/status/filterKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAc9E;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,CAAC,EAAE,eAAe,EAAE,GAAG,IAAI,GACjC,MAAM,CAuBR;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,CAAC,EAAE,eAAe,EAAE,GAAG,IAAI,EAClC,EAAE,SAAW,mBAKd"}
@@ -0,0 +1,48 @@
1
+ import { webCryptoAdapter } from "../../../adapters/crypto";
2
+ /**
3
+ * Normalizes a value
4
+ * @param v - The value to normalize
5
+ * @returns The normalized value
6
+ */
7
+ function normVal(v) {
8
+ if (v === null || v === undefined)
9
+ return null;
10
+ if (Array.isArray(v))
11
+ return v.map(String).sort();
12
+ return typeof v === "number" ? String(v) : String(v);
13
+ }
14
+ /**
15
+ * Canonicalizes a set of filters
16
+ * @param filters - The filters to canonicalize
17
+ * @returns The canonicalized filters
18
+ */
19
+ export function canonicalizeFilters(filters) {
20
+ const list = (filters ?? [])
21
+ .filter((f) => !!f && typeof f === "object" && "column" in f && "operator" in f)
22
+ .map((f) => ({
23
+ column: String(f.column),
24
+ operator: f.operator,
25
+ value: normVal(f.value),
26
+ }));
27
+ list.sort((a, b) => {
28
+ if (a.column !== b.column)
29
+ return a.column < b.column ? -1 : 1;
30
+ if (a.operator !== b.operator)
31
+ return a.operator < b.operator ? -1 : 1;
32
+ const av = JSON.stringify(a.value);
33
+ const bv = JSON.stringify(b.value);
34
+ return av < bv ? -1 : av > bv ? 1 : 0;
35
+ });
36
+ return JSON.stringify(list);
37
+ }
38
+ /**
39
+ * Computes the filter key for a given set of filters
40
+ * @param filters - The filters to compute the key for
41
+ * @param ns - The namespace to use for the key
42
+ * @returns The computed filter key
43
+ */
44
+ export async function computeFilterKey(filters, ns = "global") {
45
+ const canon = canonicalizeFilters(filters);
46
+ const namespaced = JSON.stringify({ ns, filters: JSON.parse(canon) });
47
+ return webCryptoAdapter.sha256(namespaced);
48
+ }
@@ -1,6 +1,6 @@
1
- import { SupastashFilter } from "../../../types/realtimeData.types";
2
- import { SupastashSQLiteDatabase } from "../../../types/supastashConfig.types";
3
- import { SupastashSyncStatus } from "../../../types/syncEngine.types";
1
+ import { SupastashFilter } from "../../../../shared/types/realtimeData.types";
2
+ import { SupastashSQLiteDatabase } from "../../../../shared/types/supastashConfig.types";
3
+ import { SupastashSyncStatus } from "../../../../shared/types/syncEngine.types";
4
4
  export declare function ensureSyncMarksTable(): Promise<void>;
5
5
  export declare function selectMarks(db: SupastashSQLiteDatabase, table: string, filterKey: string): Promise<SupastashSyncStatus | null>;
6
6
  export declare function selectSyncStatus(db: SupastashSQLiteDatabase, table: string, tableFilters?: SupastashFilter[]): Promise<SupastashSyncStatus>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../../../src/desktop/utils/sync/status/repo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAuDhF,wBAAsB,oBAAoB,kBAEzC;AAED,wBAAsB,WAAW,CAC/B,EAAE,EAAE,uBAAuB,EAC3B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,uCAOlB;AAED,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,uBAAuB,EAC3B,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,eAAe,EAAE,GAC/B,OAAO,CAAC,mBAAmB,CAAC,CAoB9B;AAED,wBAAsB,WAAW,CAC/B,EAAE,EAAE,uBAAuB,EAC3B,GAAG,EAAE,OAAO,CAAC,mBAAmB,CAAC,gBA8BlC;AAED,wBAAsB,WAAW,CAC/B,EAAE,EAAE,uBAAuB,EAC3B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,gBAAgB,GAAG,iBAAiB,EACzC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,gBAYnB;AAED,wBAAsB,WAAW,CAC/B,EAAE,EAAE,uBAAuB,EAC3B,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,gBASnB"}
@@ -1,6 +1,6 @@
1
- import { getSupastashConfig } from "../../../core/config";
2
- import { logWarn } from "../../logs";
3
- import { createSyncStatusTable } from "../../schema/createSyncStatus";
1
+ import { getSupastashConfig } from "../../../../shared/core/config";
2
+ import { logWarn } from "../../../../shared/utils/logs";
3
+ import { createSyncStatusTable } from "../../../../shared/utils/schema/createSyncStatus";
4
4
  import { computeFilterKey } from "./filterKey";
5
5
  const OLD_DATE = "2000-01-01T00:00:00Z";
6
6
  const SYNC_STATUS_TABLE = "supastash_sync_marks";
@@ -1,5 +1,5 @@
1
- import { SupastashFilter } from "../../../types/realtimeData.types";
2
- import { PublicScope, SupastashSyncStatus } from "../../../types/syncEngine.types";
1
+ import { SupastashFilter } from "../../../../shared/types/realtimeData.types";
2
+ import { PublicScope, SupastashSyncStatus } from "../../../../shared/types/syncEngine.types";
3
3
  /**
4
4
  * Gets the supastash sync status for a given table and filters
5
5
  * @param table - The name of the table to get the sync status for
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../../src/desktop/utils/sync/status/services.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EACL,WAAW,EACX,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAmBnD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,eAAe,EAAE,GAC1B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAWrC;AAED,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,EAAE,GAAG,SAAS,EACtC,IAAI,EAAE;IACJ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,iBAyCF;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,EAAE,GAAG,SAAS,EACtC,KAAK,GAAE,WAAmB,iBAmB3B;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,eAAe,EAAE,iBAY5B"}
@@ -1,6 +1,6 @@
1
- import { getSupastashDb } from "../../../db/dbInitializer";
2
- import { tableFilters } from "../../../store/tableFilters";
3
- import { logError, logWarn } from "../../logs";
1
+ import { getSupastashDb } from "../../../../shared/db/dbInitializer";
2
+ import { tableFilters } from "../../../../shared/store/tableFilters";
3
+ import { logError, logWarn } from "../../../../shared/utils/logs";
4
4
  import { canonicalizeFilters, computeFilterKey } from "./filterKey";
5
5
  import { deleteMarks, ensureSyncMarksTable, resetColumn, selectMarks, upsertMarks, } from "./repo";
6
6
  const maxIso = (a, b) => {
@@ -1,5 +1,5 @@
1
- import { SupastashFilter } from "../../../types/realtimeData.types";
2
- import { PublicScope, SupastashSyncStatus } from "../../../types/syncEngine.types";
1
+ import { SupastashFilter } from "../../../../shared/types/realtimeData.types";
2
+ import { PublicScope, SupastashSyncStatus } from "../../../../shared/types/syncEngine.types";
3
3
  /**
4
4
  * Clears the sync log for a specific table.
5
5
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncStatus.d.ts","sourceRoot":"","sources":["../../../../../src/desktop/utils/sync/status/syncStatus.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EACL,WAAW,EACX,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAkBnD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,iBAExD;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,kBAKzC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CASrC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,EAAE,GAAG,SAAS,EACtC,IAAI,EAAE;IACJ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,iBAOF;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,EAAE,GAAG,SAAS,EACtC,KAAK,GAAE,WAAmB,iBAO3B;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,EAAE,iBAM5E;AAED,oFAAoF;AAEpF;;;GAGG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,MAAM,iBAGvB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,iBAE1D;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,kBAE3C;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,iBAExD;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,iBAGtB"}
@@ -1,7 +1,7 @@
1
- import { getSupastashConfig } from "../../../core/config";
2
- import { getSupastashDb } from "../../../db/dbInitializer";
3
- import { logError } from "../../logs";
4
- import { createSyncStatusTable } from "../../schema/createSyncStatus";
1
+ import { getSupastashConfig } from "../../../../shared/core/config";
2
+ import { getSupastashDb } from "../../../../shared/db/dbInitializer";
3
+ import { logError } from "../../../../shared/utils/logs";
4
+ import { createSyncStatusTable } from "../../../../shared/utils/schema/createSyncStatus";
5
5
  import { clearSupastashSyncStatus, getSupastashSyncStatus, resetSupastashSyncStatus, setSupastashSyncStatus, } from "./services";
6
6
  const SYNC_STATUS_TABLE = "supastash_sync_marks";
7
7
  const SERVER_SYNC_STATUS_TABLE = "supastash_server_sync_marks";
package/dist/index.d.ts CHANGED
@@ -1,26 +1,19 @@
1
- export { configureSupastash, getSupastashConfig } from "./core/config";
2
- export { defineLocalSchema } from "./core/schemaManager";
3
- export { getSupastashDb } from "./db/dbInitializer";
4
- export { useSupastashData } from "./hooks/supastashData";
5
- export { useSupastashFilters } from "./hooks/supastashFilters";
6
- export { useSupastash } from "./hooks/supastashLogic";
7
- export { syncAllTables, syncTable } from "./hooks/syncEngine";
8
- export { useSupastashSyncStatus } from "./hooks/syncStatus";
9
- export { closeSyncGate, isSyncGateClosed, openSyncGate, } from "./store/syncStatus";
10
- export { supastashEventBus } from "./utils/events/eventBus";
11
- export { supastash } from "./utils/query/builder";
12
- export { refreshScreen } from "./utils/refreshScreenCalls";
13
- export { dropAllTables, dropTable, wipeAllTables, wipeOldDataForAllTables, wipeOldDataForATable, wipeTable, } from "./utils/schema/wipeTables";
14
- export { getSupastashRuntimeMode, reinitializeSupastash, } from "./utils/supastashMode";
15
- export { getAllTables } from "./utils/sync/getAllTables";
16
- export { fetchOlderPage } from "./utils/sync/pullFromRemote/fetchOlder";
17
- export { updateFilters } from "./utils/sync/pullFromRemote/updateFilter";
18
- export { updateLocalDb, upsertData, } from "./utils/sync/pullFromRemote/updateLocalDb";
19
- export { refreshAllTables, refreshTable, refreshTableWithPayload, } from "./utils/sync/refreshTables";
20
- export { clearSyncCalls, getAllSyncTables, getSyncCall, registerSyncCall, unregisterSyncCall, } from "./utils/sync/registration/syncCalls";
21
- export { clearAllLocalDeleteLog, clearAllLocalSyncLog, clearLocalDeleteLog, clearLocalSyncLog, clearSyncLog, getLocalDeleteLog, getSyncLog, resetSyncLog, setLocalDeleteLog, setLocalSyncLog, setSyncLog, } from "./utils/sync/status/syncStatus";
22
- export type { CrudMethods } from "./types/query.types";
23
- export type { RealtimeOptions, SupastashDataResult, SupastashFilter, } from "./types/realtimeData.types";
24
- export type { SupastashConfig, SupastashHookReturn, SupastashSQLiteClientTypes, SupastashSQLiteDatabase, SupastashSQLiteExecutor, } from "./types/supastashConfig.types";
25
- export type { SupastashClient, SupastashTransactionClient, } from "./utils/query/builder";
1
+ export { configureSupastash, getSupastashConfig } from "./shared/core/config";
2
+ export { useSupastashFilters } from "./shared/hooks/supastashFilters";
3
+ export { useSupastashSyncStatus } from "./shared/hooks/syncStatus";
4
+ export { closeSyncGate, isSyncGateClosed, openSyncGate, } from "./shared/store/syncStatus";
5
+ export { supastashEventBus } from "./shared/utils/events/eventBus";
6
+ export { refreshScreen } from "./shared/utils/refreshScreenCalls";
7
+ export { getSupastashRuntimeMode, reinitializeSupastash, } from "./shared/utils/supastashMode";
8
+ export { getAllTables } from "./shared/utils/sync/getAllTables";
9
+ export { updateFilters } from "./shared/utils/sync/pullFromRemote/updateFilter";
10
+ export { refreshAllTables, refreshTable, refreshTableWithPayload, } from "./shared/utils/sync/refreshTables";
11
+ export { clearSyncCalls, getAllSyncTables, getSyncCall, registerSyncCall, unregisterSyncCall, } from "./shared/utils/sync/registration/syncCalls";
12
+ export { supastash } from "./shared/utils/query/builder";
13
+ export type { CrudMethods } from "./shared/types/query.types";
14
+ export type { RealtimeOptions, SupastashDataResult, SupastashFilter, } from "./shared/types/realtimeData.types";
15
+ export type { LocalSchemaDefinition } from "./shared/types/schemaManager.types";
16
+ export type { ExpoSQLiteClient, RNSqliteNitroClient, RNStorageSQLiteClient, SupastashConfig, SupastashHookReturn, SupastashSQLiteClientTypes, SupastashSQLiteDatabase, SupastashSQLiteExecutor, TauriSQLiteClient, } from "./shared/types/supastashConfig.types";
17
+ export type { SyncInfo } from "./shared/types/syncEngine.types";
18
+ export type { SupastashClient, SupastashTransactionClient, } from "./shared/utils/query/builder";
26
19
  //# sourceMappingURL=index.d.ts.map