@toapi/server 1.2.1 → 1.2.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"revalidation-stream.d.ts","sourceRoot":"","sources":["../src/revalidation-stream.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAIxC,UAAU,OAAO;IACf,KAAK,EAAE,KAAK,CAAC;CACd;AAED,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,YAwCvD"}
1
+ {"version":3,"file":"revalidation-stream.d.ts","sourceRoot":"","sources":["../src/revalidation-stream.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAIxC,UAAU,OAAO;IACf,KAAK,EAAE,KAAK,CAAC;CACd;AAED,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,YA0CvD"}
@@ -18,10 +18,12 @@ export function streamRevalidatedTags({ cache }) {
18
18
  // send tags to client
19
19
  controller.enqueue(textEncoder.encode(`${tags.join(" ")}\n`));
20
20
  });
21
- // keepalive
22
- interval = setInterval(() => {
23
- controller.enqueue("\n");
24
- }, KEEPALIVE_INTERVAL);
21
+ // keepalive. The first one is sent right away so the response headers
22
+ // are flushed immediately instead of only once the interval first
23
+ // fires — consumers skip empty lines, so this is a no-op for them.
24
+ const keepalive = () => controller.enqueue(textEncoder.encode("\n"));
25
+ keepalive();
26
+ interval = setInterval(keepalive, KEEPALIVE_INTERVAL);
25
27
  },
26
28
  cancel() {
27
29
  if (interval)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toapi/server",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "author": {
5
5
  "name": "Michel Smola",
6
6
  "email": "michel.smola@farbenmeer.de"
@@ -21,13 +21,13 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "zod-openapi": "^6.0.0",
24
- "@toapi/common": "^1.2.1"
24
+ "@toapi/common": "^1.2.3"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "^25.0.3",
28
28
  "vitest": "^4.0.16",
29
29
  "zod": "^4.0.17",
30
- "@farbenmeer/tag-based-cache": "0.5.1"
30
+ "@toapi/cache": "^0.5.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "typescript": "^5 || ^6.0.0",