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
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EACL,aAAa,EACb,SAAS,EACT,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,SAAS,GACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EACL,aAAa,EACb,UAAU,GACX,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,UAAU,GACX,MAAM,gCAAgC,CAAC;AAExC,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,eAAe,EACf,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,GACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,YAAY,EACV,eAAe,EACf,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC"}
package/dist/index.js CHANGED
@@ -1,22 +1,12 @@
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 { useSupastashLiteQuery } from "./hooks/supastashLiteQuery";
6
- export { useSupastashFilters } from "./hooks/supastashFilters";
7
- export { useSupastash } from "./hooks/supastashLogic";
8
- export { syncAllTables, syncTable } from "./hooks/syncEngine";
9
- export { useSupastashSyncStatus } from "./hooks/syncStatus";
10
- export { closeSyncGate, isSyncGateClosed, openSyncGate, } from "./store/syncStatus";
11
- export { supastashEventBus } from "./utils/events/eventBus";
12
- export { supastash } from "./utils/query/builder";
13
- export { refreshScreen } from "./utils/refreshScreenCalls";
14
- export { dropAllTables, dropTable, wipeAllTables, wipeOldDataForAllTables, wipeOldDataForATable, wipeTable, } from "./utils/schema/wipeTables";
15
- export { getSupastashRuntimeMode, reinitializeSupastash, } from "./utils/supastashMode";
16
- export { getAllTables } from "./utils/sync/getAllTables";
17
- export { fetchOlderPage } from "./utils/sync/pullFromRemote/fetchOlder";
18
- export { updateFilters } from "./utils/sync/pullFromRemote/updateFilter";
19
- export { updateLocalDb, upsertData, } from "./utils/sync/pullFromRemote/updateLocalDb";
20
- export { refreshAllTables, refreshTable, refreshTableWithPayload, } from "./utils/sync/refreshTables";
21
- export { clearSyncCalls, getAllSyncTables, getSyncCall, registerSyncCall, unregisterSyncCall, } from "./utils/sync/registration/syncCalls";
22
- export { clearAllLocalDeleteLog, clearAllLocalSyncLog, clearLocalDeleteLog, clearLocalSyncLog, clearSyncLog, getLocalDeleteLog, getSyncLog, resetSyncLog, setLocalDeleteLog, setLocalSyncLog, setSyncLog, } from "./utils/sync/status/syncStatus";
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";
@@ -0,0 +1,40 @@
1
+ import { LocalSchemaDefinition } from "../../../shared/types/schemaManager.types";
2
+ /**
3
+ * 🧱 defineLocalSchema
4
+ *
5
+ * Defines a local SQLite table schema programmatically, with support for foreign keys and indices.
6
+ * Intended for offline-first apps using Supastash. Ensures consistency in structure and indexing while
7
+ * allowing runtime control of schema migration through `deletePreviousSchema`.
8
+ *
9
+ * It will also create the following indexes:
10
+ * - synced_at
11
+ * - deleted_at
12
+ * - created_at
13
+ * - updated_at
14
+ * if they do not exist in the schema and if columns exist in the table.
15
+ * ---
16
+ *
17
+ * @param tableName - The name of the local SQLite table.
18
+ * @param schema - The column definitions (e.g. `{ id: "TEXT NOT NULL", name: "TEXT" }`) and optional metadata:
19
+ * - `__indices`: Column names to be indexed.
20
+ * @param deletePreviousSchema - If `true`, drops the existing table and related Supastash metadata before re-creating.
21
+ * ⚠️ WARNING: If left `true` in production, the table will be dropped and re-created **on every load**.
22
+ *
23
+ * ---
24
+ *
25
+ * @example
26
+ * defineLocalSchema("users", {
27
+ * id: "TEXT PRIMARY KEY",
28
+ * name: "TEXT NOT NULL",
29
+ * email: "TEXT",
30
+ * user_id: "TEXT NOT NULL",
31
+ * __indices: ["email"]
32
+ * }, true);
33
+ *
34
+ * @remarks
35
+ * - Automatically injects `created_at`, `updated_at`, `deleted_at`, and `synced_at` columns.
36
+ * - Requires an `id` column to exist.
37
+ * - Validates all foreign keys and index columns exist in the schema before applying.
38
+ */
39
+ export declare function defineLocalSchema(tableName: string, schema: LocalSchemaDefinition, deletePreviousSchema?: boolean): Promise<void>;
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/native/core/schemaManager/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAMlF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,qBAAqB,EAC7B,oBAAoB,UAAQ,iBAyF7B"}
@@ -0,0 +1,141 @@
1
+ import { getSupastashDb } from "../../../shared/db/dbInitializer";
2
+ import { clearSchemaCache } from "../../../shared/utils/getTableSchema";
3
+ import log, { logError } from "../../../shared/utils/logs";
4
+ import { resetSupastashSyncStatus } from "../../utils/sync/status/services";
5
+ /**
6
+ * 🧱 defineLocalSchema
7
+ *
8
+ * Defines a local SQLite table schema programmatically, with support for foreign keys and indices.
9
+ * Intended for offline-first apps using Supastash. Ensures consistency in structure and indexing while
10
+ * allowing runtime control of schema migration through `deletePreviousSchema`.
11
+ *
12
+ * It will also create the following indexes:
13
+ * - synced_at
14
+ * - deleted_at
15
+ * - created_at
16
+ * - updated_at
17
+ * if they do not exist in the schema and if columns exist in the table.
18
+ * ---
19
+ *
20
+ * @param tableName - The name of the local SQLite table.
21
+ * @param schema - The column definitions (e.g. `{ id: "TEXT NOT NULL", name: "TEXT" }`) and optional metadata:
22
+ * - `__indices`: Column names to be indexed.
23
+ * @param deletePreviousSchema - If `true`, drops the existing table and related Supastash metadata before re-creating.
24
+ * ⚠️ WARNING: If left `true` in production, the table will be dropped and re-created **on every load**.
25
+ *
26
+ * ---
27
+ *
28
+ * @example
29
+ * defineLocalSchema("users", {
30
+ * id: "TEXT PRIMARY KEY",
31
+ * name: "TEXT NOT NULL",
32
+ * email: "TEXT",
33
+ * user_id: "TEXT NOT NULL",
34
+ * __indices: ["email"]
35
+ * }, true);
36
+ *
37
+ * @remarks
38
+ * - Automatically injects `created_at`, `updated_at`, `deleted_at`, and `synced_at` columns.
39
+ * - Requires an `id` column to exist.
40
+ * - Validates all foreign keys and index columns exist in the schema before applying.
41
+ */
42
+ export async function defineLocalSchema(tableName, schema, deletePreviousSchema = false) {
43
+ try {
44
+ if (!schema.id) {
45
+ throw new Error(`'id' of type UUID column is required for table ${tableName}`);
46
+ }
47
+ const db = await getSupastashDb();
48
+ const { __indices, __constraints, ...columnSchema } = schema;
49
+ const indexNotInSchema = __indices?.filter((i) => !columnSchema[i]) ?? [];
50
+ if (indexNotInSchema.length > 0) {
51
+ throw new Error(`Index columns ${indexNotInSchema.join(", ")} not found in schema. Please ensure all columns are defined in the schema.`);
52
+ }
53
+ // Ensure required columns
54
+ const safeSchema = {
55
+ ...columnSchema,
56
+ created_at: columnSchema.created_at ?? "TEXT NOT NULL",
57
+ updated_at: columnSchema.updated_at ?? "TEXT NOT NULL",
58
+ synced_at: "TEXT DEFAULT NULL",
59
+ deleted_at: columnSchema.deleted_at ?? "TEXT DEFAULT NULL",
60
+ };
61
+ // Build column definitions
62
+ const schemaParts = Object.entries(safeSchema).map(([key, value]) => `${key} ${value}`);
63
+ const schemaString = schemaParts.join(", ");
64
+ const sql = `CREATE TABLE IF NOT EXISTS ${tableName} (${__constraints ? `${schemaString}, ${__constraints}` : schemaString});`;
65
+ if (deletePreviousSchema) {
66
+ const dropSql = `DROP TABLE IF EXISTS ${tableName}`;
67
+ const tryDropTable = async (attempt = 1) => {
68
+ try {
69
+ await db.execAsync(dropSql);
70
+ await resetSupastashSyncStatus(tableName, undefined, "all");
71
+ }
72
+ catch (err) {
73
+ if (String(err).includes("table is locked") && attempt < 5) {
74
+ await new Promise((res) => setTimeout(res, attempt * 100));
75
+ return tryDropTable(attempt + 1);
76
+ }
77
+ throw err;
78
+ }
79
+ };
80
+ await tryDropTable();
81
+ clearSchemaCache(tableName);
82
+ log(`[Supastash] Dropped table ${tableName}`);
83
+ }
84
+ await db.execAsync(sql);
85
+ const standardIndexes = [
86
+ "synced_at",
87
+ "deleted_at",
88
+ "created_at",
89
+ "updated_at",
90
+ ];
91
+ // Generate and create index SQL
92
+ if (__indices?.length) {
93
+ for (const col of __indices) {
94
+ if (standardIndexes.includes(col)) {
95
+ continue;
96
+ }
97
+ const indexName = `idx_${tableName}_${col}`;
98
+ const indexSql = `CREATE INDEX IF NOT EXISTS ${indexName} ON ${tableName}(${col});`;
99
+ await db.execAsync(indexSql);
100
+ }
101
+ }
102
+ await createStandardIndexes(db, tableName, standardIndexes);
103
+ }
104
+ catch (error) {
105
+ logError(`[Supastash] Error defining schema for table ${tableName}`, error);
106
+ }
107
+ }
108
+ async function createStandardIndexes(db, table, columns) {
109
+ const pragmaRows = await db.getAllAsync(`PRAGMA table_info(${table});`);
110
+ const existingCols = Array.isArray(pragmaRows)
111
+ ? pragmaRows.map((r) => r.name)
112
+ : [];
113
+ try {
114
+ for (const col of columns) {
115
+ if (existingCols.includes(col)) {
116
+ const hasSameIndex = await hasSingleColumnIndex(db, table, col);
117
+ if (!hasSameIndex) {
118
+ await db.execAsync(`CREATE INDEX IF NOT EXISTS idx_${table}_${col} ON ${table}(${col});`);
119
+ }
120
+ }
121
+ }
122
+ }
123
+ catch (error) {
124
+ logError(`[Supastash] Error creating standard indexes for ${table}`, error);
125
+ }
126
+ }
127
+ async function hasSingleColumnIndex(db, table, col) {
128
+ const idxList = await db.getAllAsync(`PRAGMA index_list(${table});`);
129
+ if (!Array.isArray(idxList))
130
+ return false;
131
+ for (const idx of idxList) {
132
+ const idxName = idx.name;
133
+ const info = await db.getAllAsync(`PRAGMA index_info(${idxName});`);
134
+ if (!Array.isArray(info))
135
+ continue;
136
+ // Single-column index exactly on `col`
137
+ if (info.length === 1 && info[0]?.name === col)
138
+ return true;
139
+ }
140
+ return false;
141
+ }
@@ -0,0 +1,67 @@
1
+ import { RealtimeOptions, SupastashDataResult } from "../../shared/types/realtimeData.types";
2
+ /**
3
+ * @description
4
+ * React hook to sync and subscribe to local-first data from a Supabase table using Supastash.
5
+ *
6
+ * Use `useSupastashData` when you want:
7
+ * - Offline-first reads from local SQLite.
8
+ * - Optional realtime syncing via Supabase `postgres_changes`.
9
+ * - Batching, lazy loading, and event-driven updates.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * const { data, dataMap, trigger, cancel } = useSupastashData("users", {
14
+ * shouldFetch: !!session?.user,
15
+ * lazy: true,
16
+ * limit: 100,
17
+ * orderBy: "created_at",
18
+ * orderDesc: true,
19
+ * sqlFilter: [
20
+ * { column: "user_id", operator: "eq", value: 1 },
21
+ * { column: "is_active", operator: "eq", value: true },
22
+ * ],
23
+ * onInsert: (user) => console.log("New user:", user),
24
+ * });
25
+ *
26
+ * useEffect(() => {
27
+ * trigger(); // Manually start sync
28
+ * }, []);
29
+ * ```
30
+ *
31
+ * @param table - Name of the table (must match local SQLite schema).
32
+ * @param options - Configuration object.
33
+ *
34
+ * ## Fetch Options
35
+ * @param options.shouldFetch - If false, disables initial fetch. Defaults to `true`.
36
+ * @param options.lazy - If true, skips auto-fetch. Call `trigger()` manually.
37
+ * @param options.limit - Max records to load. Defaults to `200`.
38
+ * @param options.orderBy - Column to sort by. Defaults to `"created_at"`.
39
+ * @param options.orderDesc - If true, sorts descending. Defaults to `true`.
40
+ * @param options.sqlFilter - Optional SQL-level filters (`WHERE` clause).
41
+ * @param options.useFilterWhileSyncing - Applies filter during sync. Defaults to `true`.
42
+ * @param options.extraMapKey - Additional field to group `dataMap` by.
43
+ * @param options.clearCacheOnMount - Clears in-memory cache on mount. Defaults to `false`.
44
+ *
45
+ * ## Realtime Options
46
+ * @param options.realtime - Enables Supabase `postgres_changes` subscription. Defaults to `true`.
47
+ * @param options.filter - Realtime filter (column/operator/value).
48
+ * @param options.flushIntervalMs - Flush interval (in ms) for UI updates. Defaults to `100`.
49
+ *
50
+ * ## Event Callbacks
51
+ * @param options.onInsert - Called on `INSERT` event.
52
+ * @param options.onUpdate - Called on `UPDATE` event.
53
+ * @param options.onDelete - Called on `DELETE` event.
54
+ * @param options.onInsertAndUpdate - Called on both `INSERT` and `UPDATE`.
55
+ * @param options.onPushToRemote - Called after pushing a local change to Supabase.
56
+ *
57
+ * @returns {
58
+ * data: Array of records,
59
+ * dataMap: Map of records by ID,
60
+ * groupedBy: Optional maps grouped by field,
61
+ * trigger: Manually trigger sync,
62
+ * cancel: Cancel pending fetch or
63
+ * isFetching: Whether the data is being fetched
64
+ * }
65
+ */
66
+ export declare function useSupastashData<R = any>(table: string, options?: RealtimeOptions): SupastashDataResult<R>;
67
+ //# sourceMappingURL=supastashData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supastashData.d.ts","sourceRoot":"","sources":["../../../src/native/hooks/supastashData.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,eAAe,EACf,mBAAmB,EAEpB,MAAM,uCAAuC,CAAC;AAW/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,GAAG,EACtC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,eAAoB,GAC5B,mBAAmB,CAAC,CAAC,CAAC,CAwGxB"}
@@ -1,13 +1,13 @@
1
1
  import { useEffect, useMemo, useRef } from "react";
2
2
  import { AppState } from "react-native";
3
- import { localCache } from "../../store/localCache";
4
- import { supastashEventBus } from "../../utils/events/eventBus";
5
- import useRealtimeData from "../../utils/fetchData/realTimeCall";
6
- import { ReusedHelpers } from "../../utils/reusedHelpers";
7
- import { isTrulyNullish } from "../../utils/serializer";
8
- import useDataState from "./dataState";
9
- import useEventQueues from "./eventQueues";
10
- import { fetchCalls } from "./fetchCalls";
3
+ import { localCache } from "../../shared/store/localCache";
4
+ import { supastashEventBus } from "../../shared/utils/events/eventBus";
5
+ import useDataState from "../../shared/utils/fetchData/dataState";
6
+ import useRealtimeData from "../../shared/utils/fetchData/realTimeCall";
7
+ import { ReusedHelpers } from "../../shared/utils/reusedHelpers";
8
+ import { isTrulyNullish } from "../../shared/utils/serializer";
9
+ import useEventQueues from "../utils/fetchData/eventQueues";
10
+ import { fetchCalls } from "../utils/fetchData/fetchCalls";
11
11
  const tableSubscriptions = new Map();
12
12
  /**
13
13
  * @description
@@ -77,6 +77,7 @@ export function useSupastashData(table, options = {}) {
77
77
  const { filter, lazy = false, flushIntervalMs = 100, shouldFetch = true, realtime = true, clearCacheOnMount = false, } = options;
78
78
  const hasTriggeredRef = useRef(false);
79
79
  const unsub = useRef(null);
80
+ const appStateRef = useRef(null);
80
81
  const { dataMap, data, groupedBy, } = useDataState(table);
81
82
  const queueHandler = useEventQueues(table, options, flushIntervalMs);
82
83
  const { triggerRefresh, trigger, cancel, initialFetchAndSync, isFetching } = fetchCalls(table, options, hasTriggeredRef);
@@ -102,7 +103,7 @@ export function useSupastashData(table, options = {}) {
102
103
  if (!isAnyNullish) {
103
104
  initialFetchAndSync();
104
105
  }
105
- unsub.current = AppState.addEventListener("change", (state) => {
106
+ appStateRef.current = AppState.addEventListener("change", (state) => {
106
107
  if (state === "active") {
107
108
  if (!isAnyNullish) {
108
109
  void initialFetchAndSync();
@@ -118,11 +119,12 @@ export function useSupastashData(table, options = {}) {
118
119
  return () => {
119
120
  supastashEventBus.off?.(`refresh:${table}`, triggerRefresh);
120
121
  supastashEventBus.off?.(`refresh:all`, triggerRefresh);
121
- unsub.current?.remove();
122
+ unsub.current?.();
122
123
  tableSubscriptions.delete(subKey);
123
124
  if (clearCacheOnMount) {
124
125
  localCache.delete(table);
125
126
  }
127
+ appStateRef.current?.remove();
126
128
  };
127
129
  }, [lazy, shouldFetch, subKey, isAnyNullish]);
128
130
  // TEMP
@@ -0,0 +1,19 @@
1
+ import { SupastashHookReturn } from "../../shared/types/supastashConfig.types";
2
+ /**
3
+ * React hook to initialize and manage Supastash.
4
+ *
5
+ * Responsibilities:
6
+ * - Initializes the Supastash client.
7
+ * - Sets up the SQLite database.
8
+ * - Creates internal sync status tables.
9
+ * - Invokes the user-defined schema initializer (if provided).
10
+ * - Starts the sync engine once the DB is ready.
11
+ *
12
+ * @returns {{
13
+ * dbReady: boolean,
14
+ * startSync: () => void,
15
+ * stopSync: () => void
16
+ * }} Object containing the DB readiness state and sync control functions.
17
+ */
18
+ export declare function useSupastash(lazy?: boolean): SupastashHookReturn;
19
+ //# sourceMappingURL=supastashLogic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supastashLogic.d.ts","sourceRoot":"","sources":["../../../src/native/hooks/supastashLogic.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAO/E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,IAAI,GAAE,OAAe,GAAG,mBAAmB,CAmFvE"}
@@ -0,0 +1,101 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+ import { getSupastashConfig } from "../../shared/core/config";
3
+ import { supastashDbErrorMsg } from "../../shared/db/dbErrorMsg";
4
+ import { localCache } from "../../shared/store/localCache";
5
+ import { filterTracker, tableFilters, tableFiltersUsed, } from "../../shared/store/tableFilters";
6
+ import { supastashEventBus } from "../../shared/utils/events/eventBus";
7
+ import { logError, logWarn } from "../../shared/utils/logs";
8
+ import { createSyncStatusTable } from "../../shared/utils/schema/createSyncStatus";
9
+ import { supabaseClientErr } from "../../shared/utils/supabaseClientErr";
10
+ import { useSyncEngine } from "./syncEngine";
11
+ /**
12
+ * React hook to initialize and manage Supastash.
13
+ *
14
+ * Responsibilities:
15
+ * - Initializes the Supastash client.
16
+ * - Sets up the SQLite database.
17
+ * - Creates internal sync status tables.
18
+ * - Invokes the user-defined schema initializer (if provided).
19
+ * - Starts the sync engine once the DB is ready.
20
+ *
21
+ * @returns {{
22
+ * dbReady: boolean,
23
+ * startSync: () => void,
24
+ * stopSync: () => void
25
+ * }} Object containing the DB readiness state and sync control functions.
26
+ */
27
+ export function useSupastash(lazy = false) {
28
+ const [dbReady, setDbReady] = useState(false);
29
+ const initialized = useRef(false);
30
+ const config = getSupastashConfig();
31
+ const { startSync, stopSync } = useSyncEngine();
32
+ if (!config.sqliteClient || !config.sqliteClientType) {
33
+ logError(`
34
+ [Supastash] ${supastashDbErrorMsg}`);
35
+ return {
36
+ dbReady: false,
37
+ startSync: () => { },
38
+ stopSync: () => { },
39
+ };
40
+ }
41
+ if (!config.supabaseClient) {
42
+ logError(`[Supastash] Add a supabase client to config ${supabaseClientErr}`);
43
+ return {
44
+ dbReady: false,
45
+ startSync: () => { },
46
+ stopSync: () => { },
47
+ };
48
+ }
49
+ useEffect(() => {
50
+ if (initialized.current)
51
+ return;
52
+ initialized.current = true;
53
+ async function init() {
54
+ try {
55
+ // Create supastash metadata tables
56
+ await createSyncStatusTable();
57
+ // On schema init
58
+ if (config.onSchemaInit) {
59
+ await config.onSchemaInit();
60
+ }
61
+ // If init fails, db will not be ready
62
+ setDbReady(true);
63
+ }
64
+ catch (error) {
65
+ logError(`[Supastash] Error initializing: ${error}`);
66
+ setDbReady(false);
67
+ }
68
+ }
69
+ init();
70
+ return () => {
71
+ initialized.current = false;
72
+ filterTracker.clear();
73
+ tableFilters.clear();
74
+ tableFiltersUsed.clear();
75
+ localCache.clear();
76
+ };
77
+ }, []);
78
+ useEffect(() => {
79
+ if (lazy)
80
+ return;
81
+ const start = () => {
82
+ if (dbReady) {
83
+ try {
84
+ startSync();
85
+ }
86
+ catch (error) {
87
+ logWarn(`[Supastash] Error starting sync: ${error}`);
88
+ }
89
+ }
90
+ };
91
+ start();
92
+ supastashEventBus.on("stopSupastashSync", stopSync);
93
+ supastashEventBus.on("startSupastashSync", start);
94
+ return () => {
95
+ stopSync();
96
+ supastashEventBus.off("stopSupastashSync", stopSync);
97
+ supastashEventBus.off("startSupastashSync", start);
98
+ };
99
+ }, [dbReady]);
100
+ return { dbReady, stopSync, startSync };
101
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Push then (optionally) pull.
3
+ * - Single flight across entire app via module-scoped flags.
4
+ * - Both directions gated on connectivity.
5
+ * - "force" ignores pull cadence timing.
6
+ */
7
+ export declare function syncAll(force?: boolean): Promise<void>;
8
+ /**
9
+ * Hook to start/stop the periodic sync engine.
10
+ * - Staggers push & pull timers.
11
+ * - Debounced foreground trigger.
12
+ * - Shares module-level single-flight guards with syncAll().
13
+ */
14
+ export declare function useSyncEngine(): {
15
+ startSync: () => void;
16
+ stopSync: () => void;
17
+ };
18
+ /**
19
+ * Manually sync a single table (pull then push for that table).
20
+ * - Uses table-specific handlers from syncCalls if provided.
21
+ * - Respects configured filters when enabled.
22
+ */
23
+ export declare function syncTable(table: string): Promise<void>;
24
+ /**
25
+ * Force a global sync pass now (push then pull if due).
26
+ */
27
+ export declare function syncAllTables(): Promise<void>;
28
+ //# sourceMappingURL=syncEngine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncEngine.d.ts","sourceRoot":"","sources":["../../../src/native/hooks/syncEngine.ts"],"names":[],"mappings":"AA6BA;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAqCnE;AAuDD;;;;;GAKG;AACH,wBAAgB,aAAa;;;EA+D5B;AAMD;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC5D;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAEnD"}
@@ -1,15 +1,15 @@
1
1
  import { useEffect, useRef } from "react";
2
2
  import { AppState } from "react-native";
3
- import { getSupastashConfig } from "../../core/config";
4
- import { syncCalls } from "../../store/syncCalls";
5
- import { isSyncGateClosed } from "../../store/syncStatus";
6
- import { tableFilters } from "../../store/tableFilters";
7
- import { isOnline } from "../../utils/connection";
8
- import log from "../../utils/logs";
9
- import { updateLocalDb } from "../../utils/sync/pullFromRemote/updateLocalDb";
10
- import { pushLocalDataToRemote } from "../../utils/sync/pushLocal/sendUnsyncedToSupabase";
11
- import { pullFromRemote as doPullFromRemote } from "./pullFromRemote";
12
- import { pushLocalData as doPushLocalData } from "./pushLocal";
3
+ import { getSupastashConfig } from "../../shared/core/config";
4
+ import { syncCalls } from "../../shared/store/syncCalls";
5
+ import { isSyncGateClosed } from "../../shared/store/syncStatus";
6
+ import { tableFilters } from "../../shared/store/tableFilters";
7
+ import { isOnline } from "../../shared/utils/connection";
8
+ import log from "../../shared/utils/logs";
9
+ import { pullFromRemote as doPullFromRemote } from "../utils/sync/pullFromRemote";
10
+ import { updateLocalDb } from "../utils/sync/pullFromRemote/updateLocalDb";
11
+ import { pushLocalData as doPushLocalData } from "../utils/sync/pushLocal";
12
+ import { pushLocalDataToRemote } from "../utils/sync/pushLocal/sendUnsyncedToSupabase";
13
13
  // -----------------------------
14
14
  // Module-scoped state & tunables
15
15
  // -----------------------------
@@ -161,13 +161,13 @@ export function useSyncEngine() {
161
161
  }, pullEvery + 500);
162
162
  // Foreground trigger
163
163
  appStateSubRef.current = AppState.addEventListener("change", (state) => {
164
- if (state !== "active")
165
- return;
166
- const now = Date.now();
167
- if (now - lastForeground.current < MIN_FOREGROUND_GAP)
168
- return;
169
- lastForeground.current = now;
170
- void syncAll(true);
164
+ if (state === "active") {
165
+ const now = Date.now();
166
+ if (now - lastForeground.current < MIN_FOREGROUND_GAP)
167
+ return;
168
+ lastForeground.current = now;
169
+ void syncAll(true);
170
+ }
171
171
  });
172
172
  }
173
173
  function stopSync() {
@@ -179,7 +179,7 @@ export function useSyncEngine() {
179
179
  clearInterval(intervalRefPull.current);
180
180
  intervalRefPull.current = null;
181
181
  }
182
- appStateSubRef.current?.remove?.();
182
+ appStateSubRef.current?.remove();
183
183
  appStateSubRef.current = null;
184
184
  }
185
185
  // Auto-cleanup if the hook lives in a component lifecycle
@@ -0,0 +1,28 @@
1
+ export { configureSupastash, getSupastashConfig } from "../shared/core/config";
2
+ export { getSupastashDb } from "../shared/db/dbInitializer";
3
+ export { useSupastashFilters } from "../shared/hooks/supastashFilters";
4
+ export { useSupastashSyncStatus } from "../shared/hooks/syncStatus";
5
+ export { closeSyncGate, isSyncGateClosed, openSyncGate, } from "../shared/store/syncStatus";
6
+ export { supastashEventBus } from "../shared/utils/events/eventBus";
7
+ export { supastash } from "../shared/utils/query/builder";
8
+ export { refreshScreen } from "../shared/utils/refreshScreenCalls";
9
+ export { getSupastashRuntimeMode, reinitializeSupastash, } from "../shared/utils/supastashMode";
10
+ export { getAllTables } from "../shared/utils/sync/getAllTables";
11
+ export { updateFilters } from "../shared/utils/sync/pullFromRemote/updateFilter";
12
+ export { refreshAllTables, refreshTable, refreshTableWithPayload, } from "../shared/utils/sync/refreshTables";
13
+ export { clearSyncCalls, getAllSyncTables, getSyncCall, registerSyncCall, unregisterSyncCall, } from "../shared/utils/sync/registration/syncCalls";
14
+ export { defineLocalSchema } from "./core/schemaManager";
15
+ export { useSupastashData } from "./hooks/supastashData";
16
+ export { useSupastash } from "./hooks/supastashLogic";
17
+ export { syncAllTables, syncTable } from "./hooks/syncEngine";
18
+ export { dropAllTables, dropTable, wipeAllTables, wipeOldDataForAllTables, wipeOldDataForATable, wipeTable, } from "./utils/schema/wipeTables";
19
+ export { fetchOlderPage } from "./utils/sync/pullFromRemote/fetchOlder";
20
+ export { updateLocalDb, upsertChunkData, upsertData, } from "./utils/sync/pullFromRemote/updateLocalDb";
21
+ export { clearAllLocalDeleteLog, clearAllLocalSyncLog, clearLocalDeleteLog, clearLocalSyncLog, clearSyncLog, getLocalDeleteLog, getSyncLog, resetSyncLog, setLocalDeleteLog, setLocalSyncLog, setSyncLog, } from "./utils/sync/status/syncStatus";
22
+ export type { CrudMethods } from "../shared/types/query.types";
23
+ export type { RealtimeOptions, SupastashDataResult, SupastashFilter, } from "../shared/types/realtimeData.types";
24
+ export type { LocalSchemaDefinition } from "../shared/types/schemaManager.types";
25
+ export type { ExpoSQLiteClient, RNSqliteNitroClient, RNStorageSQLiteClient, SupastashConfig, SupastashHookReturn, SupastashSQLiteClientTypes, SupastashSQLiteDatabase, SupastashSQLiteExecutor, TauriSQLiteClient, } from "../shared/types/supastashConfig.types";
26
+ export type { SupastashClient, SupastashTransactionClient, } from "../shared/utils/query/builder";
27
+ export type { SyncInfo } from "../shared/types/syncEngine.types";
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/native/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AACjF,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,GACxB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EACL,aAAa,EACb,SAAS,EACT,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,SAAS,GACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EACL,aAAa,EACb,eAAe,EACf,UAAU,GACX,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,UAAU,GACX,MAAM,gCAAgC,CAAC;AAExC,YAAY,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,eAAe,GAChB,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACjF,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EACV,eAAe,EACf,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AAEvC,YAAY,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1,21 @@
1
+ export { configureSupastash, getSupastashConfig } from "../shared/core/config";
2
+ export { getSupastashDb } from "../shared/db/dbInitializer";
3
+ export { useSupastashFilters } from "../shared/hooks/supastashFilters";
4
+ export { useSupastashSyncStatus } from "../shared/hooks/syncStatus";
5
+ export { closeSyncGate, isSyncGateClosed, openSyncGate, } from "../shared/store/syncStatus";
6
+ export { supastashEventBus } from "../shared/utils/events/eventBus";
7
+ export { supastash } from "../shared/utils/query/builder";
8
+ export { refreshScreen } from "../shared/utils/refreshScreenCalls";
9
+ export { getSupastashRuntimeMode, reinitializeSupastash, } from "../shared/utils/supastashMode";
10
+ export { getAllTables } from "../shared/utils/sync/getAllTables";
11
+ export { updateFilters } from "../shared/utils/sync/pullFromRemote/updateFilter";
12
+ export { refreshAllTables, refreshTable, refreshTableWithPayload, } from "../shared/utils/sync/refreshTables";
13
+ export { clearSyncCalls, getAllSyncTables, getSyncCall, registerSyncCall, unregisterSyncCall, } from "../shared/utils/sync/registration/syncCalls";
14
+ export { defineLocalSchema } from "./core/schemaManager";
15
+ export { useSupastashData } from "./hooks/supastashData";
16
+ export { useSupastash } from "./hooks/supastashLogic";
17
+ export { syncAllTables, syncTable } from "./hooks/syncEngine";
18
+ export { dropAllTables, dropTable, wipeAllTables, wipeOldDataForAllTables, wipeOldDataForATable, wipeTable, } from "./utils/schema/wipeTables";
19
+ export { fetchOlderPage } from "./utils/sync/pullFromRemote/fetchOlder";
20
+ export { updateLocalDb, upsertChunkData, upsertData, } from "./utils/sync/pullFromRemote/updateLocalDb";
21
+ export { clearAllLocalDeleteLog, clearAllLocalSyncLog, clearLocalDeleteLog, clearLocalSyncLog, clearSyncLog, getLocalDeleteLog, getSyncLog, resetSyncLog, setLocalDeleteLog, setLocalSyncLog, setSyncLog, } from "./utils/sync/status/syncStatus";
@@ -0,0 +1,5 @@
1
+ import { PayloadData } from "../../../shared/types/query.types";
2
+ import { RealtimeOptions } from "../../../shared/types/realtimeData.types";
3
+ declare function useEventQueues<R>(table: string, options: RealtimeOptions<R>, flushIntervalMs: number): (eventType: string, data: PayloadData) => void;
4
+ export default useEventQueues;
5
+ //# sourceMappingURL=eventQueues.d.ts.map