@syncular/server-workers 0.34.0 → 0.35.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/realtime-do.d.ts +6 -1
- package/dist/realtime-do.js +14 -1
- package/package.json +4 -4
- package/src/realtime-do.ts +22 -0
package/dist/realtime-do.d.ts
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
* partition serialization may call `/__wake` after its own commit so sockets
|
|
72
72
|
* re-pull. See `durableObjectRealtimeNotifier` for that caller side.
|
|
73
73
|
*/
|
|
74
|
-
import { D1ServerStorage, type PruneOptions, type RealtimeHubConfig, type RemoteOperationRegistry, type RemoteOperationResolver } from '@syncular/server';
|
|
74
|
+
import { D1ServerStorage, type EraseScopeValueOptions, type EraseScopeValueResult, type PruneOptions, type RealtimeHubConfig, type RemoteOperationRegistry, type RemoteOperationResolver } from '@syncular/server';
|
|
75
75
|
export interface DurableObjectStateLike {
|
|
76
76
|
acceptWebSocket(ws: WebSocketLike, tags?: string[]): void;
|
|
77
77
|
getWebSockets(tag?: string): WebSocketLike[];
|
|
@@ -181,6 +181,11 @@ export declare class SyncularRealtimeHost {
|
|
|
181
181
|
fetch(request: Request): Promise<Response>;
|
|
182
182
|
/** Trusted maintenance shares the partition FIFO with HTTP/socket writes. */
|
|
183
183
|
pruneCommitLog(options: Omit<PruneOptions, 'storage'>): Promise<number>;
|
|
184
|
+
/**
|
|
185
|
+
* §4.6.1 scope-value erasure on the partition FIFO: one budgeted step per
|
|
186
|
+
* call, its delete commit fanned out to connected sockets.
|
|
187
|
+
*/
|
|
188
|
+
eraseScopeValue(options: EraseScopeValueOptions): Promise<EraseScopeValueResult>;
|
|
184
189
|
/** Hibernation callback: an inbound frame. */
|
|
185
190
|
webSocketMessage(ws: WebSocketLike, message: ArrayBuffer | string): Promise<void>;
|
|
186
191
|
/** Hibernation callback: the socket closed. */
|
package/dist/realtime-do.js
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
* partition serialization may call `/__wake` after its own commit so sockets
|
|
72
72
|
* re-pull. See `durableObjectRealtimeNotifier` for that caller side.
|
|
73
73
|
*/
|
|
74
|
-
import { adapterSyncError, composeEvents, createRealtimeHub, D1ServerStorage, errorBody, handleRemoteOperation, handleSyncRequest, pruneCommitLog, RingBufferEvents, SSP2_CONTENT_TYPE, SyncError, SyncularAdmin, } from '@syncular/server';
|
|
74
|
+
import { adapterSyncError, composeEvents, createRealtimeHub, D1ServerStorage, errorBody, eraseScopeValue, handleRemoteOperation, handleSyncRequest, pruneCommitLog, RingBufferEvents, SSP2_CONTENT_TYPE, SyncError, SyncularAdmin, } from '@syncular/server';
|
|
75
75
|
import { createSyncularAdminRoutes } from '@syncular/server-hono';
|
|
76
76
|
function isAttachment(value) {
|
|
77
77
|
return (typeof value === 'object' &&
|
|
@@ -199,6 +199,19 @@ export class SyncularRealtimeHost {
|
|
|
199
199
|
return pruneCommitLog({ ...options, storage: this.#storage });
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* §4.6.1 scope-value erasure on the partition FIFO: one budgeted step per
|
|
204
|
+
* call, its delete commit fanned out to connected sockets.
|
|
205
|
+
*/
|
|
206
|
+
eraseScopeValue(options) {
|
|
207
|
+
return this.#serializePartition(async () => {
|
|
208
|
+
await this.#storage.migrate();
|
|
209
|
+
return eraseScopeValue(this.#getHub().requestContextFor({
|
|
210
|
+
partition: options.partition,
|
|
211
|
+
actorId: options.actorId ?? 'syncular.erase',
|
|
212
|
+
}), options);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
202
215
|
#serializePartition(operation) {
|
|
203
216
|
const run = async () => {
|
|
204
217
|
await this.#rehydrateSockets();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/server-workers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.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.
|
|
49
|
-
"@syncular/server-hono": "0.
|
|
48
|
+
"@syncular/server": "0.35.0",
|
|
49
|
+
"@syncular/server-hono": "0.35.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@syncular/core": "0.
|
|
52
|
+
"@syncular/core": "0.35.0",
|
|
53
53
|
"miniflare": "4.20260701.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/realtime-do.ts
CHANGED
|
@@ -77,6 +77,9 @@ import {
|
|
|
77
77
|
createRealtimeHub,
|
|
78
78
|
D1ServerStorage,
|
|
79
79
|
errorBody,
|
|
80
|
+
eraseScopeValue,
|
|
81
|
+
type EraseScopeValueOptions,
|
|
82
|
+
type EraseScopeValueResult,
|
|
80
83
|
handleRemoteOperation,
|
|
81
84
|
handleSyncRequest,
|
|
82
85
|
pruneCommitLog,
|
|
@@ -326,6 +329,25 @@ export class SyncularRealtimeHost {
|
|
|
326
329
|
});
|
|
327
330
|
}
|
|
328
331
|
|
|
332
|
+
/**
|
|
333
|
+
* §4.6.1 scope-value erasure on the partition FIFO: one budgeted step per
|
|
334
|
+
* call, its delete commit fanned out to connected sockets.
|
|
335
|
+
*/
|
|
336
|
+
eraseScopeValue(
|
|
337
|
+
options: EraseScopeValueOptions,
|
|
338
|
+
): Promise<EraseScopeValueResult> {
|
|
339
|
+
return this.#serializePartition(async () => {
|
|
340
|
+
await this.#storage.migrate();
|
|
341
|
+
return eraseScopeValue(
|
|
342
|
+
this.#getHub().requestContextFor({
|
|
343
|
+
partition: options.partition,
|
|
344
|
+
actorId: options.actorId ?? 'syncular.erase',
|
|
345
|
+
}),
|
|
346
|
+
options,
|
|
347
|
+
);
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
|
|
329
351
|
#serializePartition<T>(operation: () => Promise<T>): Promise<T> {
|
|
330
352
|
const run = async (): Promise<T> => {
|
|
331
353
|
await this.#rehydrateSockets();
|