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,109 @@
|
|
|
1
|
+
import { SupastashFilter } from "../../../../shared/types/realtimeData.types";
|
|
2
|
+
import { PublicScope, SupastashSyncStatus } from "../../../../shared/types/syncEngine.types";
|
|
3
|
+
/**
|
|
4
|
+
* Clears the sync log for a specific table.
|
|
5
|
+
*
|
|
6
|
+
* Removes all stored sync checkpoints (created / updated / deleted)
|
|
7
|
+
* for the given table and filter key (if any).
|
|
8
|
+
*
|
|
9
|
+
* @param tableName - Name of the table whose sync status should be cleared.
|
|
10
|
+
* @example
|
|
11
|
+
* await clearLocalSyncLog("users");
|
|
12
|
+
*/
|
|
13
|
+
export declare function clearLocalSyncLog(tableName: string): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Clears the sync log for every local table.
|
|
16
|
+
*
|
|
17
|
+
* Drops the `supastash_sync_marks` table and recreates it.
|
|
18
|
+
* Use with caution — this wipes all sync history.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* await clearAllLocalSyncLog();
|
|
22
|
+
*/
|
|
23
|
+
export declare function clearAllLocalSyncLog(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* Returns the stored timestamps and filter info, or `null` if
|
|
27
|
+
* there is no entry for the table.
|
|
28
|
+
* @param tableName - The name of the table to get the sync log for
|
|
29
|
+
* @example
|
|
30
|
+
* const syncLog = await getSyncLog("users");
|
|
31
|
+
* console.log(syncLog);
|
|
32
|
+
* return {
|
|
33
|
+
* table_name: "users",
|
|
34
|
+
* last_synced_at: "2021-01-01T00:00:00.000Z",
|
|
35
|
+
* last_deleted_at: "2021-01-01T00:00:00.000Z",
|
|
36
|
+
* filter_key: "1234567890",
|
|
37
|
+
* filter_json: "[...]",
|
|
38
|
+
* updated_at: "2021-01-01T00:00:00.000Z"
|
|
39
|
+
* }
|
|
40
|
+
*/
|
|
41
|
+
export declare function getSyncLog(tableName: string): Promise<SupastashSyncStatus | null>;
|
|
42
|
+
/**
|
|
43
|
+
* Writes or updates the sync log for a table.
|
|
44
|
+
*
|
|
45
|
+
* Stores the latest `updated_at` and `updated_at_pk`
|
|
46
|
+
* timestamps for a table + filter combination.
|
|
47
|
+
*
|
|
48
|
+
* @param table - Table name to update.
|
|
49
|
+
* @param filters - Optional realtime filters to scope the log.
|
|
50
|
+
* @param opts - Timestamp fields to set.
|
|
51
|
+
* @example
|
|
52
|
+
* await setSyncLog("users", undefined, {
|
|
53
|
+
* lastSyncedAt: new Date().toISOString(),
|
|
54
|
+
* lastSyncedAtPk: "00000000-0000-0000-0000-000000000000",
|
|
55
|
+
* });
|
|
56
|
+
*/
|
|
57
|
+
export declare function setSyncLog(table: string, filters: SupastashFilter[] | undefined, opts: {
|
|
58
|
+
lastSyncedAt?: string | null;
|
|
59
|
+
lastDeletedAt?: string | null;
|
|
60
|
+
lastSyncedAtPk?: string | null;
|
|
61
|
+
filterNamespace?: string;
|
|
62
|
+
}): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Resets one or more timestamps in the sync log for a table.
|
|
65
|
+
*
|
|
66
|
+
* @param table - Table to reset.
|
|
67
|
+
* @param filters - Optional filters for a scoped reset.
|
|
68
|
+
* @param scope - Field(s) to reset: "all" (default),
|
|
69
|
+
* "last_synced_at", or "last_deleted_at".
|
|
70
|
+
* @example
|
|
71
|
+
* await resetSyncLog("users", undefined, "all");
|
|
72
|
+
*/
|
|
73
|
+
export declare function resetSyncLog(table: string, filters: SupastashFilter[] | undefined, scope?: PublicScope): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Deletes the sync log entry for a table (and optional filter key).
|
|
76
|
+
*
|
|
77
|
+
* @param table - Table name.
|
|
78
|
+
* @param filters - Optional filters to target a specific row.
|
|
79
|
+
* @example
|
|
80
|
+
* await clearSyncLog("users");
|
|
81
|
+
*/
|
|
82
|
+
export declare function clearSyncLog(table: string, filters?: SupastashFilter[]): Promise<void>;
|
|
83
|
+
/** ------------------- DEPRECATED 🗑 Local Sync & Delete Log ------------------- */
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated Use `setSyncLog` instead.
|
|
86
|
+
* Sets the sync timestamp for a given table.
|
|
87
|
+
*/
|
|
88
|
+
export declare function setLocalSyncLog(tableName: string, lastSyncedAt: string, lastCreatedAt?: string): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated Use `clearSyncLog` instead.
|
|
91
|
+
* Clears the delete log for a given table.
|
|
92
|
+
*/
|
|
93
|
+
export declare function clearLocalDeleteLog(tableName: string): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated Use `clearSyncLog` instead.
|
|
96
|
+
* Clears the delete status for all local tables.
|
|
97
|
+
*/
|
|
98
|
+
export declare function clearAllLocalDeleteLog(): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated Use `getSyncLog` instead.
|
|
101
|
+
* Gets the delete log for a given table.
|
|
102
|
+
*/
|
|
103
|
+
export declare function getLocalDeleteLog(tableName: string): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated Use `setSyncLog` instead.
|
|
106
|
+
* Sets the delete log for a given table.
|
|
107
|
+
*/
|
|
108
|
+
export declare function setLocalDeleteLog(tableName: string, lastDeletedAt: string): Promise<void>;
|
|
109
|
+
//# sourceMappingURL=syncStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syncStatus.d.ts","sourceRoot":"","sources":["../../../../../src/native/utils/sync/status/syncStatus.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EACL,WAAW,EACX,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAkBnD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,iBAExD;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,kBAKzC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CASrC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,EAAE,GAAG,SAAS,EACtC,IAAI,EAAE;IACJ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,iBAOF;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,EAAE,GAAG,SAAS,EACtC,KAAK,GAAE,WAAmB,iBAO3B;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,EAAE,iBAM5E;AAED,oFAAoF;AAEpF;;;GAGG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,MAAM,iBAGvB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,iBAE1D;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,kBAE3C;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,iBAExD;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,iBAGtB"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { getSupastashConfig } from "../../../../shared/core/config";
|
|
2
|
+
import { getSupastashDb } from "../../../../shared/db/dbInitializer";
|
|
3
|
+
import { logError } from "../../../../shared/utils/logs";
|
|
4
|
+
import { createSyncStatusTable } from "../../../../shared/utils/schema/createSyncStatus";
|
|
5
|
+
import { clearSupastashSyncStatus, getSupastashSyncStatus, resetSupastashSyncStatus, setSupastashSyncStatus, } from "./services";
|
|
6
|
+
const SYNC_STATUS_TABLE = "supastash_sync_marks";
|
|
7
|
+
const SERVER_SYNC_STATUS_TABLE = "supastash_server_sync_marks";
|
|
8
|
+
const getSyncStatusTable = () => {
|
|
9
|
+
const cfg = getSupastashConfig();
|
|
10
|
+
return cfg.replicationMode === "server-side"
|
|
11
|
+
? SERVER_SYNC_STATUS_TABLE
|
|
12
|
+
: SYNC_STATUS_TABLE;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Clears the sync log for a specific table.
|
|
16
|
+
*
|
|
17
|
+
* Removes all stored sync checkpoints (created / updated / deleted)
|
|
18
|
+
* for the given table and filter key (if any).
|
|
19
|
+
*
|
|
20
|
+
* @param tableName - Name of the table whose sync status should be cleared.
|
|
21
|
+
* @example
|
|
22
|
+
* await clearLocalSyncLog("users");
|
|
23
|
+
*/
|
|
24
|
+
export async function clearLocalSyncLog(tableName) {
|
|
25
|
+
await clearSupastashSyncStatus(tableName);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Clears the sync log for every local table.
|
|
29
|
+
*
|
|
30
|
+
* Drops the `supastash_sync_marks` table and recreates it.
|
|
31
|
+
* Use with caution — this wipes all sync history.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* await clearAllLocalSyncLog();
|
|
35
|
+
*/
|
|
36
|
+
export async function clearAllLocalSyncLog() {
|
|
37
|
+
const db = await getSupastashDb();
|
|
38
|
+
const syncStatusTable = getSyncStatusTable();
|
|
39
|
+
await db.runAsync(`DROP TABLE IF EXISTS ${syncStatusTable}`);
|
|
40
|
+
await createSyncStatusTable();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* Returns the stored timestamps and filter info, or `null` if
|
|
45
|
+
* there is no entry for the table.
|
|
46
|
+
* @param tableName - The name of the table to get the sync log for
|
|
47
|
+
* @example
|
|
48
|
+
* const syncLog = await getSyncLog("users");
|
|
49
|
+
* console.log(syncLog);
|
|
50
|
+
* return {
|
|
51
|
+
* table_name: "users",
|
|
52
|
+
* last_synced_at: "2021-01-01T00:00:00.000Z",
|
|
53
|
+
* last_deleted_at: "2021-01-01T00:00:00.000Z",
|
|
54
|
+
* filter_key: "1234567890",
|
|
55
|
+
* filter_json: "[...]",
|
|
56
|
+
* updated_at: "2021-01-01T00:00:00.000Z"
|
|
57
|
+
* }
|
|
58
|
+
*/
|
|
59
|
+
export async function getSyncLog(tableName) {
|
|
60
|
+
try {
|
|
61
|
+
const syncStatus = await getSupastashSyncStatus(tableName);
|
|
62
|
+
return syncStatus;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
logError(error);
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Writes or updates the sync log for a table.
|
|
71
|
+
*
|
|
72
|
+
* Stores the latest `updated_at` and `updated_at_pk`
|
|
73
|
+
* timestamps for a table + filter combination.
|
|
74
|
+
*
|
|
75
|
+
* @param table - Table name to update.
|
|
76
|
+
* @param filters - Optional realtime filters to scope the log.
|
|
77
|
+
* @param opts - Timestamp fields to set.
|
|
78
|
+
* @example
|
|
79
|
+
* await setSyncLog("users", undefined, {
|
|
80
|
+
* lastSyncedAt: new Date().toISOString(),
|
|
81
|
+
* lastSyncedAtPk: "00000000-0000-0000-0000-000000000000",
|
|
82
|
+
* });
|
|
83
|
+
*/
|
|
84
|
+
export async function setSyncLog(table, filters, opts) {
|
|
85
|
+
try {
|
|
86
|
+
await setSupastashSyncStatus(table, filters, opts);
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
logError(`[Supastash] setMarks(${table}) failed`, e);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Resets one or more timestamps in the sync log for a table.
|
|
94
|
+
*
|
|
95
|
+
* @param table - Table to reset.
|
|
96
|
+
* @param filters - Optional filters for a scoped reset.
|
|
97
|
+
* @param scope - Field(s) to reset: "all" (default),
|
|
98
|
+
* "last_synced_at", or "last_deleted_at".
|
|
99
|
+
* @example
|
|
100
|
+
* await resetSyncLog("users", undefined, "all");
|
|
101
|
+
*/
|
|
102
|
+
export async function resetSyncLog(table, filters, scope = "all") {
|
|
103
|
+
try {
|
|
104
|
+
await resetSupastashSyncStatus(table, filters, scope);
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
logError(`[Supastash] resetMarks(${table}, ${scope}) failed`, e);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Deletes the sync log entry for a table (and optional filter key).
|
|
112
|
+
*
|
|
113
|
+
* @param table - Table name.
|
|
114
|
+
* @param filters - Optional filters to target a specific row.
|
|
115
|
+
* @example
|
|
116
|
+
* await clearSyncLog("users");
|
|
117
|
+
*/
|
|
118
|
+
export async function clearSyncLog(table, filters) {
|
|
119
|
+
try {
|
|
120
|
+
await clearSupastashSyncStatus(table, filters);
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
logError(`[Supastash] clearMarks(${table}) failed`, e);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** ------------------- DEPRECATED 🗑 Local Sync & Delete Log ------------------- */
|
|
127
|
+
/**
|
|
128
|
+
* @deprecated Use `setSyncLog` instead.
|
|
129
|
+
* Sets the sync timestamp for a given table.
|
|
130
|
+
*/
|
|
131
|
+
export async function setLocalSyncLog(tableName, lastSyncedAt, lastCreatedAt) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @deprecated Use `clearSyncLog` instead.
|
|
136
|
+
* Clears the delete log for a given table.
|
|
137
|
+
*/
|
|
138
|
+
export async function clearLocalDeleteLog(tableName) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @deprecated Use `clearSyncLog` instead.
|
|
143
|
+
* Clears the delete status for all local tables.
|
|
144
|
+
*/
|
|
145
|
+
export async function clearAllLocalDeleteLog() {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @deprecated Use `getSyncLog` instead.
|
|
150
|
+
* Gets the delete log for a given table.
|
|
151
|
+
*/
|
|
152
|
+
export async function getLocalDeleteLog(tableName) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* @deprecated Use `setSyncLog` instead.
|
|
157
|
+
* Sets the delete log for a given table.
|
|
158
|
+
*/
|
|
159
|
+
export async function setLocalDeleteLog(tableName, lastDeletedAt) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syncDefaults.d.ts","sourceRoot":"","sources":["../../../src/shared/constants/syncDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAExC,eAAO,MAAM,cAAc,EAAE,mBAU5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,gBAO5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,MAAM,CAAC"}
|
|
@@ -19,6 +19,7 @@ import { SupastashConfig, SupastashSQLiteClientTypes } from "../../types/supasta
|
|
|
19
19
|
* supabaseClient: supabase,
|
|
20
20
|
* sqliteClient: { openDatabaseAsync },
|
|
21
21
|
* sqliteClientType: "expo",
|
|
22
|
+
* platform: "native",
|
|
22
23
|
* onSchemaInit: () => {
|
|
23
24
|
* defineLocalSchema("users", {
|
|
24
25
|
* id: "TEXT PRIMARY KEY",
|
|
@@ -35,6 +36,7 @@ import { SupastashConfig, SupastashSQLiteClientTypes } from "../../types/supasta
|
|
|
35
36
|
* @param config.supabaseClient - Supabase client instance (**required**)
|
|
36
37
|
* @param config.sqliteClient - SQLite client adapter (**required**)
|
|
37
38
|
* @param config.sqliteClientType - SQLite engine: `"expo" | "rn-storage" | "rn-nitro"` (**required**)
|
|
39
|
+
* @param config.platform - Runtime platform: `"native" | "desktop"` (default: `"native"`)
|
|
38
40
|
* @param config.onSchemaInit - Optional callback to define local table schemas
|
|
39
41
|
* @param config.debugMode - Enables debug logging (default: `false`)
|
|
40
42
|
* @param config.listeners - Max number of active Realtime subscriptions (default: `250`)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/core/config/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,0BAA0B,EAC3B,MAAM,mCAAmC,CAAC;AAmC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,0BAA0B,EACrE,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG;IAAE,gBAAgB,EAAE,CAAC,CAAA;CAAE,QAwCrD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,SAAS,0BAA0B,KACjC,eAAe,CAAC,CAAC,CAAC,CAEtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CACnC,CAAC,SAAS,0BAA0B,EACpC,MAAM,EAAE;IACR,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG;QAC9B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;KAC3B,CAAC;CACH,QAEA"}
|
|
@@ -14,8 +14,14 @@ let _config = {
|
|
|
14
14
|
pull: true,
|
|
15
15
|
useFiltersFromStore: true,
|
|
16
16
|
},
|
|
17
|
+
platform: "native",
|
|
18
|
+
replicationMode: "client-side",
|
|
19
|
+
hasEnabledSimpleNullHandling: false,
|
|
20
|
+
maxSyncLookbackDays: 365,
|
|
21
|
+
perTableSyncLookbackDays: undefined,
|
|
22
|
+
fullSyncTables: [],
|
|
17
23
|
listeners: 250,
|
|
18
|
-
supabaseBatchSize:
|
|
24
|
+
supabaseBatchSize: 800,
|
|
19
25
|
debugMode: true,
|
|
20
26
|
syncPolicy: DEFAULT_POLICY,
|
|
21
27
|
fieldEnforcement: DEFAULT_FIELDS,
|
|
@@ -44,6 +50,7 @@ let _configured = false;
|
|
|
44
50
|
* supabaseClient: supabase,
|
|
45
51
|
* sqliteClient: { openDatabaseAsync },
|
|
46
52
|
* sqliteClientType: "expo",
|
|
53
|
+
* platform: "native",
|
|
47
54
|
* onSchemaInit: () => {
|
|
48
55
|
* defineLocalSchema("users", {
|
|
49
56
|
* id: "TEXT PRIMARY KEY",
|
|
@@ -60,6 +67,7 @@ let _configured = false;
|
|
|
60
67
|
* @param config.supabaseClient - Supabase client instance (**required**)
|
|
61
68
|
* @param config.sqliteClient - SQLite client adapter (**required**)
|
|
62
69
|
* @param config.sqliteClientType - SQLite engine: `"expo" | "rn-storage" | "rn-nitro"` (**required**)
|
|
70
|
+
* @param config.platform - Runtime platform: `"native" | "desktop"` (default: `"native"`)
|
|
63
71
|
* @param config.onSchemaInit - Optional callback to define local table schemas
|
|
64
72
|
* @param config.debugMode - Enables debug logging (default: `false`)
|
|
65
73
|
* @param config.listeners - Max number of active Realtime subscriptions (default: `250`)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type AppStateStatus = "active" | "background";
|
|
2
|
+
type Callback = (state: AppStateStatus) => void;
|
|
3
|
+
export interface AppStateAdapter {
|
|
4
|
+
subscribe(cb: Callback): () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare class AppStateService {
|
|
7
|
+
private adapter;
|
|
8
|
+
constructor(adapter: AppStateAdapter);
|
|
9
|
+
onActive(cb: () => void): () => void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=appState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appState.d.ts","sourceRoot":"","sources":["../../../../src/shared/core/platform/appState.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,YAAY,CAAC;AAErD,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;AAEhD,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;CACrC;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAkB;gBAErB,OAAO,EAAE,eAAe;IAIpC,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,SAVQ,IAAI;CAepC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expo_sqlite.d.ts","sourceRoot":"","sources":["../../../../src/shared/db/adapters/expo_sqlite.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EAGvB,MAAM,mCAAmC,CAAC;AAG3C,eAAO,MAAM,iBAAiB,EAAE,sBAAsB,CAAC,gBAAgB,CA6GtE,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { namedToPositional } from "../normalizer";
|
|
2
|
+
export const SQLiteAdapterExpo = {
|
|
3
|
+
async openDatabaseAsync(name, sqliteClient) {
|
|
4
|
+
const db = await sqliteClient.openDatabaseAsync(name);
|
|
5
|
+
return {
|
|
6
|
+
runAsync: async (sql, params) => {
|
|
7
|
+
await db.runAsync(sql, params ?? []);
|
|
8
|
+
},
|
|
9
|
+
execAsync: async (statement) => {
|
|
10
|
+
await db.execAsync(statement);
|
|
11
|
+
},
|
|
12
|
+
getAllAsync: async (sql, params) => {
|
|
13
|
+
const result = await db.getAllAsync(sql, params ?? []);
|
|
14
|
+
return result ?? [];
|
|
15
|
+
},
|
|
16
|
+
getFirstAsync: async (sql, params) => {
|
|
17
|
+
const result = await db.getFirstAsync(sql, params ?? []);
|
|
18
|
+
return result ?? null;
|
|
19
|
+
},
|
|
20
|
+
query: async (sql, params) => {
|
|
21
|
+
const { sql: q, params: p } = params
|
|
22
|
+
? namedToPositional(sql, params)
|
|
23
|
+
: { sql, params: [] };
|
|
24
|
+
return await db.getAllAsync(q, p);
|
|
25
|
+
},
|
|
26
|
+
queryOne: async (sql, params) => {
|
|
27
|
+
const { sql: q, params: p } = params
|
|
28
|
+
? namedToPositional(sql, params)
|
|
29
|
+
: { sql, params: [] };
|
|
30
|
+
return await db.getFirstAsync(q, p);
|
|
31
|
+
},
|
|
32
|
+
execute: async (sql, params) => {
|
|
33
|
+
const { sql: q, params: p } = params
|
|
34
|
+
? namedToPositional(sql, params)
|
|
35
|
+
: { sql, params: [] };
|
|
36
|
+
return await db.runAsync(q, p);
|
|
37
|
+
},
|
|
38
|
+
closeAsync: async () => {
|
|
39
|
+
await db.closeAsync?.();
|
|
40
|
+
},
|
|
41
|
+
withTransaction: async (fn) => {
|
|
42
|
+
return await db.withTransactionAsync(async () => {
|
|
43
|
+
const txExecutor = {
|
|
44
|
+
runAsync: async (sql, params) => await db.runAsync(sql, params ?? []),
|
|
45
|
+
execAsync: async (statement) => await db.execAsync(statement),
|
|
46
|
+
getAllAsync: async (sql, params) => await db.getAllAsync(sql, params ?? []),
|
|
47
|
+
getFirstAsync: async (sql, params) => await db.getFirstAsync(sql, params ?? []),
|
|
48
|
+
query: async (sql, params) => {
|
|
49
|
+
const { sql: q, params: p } = params
|
|
50
|
+
? namedToPositional(sql, params)
|
|
51
|
+
: { sql, params: [] };
|
|
52
|
+
return await db.getAllAsync(q, p);
|
|
53
|
+
},
|
|
54
|
+
queryOne: async (sql, params) => {
|
|
55
|
+
const { sql: q, params: p } = params
|
|
56
|
+
? namedToPositional(sql, params)
|
|
57
|
+
: { sql, params: [] };
|
|
58
|
+
return await db.getFirstAsync(q, p);
|
|
59
|
+
},
|
|
60
|
+
execute: async (sql, params) => {
|
|
61
|
+
const { sql: q, params: p } = params
|
|
62
|
+
? namedToPositional(sql, params)
|
|
63
|
+
: { sql, params: [] };
|
|
64
|
+
return await db.runAsync(q, p);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
return await fn(txExecutor);
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rn_nitro.d.ts","sourceRoot":"","sources":["../../../../src/shared/db/adapters/rn_nitro.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EAGvB,MAAM,mCAAmC,CAAC;AAI3C,eAAO,MAAM,kBAAkB,EAAE,sBAAsB,CAAC,mBAAmB,CAyJ1E,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { getSupastashConfig } from "../../core/config";
|
|
2
|
+
import { isDebugMode } from "../../utils/logs";
|
|
3
|
+
import { namedToPositional } from "../normalizer";
|
|
4
|
+
export const SQLiteAdapterNitro = {
|
|
5
|
+
async openDatabaseAsync(name, sqliteClient) {
|
|
6
|
+
//Enable simple null handling for Nitro SQLite
|
|
7
|
+
const config = getSupastashConfig();
|
|
8
|
+
if (!config.hasEnabledSimpleNullHandling && isDebugMode()) {
|
|
9
|
+
console.warn("[Supastash] Nitro SQLite detected. Call `enableSimpleNullHandling()` at the top of your app to ensure correct null behavior (see: https://libraries.io/npm/@vertexmd%2Freact-native-nitro-sqlite#simplified-null-handling). If already enabled, set `hasEnabledSimpleNullHandling: true` in Supastash config to silence this warning.");
|
|
10
|
+
}
|
|
11
|
+
const db = await sqliteClient.open({ name, location: "default" });
|
|
12
|
+
return {
|
|
13
|
+
runAsync: async (sql, params) => {
|
|
14
|
+
await db.executeAsync(sql, params ?? []);
|
|
15
|
+
},
|
|
16
|
+
execAsync: async (statement) => {
|
|
17
|
+
await db.executeAsync(statement);
|
|
18
|
+
},
|
|
19
|
+
getAllAsync: async (sql, params) => {
|
|
20
|
+
const result = await db.executeAsync(sql, params ?? []);
|
|
21
|
+
const mainResult = result.rows?._array ?? [];
|
|
22
|
+
return mainResult;
|
|
23
|
+
},
|
|
24
|
+
getFirstAsync: async (sql, params) => {
|
|
25
|
+
const result = await db.executeAsync(sql, params ?? []);
|
|
26
|
+
return result.rows?._array?.[0] ?? null;
|
|
27
|
+
},
|
|
28
|
+
query: async (sql, params) => {
|
|
29
|
+
const { sql: q, params: p } = params
|
|
30
|
+
? namedToPositional(sql, params)
|
|
31
|
+
: { sql, params: [] };
|
|
32
|
+
const result = await db.executeAsync(q, p ?? []);
|
|
33
|
+
const mainResult = result.rows?._array ?? [];
|
|
34
|
+
return mainResult;
|
|
35
|
+
},
|
|
36
|
+
queryOne: async (sql, params) => {
|
|
37
|
+
const { sql: q, params: p } = params
|
|
38
|
+
? namedToPositional(sql, params)
|
|
39
|
+
: { sql, params: [] };
|
|
40
|
+
const result = await db.executeAsync(q, p ?? []);
|
|
41
|
+
return result.rows?._array?.[0] ?? null;
|
|
42
|
+
},
|
|
43
|
+
execute: async (sql, params) => {
|
|
44
|
+
const { sql: q, params: p } = params
|
|
45
|
+
? namedToPositional(sql, params)
|
|
46
|
+
: { sql, params: [] };
|
|
47
|
+
return await db.executeAsync(q, p ?? []);
|
|
48
|
+
},
|
|
49
|
+
closeAsync: async () => {
|
|
50
|
+
await db.close?.();
|
|
51
|
+
},
|
|
52
|
+
withTransaction: async (fn) => {
|
|
53
|
+
const statements = [];
|
|
54
|
+
const enqueue = (sql, params) => {
|
|
55
|
+
statements.push({ sql, params });
|
|
56
|
+
};
|
|
57
|
+
const txExecutor = {
|
|
58
|
+
runAsync: async (sql, params) => {
|
|
59
|
+
enqueue(sql, params ?? []);
|
|
60
|
+
},
|
|
61
|
+
execAsync: async (statement) => {
|
|
62
|
+
enqueue(statement, []);
|
|
63
|
+
},
|
|
64
|
+
getAllAsync: async (sql, params) => {
|
|
65
|
+
const result = await db.executeAsync(sql, params ?? []);
|
|
66
|
+
return result.rows?._array ?? [];
|
|
67
|
+
},
|
|
68
|
+
getFirstAsync: async (sql, params) => {
|
|
69
|
+
const result = await db.executeAsync(sql, params ?? []);
|
|
70
|
+
return result.rows?._array?.[0] ?? null;
|
|
71
|
+
},
|
|
72
|
+
query: async (sql, params) => {
|
|
73
|
+
const { sql: q, params: p } = params
|
|
74
|
+
? namedToPositional(sql, params)
|
|
75
|
+
: { sql, params: [] };
|
|
76
|
+
const result = await db.executeAsync(q, p ?? []);
|
|
77
|
+
return result.rows?._array ?? [];
|
|
78
|
+
},
|
|
79
|
+
queryOne: async (sql, params) => {
|
|
80
|
+
const { sql: q, params: p } = params
|
|
81
|
+
? namedToPositional(sql, params)
|
|
82
|
+
: { sql, params: [] };
|
|
83
|
+
const result = await db.executeAsync(q, p ?? []);
|
|
84
|
+
return result.rows?._array?.[0] ?? null;
|
|
85
|
+
},
|
|
86
|
+
execute: async (sql, params) => {
|
|
87
|
+
const { sql: q, params: p } = params
|
|
88
|
+
? namedToPositional(sql, params)
|
|
89
|
+
: { sql, params: [] };
|
|
90
|
+
enqueue(q, p ?? []);
|
|
91
|
+
return {};
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
await fn(txExecutor);
|
|
95
|
+
if (statements.length === 0)
|
|
96
|
+
return;
|
|
97
|
+
await db.executeAsync("BEGIN");
|
|
98
|
+
try {
|
|
99
|
+
for (const { sql, params } of statements) {
|
|
100
|
+
await db.executeAsync(sql, params);
|
|
101
|
+
}
|
|
102
|
+
await db.executeAsync("COMMIT");
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
await db.executeAsync("ROLLBACK").catch(() => { });
|
|
106
|
+
throw err;
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rn_sqlite_storage.d.ts","sourceRoot":"","sources":["../../../../src/shared/db/adapters/rn_sqlite_storage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EAGvB,MAAM,mCAAmC,CAAC;AAG3C,eAAO,MAAM,oBAAoB,EAAE,sBAAsB,CAAC,qBAAqB,CAgJ5E,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { namedToPositional } from "../normalizer";
|
|
2
|
+
export const SQLiteAdapterStorage = {
|
|
3
|
+
async openDatabaseAsync(name, sqliteClient) {
|
|
4
|
+
const db = await sqliteClient.openDatabase({ name });
|
|
5
|
+
return {
|
|
6
|
+
runAsync: async (sql, params) => {
|
|
7
|
+
await db.executeSql(sql, params ?? []);
|
|
8
|
+
},
|
|
9
|
+
execAsync: async (statement) => {
|
|
10
|
+
await db.executeSql(statement);
|
|
11
|
+
},
|
|
12
|
+
getAllAsync: async (sql, params) => {
|
|
13
|
+
const result = await db.executeSql(sql, params ?? []);
|
|
14
|
+
const mainResult = result.map((r, index) => r.rows.item(index));
|
|
15
|
+
return mainResult ?? [];
|
|
16
|
+
},
|
|
17
|
+
getFirstAsync: async (sql, params) => {
|
|
18
|
+
const result = await db.executeSql(sql, params ?? []);
|
|
19
|
+
return result[0].rows.item(0) ?? null;
|
|
20
|
+
},
|
|
21
|
+
query: async (sql, params) => {
|
|
22
|
+
const { sql: q, params: p } = params
|
|
23
|
+
? namedToPositional(sql, params)
|
|
24
|
+
: { sql, params: [] };
|
|
25
|
+
const result = await db.executeSql(q, p ?? []);
|
|
26
|
+
return result.map((r, index) => r.rows.item(index));
|
|
27
|
+
},
|
|
28
|
+
queryOne: async (sql, params) => {
|
|
29
|
+
const { sql: q, params: p } = params
|
|
30
|
+
? namedToPositional(sql, params)
|
|
31
|
+
: { sql, params: [] };
|
|
32
|
+
const result = await db.executeSql(q, p ?? []);
|
|
33
|
+
return result[0].rows.item(0) ?? null;
|
|
34
|
+
},
|
|
35
|
+
execute: async (sql, params) => {
|
|
36
|
+
const { sql: q, params: p } = params
|
|
37
|
+
? namedToPositional(sql, params)
|
|
38
|
+
: { sql, params: [] };
|
|
39
|
+
await db.executeSql(q, p ?? []);
|
|
40
|
+
},
|
|
41
|
+
closeAsync: async () => {
|
|
42
|
+
await db.close?.();
|
|
43
|
+
},
|
|
44
|
+
withTransaction: async (fn) => {
|
|
45
|
+
await db.transaction(async (tx) => {
|
|
46
|
+
const txExecutor = {
|
|
47
|
+
runAsync: async (sql, params) => {
|
|
48
|
+
await tx.executeSql(sql, params ?? []);
|
|
49
|
+
},
|
|
50
|
+
execAsync: async (statement) => {
|
|
51
|
+
await tx.executeSql(statement);
|
|
52
|
+
},
|
|
53
|
+
getAllAsync: async (sql, params) => {
|
|
54
|
+
const [, resultSet] = await tx.executeSql(sql, params ?? []);
|
|
55
|
+
const rows = [];
|
|
56
|
+
for (let i = 0; i < resultSet.rows.length; i++) {
|
|
57
|
+
rows.push(resultSet.rows.item(i));
|
|
58
|
+
}
|
|
59
|
+
return rows;
|
|
60
|
+
},
|
|
61
|
+
getFirstAsync: async (sql, params) => {
|
|
62
|
+
const [, resultSet] = await tx.executeSql(sql, params ?? []);
|
|
63
|
+
if (resultSet.rows.length === 0)
|
|
64
|
+
return null;
|
|
65
|
+
return resultSet.rows.item(0);
|
|
66
|
+
},
|
|
67
|
+
query: async (sql, params) => {
|
|
68
|
+
const { sql: q, params: p } = params
|
|
69
|
+
? namedToPositional(sql, params)
|
|
70
|
+
: { sql, params: [] };
|
|
71
|
+
const result = await db.executeSql(q, p ?? []);
|
|
72
|
+
return result.map((r, index) => r.rows.item(index));
|
|
73
|
+
},
|
|
74
|
+
queryOne: async (sql, params) => {
|
|
75
|
+
const { sql: q, params: p } = params
|
|
76
|
+
? namedToPositional(sql, params)
|
|
77
|
+
: { sql, params: [] };
|
|
78
|
+
const result = await db.executeSql(q, p ?? []);
|
|
79
|
+
return result[0].rows.item(0) ?? null;
|
|
80
|
+
},
|
|
81
|
+
execute: async (sql, params) => {
|
|
82
|
+
const { sql: q, params: p } = params
|
|
83
|
+
? namedToPositional(sql, params)
|
|
84
|
+
: { sql, params: [] };
|
|
85
|
+
await db.executeSql(q, p ?? []);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
return await fn(txExecutor);
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
};
|