prostgles-client 4.0.355 → 4.0.356

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.
@@ -54,14 +54,14 @@ const getDB = ({ tableSchema, onDebug, syncedTable, syncHandler, subscriptionHan
54
54
  const upsertSyncTable = async (basicFilter = {}, options = {}, onError) => {
55
55
  var _a;
56
56
  const syncName = `${tableName}.${JSON.stringify(basicFilter)}.${JSON.stringify((0, prostgles_types_1.omitKeys)(options, ["handlesOnData"]))}`;
57
- const syncedTableHandler = (_a = syncHandler.syncedTables[syncName]) !== null && _a !== void 0 ? _a : (await syncedTable.create({
57
+ const syncedTableHandler = (_a = syncHandler.syncedTables[syncName]) !== null && _a !== void 0 ? _a : syncedTable.create({
58
58
  ...options,
59
- onDebug: onDebug,
59
+ onDebug,
60
60
  name: tableName,
61
61
  filter: basicFilter,
62
62
  db: db,
63
63
  onError,
64
- }));
64
+ });
65
65
  syncHandler.syncedTables[syncName] = syncedTableHandler;
66
66
  return syncedTableHandler;
67
67
  };
@@ -3,7 +3,7 @@ import type { CoreParams, InitOptions } from "./prostgles";
3
3
  import type { SyncedTable } from "./SyncedTable/SyncedTable";
4
4
  export declare const getSyncHandler: ({ socket }: Pick<InitOptions, "socket">) => {
5
5
  destroySyncs: () => Promise<void>;
6
- syncedTables: Record<string, SyncedTable>;
6
+ syncedTables: Record<string, Promise<SyncedTable>>;
7
7
  addSync: (params: CoreParams, triggers: ClientSyncHandles) => Promise<any>;
8
8
  reAttachAll: () => Promise<void>;
9
9
  };
@@ -12,7 +12,7 @@ const getSyncHandler = ({ socket }) => {
12
12
  (0, prostgles_1.debug)("destroySyncs", { syncedTables });
13
13
  syncs = {};
14
14
  Object.values(syncedTables).forEach((s) => {
15
- s.destroy();
15
+ s.then((s) => s.destroy());
16
16
  });
17
17
  syncedTables = {};
18
18
  };