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,92 @@
|
|
|
1
|
+
import { getTableSchema } from "../getTableSchema";
|
|
2
|
+
import { logError, logWarn } from "../logs";
|
|
3
|
+
import { ReusedHelpers } from "../reusedHelpers";
|
|
4
|
+
export function parseJSONColumns(row) {
|
|
5
|
+
const parsedRow = { ...row };
|
|
6
|
+
const errors = [];
|
|
7
|
+
for (const key in parsedRow) {
|
|
8
|
+
const value = parsedRow[key];
|
|
9
|
+
if (typeof value === "string" &&
|
|
10
|
+
(value.startsWith("{") || value.startsWith("["))) {
|
|
11
|
+
try {
|
|
12
|
+
parsedRow[key] = JSON.parse(value);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
errors.push(`Failed to parse JSON in column ${key}: ${error}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (errors.length > 0) {
|
|
20
|
+
logWarn(`[Supastash] JSON parsing errors: ${errors.join(", ")}`);
|
|
21
|
+
}
|
|
22
|
+
return parsedRow;
|
|
23
|
+
}
|
|
24
|
+
export function sanitizeTableName(table) {
|
|
25
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(table)) {
|
|
26
|
+
throw new Error(`Invalid table name: ${table}`);
|
|
27
|
+
}
|
|
28
|
+
return table;
|
|
29
|
+
}
|
|
30
|
+
export function sanitizeOrderBy(orderBy) {
|
|
31
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(orderBy)) {
|
|
32
|
+
throw new Error(`Invalid order by column: ${orderBy}`);
|
|
33
|
+
}
|
|
34
|
+
return orderBy;
|
|
35
|
+
}
|
|
36
|
+
function buildFilterKey(table, filters) {
|
|
37
|
+
return `${table}:${JSON.stringify(filters ?? [])}`;
|
|
38
|
+
}
|
|
39
|
+
const filterCache = new Map();
|
|
40
|
+
export async function buildFilters(filters, table, noChecks = false) {
|
|
41
|
+
if (!filters || filters.length === 0)
|
|
42
|
+
return "";
|
|
43
|
+
const filterKey = buildFilterKey(table, filters);
|
|
44
|
+
let sqlFilter = filterCache.get(filterKey);
|
|
45
|
+
try {
|
|
46
|
+
let schemaColumns = [];
|
|
47
|
+
if (!noChecks) {
|
|
48
|
+
const schema = await getTableSchema(table);
|
|
49
|
+
schemaColumns = schema.map((col) => col.trim().toLowerCase());
|
|
50
|
+
}
|
|
51
|
+
const filterStringArray = [];
|
|
52
|
+
for (const filter of filters) {
|
|
53
|
+
if ("or" in filter) {
|
|
54
|
+
try {
|
|
55
|
+
const filterSql = ReusedHelpers.buildFilterForSql(filter);
|
|
56
|
+
if (filterSql) {
|
|
57
|
+
filterStringArray.push(filterSql);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
logError(`[Supastash] Failed to build OR filter for table ${table}:`, error);
|
|
62
|
+
}
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (!filter?.column) {
|
|
66
|
+
logWarn(`[Supastash] Skipping filter with missing column`);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const columnLower = String(filter.column).trim().toLowerCase();
|
|
70
|
+
if (!noChecks && !schemaColumns.includes(columnLower)) {
|
|
71
|
+
logWarn(`[Supastash] Filter column ${String(filter.column)} does not exist in table ${table}`);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
const filterSql = ReusedHelpers.buildFilterForSql(filter);
|
|
76
|
+
if (filterSql) {
|
|
77
|
+
filterStringArray.push(filterSql);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
logError(`[Supastash] Failed to build filter for column ${String(filter.column)}:`, error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return filterStringArray.length > 0
|
|
85
|
+
? ` AND ${filterStringArray.join(" AND ")}`
|
|
86
|
+
: "";
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
logError(`[Supastash] Failed to build filters for table ${table}:`, error);
|
|
90
|
+
return "";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realTimeCall.d.ts","sourceRoot":"","sources":["../../../../src/shared/utils/fetchData/realTimeCall.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAQjE,QAAA,MAAM,eAAe,GACnB,OAAO,MAAM,EACb,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,EAC5D,SAAS,eAAe,EACxB,aAAa,OAAO,EACpB,UAAU,OAAO,SAuElB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -2,12 +2,12 @@ import { useEffect, useMemo, useState } from "react";
|
|
|
2
2
|
import { getSupastashConfig } from "../../core/config";
|
|
3
3
|
import { supastashEventBus } from "../events/eventBus";
|
|
4
4
|
import { logError } from "../logs";
|
|
5
|
+
import { ReusedHelpers } from "../reusedHelpers";
|
|
5
6
|
import { supabaseClientErr } from "../supabaseClientErr";
|
|
6
|
-
import { buildFilterString } from "./buildFilter";
|
|
7
7
|
const hasRegistered = new Map();
|
|
8
8
|
const useRealtimeData = (table, queueHandler, options, initialized, realtime) => {
|
|
9
9
|
const { lazy, shouldFetch } = options;
|
|
10
|
-
const filterString = useMemo(() => buildFilterString(options.filter), [options.filter]);
|
|
10
|
+
const filterString = useMemo(() => ReusedHelpers.buildFilterString(options.filter), [options.filter]);
|
|
11
11
|
const subKey = useMemo(() => `${table}:${filterString ?? ""}`, [table, filterString]);
|
|
12
12
|
const [version, setVersion] = useState(0);
|
|
13
13
|
useEffect(() => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realTimeManager.d.ts","sourceRoot":"","sources":["../../../../src/shared/utils/fetchData/realTimeManager.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,MAAM,EAGP,MAAM,gCAAgC,CAAC;AAIxC,cAAM,wBAAwB;IAE5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAyC;IAEhE,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,aAAa,CAAsD;IAC3E,OAAO,CAAC,WAAW,CAAkB;IAErC,OAAO,CAAC,gBAAgB,CAIK;IAC7B,OAAO,CAAC,iBAAiB,CAAa;IACtC,OAAO,CAAC,oBAAoB,CAAa;IACzC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,sBAAsB,CAA8C;IAC5E,OAAO,CAAC,uBAAuB,CAA8C;IAC7E,OAAO,CAAC,eAAe,CAA4C;IAEnE,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,wBAAwB;IAO9C,OAAO,CAAC,kBAAkB;YAQZ,gBAAgB;YAmBhB,mBAAmB;IAoCjC,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,iBAAiB;YAiBX,SAAS;YAYT,cAAc;YAcd,iBAAiB;IAgC/B,OAAO,CAAC,OAAO;IAcf,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,kBAAkB;IAuB1B,OAAO,CAAC,mBAAmB;IAepB,SAAS,CACd,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,YAAY,EACrB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI;IA4BA,WAAW,CAChB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI;IAkBA,mBAAmB,IAAI,MAAM;IAI7B,cAAc,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAO9D,sBAAsB,IAAI,MAAM;IAIhC,cAAc,IAAI,IAAI;CAI9B;AAED,eAAO,MAAM,eAAe,0BAAyC,CAAC;AAEtE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,EACpD,MAAM,GAAE,MAA8C,GACrD,IAAI,CAEN;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,EACpD,MAAM,EAAE,MAAM,GACb,IAAI,CAEN"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SupastashFilter } from "../../types/realtimeData.types";
|
|
2
|
+
export declare function registerSub(table: string, filter?: SupastashFilter): boolean;
|
|
3
|
+
export declare function unregisterSub(table: string, filter?: SupastashFilter): void;
|
|
4
|
+
//# sourceMappingURL=registerSub.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerSub.d.ts","sourceRoot":"","sources":["../../../../src/shared/utils/fetchData/registerSub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAKjE,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAQ5E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,IAAI,CAQ3E"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReusedHelpers } from "../reusedHelpers";
|
|
2
2
|
const subRegistry = {};
|
|
3
3
|
export function registerSub(table, filter) {
|
|
4
|
-
const key = `${table}::${buildFilterString(filter) ?? ""}`;
|
|
4
|
+
const key = `${table}::${ReusedHelpers.buildFilterString(filter) ?? ""}`;
|
|
5
5
|
if (subRegistry[key]) {
|
|
6
6
|
subRegistry[key]++;
|
|
7
7
|
return true;
|
|
@@ -10,7 +10,7 @@ export function registerSub(table, filter) {
|
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
12
|
export function unregisterSub(table, filter) {
|
|
13
|
-
const key = `${table}::${buildFilterString(filter) ?? ""}`;
|
|
13
|
+
const key = `${table}::${ReusedHelpers.buildFilterString(filter) ?? ""}`;
|
|
14
14
|
if (subRegistry[key]) {
|
|
15
15
|
subRegistry[key]--;
|
|
16
16
|
if (subRegistry[key] <= 0) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setDataInBatches.d.ts","sourceRoot":"","sources":["../../../../src/shared/utils/fetchData/setDataInBatches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EAC7B,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,QAqBvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapShot.d.ts","sourceRoot":"","sources":["../../../../src/shared/utils/fetchData/snapShot.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAOnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,QAE9C;AAID,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,OAoBxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validatePayload.d.ts","sourceRoot":"","sources":["../../../../src/shared/utils/fetchData/validatePayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D;;;GAGG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,WAAW,iBAgBzD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,QAgB7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genUUID.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/genUUID.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,WAM7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSafeValues.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/getSafeValues.ts"],"names":[],"mappings":"AA6FA,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CA2C7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTableSchema.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/getTableSchema.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkBrE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,QAM9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/logs.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,eAEvB,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,GAAG,GAAI,GAAG,MAAM,GAAG,EAAE,SAI1B,CAAC;AAEF,eAAe,GAAG,CAAC;AAEnB;;;GAGG;AACH,QAAA,MAAM,QAAQ,GAAI,GAAG,MAAM,GAAG,EAAE,SAG/B,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,OAAO,GAAI,GAAG,MAAM,GAAG,EAAE,SAG9B,CAAC;AAEF,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { getSupastashConfig } from "../core/config";
|
|
2
|
-
const DEBUG_MODE = __DEV__
|
|
2
|
+
const DEBUG_MODE = typeof __DEV__ !== "undefined"
|
|
3
|
+
? __DEV__ // React Native
|
|
4
|
+
: process.env.NODE_ENV === "development";
|
|
5
|
+
export const isDebugMode = () => {
|
|
6
|
+
return DEBUG_MODE;
|
|
7
|
+
};
|
|
3
8
|
/**
|
|
4
9
|
* Logs a message to the console if debug mode is enabled
|
|
5
10
|
* @param args - The arguments to log
|
|
@@ -18,27 +18,27 @@ export default class SupastashCrudBuilder<T extends CrudMethods, U extends boole
|
|
|
18
18
|
* @param data - The data to insert. Could be a single object or an array of objects.
|
|
19
19
|
* @returns filter options.
|
|
20
20
|
*/
|
|
21
|
-
insert<Z = any>(data: R): SupastashFilterBuilder<"insert", false, R, Z>;
|
|
21
|
+
insert<Z = any>(data: R): Omit<SupastashFilterBuilder<"insert", false, R, Z>, "cacheFirst">;
|
|
22
22
|
/**
|
|
23
23
|
* Sets the method to update.
|
|
24
24
|
*
|
|
25
25
|
* @param data - The data to update.
|
|
26
26
|
* @returns filter options.
|
|
27
27
|
*/
|
|
28
|
-
update<Z = any>(data: R): SupastashFilterBuilder<"update", false, R, Z>;
|
|
28
|
+
update<Z = any>(data: R): Omit<SupastashFilterBuilder<"update", false, R, Z>, "cacheFirst" | "run" | "go" | "execute">;
|
|
29
29
|
/**
|
|
30
30
|
* Sets the method to delete.
|
|
31
31
|
*
|
|
32
32
|
* @returns filter options.
|
|
33
33
|
*/
|
|
34
|
-
delete<Z = any>(): SupastashFilterBuilder<"delete", false, R, Z>;
|
|
34
|
+
delete<Z = any>(): Omit<SupastashFilterBuilder<"delete", false, R, Z>, "cacheFirst">;
|
|
35
35
|
/**
|
|
36
36
|
* Sets the method to select.
|
|
37
37
|
*
|
|
38
38
|
* @param column - The column to select.
|
|
39
39
|
* @returns filter options.
|
|
40
40
|
*/
|
|
41
|
-
select<Z = any>(column?: string): SupastashFilterBuilder<"select", false, R, Z>;
|
|
41
|
+
select<Z = any>(column?: string): Omit<SupastashFilterBuilder<"select", false, R, Z>, "withTx">;
|
|
42
42
|
/**
|
|
43
43
|
* Sets the method to upsert.
|
|
44
44
|
*
|
|
@@ -59,6 +59,6 @@ export default class SupastashCrudBuilder<T extends CrudMethods, U extends boole
|
|
|
59
59
|
*/
|
|
60
60
|
upsert<Z = any>(data: R | R[], options?: {
|
|
61
61
|
onConflictKeys?: string[];
|
|
62
|
-
}): SupastashFilterBuilder<"upsert", false, R, Z>;
|
|
62
|
+
}): Omit<SupastashFilterBuilder<"upsert", false, R, Z>, "cacheFirst">;
|
|
63
63
|
}
|
|
64
64
|
//# sourceMappingURL=crud.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../../../../src/shared/utils/query/builder/crud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,sBAAsB,MAAM,WAAW,CAAC;AAE/C;;;;GAIG;AAEH,MAAM,CAAC,OAAO,OAAO,oBAAoB,CACvC,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,OAAO,EACjB,CAAC;IAMW,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJlC;;;OAGG;gBAC0B,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAE3D;;;;;OAKG;IACH,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC,GAQhB,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC;IAGxE;;;;;OAKG;IACH,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC,GAQhB,IAAI,CACP,sBAAsB,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,EAC7C,YAAY,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CACxC;IAGH;;;;OAIG;IACH,MAAM,CAAC,CAAC,GAAG,GAAG,KAOP,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC;IAGxE;;;;;OAKG;IACH,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,GAQxB,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC;IAGpE;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAS/D,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC;CAEzE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CrudMethods, ExecuteOptions, SupastashQuery, SupastashQueryResult, SyncMode } from "../../../types/query.types";
|
|
2
|
+
type FilterBuilderFor<T extends CrudMethods, U extends boolean, R, Z> = T extends "select" ? SupastashFilterBuilder<T, U, R, Z> : Omit<SupastashFilterBuilder<T, U, R, Z>, "cacheFirst">;
|
|
2
3
|
/**
|
|
3
4
|
* Builder for the filter methods
|
|
4
5
|
* @param T - The method to call
|
|
@@ -30,7 +31,7 @@ export default class SupastashFilterBuilder<T extends CrudMethods, U extends boo
|
|
|
30
31
|
* @param value - The value to filter by.
|
|
31
32
|
* @returns more filter options.
|
|
32
33
|
*/
|
|
33
|
-
eq(column: string, value: any):
|
|
34
|
+
eq(column: string, value: any): FilterBuilderFor<T, U, R, Z>;
|
|
34
35
|
/**
|
|
35
36
|
* Sets the NEQ operator for the query.
|
|
36
37
|
*
|
|
@@ -38,7 +39,7 @@ export default class SupastashFilterBuilder<T extends CrudMethods, U extends boo
|
|
|
38
39
|
* @param value - The value to filter by.
|
|
39
40
|
* @returns more filter options.
|
|
40
41
|
*/
|
|
41
|
-
neq(column: string, value: any):
|
|
42
|
+
neq(column: string, value: any): FilterBuilderFor<T, U, R, Z>;
|
|
42
43
|
/**
|
|
43
44
|
* Sets the GT operator for the query.
|
|
44
45
|
*
|
|
@@ -46,7 +47,7 @@ export default class SupastashFilterBuilder<T extends CrudMethods, U extends boo
|
|
|
46
47
|
* @param value - The value to filter by.
|
|
47
48
|
* @returns more filter options.
|
|
48
49
|
*/
|
|
49
|
-
gt(column: string, value: any):
|
|
50
|
+
gt(column: string, value: any): FilterBuilderFor<T, U, R, Z>;
|
|
50
51
|
/**
|
|
51
52
|
* Sets the LT operator for the query.
|
|
52
53
|
*
|
|
@@ -54,7 +55,7 @@ export default class SupastashFilterBuilder<T extends CrudMethods, U extends boo
|
|
|
54
55
|
* @param value - The value to filter by.
|
|
55
56
|
* @returns more filter options.
|
|
56
57
|
*/
|
|
57
|
-
lt(column: string, value: any):
|
|
58
|
+
lt(column: string, value: any): FilterBuilderFor<T, U, R, Z>;
|
|
58
59
|
/**
|
|
59
60
|
* Sets the GTE operator for the query.
|
|
60
61
|
*
|
|
@@ -62,7 +63,7 @@ export default class SupastashFilterBuilder<T extends CrudMethods, U extends boo
|
|
|
62
63
|
* @param value - The value to filter by.
|
|
63
64
|
* @returns more filter options.
|
|
64
65
|
*/
|
|
65
|
-
gte(column: string, value: any):
|
|
66
|
+
gte(column: string, value: any): FilterBuilderFor<T, U, R, Z>;
|
|
66
67
|
/**
|
|
67
68
|
* Sets the LTE operator for the query.
|
|
68
69
|
*
|
|
@@ -70,7 +71,7 @@ export default class SupastashFilterBuilder<T extends CrudMethods, U extends boo
|
|
|
70
71
|
* @param value - The value to filter by.
|
|
71
72
|
* @returns more filter options.
|
|
72
73
|
*/
|
|
73
|
-
lte(column: string, value: any):
|
|
74
|
+
lte(column: string, value: any): FilterBuilderFor<T, U, R, Z>;
|
|
74
75
|
/**
|
|
75
76
|
* Sets the LIKE operator for the query.
|
|
76
77
|
*
|
|
@@ -78,7 +79,7 @@ export default class SupastashFilterBuilder<T extends CrudMethods, U extends boo
|
|
|
78
79
|
* @param value - The value to filter by.
|
|
79
80
|
* @returns more filter options.
|
|
80
81
|
*/
|
|
81
|
-
like(column: string, value: any):
|
|
82
|
+
like(column: string, value: any): FilterBuilderFor<T, U, R, Z>;
|
|
82
83
|
/**
|
|
83
84
|
* Sets the IS operator for the query.
|
|
84
85
|
*
|
|
@@ -86,7 +87,7 @@ export default class SupastashFilterBuilder<T extends CrudMethods, U extends boo
|
|
|
86
87
|
* @param value - The value to filter by.
|
|
87
88
|
* @returns more filter options.
|
|
88
89
|
*/
|
|
89
|
-
is(column: string, value: any):
|
|
90
|
+
is(column: string, value: any): FilterBuilderFor<T, U, R, Z>;
|
|
90
91
|
/**
|
|
91
92
|
* Sets the IN operator for the query.
|
|
92
93
|
*
|
|
@@ -94,14 +95,14 @@ export default class SupastashFilterBuilder<T extends CrudMethods, U extends boo
|
|
|
94
95
|
* @param value - The value to filter by.
|
|
95
96
|
* @returns more filter options.
|
|
96
97
|
*/
|
|
97
|
-
in(column: string, value: any[]):
|
|
98
|
+
in(column: string, value: any[]): FilterBuilderFor<T, U, R, Z>;
|
|
98
99
|
/**
|
|
99
100
|
* Sets the limit of the query.
|
|
100
101
|
*
|
|
101
102
|
* @param n - The number of results to return.
|
|
102
103
|
* @returns more filter options.
|
|
103
104
|
*/
|
|
104
|
-
limit(n: number):
|
|
105
|
+
limit(n: number): FilterBuilderFor<T, U, R, Z>;
|
|
105
106
|
/**
|
|
106
107
|
* Returns only one result instead of an array.
|
|
107
108
|
* Sets `limit(1)` automatically. Fails if more than one result is returned.
|
|
@@ -109,20 +110,42 @@ export default class SupastashFilterBuilder<T extends CrudMethods, U extends boo
|
|
|
109
110
|
* Similar to Supabase `.single()`.
|
|
110
111
|
*/
|
|
111
112
|
single(): SupastashFilterBuilder<T, true, R, Z>;
|
|
113
|
+
/**
|
|
114
|
+
* Creates its own SQLite transaction for this insert or upsert.
|
|
115
|
+
*
|
|
116
|
+
* Do not use inside `db.withTransaction(...)` or
|
|
117
|
+
* `supastash.withTransaction(...)` — nested transactions are not allowed.
|
|
118
|
+
*/
|
|
119
|
+
withTx(): FilterBuilderFor<T, U, R, Z>;
|
|
112
120
|
/**
|
|
113
121
|
* Sets the preserve timestamp of the query.
|
|
114
122
|
*
|
|
115
123
|
* @param preserve - Whether to preserve the timestamp.
|
|
116
124
|
* @returns more filter options.
|
|
117
125
|
*/
|
|
118
|
-
preserveTimestamp(preserve: boolean):
|
|
126
|
+
preserveTimestamp(preserve: boolean): FilterBuilderFor<T, U, R, Z>;
|
|
119
127
|
/**
|
|
120
128
|
* Sets the sync mode of the query.
|
|
121
129
|
*
|
|
122
130
|
* @param mode - The sync mode to use.
|
|
123
131
|
* @returns more filter options.
|
|
124
132
|
*/
|
|
125
|
-
syncMode(mode: SyncMode):
|
|
133
|
+
syncMode(mode: SyncMode): FilterBuilderFor<T, U, R, Z>;
|
|
134
|
+
/**
|
|
135
|
+
* Throws an error if the query fails.
|
|
136
|
+
*
|
|
137
|
+
* @returns more filter options.
|
|
138
|
+
*/
|
|
139
|
+
throwOnError(): FilterBuilderFor<T, U, R, Z>;
|
|
140
|
+
/**
|
|
141
|
+
* Executes a cache-first fetch strategy.
|
|
142
|
+
*
|
|
143
|
+
* Attempts to resolve the query from the local database.
|
|
144
|
+
* Falls back to the remote database if no usable result is found.
|
|
145
|
+
*
|
|
146
|
+
* @returns Query results from local and/or remote sources.
|
|
147
|
+
*/
|
|
148
|
+
cacheFirst(): FilterBuilderFor<T, U, R, Z>;
|
|
126
149
|
/**
|
|
127
150
|
* Executes the query.
|
|
128
151
|
* Must be called after all filters are set.
|
|
@@ -149,4 +172,5 @@ export default class SupastashFilterBuilder<T extends CrudMethods, U extends boo
|
|
|
149
172
|
viewRemoteResult?: V;
|
|
150
173
|
}): Promise<SupastashQueryResult<T, U, V, Z>>;
|
|
151
174
|
}
|
|
175
|
+
export {};
|
|
152
176
|
//# sourceMappingURL=filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../../../src/shared/utils/query/builder/filters.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,cAAc,EAEd,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACT,MAAM,4BAA4B,CAAC;AAKpC,KAAK,gBAAgB,CACnB,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,OAAO,EACjB,CAAC,EACD,CAAC,IACC,CAAC,SAAS,QAAQ,GAClB,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAClC,IAAI,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAsB,CACzC,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,OAAO,EACjB,CAAC,EACD,CAAC;IAqCW,OAAO,CAAC,QAAQ,CAAC,KAAK;IAnClC;;;;OAIG;IACH,OAAO,CAAC,KAAK;IAYb;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAStB;;;OAGG;gBAC0B,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAE3D;;;;;;OAMG;IACH,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAI7B;;;;;;OAMG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAI9B;;;;;;OAMG;IACH,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAI7B;;;;;;OAMG;IACH,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAI7B;;;;;;OAMG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAI9B;;;;;;OAMG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAI9B;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAI/B;;;;;;OAMG;IACH,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAI7B;;;;;;OAMG;IACH,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE;IAI/B;;;;;OAKG;IACH,KAAK,CAAC,CAAC,EAAE,MAAM;IAIf;;;;;OAKG;IACH,MAAM;IAQN;;;;;OAKG;IACH,MAAM;IAUN;;;;;OAKG;IACH,iBAAiB,CAAC,QAAQ,EAAE,OAAO;IAInC;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ;IAIvB;;;;OAIG;IACH,YAAY;IAIZ;;;;;;;OAOG;IACH,UAAU;IAIV;;;;;OAKG;IACH,OAAO,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,EAC/B,OAAO,CAAC,EAAE,cAAc,GAAG;QAAE,gBAAgB,CAAC,EAAE,CAAC,CAAA;KAAE,GAClD,OAAO,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IA4D5C;;;;OAIG;IACH,GAAG,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,EAC3B,OAAO,CAAC,EAAE,cAAc,GAAG;QAAE,gBAAgB,CAAC,EAAE,CAAC,CAAA;KAAE;IAKrD;;;;OAIG;IACH,EAAE,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,EAC1B,OAAO,CAAC,EAAE,cAAc,GAAG;QAAE,gBAAgB,CAAC,EAAE,CAAC,CAAA;KAAE;CAItD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import log from "
|
|
1
|
+
import log from "../../logs";
|
|
2
2
|
import { querySupabase } from "../remoteQuery/supabaseQuery";
|
|
3
3
|
import { queryDb } from "./mainQuery";
|
|
4
4
|
/**
|
|
@@ -151,6 +151,19 @@ export default class SupastashFilterBuilder {
|
|
|
151
151
|
limit: 1,
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Creates its own SQLite transaction for this insert or upsert.
|
|
156
|
+
*
|
|
157
|
+
* Do not use inside `db.withTransaction(...)` or
|
|
158
|
+
* `supastash.withTransaction(...)` — nested transactions are not allowed.
|
|
159
|
+
*/
|
|
160
|
+
withTx() {
|
|
161
|
+
const isInATx = this.query.txId !== null;
|
|
162
|
+
if (isInATx) {
|
|
163
|
+
throw new Error(`[Supastash] Cannot use \`withTx()\` inside a transaction. Method: ${this.query.method} on table: ${this.query.table}`);
|
|
164
|
+
}
|
|
165
|
+
return this.withQueryPatch({ withTx: true });
|
|
166
|
+
}
|
|
154
167
|
/**
|
|
155
168
|
* Sets the preserve timestamp of the query.
|
|
156
169
|
*
|
|
@@ -169,6 +182,25 @@ export default class SupastashFilterBuilder {
|
|
|
169
182
|
syncMode(mode) {
|
|
170
183
|
return this.withQueryPatch({ type: mode });
|
|
171
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Throws an error if the query fails.
|
|
187
|
+
*
|
|
188
|
+
* @returns more filter options.
|
|
189
|
+
*/
|
|
190
|
+
throwOnError() {
|
|
191
|
+
return this.withQueryPatch({ throwOnError: true });
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Executes a cache-first fetch strategy.
|
|
195
|
+
*
|
|
196
|
+
* Attempts to resolve the query from the local database.
|
|
197
|
+
* Falls back to the remote database if no usable result is found.
|
|
198
|
+
*
|
|
199
|
+
* @returns Query results from local and/or remote sources.
|
|
200
|
+
*/
|
|
201
|
+
cacheFirst() {
|
|
202
|
+
return this.withQueryPatch({ fetchPolicy: "localFirst" });
|
|
203
|
+
}
|
|
172
204
|
/**
|
|
173
205
|
* Executes the query.
|
|
174
206
|
* Must be called after all filters are set.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CrudMethods, SupastashQuery } from "../../../types/query.types";
|
|
1
|
+
import { CrudMethods, PayloadData, SupastashQuery } from "../../../types/query.types";
|
|
2
2
|
import SupastashCrudBuilder from "./crud";
|
|
3
3
|
/**
|
|
4
4
|
* Builder for the supastash query
|
|
@@ -19,7 +19,34 @@ export declare class SupastashQueryBuilder<T extends CrudMethods, U extends bool
|
|
|
19
19
|
* @returns crud options.
|
|
20
20
|
*/
|
|
21
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>;
|
|
22
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>;
|
|
23
50
|
/**
|
|
24
51
|
* Supastash query builder for local-first CRUD operations.
|
|
25
52
|
*
|
|
@@ -42,4 +69,5 @@ export declare class SupastashQueryBuilder<T extends CrudMethods, U extends bool
|
|
|
42
69
|
* .run(); // Required to execute the query
|
|
43
70
|
*/
|
|
44
71
|
export declare const supastash: SupastashQueryBuilder<CrudMethods, boolean, any>;
|
|
72
|
+
export {};
|
|
45
73
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/utils/query/builder/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EAEX,WAAW,EACX,cAAc,EAEf,MAAM,4BAA4B,CAAC;AAGpC,OAAO,oBAAoB,MAAM,QAAQ,CAAC;AAE1C;;;;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,138 @@
|
|
|
1
|
+
import { getSupastashDb } from "../../../db/dbInitializer";
|
|
2
|
+
import { txStore } from "../../../store/tx";
|
|
3
|
+
import { generateUUIDv4 } from "../../genUUID";
|
|
4
|
+
import { queueRemoteCall } from "../helpers/queueRemote";
|
|
5
|
+
import SupastashCrudBuilder from "./crud";
|
|
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
|
+
const newQuery = { ...this.query, table, id };
|
|
28
|
+
return new SupastashCrudBuilder(newQuery);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Executes multiple Supastash operations inside a single SQLite transaction.
|
|
32
|
+
*
|
|
33
|
+
* ⚠️ Do NOT call this inside `db.withTransaction(...)`
|
|
34
|
+
* or another `supastash.withTransaction(...)`.
|
|
35
|
+
* Nested transactions are not supported and will throw.
|
|
36
|
+
*
|
|
37
|
+
* All queries executed using the provided `tx` builder
|
|
38
|
+
* will share the same SQLite transaction and `txId`.
|
|
39
|
+
*
|
|
40
|
+
* If any operation inside the callback throws,
|
|
41
|
+
* the entire transaction is rolled back automatically.
|
|
42
|
+
*
|
|
43
|
+
* Example:
|
|
44
|
+
*
|
|
45
|
+
* await supastash.withTransaction(async (tx) => {
|
|
46
|
+
* await tx.from("orders").insert(order).run();
|
|
47
|
+
* await tx.from("ledger").insert(ledgerEntry).run();
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
*
|
|
51
|
+
* In this example, both inserts succeed or both fail.
|
|
52
|
+
*/
|
|
53
|
+
withTransaction(fn) {
|
|
54
|
+
const query = async () => {
|
|
55
|
+
// Create a new transaction id
|
|
56
|
+
const newTxId = generateUUIDv4();
|
|
57
|
+
try {
|
|
58
|
+
const db = await getSupastashDb();
|
|
59
|
+
// Add the transaction to the store
|
|
60
|
+
txStore[newTxId] = [];
|
|
61
|
+
// Execute the local calls
|
|
62
|
+
await db.withTransaction(async (tx) => {
|
|
63
|
+
const txQuery = {
|
|
64
|
+
...this.query,
|
|
65
|
+
txId: newTxId,
|
|
66
|
+
tx,
|
|
67
|
+
throwOnError: true, // Throw the error to roll back the transaction
|
|
68
|
+
};
|
|
69
|
+
const txBuilder = new SupastashQueryBuilder(txQuery);
|
|
70
|
+
return fn(txBuilder);
|
|
71
|
+
});
|
|
72
|
+
// Execute the remote calls
|
|
73
|
+
const remoteCalls = txStore[newTxId] ?? [];
|
|
74
|
+
if (remoteCalls.length > 0) {
|
|
75
|
+
const newStates = remoteCalls.map((call) => {
|
|
76
|
+
return {
|
|
77
|
+
...call,
|
|
78
|
+
txId: null,
|
|
79
|
+
tx: null,
|
|
80
|
+
withTx: false,
|
|
81
|
+
type: "remoteOnly",
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
for (const state of newStates) {
|
|
85
|
+
queueRemoteCall(state);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
// Delete the transaction from the store
|
|
91
|
+
delete txStore[newTxId];
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return query();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Supastash query builder for local-first CRUD operations.
|
|
99
|
+
*
|
|
100
|
+
* This builder allows you to construct and execute queries against a local SQLite store
|
|
101
|
+
* with optional synchronization to Supabase.
|
|
102
|
+
*
|
|
103
|
+
* Notes:
|
|
104
|
+
* - SELECT operations return local data by default unless `sync mode` is set to "remoteOnly".
|
|
105
|
+
* - `.run()` (alias of `.execute()`) is **required** to finalize and perform the query.
|
|
106
|
+
* - Use `.run({ viewRemoteResult: true })` to view the remote result from Supabase.
|
|
107
|
+
* - All operations except DELETE return local data automatically — no need to chain `.select()`.
|
|
108
|
+
*
|
|
109
|
+
* @returns A chainable Supastash query instance.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* const result = await supastash
|
|
113
|
+
* .from("users")
|
|
114
|
+
* .update<T>({ name: "John Doe" })
|
|
115
|
+
* .eq("id", "1")
|
|
116
|
+
* .run(); // Required to execute the query
|
|
117
|
+
*/
|
|
118
|
+
export const supastash = new SupastashQueryBuilder({
|
|
119
|
+
id: generateUUIDv4(),
|
|
120
|
+
table: "",
|
|
121
|
+
method: "none",
|
|
122
|
+
payload: null,
|
|
123
|
+
filters: [],
|
|
124
|
+
limit: null,
|
|
125
|
+
select: null,
|
|
126
|
+
isSingle: false,
|
|
127
|
+
type: "localFirst",
|
|
128
|
+
runSelected: false,
|
|
129
|
+
viewRemoteResult: false,
|
|
130
|
+
onConflictKeys: ["id"],
|
|
131
|
+
preserveTimestamp: false,
|
|
132
|
+
throwOnError: false,
|
|
133
|
+
fetchPolicy: null,
|
|
134
|
+
// With tx
|
|
135
|
+
txId: null,
|
|
136
|
+
tx: null,
|
|
137
|
+
withTx: false,
|
|
138
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mainQuery.d.ts","sourceRoot":"","sources":["../../../../../src/shared/utils/query/builder/mainQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EAGX,cAAc,EACd,oBAAoB,EAErB,MAAM,4BAA4B,CAAC;AAWpC;;;;GAIG;AACH,wBAAsB,OAAO,CAC3B,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,EACjB,CAAC,EACD,CAAC,EAED,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,gBAAgB,EAAE,CAAC,CAAA;CAAE,GACvD,OAAO,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAiG3C"}
|