@toapi/client 1.3.1 → 1.3.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":"pub-sub.d.ts","sourceRoot":"","sources":["../src/pub-sub.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzD,UAAU,OAAO;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,gBAAgB,CAAoD;IAC5E,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,MAAM,CAAS;gBAEX,OAAO,EAAE,OAAO;IAI5B,SAAS,CAAC,QAAQ,EAAE,YAAY;IAO1B,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC;CAkChC"}
1
+ {"version":3,"file":"pub-sub.d.ts","sourceRoot":"","sources":["../src/pub-sub.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzD,UAAU,OAAO;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,gBAAgB,CAAoD;IAC5E,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,MAAM,CAAS;gBAEX,OAAO,EAAE,OAAO;IAI5B,SAAS,CAAC,QAAQ,EAAE,YAAY;IAO1B,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC;CA6BhC"}
package/dist/pub-sub.js CHANGED
@@ -20,17 +20,18 @@ export class PubSub {
20
20
  urls.delete(url);
21
21
  }
22
22
  }
23
- const timeout = setTimeout(() => Promise.all(Array.from(urls).map((url) => {
24
- if (this.requestedUrls.has(url)) {
23
+ const timeout = setTimeout(() => {
24
+ const pendingUrls = new Set();
25
+ for (const url of urls) {
25
26
  this.debounceTimeouts.delete(url);
26
- // needs to be refetched
27
- return this.publish(urls);
27
+ if (this.requestedUrls.delete(url)) {
28
+ pendingUrls.add(url);
29
+ }
28
30
  }
29
- else {
30
- // debounce timeout over
31
- this.debounceTimeouts.delete(url);
32
- }
33
- })), this.minTTL);
31
+ // Consume pending invalidations and unlock the entire batch before replay.
32
+ if (pendingUrls.size)
33
+ return this.publish(pendingUrls);
34
+ }, this.minTTL);
34
35
  for (const url of urls) {
35
36
  this.debounceTimeouts.set(url, timeout);
36
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toapi/client",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "author": {
5
5
  "name": "Michel Smola",
6
6
  "email": "michel.smola@farbenmeer.de"
@@ -20,13 +20,13 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@toapi/common": "^1.3.1"
23
+ "@toapi/common": "^1.3.3"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^25.0.3",
27
27
  "vitest": "^5.0.0",
28
28
  "zod": "^4.0.17",
29
- "@toapi/server": "^1.3.1"
29
+ "@toapi/server": "^1.3.3"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "typescript": "^5 || ^6.0.0 || ^7.0.0",