@syncular/server-workers 0.30.15 → 0.31.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.
@@ -193,7 +193,7 @@ export class SyncularRealtimeHost {
193
193
  });
194
194
  }
195
195
  catch (error) {
196
- const sync = adapterSyncError(error, this.#getHub().onError, 'sync');
196
+ const sync = adapterSyncError(error, (error, context) => this.#getHub().onError?.(error, context), 'sync', (error, context) => this.#getHub().mapError?.(error, context));
197
197
  return Response.json(errorBody(sync), { status: sync.httpStatus });
198
198
  }
199
199
  }
@@ -236,7 +236,7 @@ export class SyncularRealtimeHost {
236
236
  }
237
237
  catch (error) {
238
238
  server.close(1011, 'realtime connect failed');
239
- const sync = adapterSyncError(error, this.#getHub().onError, 'realtime');
239
+ const sync = adapterSyncError(error, (error, context) => this.#getHub().onError?.(error, context), 'realtime', (error, context) => this.#getHub().mapError?.(error, context));
240
240
  return Response.json(errorBody(sync), { status: sync.httpStatus });
241
241
  }
242
242
  // `webSocket` is a workerd-only ResponseInit field (the 101 upgrade
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/server-workers",
3
- "version": "0.30.15",
3
+ "version": "0.31.0",
4
4
  "description": "Cloudflare Workers adapter for the Syncular sync server",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Benjamin Kniffler",
@@ -45,11 +45,11 @@
45
45
  "!dist/**/*.test.d.ts"
46
46
  ],
47
47
  "dependencies": {
48
- "@syncular/server": "0.30.15",
49
- "@syncular/server-hono": "0.30.15"
48
+ "@syncular/server": "0.31.0",
49
+ "@syncular/server-hono": "0.31.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@syncular/core": "0.30.15",
52
+ "@syncular/core": "0.31.0",
53
53
  "miniflare": "4.20260701.0"
54
54
  }
55
55
  }
@@ -297,7 +297,12 @@ export class SyncularRealtimeHost {
297
297
  headers: { 'content-type': SSP2_CONTENT_TYPE },
298
298
  });
299
299
  } catch (error) {
300
- const sync = adapterSyncError(error, this.#getHub().onError, 'sync');
300
+ const sync = adapterSyncError(
301
+ error,
302
+ (error, context) => this.#getHub().onError?.(error, context),
303
+ 'sync',
304
+ (error, context) => this.#getHub().mapError?.(error, context),
305
+ );
301
306
  return Response.json(errorBody(sync), { status: sync.httpStatus });
302
307
  }
303
308
  }
@@ -343,7 +348,12 @@ export class SyncularRealtimeHost {
343
348
  this.#sessions.set(server, session);
344
349
  } catch (error) {
345
350
  server.close(1011, 'realtime connect failed');
346
- const sync = adapterSyncError(error, this.#getHub().onError, 'realtime');
351
+ const sync = adapterSyncError(
352
+ error,
353
+ (error, context) => this.#getHub().onError?.(error, context),
354
+ 'realtime',
355
+ (error, context) => this.#getHub().mapError?.(error, context),
356
+ );
347
357
  return Response.json(errorBody(sync), { status: sync.httpStatus });
348
358
  }
349
359
  // `webSocket` is a workerd-only ResponseInit field (the 101 upgrade