@orpc/experimental-durable-iterator 0.0.0-next.f677f1d → 0.0.0-next.f724c58
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 +2 -2
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/durable-object/index.d.mts +4 -0
- package/dist/durable-object/index.d.ts +4 -0
- package/dist/durable-object/index.mjs +6 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<image align="center" src="https://orpc.
|
|
2
|
+
<image align="center" src="https://orpc.dev/logo.webp" width=280 alt="oRPC logo" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
<h1></h1>
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
## Documentation
|
|
47
47
|
|
|
48
|
-
You can find the full documentation [here](https://orpc.
|
|
48
|
+
You can find the full documentation [here](https://orpc.dev).
|
|
49
49
|
|
|
50
50
|
## Packages
|
|
51
51
|
|
package/dist/client/index.d.mts
CHANGED
|
@@ -47,7 +47,7 @@ interface DurableIteratorLinkPluginOptions<T extends ClientContext> extends Omit
|
|
|
47
47
|
refreshTokenDelayInSeconds?: Value<Promisable<number>, [tokenPayload: DurableIteratorTokenPayload, options: StandardLinkInterceptorOptions<T>]>;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* @see {@link https://orpc.
|
|
50
|
+
* @see {@link https://orpc.dev/docs/integrations/durable-iterator Durable Iterator Integration}
|
|
51
51
|
*/
|
|
52
52
|
declare class DurableIteratorLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
53
53
|
readonly CONTEXT_SYMBOL: symbol;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ interface DurableIteratorLinkPluginOptions<T extends ClientContext> extends Omit
|
|
|
47
47
|
refreshTokenDelayInSeconds?: Value<Promisable<number>, [tokenPayload: DurableIteratorTokenPayload, options: StandardLinkInterceptorOptions<T>]>;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* @see {@link https://orpc.
|
|
50
|
+
* @see {@link https://orpc.dev/docs/integrations/durable-iterator Durable Iterator Integration}
|
|
51
51
|
*/
|
|
52
52
|
declare class DurableIteratorLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
53
53
|
readonly CONTEXT_SYMBOL: symbol;
|
|
@@ -96,6 +96,9 @@ interface EventResumeStorageOptions extends StandardRPCJsonSerializerOptions {
|
|
|
96
96
|
*
|
|
97
97
|
* @remarks
|
|
98
98
|
* - Use infinite values to disable
|
|
99
|
+
* - Note that for performance, expired event cleanup is deferred. This means
|
|
100
|
+
* expired events may remain in storage for a short period beyond their
|
|
101
|
+
* retention time.
|
|
99
102
|
*
|
|
100
103
|
* @default NaN (disabled)
|
|
101
104
|
*/
|
|
@@ -135,6 +138,7 @@ declare class EventResumeStorage<T extends object> {
|
|
|
135
138
|
get(websocket: DurableIteratorWebsocket, lastEventId: string): T[];
|
|
136
139
|
private initSchema;
|
|
137
140
|
private resetSchema;
|
|
141
|
+
private lastCleanupTime;
|
|
138
142
|
private cleanupExpiredEvents;
|
|
139
143
|
private serializeEventPayload;
|
|
140
144
|
private deserializeEventPayload;
|
|
@@ -96,6 +96,9 @@ interface EventResumeStorageOptions extends StandardRPCJsonSerializerOptions {
|
|
|
96
96
|
*
|
|
97
97
|
* @remarks
|
|
98
98
|
* - Use infinite values to disable
|
|
99
|
+
* - Note that for performance, expired event cleanup is deferred. This means
|
|
100
|
+
* expired events may remain in storage for a short period beyond their
|
|
101
|
+
* retention time.
|
|
99
102
|
*
|
|
100
103
|
* @default NaN (disabled)
|
|
101
104
|
*/
|
|
@@ -135,6 +138,7 @@ declare class EventResumeStorage<T extends object> {
|
|
|
135
138
|
get(websocket: DurableIteratorWebsocket, lastEventId: string): T[];
|
|
136
139
|
private initSchema;
|
|
137
140
|
private resetSchema;
|
|
141
|
+
private lastCleanupTime;
|
|
138
142
|
private cleanupExpiredEvents;
|
|
139
143
|
private serializeEventPayload;
|
|
140
144
|
private deserializeEventPayload;
|
|
@@ -241,7 +241,13 @@ class EventResumeStorage {
|
|
|
241
241
|
`);
|
|
242
242
|
this.initSchema();
|
|
243
243
|
}
|
|
244
|
+
lastCleanupTime;
|
|
244
245
|
cleanupExpiredEvents() {
|
|
246
|
+
const now = Date.now();
|
|
247
|
+
if (this.lastCleanupTime && this.lastCleanupTime + this.retentionSeconds * 1e3 > now) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
this.lastCleanupTime = now;
|
|
245
251
|
this.durableState.storage.sql.exec(`
|
|
246
252
|
DELETE FROM "${this.schemaPrefix}events" WHERE stored_at < unixepoch() - ?
|
|
247
253
|
`, this.retentionSeconds);
|
package/dist/index.d.mts
CHANGED
|
@@ -70,7 +70,7 @@ interface DurableIteratorHandlerPluginContext {
|
|
|
70
70
|
isClientDurableIteratorOutput?: boolean;
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* @see {@link https://orpc.
|
|
73
|
+
* @see {@link https://orpc.dev/docs/integrations/durable-iterator Durable Iterator Integration}
|
|
74
74
|
*/
|
|
75
75
|
declare class DurableIteratorHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
76
76
|
readonly CONTEXT_SYMBOL: symbol;
|
package/dist/index.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ interface DurableIteratorHandlerPluginContext {
|
|
|
70
70
|
isClientDurableIteratorOutput?: boolean;
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* @see {@link https://orpc.
|
|
73
|
+
* @see {@link https://orpc.dev/docs/integrations/durable-iterator Durable Iterator Integration}
|
|
74
74
|
*/
|
|
75
75
|
declare class DurableIteratorHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
76
76
|
readonly CONTEXT_SYMBOL: symbol;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/experimental-durable-iterator",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.f724c58",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://orpc.
|
|
6
|
+
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/unnoq/orpc.git",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"partysocket": "^1.1.
|
|
38
|
-
"valibot": "^1.
|
|
39
|
-
"@orpc/client": "0.0.0-next.
|
|
40
|
-
"@orpc/contract": "0.0.0-next.
|
|
41
|
-
"@orpc/server": "0.0.0-next.
|
|
42
|
-
"@orpc/shared": "0.0.0-next.
|
|
37
|
+
"partysocket": "^1.1.6",
|
|
38
|
+
"valibot": "^1.2.0",
|
|
39
|
+
"@orpc/client": "0.0.0-next.f724c58",
|
|
40
|
+
"@orpc/contract": "0.0.0-next.f724c58",
|
|
41
|
+
"@orpc/server": "0.0.0-next.f724c58",
|
|
42
|
+
"@orpc/shared": "0.0.0-next.f724c58"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@cloudflare/workers-types": "^4.
|
|
45
|
+
"@cloudflare/workers-types": "^4.20251121.0",
|
|
46
46
|
"@types/node": "^22.15.30",
|
|
47
|
-
"@orpc/standard-server-peer": "0.0.0-next.
|
|
47
|
+
"@orpc/standard-server-peer": "0.0.0-next.f724c58"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "unbuild",
|