@use-stall/core 0.0.14 → 0.1.0

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/dist/index.js CHANGED
@@ -227,8 +227,8 @@ var get_recent_sync_logs = async (props) => {
227
227
  };
228
228
  var is_sync_queue_empty = async () => {
229
229
  try {
230
- const pending_items = await local_db.sync_queue.where("status").equals("pending").toArray();
231
- return pending_items.length === 0;
230
+ const pending_items = await local_db.sync_queue.count();
231
+ return pending_items === 0;
232
232
  } catch (error) {
233
233
  console.error("Error checking sync queue status:", error);
234
234
  return false;
@@ -319,7 +319,9 @@ var is_syncing = false;
319
319
  var replace_temporary_ids = async (props) => {
320
320
  const { table, stall_offline_id, connector_id } = props;
321
321
  try {
322
- const existing = await local_db[table].where("stall_offline_id").equals(stall_offline_id).first();
322
+ const existing = await local_db[table].filter(
323
+ (record) => record.metadata?.stall_offline_id === stall_offline_id || record?.stall_offline_id === stall_offline_id
324
+ ).first();
323
325
  if (existing) {
324
326
  await local_db[table].update(existing.id, {
325
327
  id: connector_id
package/dist/index.mjs CHANGED
@@ -160,8 +160,8 @@ var get_recent_sync_logs = async (props) => {
160
160
  };
161
161
  var is_sync_queue_empty = async () => {
162
162
  try {
163
- const pending_items = await local_db.sync_queue.where("status").equals("pending").toArray();
164
- return pending_items.length === 0;
163
+ const pending_items = await local_db.sync_queue.count();
164
+ return pending_items === 0;
165
165
  } catch (error) {
166
166
  console.error("Error checking sync queue status:", error);
167
167
  return false;
@@ -252,7 +252,9 @@ var is_syncing = false;
252
252
  var replace_temporary_ids = async (props) => {
253
253
  const { table, stall_offline_id, connector_id } = props;
254
254
  try {
255
- const existing = await local_db[table].where("stall_offline_id").equals(stall_offline_id).first();
255
+ const existing = await local_db[table].filter(
256
+ (record) => record.metadata?.stall_offline_id === stall_offline_id || record?.stall_offline_id === stall_offline_id
257
+ ).first();
256
258
  if (existing) {
257
259
  await local_db[table].update(existing.id, {
258
260
  id: connector_id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-stall/core",
3
- "version": "0.0.14",
3
+ "version": "0.1.0",
4
4
  "author": "Stall",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",