supastash 0.1.62 → 0.2.1
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.
- package/README.md +37 -8
- package/dist/desktop/adapters/appstate.d.ts +2 -0
- package/dist/desktop/adapters/appstate.d.ts.map +1 -0
- package/dist/desktop/adapters/appstate.js +10 -0
- package/dist/desktop/adapters/crypto.d.ts +3 -0
- package/dist/desktop/adapters/crypto.d.ts.map +1 -0
- package/dist/desktop/adapters/crypto.js +16 -0
- package/dist/{core → desktop/core}/schemaManager/index.d.ts +1 -1
- package/dist/desktop/core/schemaManager/index.d.ts.map +1 -0
- package/dist/{core → desktop/core}/schemaManager/index.js +3 -3
- package/dist/{hooks/supastashData/index.d.ts → desktop/hooks/supastashData.d.ts} +2 -2
- package/dist/desktop/hooks/supastashData.d.ts.map +1 -0
- package/dist/desktop/hooks/supastashData.js +139 -0
- package/dist/{hooks → desktop/hooks}/supastashLogic.d.ts +1 -1
- package/dist/desktop/hooks/supastashLogic.d.ts.map +1 -0
- package/dist/{hooks → desktop/hooks}/supastashLogic.js +11 -12
- package/dist/{hooks/syncEngine/index.d.ts → desktop/hooks/syncEngine.d.ts} +1 -1
- package/dist/desktop/hooks/syncEngine.d.ts.map +1 -0
- package/dist/desktop/hooks/syncEngine.js +233 -0
- package/dist/desktop/index.d.ts +28 -0
- package/dist/desktop/index.d.ts.map +1 -0
- package/dist/desktop/index.js +21 -0
- package/dist/{hooks/supastashData → desktop/utils/fetchData}/eventQueues.d.ts +2 -2
- package/dist/desktop/utils/fetchData/eventQueues.d.ts.map +1 -0
- package/dist/{hooks/supastashData → desktop/utils/fetchData}/eventQueues.js +3 -3
- package/dist/{hooks/supastashData → desktop/utils/fetchData}/fetchCalls.d.ts +1 -1
- package/dist/desktop/utils/fetchData/fetchCalls.d.ts.map +1 -0
- package/dist/{hooks/supastashData → desktop/utils/fetchData}/fetchCalls.js +5 -5
- package/dist/desktop/utils/fetchData/initialFetch.d.ts +3 -0
- package/dist/desktop/utils/fetchData/initialFetch.d.ts.map +1 -0
- package/dist/{utils → desktop/utils}/fetchData/initialFetch.js +2 -2
- package/dist/{utils → desktop/utils}/fetchData/receiveData.d.ts +1 -1
- package/dist/desktop/utils/fetchData/receiveData.d.ts.map +1 -0
- package/dist/{utils → desktop/utils}/fetchData/receiveData.js +7 -7
- package/dist/desktop/utils/query/index.d.ts +73 -0
- package/dist/desktop/utils/query/index.d.ts.map +1 -0
- package/dist/desktop/utils/query/index.js +139 -0
- package/dist/desktop/utils/schema/wipeTables.d.ts.map +1 -0
- package/dist/{utils → desktop/utils}/schema/wipeTables.js +4 -4
- package/dist/desktop/utils/sync/pullFromRemote/fetchOlder.d.ts +44 -0
- package/dist/desktop/utils/sync/pullFromRemote/fetchOlder.d.ts.map +1 -0
- package/dist/desktop/utils/sync/pullFromRemote/fetchOlder.js +55 -0
- package/dist/desktop/utils/sync/pullFromRemote/fetchOlderHelpers.d.ts +33 -0
- package/dist/desktop/utils/sync/pullFromRemote/fetchOlderHelpers.d.ts.map +1 -0
- package/dist/desktop/utils/sync/pullFromRemote/fetchOlderHelpers.js +104 -0
- package/dist/desktop/utils/sync/pullFromRemote/index.d.ts.map +1 -0
- package/dist/{hooks/syncEngine → desktop/utils/sync}/pullFromRemote/index.js +7 -7
- package/dist/{utils → desktop/utils}/sync/pullFromRemote/pullData.d.ts +3 -4
- package/dist/desktop/utils/sync/pullFromRemote/pullData.d.ts.map +1 -0
- package/dist/{utils → desktop/utils}/sync/pullFromRemote/pullData.js +10 -15
- package/dist/desktop/utils/sync/pullFromRemote/updateLocalDb.d.ts +46 -0
- package/dist/desktop/utils/sync/pullFromRemote/updateLocalDb.d.ts.map +1 -0
- package/dist/desktop/utils/sync/pullFromRemote/updateLocalDb.js +284 -0
- package/dist/desktop/utils/sync/pushLocal/index.d.ts.map +1 -0
- package/dist/{hooks/syncEngine → desktop/utils/sync}/pushLocal/index.js +8 -11
- package/dist/desktop/utils/sync/pushLocal/sendUnsyncedToSupabase.d.ts.map +1 -0
- package/dist/{utils → desktop/utils}/sync/pushLocal/sendUnsyncedToSupabase.js +5 -8
- package/dist/{utils → desktop/utils}/sync/pushLocal/uploadChunk.d.ts +1 -1
- package/dist/desktop/utils/sync/pushLocal/uploadChunk.d.ts.map +1 -0
- package/dist/{utils → desktop/utils}/sync/pushLocal/uploadChunk.js +8 -12
- package/dist/{utils → desktop/utils}/sync/pushLocal/uploadHelpers.d.ts +2 -2
- package/dist/desktop/utils/sync/pushLocal/uploadHelpers.d.ts.map +1 -0
- package/dist/{utils → desktop/utils}/sync/pushLocal/uploadHelpers.js +7 -7
- package/dist/{utils → desktop/utils}/sync/status/filterKey.d.ts +3 -3
- package/dist/desktop/utils/sync/status/filterKey.d.ts.map +1 -0
- package/dist/desktop/utils/sync/status/filterKey.js +48 -0
- package/dist/desktop/utils/sync/status/repo.d.ts +10 -0
- package/dist/desktop/utils/sync/status/repo.d.ts.map +1 -0
- package/dist/{utils → desktop/utils}/sync/status/repo.js +31 -25
- package/dist/{utils → desktop/utils}/sync/status/services.d.ts +6 -7
- package/dist/desktop/utils/sync/status/services.d.ts.map +1 -0
- package/dist/{utils → desktop/utils}/sync/status/services.js +4 -9
- package/dist/{utils → desktop/utils}/sync/status/syncStatus.d.ts +6 -8
- package/dist/desktop/utils/sync/status/syncStatus.d.ts.map +1 -0
- package/dist/{utils → desktop/utils}/sync/status/syncStatus.js +14 -6
- package/dist/index.d.ts +18 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -21
- package/dist/native/core/schemaManager/index.d.ts +40 -0
- package/dist/native/core/schemaManager/index.d.ts.map +1 -0
- package/dist/native/core/schemaManager/index.js +141 -0
- package/dist/native/hooks/supastashData.d.ts +67 -0
- package/dist/native/hooks/supastashData.d.ts.map +1 -0
- package/dist/{hooks/supastashData/index.js → native/hooks/supastashData.js} +23 -13
- package/dist/native/hooks/supastashLogic.d.ts +19 -0
- package/dist/native/hooks/supastashLogic.d.ts.map +1 -0
- package/dist/native/hooks/supastashLogic.js +101 -0
- package/dist/native/hooks/syncEngine.d.ts +28 -0
- package/dist/native/hooks/syncEngine.d.ts.map +1 -0
- package/dist/{hooks/syncEngine/index.js → native/hooks/syncEngine.js} +18 -18
- package/dist/native/index.d.ts +28 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +21 -0
- package/dist/native/utils/fetchData/eventQueues.d.ts +5 -0
- package/dist/native/utils/fetchData/eventQueues.d.ts.map +1 -0
- package/dist/native/utils/fetchData/eventQueues.js +52 -0
- package/dist/native/utils/fetchData/fetchCalls.d.ts +9 -0
- package/dist/native/utils/fetchData/fetchCalls.d.ts.map +1 -0
- package/dist/native/utils/fetchData/fetchCalls.js +88 -0
- package/dist/native/utils/fetchData/initialFetch.d.ts +3 -0
- package/dist/native/utils/fetchData/initialFetch.d.ts.map +1 -0
- package/dist/native/utils/fetchData/initialFetch.js +21 -0
- package/dist/native/utils/fetchData/receiveData.d.ts +3 -0
- package/dist/native/utils/fetchData/receiveData.d.ts.map +1 -0
- package/dist/native/utils/fetchData/receiveData.js +39 -0
- package/dist/native/utils/query/index.d.ts +73 -0
- package/dist/native/utils/query/index.d.ts.map +1 -0
- package/dist/native/utils/query/index.js +139 -0
- package/dist/native/utils/schema/wipeTables.d.ts +98 -0
- package/dist/native/utils/schema/wipeTables.d.ts.map +1 -0
- package/dist/native/utils/schema/wipeTables.js +188 -0
- package/dist/native/utils/sync/pullFromRemote/fetchOlder.d.ts +44 -0
- package/dist/native/utils/sync/pullFromRemote/fetchOlder.d.ts.map +1 -0
- package/dist/native/utils/sync/pullFromRemote/fetchOlder.js +55 -0
- package/dist/native/utils/sync/pullFromRemote/fetchOlderHelpers.d.ts +33 -0
- package/dist/native/utils/sync/pullFromRemote/fetchOlderHelpers.d.ts.map +1 -0
- package/dist/native/utils/sync/pullFromRemote/fetchOlderHelpers.js +104 -0
- package/dist/native/utils/sync/pullFromRemote/index.d.ts +5 -0
- package/dist/native/utils/sync/pullFromRemote/index.d.ts.map +1 -0
- package/dist/native/utils/sync/pullFromRemote/index.js +73 -0
- package/dist/native/utils/sync/pullFromRemote/pullData.d.ts +21 -0
- package/dist/native/utils/sync/pullFromRemote/pullData.d.ts.map +1 -0
- package/dist/native/utils/sync/pullFromRemote/pullData.js +80 -0
- package/dist/native/utils/sync/pullFromRemote/updateLocalDb.d.ts +46 -0
- package/dist/native/utils/sync/pullFromRemote/updateLocalDb.d.ts.map +1 -0
- package/dist/native/utils/sync/pullFromRemote/updateLocalDb.js +278 -0
- package/dist/native/utils/sync/pushLocal/index.d.ts +5 -0
- package/dist/native/utils/sync/pushLocal/index.d.ts.map +1 -0
- package/dist/native/utils/sync/pushLocal/index.js +101 -0
- package/dist/native/utils/sync/pushLocal/sendUnsyncedToSupabase.d.ts +6 -0
- package/dist/native/utils/sync/pushLocal/sendUnsyncedToSupabase.d.ts.map +1 -0
- package/dist/native/utils/sync/pushLocal/sendUnsyncedToSupabase.js +57 -0
- package/dist/native/utils/sync/pushLocal/uploadChunk.d.ts +8 -0
- package/dist/native/utils/sync/pushLocal/uploadChunk.d.ts.map +1 -0
- package/dist/native/utils/sync/pushLocal/uploadChunk.js +173 -0
- package/dist/native/utils/sync/pushLocal/uploadHelpers.d.ts +41 -0
- package/dist/native/utils/sync/pushLocal/uploadHelpers.d.ts.map +1 -0
- package/dist/native/utils/sync/pushLocal/uploadHelpers.js +243 -0
- package/dist/native/utils/sync/status/filterKey.d.ts +15 -0
- package/dist/native/utils/sync/status/filterKey.d.ts.map +1 -0
- package/dist/{utils → native/utils}/sync/status/filterKey.js +5 -16
- package/dist/native/utils/sync/status/repo.d.ts +10 -0
- package/dist/native/utils/sync/status/repo.d.ts.map +1 -0
- package/dist/native/utils/sync/status/repo.js +97 -0
- package/dist/native/utils/sync/status/services.d.ts +31 -0
- package/dist/native/utils/sync/status/services.d.ts.map +1 -0
- package/dist/native/utils/sync/status/services.js +107 -0
- package/dist/native/utils/sync/status/syncStatus.d.ts +109 -0
- package/dist/native/utils/sync/status/syncStatus.d.ts.map +1 -0
- package/dist/native/utils/sync/status/syncStatus.js +161 -0
- package/dist/shared/constants/syncDefaults.d.ts.map +1 -0
- package/dist/{core → shared/core}/config/index.d.ts +2 -0
- package/dist/shared/core/config/index.d.ts.map +1 -0
- package/dist/{core → shared/core}/config/index.js +9 -1
- package/dist/shared/core/platform/appState.d.ts +12 -0
- package/dist/shared/core/platform/appState.d.ts.map +1 -0
- package/dist/shared/core/platform/appState.js +11 -0
- package/dist/shared/db/adapters/expo_sqlite.d.ts +3 -0
- package/dist/shared/db/adapters/expo_sqlite.d.ts.map +1 -0
- package/dist/shared/db/adapters/expo_sqlite.js +72 -0
- package/dist/shared/db/adapters/rn_nitro.d.ts +3 -0
- package/dist/shared/db/adapters/rn_nitro.d.ts.map +1 -0
- package/dist/shared/db/adapters/rn_nitro.js +111 -0
- package/dist/shared/db/adapters/rn_sqlite_storage.d.ts +3 -0
- package/dist/shared/db/adapters/rn_sqlite_storage.d.ts.map +1 -0
- package/dist/shared/db/adapters/rn_sqlite_storage.js +93 -0
- package/dist/shared/db/adapters/tauri.d.ts +3 -0
- package/dist/shared/db/adapters/tauri.d.ts.map +1 -0
- package/dist/shared/db/adapters/tauri.js +100 -0
- package/dist/shared/db/dbErrorMsg.d.ts.map +1 -0
- package/dist/{db → shared/db}/dbErrorMsg.js +7 -0
- package/dist/{db → shared/db}/dbInitializer.d.ts +1 -1
- package/dist/shared/db/dbInitializer.d.ts.map +1 -0
- package/dist/{db → shared/db}/dbInitializer.js +28 -15
- package/dist/shared/db/normalizer.d.ts +6 -0
- package/dist/shared/db/normalizer.d.ts.map +1 -0
- package/dist/shared/db/normalizer.js +26 -0
- package/dist/{hooks → shared/hooks}/supastashFilters/index.d.ts +3 -3
- package/dist/shared/hooks/supastashFilters/index.d.ts.map +1 -0
- package/dist/{hooks → shared/hooks}/supastashFilters/index.js +6 -4
- package/dist/{hooks → shared/hooks}/syncStatus/index.d.ts +1 -1
- package/dist/shared/hooks/syncStatus/index.d.ts.map +1 -0
- package/dist/shared/store/localCache.d.ts.map +1 -0
- package/dist/shared/store/sharedDb.d.ts +6 -0
- package/dist/shared/store/sharedDb.d.ts.map +1 -0
- package/dist/shared/store/sharedDb.js +17 -0
- package/dist/shared/store/syncCalls.d.ts.map +1 -0
- package/dist/{store → shared/store}/syncStatus.d.ts +1 -1
- package/dist/shared/store/syncStatus.d.ts.map +1 -0
- package/dist/shared/store/tableFilters.d.ts +5 -0
- package/dist/shared/store/tableFilters.d.ts.map +1 -0
- package/dist/shared/store/tableSchemaData.d.ts.map +1 -0
- package/dist/shared/store/tx.d.ts +3 -0
- package/dist/shared/store/tx.d.ts.map +1 -0
- package/dist/shared/store/tx.js +1 -0
- package/dist/shared/types/adapters.types.d.ts +8 -0
- package/dist/{types → shared/types}/expoSqlite.types.d.ts +3 -13
- package/dist/{types → shared/types}/index.d.ts +1 -1
- package/dist/shared/types/index.d.ts.map +1 -0
- package/dist/{types → shared/types}/liteQuery.types.d.ts +2 -2
- package/dist/{types → shared/types}/query.types.d.ts +24 -1
- package/dist/{types → shared/types}/realtimeData.types.d.ts +8 -4
- package/dist/{types → shared/types}/supastashConfig.types.d.ts +263 -8
- package/dist/{types → shared/types}/syncEngine.types.d.ts +49 -7
- package/dist/shared/utils/connection.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/connection.js +6 -6
- package/dist/shared/utils/errorHandler.d.ts +6 -0
- package/dist/shared/utils/errorHandler.d.ts.map +1 -0
- package/dist/shared/utils/errorHandler.js +8 -0
- package/dist/shared/utils/events/eventBus.d.ts.map +1 -0
- package/dist/shared/utils/fetchData/addPayloadToUI.d.ts.map +1 -0
- package/dist/shared/utils/fetchData/createTable.d.ts.map +1 -0
- package/dist/shared/utils/fetchData/createTable.js +38 -0
- package/dist/shared/utils/fetchData/dataState.d.ts.map +1 -0
- package/dist/{hooks/supastashData → shared/utils/fetchData}/dataState.js +1 -1
- package/dist/shared/utils/fetchData/deleteData.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/fetchData/deleteData.js +8 -5
- package/dist/{utils → shared/utils}/fetchData/fetchLocalData.d.ts +2 -2
- package/dist/shared/utils/fetchData/fetchLocalData.d.ts.map +1 -0
- package/dist/shared/utils/fetchData/getKeyType.d.ts.map +1 -0
- package/dist/shared/utils/fetchData/liteHelpers.d.ts +6 -0
- package/dist/shared/utils/fetchData/liteHelpers.d.ts.map +1 -0
- package/dist/shared/utils/fetchData/liteHelpers.js +92 -0
- package/dist/shared/utils/fetchData/realTimeCall.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/fetchData/realTimeCall.js +2 -2
- package/dist/shared/utils/fetchData/realTimeManager.d.ts.map +1 -0
- package/dist/shared/utils/fetchData/registerSub.d.ts +4 -0
- package/dist/shared/utils/fetchData/registerSub.d.ts.map +1 -0
- package/dist/{hooks/supastashData → shared/utils/fetchData}/registerSub.js +3 -3
- package/dist/shared/utils/fetchData/setDataInBatches.d.ts.map +1 -0
- package/dist/shared/utils/fetchData/snapShot.d.ts.map +1 -0
- package/dist/shared/utils/fetchData/validatePayload.d.ts.map +1 -0
- package/dist/shared/utils/genUUID.d.ts.map +1 -0
- package/dist/shared/utils/getSafeValues.d.ts.map +1 -0
- package/dist/shared/utils/getTableSchema.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/logs.d.ts +1 -0
- package/dist/shared/utils/logs.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/logs.js +6 -1
- package/dist/{utils → shared/utils}/query/builder/crud.d.ts +5 -5
- package/dist/shared/utils/query/builder/crud.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/builder/filters.d.ts +36 -12
- package/dist/shared/utils/query/builder/filters.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/builder/filters.js +33 -1
- package/dist/{utils → shared/utils}/query/builder/index.d.ts +29 -1
- package/dist/shared/utils/query/builder/index.d.ts.map +1 -0
- package/dist/shared/utils/query/builder/index.js +138 -0
- package/dist/shared/utils/query/builder/mainQuery.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/builder/mainQuery.js +17 -2
- package/dist/shared/utils/query/helpers/localDb/getLocalMethod.d.ts +15 -0
- package/dist/shared/utils/query/helpers/localDb/getLocalMethod.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/helpers/localDb/getLocalMethod.js +7 -6
- package/dist/{utils → shared/utils}/query/helpers/localDb/insertMany.d.ts +3 -0
- package/dist/shared/utils/query/helpers/localDb/insertMany.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/helpers/localDb/insertMany.js +10 -3
- package/dist/shared/utils/query/helpers/localDb/localQueryBuilder.d.ts +34 -0
- package/dist/shared/utils/query/helpers/localDb/localQueryBuilder.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/helpers/localDb/localQueryBuilder.js +17 -10
- package/dist/{utils → shared/utils}/query/helpers/localDb/upsertMany.d.ts +3 -0
- package/dist/shared/utils/query/helpers/localDb/upsertMany.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/helpers/localDb/upsertMany.js +9 -2
- package/dist/shared/utils/query/helpers/mainQueryHelpers.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/helpers/mainQueryHelpers.js +39 -9
- package/dist/shared/utils/query/helpers/queryValidator.d.ts.map +1 -0
- package/dist/shared/utils/query/helpers/queueRemote.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/helpers/queueRemote.js +36 -27
- package/dist/shared/utils/query/helpers/remoteDb/queryFilterBuilder.d.ts.map +1 -0
- package/dist/shared/utils/query/helpers/remoteDb/queryUtils.d.ts.map +1 -0
- package/dist/shared/utils/query/localDbQuery/delete.d.ts +22 -0
- package/dist/shared/utils/query/localDbQuery/delete.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/localDbQuery/delete.js +16 -5
- package/dist/shared/utils/query/localDbQuery/index.d.ts.map +1 -0
- package/dist/shared/utils/query/localDbQuery/index.js +15 -0
- package/dist/shared/utils/query/localDbQuery/insert.d.ts +10 -0
- package/dist/shared/utils/query/localDbQuery/insert.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/localDbQuery/insert.js +8 -5
- package/dist/{utils → shared/utils}/query/localDbQuery/select.d.ts +2 -2
- package/dist/shared/utils/query/localDbQuery/select.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/localDbQuery/select.js +5 -2
- package/dist/shared/utils/query/localDbQuery/update.d.ts +11 -0
- package/dist/shared/utils/query/localDbQuery/update.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/localDbQuery/update.js +7 -4
- package/dist/shared/utils/query/localDbQuery/upsert.d.ts +9 -0
- package/dist/shared/utils/query/localDbQuery/upsert.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/localDbQuery/upsert.js +8 -3
- package/dist/shared/utils/query/remoteQuery/supabaseQuery.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/query/remoteQuery/supabaseQuery.js +5 -2
- package/dist/shared/utils/refreshScreenCalls.d.ts.map +1 -0
- package/dist/shared/utils/reusedHelpers.d.ts +8 -0
- package/dist/shared/utils/reusedHelpers.d.ts.map +1 -0
- package/dist/shared/utils/reusedHelpers.js +162 -0
- package/dist/shared/utils/schema/createSyncStatus.d.ts +19 -0
- package/dist/shared/utils/schema/createSyncStatus.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/schema/createSyncStatus.js +30 -3
- package/dist/shared/utils/serializer.d.ts.map +1 -0
- package/dist/shared/utils/supabaseClientErr.d.ts.map +1 -0
- package/dist/shared/utils/supastashMode.d.ts.map +1 -0
- package/dist/shared/utils/sync/getAllTables.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/sync/getAllTables.js +1 -1
- package/dist/shared/utils/sync/pullFromRemote/getLastCreatedInfo.d.ts.map +1 -0
- package/dist/shared/utils/sync/pullFromRemote/getLastDeletedInfo.d.ts.map +1 -0
- package/dist/shared/utils/sync/pullFromRemote/getLastPulledInfo.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/sync/pullFromRemote/helpers.d.ts +10 -7
- package/dist/shared/utils/sync/pullFromRemote/helpers.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/sync/pullFromRemote/helpers.js +20 -14
- package/dist/shared/utils/sync/pullFromRemote/runLimitedConcurrency.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/sync/pullFromRemote/runLimitedConcurrency.js +1 -1
- package/dist/shared/utils/sync/pullFromRemote/stringifyFields.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/sync/pullFromRemote/updateFilter.d.ts +1 -1
- package/dist/shared/utils/sync/pullFromRemote/updateFilter.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/sync/pullFromRemote/updateFilter.js +5 -3
- package/dist/shared/utils/sync/pullFromRemote/validateFilters.d.ts +3 -0
- package/dist/shared/utils/sync/pullFromRemote/validateFilters.d.ts.map +1 -0
- package/dist/shared/utils/sync/pullFromRemote/validateFilters.js +49 -0
- package/dist/shared/utils/sync/pushLocal/deleteChunks.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/sync/pushLocal/deleteChunks.js +7 -5
- package/dist/shared/utils/sync/pushLocal/getAllUnsyncedData.d.ts.map +1 -0
- package/dist/shared/utils/sync/pushLocal/getAllUnsyncedData.js +53 -0
- package/dist/shared/utils/sync/pushLocal/normalize.d.ts.map +1 -0
- package/dist/shared/utils/sync/pushLocal/parseFields.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/sync/queryStatus.d.ts +1 -1
- package/dist/shared/utils/sync/queryStatus.d.ts.map +1 -0
- package/dist/shared/utils/sync/refreshTables.d.ts.map +1 -0
- package/dist/shared/utils/sync/registration/syncCalls.d.ts.map +1 -0
- package/dist/{utils → shared/utils}/sync/registration/syncCalls.js +1 -1
- package/dist/shared/utils/sync/status/remoteSchema.d.ts +4 -0
- package/dist/shared/utils/sync/status/remoteSchema.d.ts.map +1 -0
- package/dist/shared/utils/sync/status/remoteSchema.js +140 -0
- package/dist/shared/utils/sync/status/syncUpdate.d.ts.map +1 -0
- package/dist/shared/utils/tableValidator.d.ts.map +1 -0
- package/package.json +29 -12
- package/dist/constants/syncDefaults.d.ts.map +0 -1
- package/dist/core/config/index.d.ts.map +0 -1
- package/dist/core/schemaManager/index.d.ts.map +0 -1
- package/dist/db/adapters/expo_sqlite.d.ts +0 -3
- package/dist/db/adapters/expo_sqlite.d.ts.map +0 -1
- package/dist/db/adapters/expo_sqlite.js +0 -24
- package/dist/db/adapters/rn_nitro.d.ts +0 -3
- package/dist/db/adapters/rn_nitro.d.ts.map +0 -1
- package/dist/db/adapters/rn_nitro.js +0 -34
- package/dist/db/adapters/rn_sqlite_storage.d.ts +0 -3
- package/dist/db/adapters/rn_sqlite_storage.d.ts.map +0 -1
- package/dist/db/adapters/rn_sqlite_storage.js +0 -25
- package/dist/db/dbErrorMsg.d.ts.map +0 -1
- package/dist/db/dbInitializer.d.ts.map +0 -1
- package/dist/hooks/supastashData/addPayloadToUI.d.ts.map +0 -1
- package/dist/hooks/supastashData/dataState.d.ts.map +0 -1
- package/dist/hooks/supastashData/eventQueues.d.ts.map +0 -1
- package/dist/hooks/supastashData/fetchCalls.d.ts.map +0 -1
- package/dist/hooks/supastashData/index.d.ts.map +0 -1
- package/dist/hooks/supastashData/realtimeSubscription.d.ts +0 -5
- package/dist/hooks/supastashData/realtimeSubscription.d.ts.map +0 -1
- package/dist/hooks/supastashData/realtimeSubscription.js +0 -96
- package/dist/hooks/supastashData/registerSub.d.ts +0 -4
- package/dist/hooks/supastashData/registerSub.d.ts.map +0 -1
- package/dist/hooks/supastashFilters/index.d.ts.map +0 -1
- package/dist/hooks/supastashLiteQuery/fetchCalls.d.ts +0 -1
- package/dist/hooks/supastashLiteQuery/fetchCalls.d.ts.map +0 -1
- package/dist/hooks/supastashLiteQuery/fetchCalls.js +0 -122
- package/dist/hooks/supastashLiteQuery/index.d.ts +0 -53
- package/dist/hooks/supastashLiteQuery/index.d.ts.map +0 -1
- package/dist/hooks/supastashLiteQuery/index.js +0 -117
- package/dist/hooks/supastashLiteQuery/loadCacheOnMount.d.ts +0 -1
- package/dist/hooks/supastashLiteQuery/loadCacheOnMount.d.ts.map +0 -1
- package/dist/hooks/supastashLiteQuery/loadCacheOnMount.js +0 -1
- package/dist/hooks/supastashLogic.d.ts.map +0 -1
- package/dist/hooks/syncEngine/index.d.ts.map +0 -1
- package/dist/hooks/syncEngine/pullFromRemote/index.d.ts.map +0 -1
- package/dist/hooks/syncEngine/pushLocal/index.d.ts.map +0 -1
- package/dist/hooks/syncStatus/index.d.ts.map +0 -1
- package/dist/store/localCache.d.ts.map +0 -1
- package/dist/store/syncCalls.d.ts.map +0 -1
- package/dist/store/syncStatus.d.ts.map +0 -1
- package/dist/store/tableFilters.d.ts +0 -5
- package/dist/store/tableFilters.d.ts.map +0 -1
- package/dist/store/tableSchemaData.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/supastashFilters.types.d.ts +0 -3
- package/dist/utils/connection.d.ts.map +0 -1
- package/dist/utils/createIndexes.d.ts +0 -9
- package/dist/utils/createIndexes.d.ts.map +0 -1
- package/dist/utils/createIndexes.js +0 -74
- package/dist/utils/events/eventBus.d.ts.map +0 -1
- package/dist/utils/fetchData/buildFilter.d.ts +0 -4
- package/dist/utils/fetchData/buildFilter.d.ts.map +0 -1
- package/dist/utils/fetchData/buildFilter.js +0 -58
- package/dist/utils/fetchData/createTable.d.ts.map +0 -1
- package/dist/utils/fetchData/createTable.js +0 -81
- package/dist/utils/fetchData/deleteData.d.ts.map +0 -1
- package/dist/utils/fetchData/fetchLocalData.d.ts.map +0 -1
- package/dist/utils/fetchData/getKeyType.d.ts.map +0 -1
- package/dist/utils/fetchData/initialFetch.d.ts +0 -3
- package/dist/utils/fetchData/initialFetch.d.ts.map +0 -1
- package/dist/utils/fetchData/liteHelpers.d.ts +0 -6
- package/dist/utils/fetchData/liteHelpers.d.ts.map +0 -1
- package/dist/utils/fetchData/liteHelpers.js +0 -197
- package/dist/utils/fetchData/liteReducer.d.ts +0 -3
- package/dist/utils/fetchData/liteReducer.d.ts.map +0 -1
- package/dist/utils/fetchData/liteReducer.js +0 -103
- package/dist/utils/fetchData/realTimeCall.d.ts.map +0 -1
- package/dist/utils/fetchData/realTimeManager.d.ts.map +0 -1
- package/dist/utils/fetchData/receiveData.d.ts.map +0 -1
- package/dist/utils/fetchData/setDataInBatches.d.ts.map +0 -1
- package/dist/utils/fetchData/snapShot.d.ts.map +0 -1
- package/dist/utils/fetchData/validatePayload.d.ts.map +0 -1
- package/dist/utils/genUUID.d.ts.map +0 -1
- package/dist/utils/getSafeValues.d.ts.map +0 -1
- package/dist/utils/getTableSchema.d.ts.map +0 -1
- package/dist/utils/logs.d.ts.map +0 -1
- package/dist/utils/query/builder/crud.d.ts.map +0 -1
- package/dist/utils/query/builder/filters.d.ts.map +0 -1
- package/dist/utils/query/builder/index.d.ts.map +0 -1
- package/dist/utils/query/builder/index.js +0 -62
- package/dist/utils/query/builder/mainQuery.d.ts.map +0 -1
- package/dist/utils/query/helpers/localDb/getLocalMethod.d.ts +0 -15
- package/dist/utils/query/helpers/localDb/getLocalMethod.d.ts.map +0 -1
- package/dist/utils/query/helpers/localDb/insertMany.d.ts.map +0 -1
- package/dist/utils/query/helpers/localDb/localQueryBuilder.d.ts +0 -34
- package/dist/utils/query/helpers/localDb/localQueryBuilder.d.ts.map +0 -1
- package/dist/utils/query/helpers/localDb/upsertMany.d.ts.map +0 -1
- package/dist/utils/query/helpers/mainQueryHelpers.d.ts.map +0 -1
- package/dist/utils/query/helpers/queryValidator.d.ts.map +0 -1
- package/dist/utils/query/helpers/queueRemote.d.ts.map +0 -1
- package/dist/utils/query/helpers/remoteDb/queryFilterBuilder.d.ts.map +0 -1
- package/dist/utils/query/helpers/remoteDb/queryUtils.d.ts.map +0 -1
- package/dist/utils/query/localDbQuery/delete.d.ts +0 -16
- package/dist/utils/query/localDbQuery/delete.d.ts.map +0 -1
- package/dist/utils/query/localDbQuery/index.d.ts.map +0 -1
- package/dist/utils/query/localDbQuery/index.js +0 -15
- package/dist/utils/query/localDbQuery/insert.d.ts +0 -10
- package/dist/utils/query/localDbQuery/insert.d.ts.map +0 -1
- package/dist/utils/query/localDbQuery/select.d.ts.map +0 -1
- package/dist/utils/query/localDbQuery/update.d.ts +0 -11
- package/dist/utils/query/localDbQuery/update.d.ts.map +0 -1
- package/dist/utils/query/localDbQuery/upsert.d.ts +0 -9
- package/dist/utils/query/localDbQuery/upsert.d.ts.map +0 -1
- package/dist/utils/query/remoteQuery/supabaseQuery.d.ts.map +0 -1
- package/dist/utils/refreshScreenCalls.d.ts.map +0 -1
- package/dist/utils/schema/createSyncStatus.d.ts +0 -17
- package/dist/utils/schema/createSyncStatus.d.ts.map +0 -1
- package/dist/utils/schema/wipeTables.d.ts.map +0 -1
- package/dist/utils/serializer.d.ts.map +0 -1
- package/dist/utils/supabaseClientErr.d.ts.map +0 -1
- package/dist/utils/supastashMode.d.ts.map +0 -1
- package/dist/utils/sync/getAllTables.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/getLastCreatedInfo.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/getLastDeletedInfo.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/getLastPulledInfo.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/helpers.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/pullData.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/pullDeletedData.d.ts +0 -12
- package/dist/utils/sync/pullFromRemote/pullDeletedData.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/pullDeletedData.js +0 -51
- package/dist/utils/sync/pullFromRemote/runLimitedConcurrency.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/stringifyFields.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/updateFilter.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/updateLocalDb.d.ts +0 -14
- package/dist/utils/sync/pullFromRemote/updateLocalDb.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/updateLocalDb.js +0 -200
- package/dist/utils/sync/pullFromRemote/validateFilters.d.ts +0 -5
- package/dist/utils/sync/pullFromRemote/validateFilters.d.ts.map +0 -1
- package/dist/utils/sync/pullFromRemote/validateFilters.js +0 -103
- package/dist/utils/sync/pushLocal/deleteChunks.d.ts.map +0 -1
- package/dist/utils/sync/pushLocal/getAllUnsyncedData.d.ts.map +0 -1
- package/dist/utils/sync/pushLocal/getAllUnsyncedData.js +0 -85
- package/dist/utils/sync/pushLocal/normalize.d.ts.map +0 -1
- package/dist/utils/sync/pushLocal/parseFields.d.ts.map +0 -1
- package/dist/utils/sync/pushLocal/sendUnsyncedToSupabase.d.ts.map +0 -1
- package/dist/utils/sync/pushLocal/uploadChunk.d.ts.map +0 -1
- package/dist/utils/sync/pushLocal/uploadHelpers.d.ts.map +0 -1
- package/dist/utils/sync/queryStatus.d.ts.map +0 -1
- package/dist/utils/sync/refreshTables.d.ts.map +0 -1
- package/dist/utils/sync/registration/syncCalls.d.ts.map +0 -1
- package/dist/utils/sync/status/filterKey.d.ts.map +0 -1
- package/dist/utils/sync/status/repo.d.ts +0 -10
- package/dist/utils/sync/status/repo.d.ts.map +0 -1
- package/dist/utils/sync/status/services.d.ts.map +0 -1
- package/dist/utils/sync/status/syncStatus.d.ts.map +0 -1
- package/dist/utils/sync/status/syncUpdate.d.ts.map +0 -1
- package/dist/utils/syncStatus.d.ts +0 -69
- package/dist/utils/syncStatus.d.ts.map +0 -1
- package/dist/utils/syncStatus.js +0 -129
- package/dist/utils/syncUpdate.d.ts +0 -7
- package/dist/utils/syncUpdate.d.ts.map +0 -1
- package/dist/utils/syncUpdate.js +0 -18
- package/dist/utils/tableValidator.d.ts.map +0 -1
- package/dist/utils/toggleSupastashMode.d.ts +0 -28
- package/dist/utils/toggleSupastashMode.d.ts.map +0 -1
- package/dist/utils/toggleSupastashMode.js +0 -46
- /package/dist/{utils → desktop/utils}/schema/wipeTables.d.ts +0 -0
- /package/dist/{hooks/syncEngine → desktop/utils/sync}/pullFromRemote/index.d.ts +0 -0
- /package/dist/{hooks/syncEngine → desktop/utils/sync}/pushLocal/index.d.ts +0 -0
- /package/dist/{utils → desktop/utils}/sync/pushLocal/sendUnsyncedToSupabase.d.ts +0 -0
- /package/dist/{constants → shared/constants}/syncDefaults.d.ts +0 -0
- /package/dist/{constants → shared/constants}/syncDefaults.js +0 -0
- /package/dist/{db → shared/db}/dbErrorMsg.d.ts +0 -0
- /package/dist/{hooks → shared/hooks}/syncStatus/index.js +0 -0
- /package/dist/{store → shared/store}/localCache.d.ts +0 -0
- /package/dist/{store → shared/store}/localCache.js +0 -0
- /package/dist/{store → shared/store}/syncCalls.d.ts +0 -0
- /package/dist/{store → shared/store}/syncCalls.js +0 -0
- /package/dist/{store → shared/store}/syncStatus.js +0 -0
- /package/dist/{store → shared/store}/tableFilters.js +0 -0
- /package/dist/{store → shared/store}/tableSchemaData.d.ts +0 -0
- /package/dist/{store → shared/store}/tableSchemaData.js +0 -0
- /package/dist/{types → shared/types}/index.js +0 -0
- /package/dist/{types → shared/types}/rnNitroSqlite.types.d.ts +0 -0
- /package/dist/{types → shared/types}/rnSqliteStorage.types.d.ts +0 -0
- /package/dist/{types → shared/types}/schemaManager.types.d.ts +0 -0
- /package/dist/{utils → shared/utils}/connection.d.ts +0 -0
- /package/dist/{utils → shared/utils}/events/eventBus.d.ts +0 -0
- /package/dist/{utils → shared/utils}/events/eventBus.js +0 -0
- /package/dist/{hooks/supastashData → shared/utils/fetchData}/addPayloadToUI.d.ts +0 -0
- /package/dist/{hooks/supastashData → shared/utils/fetchData}/addPayloadToUI.js +0 -0
- /package/dist/{utils → shared/utils}/fetchData/createTable.d.ts +0 -0
- /package/dist/{hooks/supastashData → shared/utils/fetchData}/dataState.d.ts +0 -0
- /package/dist/{utils → shared/utils}/fetchData/deleteData.d.ts +0 -0
- /package/dist/{utils → shared/utils}/fetchData/fetchLocalData.js +0 -0
- /package/dist/{utils → shared/utils}/fetchData/getKeyType.d.ts +0 -0
- /package/dist/{utils → shared/utils}/fetchData/getKeyType.js +0 -0
- /package/dist/{utils → shared/utils}/fetchData/realTimeCall.d.ts +0 -0
- /package/dist/{utils → shared/utils}/fetchData/realTimeManager.d.ts +0 -0
- /package/dist/{utils → shared/utils}/fetchData/realTimeManager.js +0 -0
- /package/dist/{utils → shared/utils}/fetchData/setDataInBatches.d.ts +0 -0
- /package/dist/{utils → shared/utils}/fetchData/setDataInBatches.js +0 -0
- /package/dist/{utils → shared/utils}/fetchData/snapShot.d.ts +0 -0
- /package/dist/{utils → shared/utils}/fetchData/snapShot.js +0 -0
- /package/dist/{utils → shared/utils}/fetchData/validatePayload.d.ts +0 -0
- /package/dist/{utils → shared/utils}/fetchData/validatePayload.js +0 -0
- /package/dist/{utils → shared/utils}/genUUID.d.ts +0 -0
- /package/dist/{utils → shared/utils}/genUUID.js +0 -0
- /package/dist/{utils → shared/utils}/getSafeValues.d.ts +0 -0
- /package/dist/{utils → shared/utils}/getSafeValues.js +0 -0
- /package/dist/{utils → shared/utils}/getTableSchema.d.ts +0 -0
- /package/dist/{utils → shared/utils}/getTableSchema.js +0 -0
- /package/dist/{utils → shared/utils}/query/builder/crud.js +0 -0
- /package/dist/{utils → shared/utils}/query/builder/mainQuery.d.ts +0 -0
- /package/dist/{utils → shared/utils}/query/helpers/mainQueryHelpers.d.ts +0 -0
- /package/dist/{utils → shared/utils}/query/helpers/queryValidator.d.ts +0 -0
- /package/dist/{utils → shared/utils}/query/helpers/queryValidator.js +0 -0
- /package/dist/{utils → shared/utils}/query/helpers/queueRemote.d.ts +0 -0
- /package/dist/{utils → shared/utils}/query/helpers/remoteDb/queryFilterBuilder.d.ts +0 -0
- /package/dist/{utils → shared/utils}/query/helpers/remoteDb/queryFilterBuilder.js +0 -0
- /package/dist/{utils → shared/utils}/query/helpers/remoteDb/queryUtils.d.ts +0 -0
- /package/dist/{utils → shared/utils}/query/helpers/remoteDb/queryUtils.js +0 -0
- /package/dist/{utils → shared/utils}/query/localDbQuery/index.d.ts +0 -0
- /package/dist/{utils → shared/utils}/query/remoteQuery/supabaseQuery.d.ts +0 -0
- /package/dist/{utils → shared/utils}/refreshScreenCalls.d.ts +0 -0
- /package/dist/{utils → shared/utils}/refreshScreenCalls.js +0 -0
- /package/dist/{utils → shared/utils}/serializer.d.ts +0 -0
- /package/dist/{utils → shared/utils}/serializer.js +0 -0
- /package/dist/{utils → shared/utils}/supabaseClientErr.d.ts +0 -0
- /package/dist/{utils → shared/utils}/supabaseClientErr.js +0 -0
- /package/dist/{utils → shared/utils}/supastashMode.d.ts +0 -0
- /package/dist/{utils → shared/utils}/supastashMode.js +0 -0
- /package/dist/{utils → shared/utils}/sync/getAllTables.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastCreatedInfo.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastCreatedInfo.js +0 -0
- /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastDeletedInfo.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastDeletedInfo.js +0 -0
- /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastPulledInfo.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/pullFromRemote/getLastPulledInfo.js +0 -0
- /package/dist/{utils → shared/utils}/sync/pullFromRemote/runLimitedConcurrency.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/pullFromRemote/stringifyFields.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/pullFromRemote/stringifyFields.js +0 -0
- /package/dist/{utils → shared/utils}/sync/pushLocal/deleteChunks.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/pushLocal/getAllUnsyncedData.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/pushLocal/normalize.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/pushLocal/normalize.js +0 -0
- /package/dist/{utils → shared/utils}/sync/pushLocal/parseFields.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/pushLocal/parseFields.js +0 -0
- /package/dist/{utils → shared/utils}/sync/queryStatus.js +0 -0
- /package/dist/{utils → shared/utils}/sync/refreshTables.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/refreshTables.js +0 -0
- /package/dist/{utils → shared/utils}/sync/registration/syncCalls.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/status/syncUpdate.d.ts +0 -0
- /package/dist/{utils → shared/utils}/sync/status/syncUpdate.js +0 -0
- /package/dist/{utils → shared/utils}/tableValidator.d.ts +0 -0
- /package/dist/{utils → shared/utils}/tableValidator.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/desktop/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,EACV,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,uCAAuC,CAAC;AAE/C,YAAY,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAEjF,YAAY,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACjE,YAAY,EACV,eAAe,EACf,0BAA0B,GAC3B,MAAM,+BAA+B,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";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PayloadData } from "
|
|
2
|
-
import { RealtimeOptions } from "
|
|
1
|
+
import { PayloadData } from "../../../shared/types/query.types";
|
|
2
|
+
import { RealtimeOptions } from "../../../shared/types/realtimeData.types";
|
|
3
3
|
declare function useEventQueues<R>(table: string, options: RealtimeOptions<R>, flushIntervalMs: number): (eventType: string, data: PayloadData) => void;
|
|
4
4
|
export default useEventQueues;
|
|
5
5
|
//# sourceMappingURL=eventQueues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventQueues.d.ts","sourceRoot":"","sources":["../../../../src/desktop/utils/fetchData/eventQueues.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAK3E,iBAAS,cAAc,CAAC,CAAC,EACvB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,EAC3B,eAAe,EAAE,MAAM,eA8CU,MAAM,QAAQ,WAAW,UAgB3D;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef } from "react";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import useDataState from "../../../shared/utils/fetchData/dataState";
|
|
3
|
+
import { deleteData } from "../../../shared/utils/fetchData/deleteData";
|
|
4
|
+
import { receiveData } from "./receiveData";
|
|
5
5
|
function useEventQueues(table, options, flushIntervalMs) {
|
|
6
6
|
const { dataMap } = useDataState(table);
|
|
7
7
|
const insertQueue = useRef([]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RealtimeOptions } from "
|
|
1
|
+
import { RealtimeOptions } from "../../../shared/types/realtimeData.types";
|
|
2
2
|
export declare function fetchCalls<R = any>(table: string, options: RealtimeOptions<R>, initialized: React.RefObject<boolean>): {
|
|
3
3
|
triggerRefresh: () => Promise<void>;
|
|
4
4
|
trigger: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchCalls.d.ts","sourceRoot":"","sources":["../../../../src/desktop/utils/fetchData/fetchCalls.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,eAAe,EAEhB,MAAM,0CAA0C,CAAC;AAKlD,wBAAgB,UAAU,CAAC,CAAC,GAAG,GAAG,EAChC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,EAC3B,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC;;;;;;EA4GtC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
|
2
|
-
import { syncCalls } from "
|
|
3
|
-
import { tableFilters, tableFiltersUsed } from "
|
|
4
|
-
import { fetchLocalData } from "
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { syncCalls } from "../../../shared/store/syncCalls";
|
|
3
|
+
import { tableFilters, tableFiltersUsed, } from "../../../shared/store/tableFilters";
|
|
4
|
+
import { fetchLocalData } from "../../../shared/utils/fetchData/fetchLocalData";
|
|
5
|
+
import { logError } from "../../../shared/utils/logs";
|
|
6
|
+
import { initialFetch } from "./initialFetch";
|
|
7
7
|
export function fetchCalls(table, options, initialized) {
|
|
8
8
|
const { shouldFetch = true, limit, filter, onPushToRemote, onInsertAndUpdate, useFilterWhileSyncing = true, extraMapKeys, daylength, onlyUseFilterForRealtime, orderBy, orderDesc, sqlFilter, } = options;
|
|
9
9
|
const cancelled = useRef(false);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SupastashFilter } from "../../../shared/types/realtimeData.types";
|
|
2
|
+
export declare function initialFetch(table: string, filter?: SupastashFilter[], onReceiveData?: (payload: any) => Promise<void>, onPushToRemote?: (payload: any[]) => Promise<boolean>): Promise<void>;
|
|
3
|
+
//# sourceMappingURL=initialFetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialFetch.d.ts","sourceRoot":"","sources":["../../../../src/desktop/utils/fetchData/initialFetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAQ3E,wBAAsB,YAAY,CAChC,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,eAAe,EAAE,EAC1B,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,EAC/C,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,iBAatD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createTable } from "../../../shared/utils/fetchData/createTable";
|
|
2
|
+
import { logError } from "../../../shared/utils/logs";
|
|
2
3
|
import { updateLocalDb } from "../sync/pullFromRemote/updateLocalDb";
|
|
3
4
|
import { pushLocalDataToRemote } from "../sync/pushLocal/sendUnsyncedToSupabase";
|
|
4
|
-
import { createTable } from "./createTable";
|
|
5
5
|
let isInSync = new Map();
|
|
6
6
|
export async function initialFetch(table, filter, onReceiveData, onPushToRemote) {
|
|
7
7
|
if (isInSync.get(table))
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PayloadData } from "
|
|
1
|
+
import { PayloadData } from "../../../shared/types/query.types";
|
|
2
2
|
export declare function receiveData(payload: PayloadData, table: string, shouldFetch?: boolean, upsertCall?: (item: any) => void | Promise<void>): Promise<void>;
|
|
3
3
|
//# sourceMappingURL=receiveData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receiveData.d.ts","sourceRoot":"","sources":["../../../../src/desktop/utils/fetchData/receiveData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAShE,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,MAAM,EACb,WAAW,GAAE,OAAc,EAC3B,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,iBAuCjD"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getSupastashDb } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { getSupastashDb } from "../../../shared/db/dbInitializer";
|
|
2
|
+
import { createTable } from "../../../shared/utils/fetchData/createTable";
|
|
3
|
+
import log, { logError } from "../../../shared/utils/logs";
|
|
4
|
+
import { refreshScreen } from "../../../shared/utils/refreshScreenCalls";
|
|
5
|
+
import { checkIfTableExist } from "../../../shared/utils/tableValidator";
|
|
6
|
+
import { upsertData } from "../sync/pullFromRemote/updateLocalDb";
|
|
7
7
|
const DEFAULT_DATE = "1970-01-01T00:00:00Z";
|
|
8
8
|
export async function receiveData(payload, table, shouldFetch = true, upsertCall) {
|
|
9
9
|
if (!shouldFetch)
|
|
@@ -29,7 +29,7 @@ export async function receiveData(payload, table, shouldFetch = true, upsertCall
|
|
|
29
29
|
await upsertCall(payload);
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
await upsertData(table, payload);
|
|
32
|
+
await upsertData({ table, record: payload });
|
|
33
33
|
}
|
|
34
34
|
refreshScreen(table);
|
|
35
35
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CrudMethods, PayloadData, SupastashQuery } from "../../../shared/types/query.types";
|
|
2
|
+
import SupastashCrudBuilder from "../../../shared/utils/query/builder/crud";
|
|
3
|
+
/**
|
|
4
|
+
* Builder for the supastash query
|
|
5
|
+
* @param T - The method to call
|
|
6
|
+
* @param U - Whether to return a single row or multiple rows
|
|
7
|
+
*/
|
|
8
|
+
export declare class SupastashQueryBuilder<T extends CrudMethods, U extends boolean, R> {
|
|
9
|
+
private readonly query;
|
|
10
|
+
/**
|
|
11
|
+
* Constructor for the supastash query builder
|
|
12
|
+
* @param query - The query to build
|
|
13
|
+
*/
|
|
14
|
+
constructor(query: SupastashQuery<T, U, R>);
|
|
15
|
+
/**
|
|
16
|
+
* Sets the table to query.
|
|
17
|
+
*
|
|
18
|
+
* @param table - The table to query.
|
|
19
|
+
* @returns crud options.
|
|
20
|
+
*/
|
|
21
|
+
from(table: string): SupastashCrudBuilder<T, U, R>;
|
|
22
|
+
/**
|
|
23
|
+
* Executes multiple Supastash operations inside a single SQLite transaction.
|
|
24
|
+
*
|
|
25
|
+
* ⚠️ Do NOT call this inside `db.withTransaction(...)`
|
|
26
|
+
* or another `supastash.withTransaction(...)`.
|
|
27
|
+
* Nested transactions are not supported and will throw.
|
|
28
|
+
*
|
|
29
|
+
* All queries executed using the provided `tx` builder
|
|
30
|
+
* will share the same SQLite transaction and `txId`.
|
|
31
|
+
*
|
|
32
|
+
* If any operation inside the callback throws,
|
|
33
|
+
* the entire transaction is rolled back automatically.
|
|
34
|
+
*
|
|
35
|
+
* Example:
|
|
36
|
+
*
|
|
37
|
+
* await supastash.withTransaction(async (tx) => {
|
|
38
|
+
* await tx.from("orders").insert(order).run();
|
|
39
|
+
* await tx.from("ledger").insert(ledgerEntry).run();
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
*
|
|
43
|
+
* In this example, both inserts succeed or both fail.
|
|
44
|
+
*/
|
|
45
|
+
withTransaction(fn: (tx: SupastashTransactionalBuilder<T, U, R>) => Promise<void> | void): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
type SupastashTransactionalBuilder<T extends CrudMethods, U extends boolean, R> = Omit<SupastashQueryBuilder<T, U, R>, "withTransaction">;
|
|
48
|
+
export type SupastashTransactionClient = SupastashTransactionalBuilder<CrudMethods, boolean, PayloadData>;
|
|
49
|
+
export type SupastashClient = SupastashTransactionalBuilder<CrudMethods, boolean, PayloadData>;
|
|
50
|
+
/**
|
|
51
|
+
* Supastash query builder for local-first CRUD operations.
|
|
52
|
+
*
|
|
53
|
+
* This builder allows you to construct and execute queries against a local SQLite store
|
|
54
|
+
* with optional synchronization to Supabase.
|
|
55
|
+
*
|
|
56
|
+
* Notes:
|
|
57
|
+
* - SELECT operations return local data by default unless `sync mode` is set to "remoteOnly".
|
|
58
|
+
* - `.run()` (alias of `.execute()`) is **required** to finalize and perform the query.
|
|
59
|
+
* - Use `.run({ viewRemoteResult: true })` to view the remote result from Supabase.
|
|
60
|
+
* - All operations except DELETE return local data automatically — no need to chain `.select()`.
|
|
61
|
+
*
|
|
62
|
+
* @returns A chainable Supastash query instance.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* const result = await supastash
|
|
66
|
+
* .from("users")
|
|
67
|
+
* .update<T>({ name: "John Doe" })
|
|
68
|
+
* .eq("id", "1")
|
|
69
|
+
* .run(); // Required to execute the query
|
|
70
|
+
*/
|
|
71
|
+
export declare const supastash: SupastashQueryBuilder<CrudMethods, boolean, any>;
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/desktop/utils/query/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EAEX,WAAW,EACX,cAAc,EAEf,MAAM,mCAAmC,CAAC;AAE3C,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAG5E;;;;GAIG;AACH,qBAAa,qBAAqB,CAChC,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,OAAO,EACjB,CAAC;IAED,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0B;IAEhD;;;OAGG;gBACS,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAI1C;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM;IAOlB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,eAAe,CACb,EAAE,EAAE,CAAC,EAAE,EAAE,6BAA6B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;CAgD3E;AAED,KAAK,6BAA6B,CAChC,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,OAAO,EACjB,CAAC,IACC,IAAI,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAE5D,MAAM,MAAM,0BAA0B,GAAG,6BAA6B,CACpE,WAAW,EACX,OAAO,EACP,WAAW,CACZ,CAAC;AACF,MAAM,MAAM,eAAe,GAAG,6BAA6B,CACzD,WAAW,EACX,OAAO,EACP,WAAW,CACZ,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,SAAS,kDAyBiC,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { getSupastashDb } from "../../../desktop/db/dbInitializer";
|
|
2
|
+
import { txStore } from "../../../shared/store/tx";
|
|
3
|
+
import { generateUUIDv4 } from "../../../shared/utils/genUUID";
|
|
4
|
+
import SupastashCrudBuilder from "../../../shared/utils/query/builder/crud";
|
|
5
|
+
import { queueRemoteCall } from "../../../shared/utils/query/helpers/queueRemote";
|
|
6
|
+
/**
|
|
7
|
+
* Builder for the supastash query
|
|
8
|
+
* @param T - The method to call
|
|
9
|
+
* @param U - Whether to return a single row or multiple rows
|
|
10
|
+
*/
|
|
11
|
+
export class SupastashQueryBuilder {
|
|
12
|
+
/**
|
|
13
|
+
* Constructor for the supastash query builder
|
|
14
|
+
* @param query - The query to build
|
|
15
|
+
*/
|
|
16
|
+
constructor(query) {
|
|
17
|
+
this.query = query;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Sets the table to query.
|
|
21
|
+
*
|
|
22
|
+
* @param table - The table to query.
|
|
23
|
+
* @returns crud options.
|
|
24
|
+
*/
|
|
25
|
+
from(table) {
|
|
26
|
+
const id = generateUUIDv4();
|
|
27
|
+
getSupastashDb();
|
|
28
|
+
const newQuery = { ...this.query, table, id };
|
|
29
|
+
return new SupastashCrudBuilder(newQuery);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Executes multiple Supastash operations inside a single SQLite transaction.
|
|
33
|
+
*
|
|
34
|
+
* ⚠️ Do NOT call this inside `db.withTransaction(...)`
|
|
35
|
+
* or another `supastash.withTransaction(...)`.
|
|
36
|
+
* Nested transactions are not supported and will throw.
|
|
37
|
+
*
|
|
38
|
+
* All queries executed using the provided `tx` builder
|
|
39
|
+
* will share the same SQLite transaction and `txId`.
|
|
40
|
+
*
|
|
41
|
+
* If any operation inside the callback throws,
|
|
42
|
+
* the entire transaction is rolled back automatically.
|
|
43
|
+
*
|
|
44
|
+
* Example:
|
|
45
|
+
*
|
|
46
|
+
* await supastash.withTransaction(async (tx) => {
|
|
47
|
+
* await tx.from("orders").insert(order).run();
|
|
48
|
+
* await tx.from("ledger").insert(ledgerEntry).run();
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* In this example, both inserts succeed or both fail.
|
|
53
|
+
*/
|
|
54
|
+
withTransaction(fn) {
|
|
55
|
+
const query = async () => {
|
|
56
|
+
// Create a new transaction id
|
|
57
|
+
const newTxId = generateUUIDv4();
|
|
58
|
+
try {
|
|
59
|
+
const db = await getSupastashDb();
|
|
60
|
+
// Add the transaction to the store
|
|
61
|
+
txStore[newTxId] = [];
|
|
62
|
+
// Execute the local calls
|
|
63
|
+
await db.withTransaction(async (tx) => {
|
|
64
|
+
const txQuery = {
|
|
65
|
+
...this.query,
|
|
66
|
+
txId: newTxId,
|
|
67
|
+
tx,
|
|
68
|
+
throwOnError: true, // Throw the error to roll back the transaction
|
|
69
|
+
};
|
|
70
|
+
const txBuilder = new SupastashQueryBuilder(txQuery);
|
|
71
|
+
return fn(txBuilder);
|
|
72
|
+
});
|
|
73
|
+
// Execute the remote calls
|
|
74
|
+
const remoteCalls = txStore[newTxId] ?? [];
|
|
75
|
+
if (remoteCalls.length > 0) {
|
|
76
|
+
const newStates = remoteCalls.map((call) => {
|
|
77
|
+
return {
|
|
78
|
+
...call,
|
|
79
|
+
txId: null,
|
|
80
|
+
tx: null,
|
|
81
|
+
withTx: false,
|
|
82
|
+
type: "remoteOnly",
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
for (const state of newStates) {
|
|
86
|
+
queueRemoteCall(state);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
// Delete the transaction from the store
|
|
92
|
+
delete txStore[newTxId];
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return query();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Supastash query builder for local-first CRUD operations.
|
|
100
|
+
*
|
|
101
|
+
* This builder allows you to construct and execute queries against a local SQLite store
|
|
102
|
+
* with optional synchronization to Supabase.
|
|
103
|
+
*
|
|
104
|
+
* Notes:
|
|
105
|
+
* - SELECT operations return local data by default unless `sync mode` is set to "remoteOnly".
|
|
106
|
+
* - `.run()` (alias of `.execute()`) is **required** to finalize and perform the query.
|
|
107
|
+
* - Use `.run({ viewRemoteResult: true })` to view the remote result from Supabase.
|
|
108
|
+
* - All operations except DELETE return local data automatically — no need to chain `.select()`.
|
|
109
|
+
*
|
|
110
|
+
* @returns A chainable Supastash query instance.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* const result = await supastash
|
|
114
|
+
* .from("users")
|
|
115
|
+
* .update<T>({ name: "John Doe" })
|
|
116
|
+
* .eq("id", "1")
|
|
117
|
+
* .run(); // Required to execute the query
|
|
118
|
+
*/
|
|
119
|
+
export const supastash = new SupastashQueryBuilder({
|
|
120
|
+
id: generateUUIDv4(),
|
|
121
|
+
table: "",
|
|
122
|
+
method: "none",
|
|
123
|
+
payload: null,
|
|
124
|
+
filters: [],
|
|
125
|
+
limit: null,
|
|
126
|
+
select: null,
|
|
127
|
+
isSingle: false,
|
|
128
|
+
type: "localFirst",
|
|
129
|
+
runSelected: false,
|
|
130
|
+
viewRemoteResult: false,
|
|
131
|
+
onConflictKeys: ["id"],
|
|
132
|
+
preserveTimestamp: false,
|
|
133
|
+
throwOnError: false,
|
|
134
|
+
fetchPolicy: null,
|
|
135
|
+
// With tx
|
|
136
|
+
txId: null,
|
|
137
|
+
tx: null,
|
|
138
|
+
withTx: false,
|
|
139
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wipeTables.d.ts","sourceRoot":"","sources":["../../../../src/desktop/utils/schema/wipeTables.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,iBAWhD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,iBAWhD;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,kBAalC;AAED;;;;;;;;;;;;;GAaG;AAEH,wBAAsB,aAAa,kBAalC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,iBAyBpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,aAAa,GAAE,MAAM,EAAO,iBAiB7B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getSupastashDb } from "
|
|
2
|
-
import { clearSchemaCache } from "
|
|
3
|
-
import log from "
|
|
4
|
-
import { getAllTables } from "
|
|
1
|
+
import { getSupastashDb } from "../../../shared/db/dbInitializer";
|
|
2
|
+
import { clearSchemaCache } from "../../../shared/utils/getTableSchema";
|
|
3
|
+
import log from "../../../shared/utils/logs";
|
|
4
|
+
import { getAllTables } from "../../../shared/utils/sync/getAllTables";
|
|
5
5
|
import { clearLocalSyncLog } from "../sync/status/syncStatus";
|
|
6
6
|
/**
|
|
7
7
|
* Wipes a specific table from the local SQLite database and removes its sync metadata.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { PayloadData } from "../../../../shared/types/query.types";
|
|
2
|
+
import { SupastashFilter } from "../../../../shared/types/realtimeData.types";
|
|
3
|
+
/**
|
|
4
|
+
* Fetches a backward page of records from the server relative to the current
|
|
5
|
+
* earliest locally stored row.
|
|
6
|
+
*
|
|
7
|
+
* This function performs cursor-based backward pagination by:
|
|
8
|
+
* - Determining the earliest known local record for the table
|
|
9
|
+
* - Validating the provided boundary timestamp
|
|
10
|
+
* - Fetching older records from the server up to the specified limit
|
|
11
|
+
* - Optionally persisting the results into the local database
|
|
12
|
+
*
|
|
13
|
+
* Designed for infinite scroll and historical lookback scenarios.
|
|
14
|
+
*
|
|
15
|
+
* @returns An object containing:
|
|
16
|
+
* - `data`: The fetched records
|
|
17
|
+
* - `hasMore`: Whether additional older records may exist
|
|
18
|
+
*/
|
|
19
|
+
export declare function fetchOlderPage({ boundaryTs, table, filters, limit, shouldStoreToLocalDb, }: {
|
|
20
|
+
/**
|
|
21
|
+
* The timestamp to cap lookback at.
|
|
22
|
+
*/
|
|
23
|
+
boundaryTs: string;
|
|
24
|
+
/**
|
|
25
|
+
* The table to fetch data from.
|
|
26
|
+
*/
|
|
27
|
+
table: string;
|
|
28
|
+
/**
|
|
29
|
+
* The filters to apply to the data.
|
|
30
|
+
*/
|
|
31
|
+
filters?: SupastashFilter[];
|
|
32
|
+
/**
|
|
33
|
+
* The maximum number of records to fetch.
|
|
34
|
+
*/
|
|
35
|
+
limit: number;
|
|
36
|
+
/**
|
|
37
|
+
* The data to store to the database.
|
|
38
|
+
*/
|
|
39
|
+
shouldStoreToLocalDb?: boolean;
|
|
40
|
+
}): Promise<{
|
|
41
|
+
hasMore: boolean;
|
|
42
|
+
data: PayloadData[];
|
|
43
|
+
}>;
|
|
44
|
+
//# sourceMappingURL=fetchOlder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchOlder.d.ts","sourceRoot":"","sources":["../../../../../src/desktop/utils/sync/pullFromRemote/fetchOlder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAI9E;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,cAAc,CAAC,EACnC,UAAU,EACV,KAAK,EACL,OAAO,EACP,KAAK,EACL,oBAA2B,GAC5B,EAAE;IACD;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAE5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC,CAwCrD"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { getSupastashConfig } from "../../../../shared/core/config";
|
|
2
|
+
import { logWarn } from "../../../../shared/utils/logs";
|
|
3
|
+
import { FetchOlderHelpers } from "./fetchOlderHelpers";
|
|
4
|
+
/**
|
|
5
|
+
* Fetches a backward page of records from the server relative to the current
|
|
6
|
+
* earliest locally stored row.
|
|
7
|
+
*
|
|
8
|
+
* This function performs cursor-based backward pagination by:
|
|
9
|
+
* - Determining the earliest known local record for the table
|
|
10
|
+
* - Validating the provided boundary timestamp
|
|
11
|
+
* - Fetching older records from the server up to the specified limit
|
|
12
|
+
* - Optionally persisting the results into the local database
|
|
13
|
+
*
|
|
14
|
+
* Designed for infinite scroll and historical lookback scenarios.
|
|
15
|
+
*
|
|
16
|
+
* @returns An object containing:
|
|
17
|
+
* - `data`: The fetched records
|
|
18
|
+
* - `hasMore`: Whether additional older records may exist
|
|
19
|
+
*/
|
|
20
|
+
export async function fetchOlderPage({ boundaryTs, table, filters, limit, shouldStoreToLocalDb = true, }) {
|
|
21
|
+
try {
|
|
22
|
+
const isGhost = getSupastashConfig().supastashMode === "ghost";
|
|
23
|
+
if (isGhost) {
|
|
24
|
+
return { hasMore: false, data: [] };
|
|
25
|
+
}
|
|
26
|
+
const lookbackDays = await FetchOlderHelpers.getLookbackDays({
|
|
27
|
+
table,
|
|
28
|
+
filters,
|
|
29
|
+
});
|
|
30
|
+
if (boundaryTs) {
|
|
31
|
+
FetchOlderHelpers.validateBoundaryTs({
|
|
32
|
+
boundaryTs,
|
|
33
|
+
earliestDate: lookbackDays.createdAt,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const data = await FetchOlderHelpers.fetchData({
|
|
37
|
+
table,
|
|
38
|
+
filters,
|
|
39
|
+
limit,
|
|
40
|
+
boundaryTs,
|
|
41
|
+
earliestDate: lookbackDays.createdAt,
|
|
42
|
+
earliestId: lookbackDays.id,
|
|
43
|
+
});
|
|
44
|
+
if (shouldStoreToLocalDb) {
|
|
45
|
+
await FetchOlderHelpers.storeToDb({ table, data });
|
|
46
|
+
}
|
|
47
|
+
if (data.length > limit) {
|
|
48
|
+
logWarn(`[Supastash] Pagination overflow detected for table ${table}`);
|
|
49
|
+
}
|
|
50
|
+
return { hasMore: data.length === limit, data };
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return FetchOlderHelpers.handleError(error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PayloadData } from "../../../../shared/types/query.types";
|
|
2
|
+
import { SupastashFilter } from "../../../../shared/types/realtimeData.types";
|
|
3
|
+
import { SupastashError } from "../../../../shared/utils/errorHandler";
|
|
4
|
+
export declare const FetchOlderHelpers: {
|
|
5
|
+
validateBoundaryTs({ boundaryTs, earliestDate, }: {
|
|
6
|
+
boundaryTs: string;
|
|
7
|
+
earliestDate: string;
|
|
8
|
+
}): void;
|
|
9
|
+
getLookbackDays({ table, filters, }: {
|
|
10
|
+
table: string;
|
|
11
|
+
filters?: SupastashFilter[];
|
|
12
|
+
}): Promise<{
|
|
13
|
+
createdAt: any;
|
|
14
|
+
id: any;
|
|
15
|
+
}>;
|
|
16
|
+
fetchData({ table, filters, limit, earliestDate, boundaryTs, earliestId, }: {
|
|
17
|
+
table: string;
|
|
18
|
+
filters?: SupastashFilter[];
|
|
19
|
+
limit: number;
|
|
20
|
+
boundaryTs?: string;
|
|
21
|
+
earliestDate: string;
|
|
22
|
+
earliestId: string;
|
|
23
|
+
}): Promise<any[]>;
|
|
24
|
+
handleError(error: SupastashError): {
|
|
25
|
+
hasMore: boolean;
|
|
26
|
+
data: PayloadData[];
|
|
27
|
+
};
|
|
28
|
+
storeToDb({ table, data }: {
|
|
29
|
+
table: string;
|
|
30
|
+
data: PayloadData[];
|
|
31
|
+
}): Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=fetchOlderHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchOlderHelpers.d.ts","sourceRoot":"","sources":["../../../../../src/desktop/utils/sync/pullFromRemote/fetchOlderHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AASvE,eAAO,MAAM,iBAAiB;sDAIzB;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB;yCAmBE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;KAC7B;;;;gFA8BE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;QAC5B,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;KACpB;uBAqDkB,cAAc,GAAG;QAClC,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE,WAAW,EAAE,CAAC;KACrB;+BAagC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,EAAE,CAAA;KAAE;CAOxE,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { getSupastashConfig } from "../../../../shared/core/config";
|
|
2
|
+
import { getSupastashDb } from "../../../../shared/db/dbInitializer";
|
|
3
|
+
import { SupastashError } from "../../../../shared/utils/errorHandler";
|
|
4
|
+
import { logWarn } from "../../../../shared/utils/logs";
|
|
5
|
+
import { ReusedHelpers } from "../../../../shared/utils/reusedHelpers";
|
|
6
|
+
import { supabaseClientErr } from "../../../../shared/utils/supabaseClientErr";
|
|
7
|
+
import { upsertChunkData } from "./updateLocalDb";
|
|
8
|
+
const DEFAULT_DATE = "2000-01-01T00:00:00Z";
|
|
9
|
+
const DEFAULT_ID = "00000000-0000-0000-0000-000000000000";
|
|
10
|
+
export const FetchOlderHelpers = {
|
|
11
|
+
validateBoundaryTs({ boundaryTs, earliestDate, }) {
|
|
12
|
+
const boundaryTsDate = new Date(boundaryTs);
|
|
13
|
+
if (isNaN(boundaryTsDate.getTime())) {
|
|
14
|
+
logWarn(`Invalid boundary timestamp: ${boundaryTs}`);
|
|
15
|
+
throw new SupastashError(`Invalid boundary timestamp: ${boundaryTs}`, "INVALID_BOUNDARY_TS");
|
|
16
|
+
}
|
|
17
|
+
if (boundaryTsDate > new Date(earliestDate)) {
|
|
18
|
+
throw new SupastashError(`Boundary timestamp is more recent than oldest data: ${boundaryTs} > ${earliestDate}`, "BOUNDARY_TS_MORE_RECENT_THAN_OLDEST_DATA");
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
async getLookbackDays({ table, filters, }) {
|
|
22
|
+
// If no cursor, build the SQL filter
|
|
23
|
+
let sqlFilter = "";
|
|
24
|
+
if (filters) {
|
|
25
|
+
for (const filter of filters) {
|
|
26
|
+
sqlFilter += ReusedHelpers.buildFilterForSql(filter);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Fetch the earliest date and id
|
|
30
|
+
const db = await getSupastashDb();
|
|
31
|
+
const result = await db.getFirstAsync(`
|
|
32
|
+
SELECT id, created_at FROM ${table}
|
|
33
|
+
${sqlFilter}
|
|
34
|
+
ORDER BY created_at ASC, id ASC
|
|
35
|
+
LIMIT 1
|
|
36
|
+
`);
|
|
37
|
+
if (!result)
|
|
38
|
+
return { createdAt: DEFAULT_DATE, id: DEFAULT_ID };
|
|
39
|
+
return { createdAt: result.created_at, id: result.id };
|
|
40
|
+
},
|
|
41
|
+
async fetchData({ table, filters, limit, earliestDate, boundaryTs, earliestId, }) {
|
|
42
|
+
const supabase = getSupastashConfig().supabaseClient;
|
|
43
|
+
if (!supabase)
|
|
44
|
+
throw new Error(`No supabase client found: ${supabaseClientErr}`);
|
|
45
|
+
let cursorId = earliestId;
|
|
46
|
+
let cursorDate = earliestDate;
|
|
47
|
+
const results = [];
|
|
48
|
+
let remainingLimit = limit;
|
|
49
|
+
while (true) {
|
|
50
|
+
const pageSize = Math.min(1000, remainingLimit);
|
|
51
|
+
// Build the query
|
|
52
|
+
let q = supabase
|
|
53
|
+
.from(table)
|
|
54
|
+
.select("*")
|
|
55
|
+
.limit(pageSize)
|
|
56
|
+
.order("created_at", { ascending: false })
|
|
57
|
+
.order("id", { ascending: false })
|
|
58
|
+
.is("deleted_at", null);
|
|
59
|
+
q = q
|
|
60
|
+
.or(`created_at.lt.${cursorDate},and(created_at.eq.${cursorDate},id.lt.${cursorId})`)
|
|
61
|
+
.gte("created_at", boundaryTs ?? DEFAULT_DATE);
|
|
62
|
+
if (filters) {
|
|
63
|
+
q = ReusedHelpers.applyFilters(q, filters, table);
|
|
64
|
+
}
|
|
65
|
+
const { data, error } = await q;
|
|
66
|
+
if (error)
|
|
67
|
+
throw error;
|
|
68
|
+
if (!data || data.length === 0)
|
|
69
|
+
break;
|
|
70
|
+
results.push(...data);
|
|
71
|
+
const last = data[data.length - 1];
|
|
72
|
+
cursorId = last.id;
|
|
73
|
+
cursorDate = last.created_at;
|
|
74
|
+
if (data.length < pageSize) {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
if (remainingLimit <= pageSize) {
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
remainingLimit -= pageSize;
|
|
81
|
+
}
|
|
82
|
+
return results;
|
|
83
|
+
},
|
|
84
|
+
handleError(error) {
|
|
85
|
+
switch (error.code) {
|
|
86
|
+
case "INVALID_BOUNDARY_TS":
|
|
87
|
+
logWarn(error.message);
|
|
88
|
+
return { hasMore: false, data: [] };
|
|
89
|
+
case "BOUNDARY_TS_MORE_RECENT_THAN_OLDEST_DATA":
|
|
90
|
+
logWarn(error.message);
|
|
91
|
+
return { hasMore: false, data: [] };
|
|
92
|
+
default:
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
async storeToDb({ table, data }) {
|
|
97
|
+
if (data.length === 0)
|
|
98
|
+
return;
|
|
99
|
+
const db = await getSupastashDb();
|
|
100
|
+
await db.withTransaction(async (tx) => {
|
|
101
|
+
await upsertChunkData({ tx, table, records: data });
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/desktop/utils/sync/pullFromRemote/index.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,wBAAsB,cAAc,kBAqEnC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { getSupastashConfig } from "
|
|
2
|
-
import { syncCalls } from "
|
|
3
|
-
import { tableFilters } from "
|
|
4
|
-
import log from "
|
|
5
|
-
import { getAllTables } from "
|
|
6
|
-
import { runLimitedConcurrency } from "
|
|
1
|
+
import { getSupastashConfig } from "../../../../shared/core/config";
|
|
2
|
+
import { syncCalls } from "../../../../shared/store/syncCalls";
|
|
3
|
+
import { tableFilters } from "../../../../shared/store/tableFilters";
|
|
4
|
+
import log from "../../../../shared/utils/logs";
|
|
5
|
+
import { getAllTables } from "../../../../shared/utils/sync/getAllTables";
|
|
6
|
+
import { runLimitedConcurrency } from "../../../../shared/utils/sync/pullFromRemote/runLimitedConcurrency";
|
|
7
|
+
import { SyncInfoUpdater } from "../../../../shared/utils/sync/queryStatus";
|
|
7
8
|
import { updateLocalDb } from "../../../utils/sync/pullFromRemote/updateLocalDb";
|
|
8
|
-
import { SyncInfoUpdater } from "../../../utils/sync/queryStatus";
|
|
9
9
|
/**
|
|
10
10
|
* Pulls the data from the remote database to the local database
|
|
11
11
|
*/
|