@libp2p/utils 6.6.6 → 6.6.7-7eed3b40d

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.
Files changed (33) hide show
  1. package/dist/index.min.js.map +1 -1
  2. package/dist/src/index.d.ts +1 -16
  3. package/dist/src/index.d.ts.map +1 -1
  4. package/dist/src/index.js +1 -16
  5. package/dist/src/index.js.map +1 -1
  6. package/dist/src/multiaddr/is-global-unicast.d.ts.map +1 -1
  7. package/dist/src/multiaddr/is-global-unicast.js +8 -7
  8. package/dist/src/multiaddr/is-global-unicast.js.map +1 -1
  9. package/dist/src/multiaddr/is-ip-based.d.ts.map +1 -1
  10. package/dist/src/multiaddr/is-ip-based.js +7 -4
  11. package/dist/src/multiaddr/is-ip-based.js.map +1 -1
  12. package/dist/src/multiaddr/is-link-local.d.ts.map +1 -1
  13. package/dist/src/multiaddr/is-link-local.js +14 -11
  14. package/dist/src/multiaddr/is-link-local.js.map +1 -1
  15. package/dist/src/multiaddr/is-network-address.d.ts.map +1 -1
  16. package/dist/src/multiaddr/is-network-address.js +13 -14
  17. package/dist/src/multiaddr/is-network-address.js.map +1 -1
  18. package/dist/src/private-ip.d.ts.map +1 -1
  19. package/dist/src/private-ip.js +3 -6
  20. package/dist/src/private-ip.js.map +1 -1
  21. package/dist/src/repeating-task.d.ts +13 -0
  22. package/dist/src/repeating-task.d.ts.map +1 -1
  23. package/dist/src/repeating-task.js +12 -0
  24. package/dist/src/repeating-task.js.map +1 -1
  25. package/package.json +6 -6
  26. package/src/index.ts +1 -16
  27. package/src/multiaddr/is-global-unicast.ts +8 -9
  28. package/src/multiaddr/is-ip-based.ts +7 -5
  29. package/src/multiaddr/is-link-local.ts +14 -12
  30. package/src/multiaddr/is-network-address.ts +13 -15
  31. package/src/private-ip.ts +15 -1
  32. package/src/repeating-task.ts +31 -0
  33. package/dist/typedoc-urls.json +0 -147
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * @packageDocumentation\n *\n * The libp2p ecosystem has lots of repos with it comes several problems like:\n *\n * - Domain logic dedupe - all modules shared a lot of logic like validation, streams handling, etc.\n * - Dependencies management - it's really easy with so many repos for dependencies to go out of control, they become outdated, different repos use different modules to do the same thing (like merging defaults options), browser bundles ends up with multiple versions of the same package, bumping versions is cumbersome to do because we need to go through several repos, etc.\n *\n * These problems are the motivation for this package, having shared logic in this package avoids creating cyclic dependencies, centralizes common use modules/functions (exactly like aegir does for the tooling), semantic versioning for 3rd party dependencies is handled in one single place (a good example is going from streams 2 to 3) and maintainers should only care about having `libp2p-utils` updated.\n *\n * @example\n *\n * Each function should be imported directly.\n *\n * ```TypeScript\n * import { ipPortToMultiaddr } from '@libp2p/utils/ip-port-to-multiaddr'\n *\n * const ma = ipPortToMultiaddr('127.0.0.1', 9000)\n * ```\n */\n\nexport {}\n"],
4
+ "sourcesContent": ["/**\n * @packageDocumentation\n *\n * This module contains utility functions used by libp2p modules.\n */\n\nexport {}\n"],
5
5
  "mappings": ";qYAAA,IAAAA,EAAA",
6
6
  "names": ["index_exports"]
7
7
  }
@@ -1,22 +1,7 @@
1
1
  /**
2
2
  * @packageDocumentation
3
3
  *
4
- * The libp2p ecosystem has lots of repos with it comes several problems like:
5
- *
6
- * - Domain logic dedupe - all modules shared a lot of logic like validation, streams handling, etc.
7
- * - Dependencies management - it's really easy with so many repos for dependencies to go out of control, they become outdated, different repos use different modules to do the same thing (like merging defaults options), browser bundles ends up with multiple versions of the same package, bumping versions is cumbersome to do because we need to go through several repos, etc.
8
- *
9
- * These problems are the motivation for this package, having shared logic in this package avoids creating cyclic dependencies, centralizes common use modules/functions (exactly like aegir does for the tooling), semantic versioning for 3rd party dependencies is handled in one single place (a good example is going from streams 2 to 3) and maintainers should only care about having `libp2p-utils` updated.
10
- *
11
- * @example
12
- *
13
- * Each function should be imported directly.
14
- *
15
- * ```TypeScript
16
- * import { ipPortToMultiaddr } from '@libp2p/utils/ip-port-to-multiaddr'
17
- *
18
- * const ma = ipPortToMultiaddr('127.0.0.1', 9000)
19
- * ```
4
+ * This module contains utility functions used by libp2p modules.
20
5
  */
21
6
  export {};
22
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAA"}
package/dist/src/index.js CHANGED
@@ -1,22 +1,7 @@
1
1
  /**
2
2
  * @packageDocumentation
3
3
  *
4
- * The libp2p ecosystem has lots of repos with it comes several problems like:
5
- *
6
- * - Domain logic dedupe - all modules shared a lot of logic like validation, streams handling, etc.
7
- * - Dependencies management - it's really easy with so many repos for dependencies to go out of control, they become outdated, different repos use different modules to do the same thing (like merging defaults options), browser bundles ends up with multiple versions of the same package, bumping versions is cumbersome to do because we need to go through several repos, etc.
8
- *
9
- * These problems are the motivation for this package, having shared logic in this package avoids creating cyclic dependencies, centralizes common use modules/functions (exactly like aegir does for the tooling), semantic versioning for 3rd party dependencies is handled in one single place (a good example is going from streams 2 to 3) and maintainers should only care about having `libp2p-utils` updated.
10
- *
11
- * @example
12
- *
13
- * Each function should be imported directly.
14
- *
15
- * ```TypeScript
16
- * import { ipPortToMultiaddr } from '@libp2p/utils/ip-port-to-multiaddr'
17
- *
18
- * const ma = ipPortToMultiaddr('127.0.0.1', 9000)
19
- * ```
4
+ * This module contains utility functions used by libp2p modules.
20
5
  */
21
6
  export {};
22
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-global-unicast.d.ts","sourceRoot":"","sources":["../../../src/multiaddr/is-global-unicast.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,wBAAgB,eAAe,CAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAgBvD"}
1
+ {"version":3,"file":"is-global-unicast.d.ts","sourceRoot":"","sources":["../../../src/multiaddr/is-global-unicast.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD;;GAEG;AACH,wBAAgB,eAAe,CAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAgBvD"}
@@ -1,16 +1,17 @@
1
1
  import { cidrContains } from '@chainsafe/netmask';
2
- const CODEC_IP6 = 0x29;
2
+ import { CODE_IP6 } from '@multiformats/multiaddr';
3
3
  /**
4
4
  * Check if a given multiaddr is an IPv6 global unicast address
5
5
  */
6
6
  export function isGlobalUnicast(ma) {
7
7
  try {
8
- const [[codec, value]] = ma.stringTuples();
9
- if (value == null) {
10
- return false;
11
- }
12
- if (codec === CODEC_IP6) {
13
- return cidrContains('2000::/3', value);
8
+ for (const { code, value } of ma.getComponents()) {
9
+ if (value == null) {
10
+ continue;
11
+ }
12
+ if (code === CODE_IP6) {
13
+ return cidrContains('2000::/3', value);
14
+ }
14
15
  }
15
16
  }
16
17
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"is-global-unicast.js","sourceRoot":"","sources":["../../../src/multiaddr/is-global-unicast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGjD,MAAM,SAAS,GAAG,IAAI,CAAA;AAEtB;;GAEG;AACH,MAAM,UAAU,eAAe,CAAE,EAAa;IAC5C,IAAI,CAAC;QACH,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAA;QAE1C,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,OAAO,KAAK,CAAA;QACd,CAAC;QAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;QACxC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
1
+ {"version":3,"file":"is-global-unicast.js","sourceRoot":"","sources":["../../../src/multiaddr/is-global-unicast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGlD;;GAEG;AACH,MAAM,UAAU,eAAe,CAAE,EAAa;IAC5C,IAAI,CAAC;QACH,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC;YACjD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;gBAClB,SAAQ;YACV,CAAC;YAED,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtB,OAAO,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;YACxC,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-ip-based.d.ts","sourceRoot":"","sources":["../../../src/multiaddr/is-ip-based.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAKxD;;GAEG;AACH,wBAAgB,SAAS,CAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAUjD"}
1
+ {"version":3,"file":"is-ip-based.d.ts","sourceRoot":"","sources":["../../../src/multiaddr/is-ip-based.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD;;GAEG;AACH,wBAAgB,SAAS,CAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAcjD"}
@@ -1,12 +1,15 @@
1
- const CODEC_IP4 = 0x04;
2
- const CODEC_IP6 = 0x29;
1
+ import { CODE_IP4, CODE_IP6, CODE_IP6ZONE } from '@multiformats/multiaddr';
3
2
  /**
4
3
  * Check if a given multiaddr is IP-based
5
4
  */
6
5
  export function isIpBased(ma) {
7
6
  try {
8
- const [[codec]] = ma.stringTuples();
9
- return codec === CODEC_IP4 || codec === CODEC_IP6;
7
+ for (const { code } of ma.getComponents()) {
8
+ if (code === CODE_IP6ZONE) {
9
+ continue;
10
+ }
11
+ return code === CODE_IP4 || code === CODE_IP6;
12
+ }
10
13
  }
11
14
  catch {
12
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-ip-based.js","sourceRoot":"","sources":["../../../src/multiaddr/is-ip-based.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,IAAI,CAAA;AACtB,MAAM,SAAS,GAAG,IAAI,CAAA;AAEtB;;GAEG;AACH,MAAM,UAAU,SAAS,CAAE,EAAa;IACtC,IAAI,CAAC;QACH,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAA;QAEnC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,CAAA;IACnD,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
1
+ {"version":3,"file":"is-ip-based.js","sourceRoot":"","sources":["../../../src/multiaddr/is-ip-based.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAG1E;;GAEG;AACH,MAAM,UAAU,SAAS,CAAE,EAAa;IACtC,IAAI,CAAC;QACH,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC;YAC1C,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC1B,SAAQ;YACV,CAAC;YAED,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,QAAQ,CAAA;QAC/C,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-link-local.d.ts","sourceRoot":"","sources":["../../../src/multiaddr/is-link-local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAKxD;;GAEG;AACH,wBAAgB,WAAW,CAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAoBnD"}
1
+ {"version":3,"file":"is-link-local.d.ts","sourceRoot":"","sources":["../../../src/multiaddr/is-link-local.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD;;GAEG;AACH,wBAAgB,WAAW,CAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAwBnD"}
@@ -1,19 +1,22 @@
1
- const CODEC_IP4 = 0x04;
2
- const CODEC_IP6 = 0x29;
1
+ import { CODE_IP4, CODE_IP6, CODE_IP6ZONE } from '@multiformats/multiaddr';
3
2
  /**
4
3
  * Check if a given multiaddr is a link-local address
5
4
  */
6
5
  export function isLinkLocal(ma) {
7
6
  try {
8
- const [[codec, value]] = ma.stringTuples();
9
- if (value == null) {
10
- return false;
11
- }
12
- if (codec === CODEC_IP4) {
13
- return value.startsWith('169.254.');
14
- }
15
- if (codec === CODEC_IP6) {
16
- return value.toLowerCase().startsWith('fe80');
7
+ for (const { code, value } of ma.getComponents()) {
8
+ if (code === CODE_IP6ZONE) {
9
+ continue;
10
+ }
11
+ if (value == null) {
12
+ continue;
13
+ }
14
+ if (code === CODE_IP4) {
15
+ return value.startsWith('169.254.');
16
+ }
17
+ if (code === CODE_IP6) {
18
+ return value.toLowerCase().startsWith('fe80');
19
+ }
17
20
  }
18
21
  }
19
22
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"is-link-local.js","sourceRoot":"","sources":["../../../src/multiaddr/is-link-local.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,IAAI,CAAA;AACtB,MAAM,SAAS,GAAG,IAAI,CAAA;AAEtB;;GAEG;AACH,MAAM,UAAU,WAAW,CAAE,EAAa;IACxC,IAAI,CAAC;QACH,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAA;QAE1C,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,OAAO,KAAK,CAAA;QACd,CAAC;QAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;QACrC,CAAC;QAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
1
+ {"version":3,"file":"is-link-local.js","sourceRoot":"","sources":["../../../src/multiaddr/is-link-local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAG1E;;GAEG;AACH,MAAM,UAAU,WAAW,CAAE,EAAa;IACxC,IAAI,CAAC;QACH,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC;YACjD,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC1B,SAAQ;YACV,CAAC;YAED,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;gBAClB,SAAQ;YACV,CAAC;YAED,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtB,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;YACrC,CAAC;YAED,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtB,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;YAC/C,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-network-address.d.ts","sourceRoot":"","sources":["../../../src/multiaddr/is-network-address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAkBxD;;GAEG;AACH,wBAAgB,gBAAgB,CAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAUxD"}
1
+ {"version":3,"file":"is-network-address.d.ts","sourceRoot":"","sources":["../../../src/multiaddr/is-network-address.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAWxD;;GAEG;AACH,wBAAgB,gBAAgB,CAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAcxD"}
@@ -1,24 +1,23 @@
1
- const CODEC_IP4 = 0x04;
2
- const CODEC_IP6 = 0x29;
3
- const CODEC_DNS = 0x35;
4
- const CODEC_DNS4 = 0x36;
5
- const CODEC_DNS6 = 0x37;
6
- const CODEC_DNSADDR = 0x38;
1
+ import { CODE_IP4, CODE_IP6, CODE_IP6ZONE, CODE_DNS, CODE_DNS4, CODE_DNS6, CODE_DNSADDR } from '@multiformats/multiaddr';
7
2
  const NETWORK_CODECS = [
8
- CODEC_IP4,
9
- CODEC_IP6,
10
- CODEC_DNS,
11
- CODEC_DNS4,
12
- CODEC_DNS6,
13
- CODEC_DNSADDR
3
+ CODE_IP4,
4
+ CODE_IP6,
5
+ CODE_DNS,
6
+ CODE_DNS4,
7
+ CODE_DNS6,
8
+ CODE_DNSADDR
14
9
  ];
15
10
  /**
16
11
  * Check if a given multiaddr is a network address
17
12
  */
18
13
  export function isNetworkAddress(ma) {
19
14
  try {
20
- const [[codec]] = ma.stringTuples();
21
- return NETWORK_CODECS.includes(codec);
15
+ for (const { code } of ma.getComponents()) {
16
+ if (code === CODE_IP6ZONE) {
17
+ continue;
18
+ }
19
+ return NETWORK_CODECS.includes(code);
20
+ }
22
21
  }
23
22
  catch {
24
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-network-address.js","sourceRoot":"","sources":["../../../src/multiaddr/is-network-address.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,IAAI,CAAA;AACtB,MAAM,SAAS,GAAG,IAAI,CAAA;AACtB,MAAM,SAAS,GAAG,IAAI,CAAA;AACtB,MAAM,UAAU,GAAG,IAAI,CAAA;AACvB,MAAM,UAAU,GAAG,IAAI,CAAA;AACvB,MAAM,aAAa,GAAG,IAAI,CAAA;AAE1B,MAAM,cAAc,GAAG;IACrB,SAAS;IACT,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;IACV,aAAa;CACd,CAAA;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAE,EAAa;IAC7C,IAAI,CAAC;QACH,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAA;QAEnC,OAAO,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACvC,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
1
+ {"version":3,"file":"is-network-address.js","sourceRoot":"","sources":["../../../src/multiaddr/is-network-address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAGxH,MAAM,cAAc,GAAG;IACrB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,SAAS;IACT,YAAY;CACb,CAAA;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAE,EAAa;IAC7C,IAAI,CAAC;QACH,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC;YAC1C,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC1B,SAAQ;YACV,CAAC;YAED,OAAO,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"private-ip.d.ts","sourceRoot":"","sources":["../../src/private-ip.ts"],"names":[],"mappings":"AA0FA,wBAAgB,WAAW,CAAE,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE5D"}
1
+ {"version":3,"file":"private-ip.d.ts","sourceRoot":"","sources":["../../src/private-ip.ts"],"names":[],"mappings":"AA0FA,wBAAgB,WAAW,CAAE,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAgB5D"}
@@ -79,17 +79,14 @@ export function isPrivateIp(ip) {
79
79
  if (isIPv4(ip)) {
80
80
  return ipv4Check(ip);
81
81
  }
82
- else if (isIpv4MappedIpv6(ip)) {
82
+ if (isIpv4MappedIpv6(ip)) {
83
83
  return ipv4MappedIpv6Check(ip);
84
84
  }
85
- else if (isIpv4EmbeddedIpv6(ip)) {
85
+ if (isIpv4EmbeddedIpv6(ip)) {
86
86
  return ipv4EmbeddedIpv6Check(ip);
87
87
  }
88
- else if (isIPv6(ip)) {
88
+ if (isIPv6(ip)) {
89
89
  return ipv6Check(ip);
90
90
  }
91
- else {
92
- return undefined;
93
- }
94
91
  }
95
92
  //# sourceMappingURL=private-ip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"private-ip.js","sourceRoot":"","sources":["../../src/private-ip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,iBAAiB,GAAG;IACxB,WAAW;IACX,YAAY;IACZ,eAAe;IACf,aAAa;IACb,gBAAgB;IAChB,eAAe;IACf,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,oBAAoB;CACrB,CAAA;AAED,MAAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;AAE7E,SAAS,SAAS,CAAE,MAAc;IAChC,KAAK,MAAM,CAAC,IAAI,cAAc,EAAE,CAAC;QAC/B,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAAC,OAAO,IAAI,CAAA;QAAC,CAAC;IACzC,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,gBAAgB,CAAE,MAAc;IACvC,OAAO,gDAAgD,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACtE,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAE,MAAc;IAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAE/B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CA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AgB,CAAC,EAAE,CAAC,EAAE,CAAC;QACzB,OAAO,mBAAmB,CAAC,EAAE,CAAC,CAAA;IAChC,CAAC;IAED,IAAI,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3B,OAAO,qBAAqB,CAAC,EAAE,CAAC,CAAA;IAClC,CAAC;IAED,IAAI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;QACf,OAAO,SAAS,CAAC,EAAE,CAAC,CAAA;IACtB,CAAC;AACH,CAAC"}
@@ -20,6 +20,12 @@ export interface RepeatingTask {
20
20
  * running, that run will not be interrupted.
21
21
  */
22
22
  setTimeout(ms: number): void;
23
+ /**
24
+ * Schedule the task to be run immediately - if the task is not running it
25
+ * will run after a short delay in order to debounce multiple `.run()`
26
+ * invocations.
27
+ */
28
+ run(): void;
23
29
  /**
24
30
  * Start the task running
25
31
  */
@@ -41,6 +47,13 @@ export interface RepeatingTaskOptions {
41
47
  * @default false
42
48
  */
43
49
  runImmediately?: boolean;
50
+ /**
51
+ * When `.run()` is called to run the task outside of the current interval,
52
+ * debounce repeated calls to `.run()` by this amount.
53
+ *
54
+ * @default 100
55
+ */
56
+ debounce?: number;
44
57
  }
45
58
  export declare function repeatingTask(fn: (options?: AbortOptions) => void | Promise<void>, interval: number, options?: RepeatingTaskOptions): RepeatingTask;
46
59
  //# sourceMappingURL=repeating-task.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repeating-task.d.ts","sourceRoot":"","sources":["../../src/repeating-task.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE7B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE5B;;OAEG;IACH,KAAK,IAAI,IAAI,CAAA;IAEb;;OAEG;IACH,IAAI,IAAI,IAAI,CAAA;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,wBAAgB,aAAa,CAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,aAAa,CA6EpJ"}
1
+ {"version":3,"file":"repeating-task.d.ts","sourceRoot":"","sources":["../../src/repeating-task.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE7B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE5B;;;;OAIG;IACH,GAAG,IAAI,IAAI,CAAA;IAEX;;OAEG;IACH,KAAK,IAAI,IAAI,CAAA;IAEb;;OAEG;IACH,IAAI,IAAI,IAAI,CAAA;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IAExB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,aAAa,CAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,aAAa,CA4FpJ"}
@@ -1,8 +1,10 @@
1
1
  import { anySignal } from 'any-signal';
2
2
  import { setMaxListeners } from 'main-event';
3
+ import { debounce } from "./debounce.js";
3
4
  export function repeatingTask(fn, interval, options) {
4
5
  let timeout;
5
6
  let shutdownController;
7
+ let running = false;
6
8
  function runTask() {
7
9
  const opts = {
8
10
  signal: shutdownController.signal
@@ -12,11 +14,13 @@ export function repeatingTask(fn, interval, options) {
12
14
  setMaxListeners(Infinity, signal);
13
15
  opts.signal = signal;
14
16
  }
17
+ running = true;
15
18
  Promise.resolve().then(async () => {
16
19
  await fn(opts);
17
20
  })
18
21
  .catch(() => { })
19
22
  .finally(() => {
23
+ running = false;
20
24
  if (shutdownController.signal.aborted) {
21
25
  // task has been cancelled, bail
22
26
  return;
@@ -25,6 +29,7 @@ export function repeatingTask(fn, interval, options) {
25
29
  timeout = setTimeout(runTask, interval);
26
30
  });
27
31
  }
32
+ const runTaskDebounced = debounce(runTask, options?.debounce ?? 100);
28
33
  let started = false;
29
34
  return {
30
35
  setInterval: (ms) => {
@@ -43,6 +48,13 @@ export function repeatingTask(fn, interval, options) {
43
48
  options ??= {};
44
49
  options.timeout = ms;
45
50
  },
51
+ run: () => {
52
+ if (running) {
53
+ return;
54
+ }
55
+ clearTimeout(timeout);
56
+ runTaskDebounced();
57
+ },
46
58
  start: () => {
47
59
  if (started) {
48
60
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"repeating-task.js","sourceRoot":"","sources":["../../src/repeating-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAoD5C,MAAM,UAAU,aAAa,CAAE,EAAoD,EAAE,QAAgB,EAAE,OAA8B;IACnI,IAAI,OAAsC,CAAA;IAC1C,IAAI,kBAAmC,CAAA;IAEvC,SAAS,OAAO;QACd,MAAM,IAAI,GAAiB;YACzB,MAAM,EAAE,kBAAkB,CAAC,MAAM;SAClC,CAAA;QAED,IAAI,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,CAAC;YAC7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ACZ,OAAM;YACR,CAAC;YAED,YAAY,CAAC,OAAO,CAAC,CAAA;YACrB,gBAAgB,EAAE,CAAA;QACpB,CAAC;QACD,KAAK,EAAE,GAAS,EAAE;YAChB,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAM;YACR,CAAC;YAED,OAAO,GAAG,IAAI,CAAA;YACd,kBAAkB,GAAG,IAAI,eAAe,EAAE,CAAA;YAC1C,eAAe,CAAC,QAAQ,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAA;YAEpD,UAAU;YACV,IAAI,OAAO,EAAE,cAAc,KAAK,IAAI,EAAE,CAAC;gBACrC,cAAc,CAAC,GAAG,EAAE;oBAClB,OAAO,EAAE,CAAA;gBACX,CAAC,CAAC,CAAA;YACJ,CAAC;iBAAM,CAAC;gBACN,YAAY;gBACZ,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;YACzC,CAAC;QACH,CAAC;QACD,IAAI,EAAE,GAAS,EAAE;YACf,YAAY,CAAC,OAAO,CAAC,CAAA;YACrB,kBAAkB,EAAE,KAAK,EAAE,CAAA;YAC3B,OAAO,GAAG,KAAK,CAAA;QACjB,CAAC;KACF,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/utils",
3
- "version": "6.6.6",
3
+ "version": "6.6.7-7eed3b40d",
4
4
  "description": "Package to aggregate shared logic and dependencies for the libp2p ecosystem",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/utils#readme",
@@ -191,10 +191,10 @@
191
191
  "dependencies": {
192
192
  "@chainsafe/is-ip": "^2.1.0",
193
193
  "@chainsafe/netmask": "^2.0.0",
194
- "@libp2p/crypto": "^5.1.5",
195
- "@libp2p/interface": "^2.10.3",
196
- "@libp2p/logger": "^5.1.19",
197
- "@multiformats/multiaddr": "^12.4.0",
194
+ "@libp2p/crypto": "5.1.6-7eed3b40d",
195
+ "@libp2p/interface": "2.10.4-7eed3b40d",
196
+ "@libp2p/logger": "5.1.20-7eed3b40d",
197
+ "@multiformats/multiaddr": "^12.4.4",
198
198
  "@sindresorhus/fnv1a": "^3.1.0",
199
199
  "any-signal": "^4.1.1",
200
200
  "delay": "^6.0.0",
@@ -214,7 +214,7 @@
214
214
  "uint8arrays": "^5.1.0"
215
215
  },
216
216
  "devDependencies": {
217
- "@libp2p/peer-id": "^5.1.6",
217
+ "@libp2p/peer-id": "5.1.7-7eed3b40d",
218
218
  "@types/netmask": "^2.0.5",
219
219
  "aegir": "^47.0.14",
220
220
  "benchmark": "^2.1.4",
package/src/index.ts CHANGED
@@ -1,22 +1,7 @@
1
1
  /**
2
2
  * @packageDocumentation
3
3
  *
4
- * The libp2p ecosystem has lots of repos with it comes several problems like:
5
- *
6
- * - Domain logic dedupe - all modules shared a lot of logic like validation, streams handling, etc.
7
- * - Dependencies management - it's really easy with so many repos for dependencies to go out of control, they become outdated, different repos use different modules to do the same thing (like merging defaults options), browser bundles ends up with multiple versions of the same package, bumping versions is cumbersome to do because we need to go through several repos, etc.
8
- *
9
- * These problems are the motivation for this package, having shared logic in this package avoids creating cyclic dependencies, centralizes common use modules/functions (exactly like aegir does for the tooling), semantic versioning for 3rd party dependencies is handled in one single place (a good example is going from streams 2 to 3) and maintainers should only care about having `libp2p-utils` updated.
10
- *
11
- * @example
12
- *
13
- * Each function should be imported directly.
14
- *
15
- * ```TypeScript
16
- * import { ipPortToMultiaddr } from '@libp2p/utils/ip-port-to-multiaddr'
17
- *
18
- * const ma = ipPortToMultiaddr('127.0.0.1', 9000)
19
- * ```
4
+ * This module contains utility functions used by libp2p modules.
20
5
  */
21
6
 
22
7
  export {}
@@ -1,21 +1,20 @@
1
1
  import { cidrContains } from '@chainsafe/netmask'
2
+ import { CODE_IP6 } from '@multiformats/multiaddr'
2
3
  import type { Multiaddr } from '@multiformats/multiaddr'
3
4
 
4
- const CODEC_IP6 = 0x29
5
-
6
5
  /**
7
6
  * Check if a given multiaddr is an IPv6 global unicast address
8
7
  */
9
8
  export function isGlobalUnicast (ma: Multiaddr): boolean {
10
9
  try {
11
- const [[codec, value]] = ma.stringTuples()
12
-
13
- if (value == null) {
14
- return false
15
- }
10
+ for (const { code, value } of ma.getComponents()) {
11
+ if (value == null) {
12
+ continue
13
+ }
16
14
 
17
- if (codec === CODEC_IP6) {
18
- return cidrContains('2000::/3', value)
15
+ if (code === CODE_IP6) {
16
+ return cidrContains('2000::/3', value)
17
+ }
19
18
  }
20
19
  } catch {
21
20
 
@@ -1,16 +1,18 @@
1
+ import { CODE_IP4, CODE_IP6, CODE_IP6ZONE } from '@multiformats/multiaddr'
1
2
  import type { Multiaddr } from '@multiformats/multiaddr'
2
3
 
3
- const CODEC_IP4 = 0x04
4
- const CODEC_IP6 = 0x29
5
-
6
4
  /**
7
5
  * Check if a given multiaddr is IP-based
8
6
  */
9
7
  export function isIpBased (ma: Multiaddr): boolean {
10
8
  try {
11
- const [[codec]] = ma.stringTuples()
9
+ for (const { code } of ma.getComponents()) {
10
+ if (code === CODE_IP6ZONE) {
11
+ continue
12
+ }
12
13
 
13
- return codec === CODEC_IP4 || codec === CODEC_IP6
14
+ return code === CODE_IP4 || code === CODE_IP6
15
+ }
14
16
  } catch {
15
17
 
16
18
  }
@@ -1,25 +1,27 @@
1
+ import { CODE_IP4, CODE_IP6, CODE_IP6ZONE } from '@multiformats/multiaddr'
1
2
  import type { Multiaddr } from '@multiformats/multiaddr'
2
3
 
3
- const CODEC_IP4 = 0x04
4
- const CODEC_IP6 = 0x29
5
-
6
4
  /**
7
5
  * Check if a given multiaddr is a link-local address
8
6
  */
9
7
  export function isLinkLocal (ma: Multiaddr): boolean {
10
8
  try {
11
- const [[codec, value]] = ma.stringTuples()
9
+ for (const { code, value } of ma.getComponents()) {
10
+ if (code === CODE_IP6ZONE) {
11
+ continue
12
+ }
12
13
 
13
- if (value == null) {
14
- return false
15
- }
14
+ if (value == null) {
15
+ continue
16
+ }
16
17
 
17
- if (codec === CODEC_IP4) {
18
- return value.startsWith('169.254.')
19
- }
18
+ if (code === CODE_IP4) {
19
+ return value.startsWith('169.254.')
20
+ }
20
21
 
21
- if (codec === CODEC_IP6) {
22
- return value.toLowerCase().startsWith('fe80')
22
+ if (code === CODE_IP6) {
23
+ return value.toLowerCase().startsWith('fe80')
24
+ }
23
25
  }
24
26
  } catch {
25
27
 
@@ -1,19 +1,13 @@
1
+ import { CODE_IP4, CODE_IP6, CODE_IP6ZONE, CODE_DNS, CODE_DNS4, CODE_DNS6, CODE_DNSADDR } from '@multiformats/multiaddr'
1
2
  import type { Multiaddr } from '@multiformats/multiaddr'
2
3
 
3
- const CODEC_IP4 = 0x04
4
- const CODEC_IP6 = 0x29
5
- const CODEC_DNS = 0x35
6
- const CODEC_DNS4 = 0x36
7
- const CODEC_DNS6 = 0x37
8
- const CODEC_DNSADDR = 0x38
9
-
10
4
  const NETWORK_CODECS = [
11
- CODEC_IP4,
12
- CODEC_IP6,
13
- CODEC_DNS,
14
- CODEC_DNS4,
15
- CODEC_DNS6,
16
- CODEC_DNSADDR
5
+ CODE_IP4,
6
+ CODE_IP6,
7
+ CODE_DNS,
8
+ CODE_DNS4,
9
+ CODE_DNS6,
10
+ CODE_DNSADDR
17
11
  ]
18
12
 
19
13
  /**
@@ -21,9 +15,13 @@ const NETWORK_CODECS = [
21
15
  */
22
16
  export function isNetworkAddress (ma: Multiaddr): boolean {
23
17
  try {
24
- const [[codec]] = ma.stringTuples()
18
+ for (const { code } of ma.getComponents()) {
19
+ if (code === CODE_IP6ZONE) {
20
+ continue
21
+ }
25
22
 
26
- return NETWORK_CODECS.includes(codec)
23
+ return NETWORK_CODECS.includes(code)
24
+ }
27
25
  } catch {
28
26
 
29
27
  }
package/src/private-ip.ts CHANGED
@@ -89,5 +89,19 @@ function ipv6Check (ipAddr: string): boolean {
89
89
  }
90
90
 
91
91
  export function isPrivateIp (ip: string): boolean | undefined {
92
- if (isIPv4(ip)) { return ipv4Check(ip) } else if (isIpv4MappedIpv6(ip)) { return ipv4MappedIpv6Check(ip) } else if (isIpv4EmbeddedIpv6(ip)) { return ipv4EmbeddedIpv6Check(ip) } else if (isIPv6(ip)) { return ipv6Check(ip) } else { return undefined }
92
+ if (isIPv4(ip)) {
93
+ return ipv4Check(ip)
94
+ }
95
+
96
+ if (isIpv4MappedIpv6(ip)) {
97
+ return ipv4MappedIpv6Check(ip)
98
+ }
99
+
100
+ if (isIpv4EmbeddedIpv6(ip)) {
101
+ return ipv4EmbeddedIpv6Check(ip)
102
+ }
103
+
104
+ if (isIPv6(ip)) {
105
+ return ipv6Check(ip)
106
+ }
93
107
  }
@@ -1,5 +1,6 @@
1
1
  import { anySignal } from 'any-signal'
2
2
  import { setMaxListeners } from 'main-event'
3
+ import { debounce } from './debounce.ts'
3
4
  import type { AbortOptions } from '@libp2p/interface'
4
5
 
5
6
  export interface RepeatingTask {
@@ -25,6 +26,13 @@ export interface RepeatingTask {
25
26
  */
26
27
  setTimeout(ms: number): void
27
28
 
29
+ /**
30
+ * Schedule the task to be run immediately - if the task is not running it
31
+ * will run after a short delay in order to debounce multiple `.run()`
32
+ * invocations.
33
+ */
34
+ run(): void
35
+
28
36
  /**
29
37
  * Start the task running
30
38
  */
@@ -49,11 +57,20 @@ export interface RepeatingTaskOptions {
49
57
  * @default false
50
58
  */
51
59
  runImmediately?: boolean
60
+
61
+ /**
62
+ * When `.run()` is called to run the task outside of the current interval,
63
+ * debounce repeated calls to `.run()` by this amount.
64
+ *
65
+ * @default 100
66
+ */
67
+ debounce?: number
52
68
  }
53
69
 
54
70
  export function repeatingTask (fn: (options?: AbortOptions) => void | Promise<void>, interval: number, options?: RepeatingTaskOptions): RepeatingTask {
55
71
  let timeout: ReturnType<typeof setTimeout>
56
72
  let shutdownController: AbortController
73
+ let running = false
57
74
 
58
75
  function runTask (): void {
59
76
  const opts: AbortOptions = {
@@ -67,11 +84,15 @@ export function repeatingTask (fn: (options?: AbortOptions) => void | Promise<vo
67
84
  opts.signal = signal
68
85
  }
69
86
 
87
+ running = true
88
+
70
89
  Promise.resolve().then(async () => {
71
90
  await fn(opts)
72
91
  })
73
92
  .catch(() => {})
74
93
  .finally(() => {
94
+ running = false
95
+
75
96
  if (shutdownController.signal.aborted) {
76
97
  // task has been cancelled, bail
77
98
  return
@@ -82,6 +103,8 @@ export function repeatingTask (fn: (options?: AbortOptions) => void | Promise<vo
82
103
  })
83
104
  }
84
105
 
106
+ const runTaskDebounced = debounce(runTask, options?.debounce ?? 100)
107
+
85
108
  let started = false
86
109
 
87
110
  return {
@@ -103,6 +126,14 @@ export function repeatingTask (fn: (options?: AbortOptions) => void | Promise<vo
103
126
  options ??= {}
104
127
  options.timeout = ms
105
128
  },
129
+ run: (): void => {
130
+ if (running) {
131
+ return
132
+ }
133
+
134
+ clearTimeout(timeout)
135
+ runTaskDebounced()
136
+ },
106
137
  start: (): void => {
107
138
  if (started) {
108
139
  return
@@ -1,147 +0,0 @@
1
- {
2
- "createTimeoutOptions": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.abort-options.createTimeoutOptions.html",
3
- "./abort-options:createTimeoutOptions": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.abort-options.createTimeoutOptions.html",
4
- "AbstractStream": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.abstract-stream.AbstractStream.html",
5
- "./abstract-stream:AbstractStream": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.abstract-stream.AbstractStream.html",
6
- "AbstractStreamInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.abstract-stream.AbstractStreamInit.html",
7
- "./abstract-stream:AbstractStreamInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.abstract-stream.AbstractStreamInit.html",
8
- "AdaptiveTimeout": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.adaptive-timeout.AdaptiveTimeout.html",
9
- "./adaptive-timeout:AdaptiveTimeout": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.adaptive-timeout.AdaptiveTimeout.html",
10
- "AdaptiveTimeoutInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive-timeout.AdaptiveTimeoutInit.html",
11
- "./adaptive-timeout:AdaptiveTimeoutInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive-timeout.AdaptiveTimeoutInit.html",
12
- "AdaptiveTimeoutSignal": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive-timeout.AdaptiveTimeoutSignal.html",
13
- "./adaptive-timeout:AdaptiveTimeoutSignal": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive-timeout.AdaptiveTimeoutSignal.html",
14
- "GetTimeoutSignalOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive-timeout.GetTimeoutSignalOptions.html",
15
- "./adaptive-timeout:GetTimeoutSignalOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.adaptive-timeout.GetTimeoutSignalOptions.html",
16
- "DEFAULT_FAILURE_MULTIPLIER": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive-timeout.DEFAULT_FAILURE_MULTIPLIER.html",
17
- "./adaptive-timeout:DEFAULT_FAILURE_MULTIPLIER": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive-timeout.DEFAULT_FAILURE_MULTIPLIER.html",
18
- "DEFAULT_INTERVAL": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive-timeout.DEFAULT_INTERVAL.html",
19
- "./adaptive-timeout:DEFAULT_INTERVAL": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive-timeout.DEFAULT_INTERVAL.html",
20
- "DEFAULT_MAX_TIMEOUT": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive-timeout.DEFAULT_MAX_TIMEOUT.html",
21
- "./adaptive-timeout:DEFAULT_MAX_TIMEOUT": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive-timeout.DEFAULT_MAX_TIMEOUT.html",
22
- "DEFAULT_MIN_TIMEOUT": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive-timeout.DEFAULT_MIN_TIMEOUT.html",
23
- "./adaptive-timeout:DEFAULT_MIN_TIMEOUT": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive-timeout.DEFAULT_MIN_TIMEOUT.html",
24
- "DEFAULT_TIMEOUT_MULTIPLIER": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive-timeout.DEFAULT_TIMEOUT_MULTIPLIER.html",
25
- "./adaptive-timeout:DEFAULT_TIMEOUT_MULTIPLIER": "https://libp2p.github.io/js-libp2p/variables/_libp2p_utils.adaptive-timeout.DEFAULT_TIMEOUT_MULTIPLIER.html",
26
- "arrayEquals": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.array-equals.arrayEquals.html",
27
- "./array-equals:arrayEquals": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.array-equals.arrayEquals.html",
28
- "SafelyCloseConnectionOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.close.SafelyCloseConnectionOptions.html",
29
- "./close:SafelyCloseConnectionOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.close.SafelyCloseConnectionOptions.html",
30
- "safelyCloseConnectionIfUnused": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close.safelyCloseConnectionIfUnused.html",
31
- "./close:safelyCloseConnectionIfUnused": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close.safelyCloseConnectionIfUnused.html",
32
- "safelyCloseStream": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close.safelyCloseStream.html",
33
- "./close:safelyCloseStream": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close.safelyCloseStream.html",
34
- "closeSource": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close-source.closeSource.html",
35
- "./close-source:closeSource": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.close-source.closeSource.html",
36
- "DebouncedFunction": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.debounce.DebouncedFunction.html",
37
- "./debounce:DebouncedFunction": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.debounce.DebouncedFunction.html",
38
- "debounce": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.debounce.debounce.html",
39
- "./debounce:debounce": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.debounce.debounce.html",
40
- "BloomFilter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.filters.BloomFilter.html",
41
- "Bucket": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.filters.Bucket.html",
42
- "CuckooFilter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.filters.CuckooFilter.html",
43
- "Fingerprint": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.filters.Fingerprint.html",
44
- "ScalableCuckooFilter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.filters.ScalableCuckooFilter.html",
45
- "BloomFilterOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.BloomFilterOptions.html",
46
- "CuckooFilterInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.CuckooFilterInit.html",
47
- "Filter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.Filter.html",
48
- "./filters:Filter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.Filter.html",
49
- "Hash": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.Hash.html",
50
- "ScalableCuckooFilterInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.filters.ScalableCuckooFilterInit.html",
51
- "createBloomFilter": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.filters.createBloomFilter.html",
52
- "createCuckooFilter": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.filters.createCuckooFilter.html",
53
- "createScalableCuckooFilter": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.filters.createScalableCuckooFilter.html",
54
- "getThinWaistAddresses": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.get-thin-waist-addresses.getThinWaistAddresses.html",
55
- "./get-thin-waist-addresses:getThinWaistAddresses": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.get-thin-waist-addresses.getThinWaistAddresses.html",
56
- "isGlobalUnicastIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.global-unicast-ip.isGlobalUnicastIp.html",
57
- "./global-unicast-ip:isGlobalUnicastIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.global-unicast-ip.isGlobalUnicastIp.html",
58
- "ipPortToMultiaddr": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.ip-port-to-multiaddr.ipPortToMultiaddr.html",
59
- "./ip-port-to-multiaddr:ipPortToMultiaddr": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.ip-port-to-multiaddr.ipPortToMultiaddr.html",
60
- "isAsyncGenerator": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is-async-generator.isAsyncGenerator.html",
61
- "./is-async-generator:isAsyncGenerator": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is-async-generator.isAsyncGenerator.html",
62
- "isGenerator": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is-generator.isGenerator.html",
63
- "./is-generator:isGenerator": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is-generator.isGenerator.html",
64
- "isPromise": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is-promise.isPromise.html",
65
- "./is-promise:isPromise": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.is-promise.isPromise.html",
66
- "isLinkLocalIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.link-local-ip.isLinkLocalIp.html",
67
- "./link-local-ip:isLinkLocalIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.link-local-ip.isLinkLocalIp.html",
68
- "mergeOptions": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.merge-options.mergeOptions.html",
69
- "./merge-options:mergeOptions": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.merge-options.mergeOptions.html",
70
- "MovingAverage": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.moving-average.MovingAverage.html",
71
- "./moving-average:MovingAverage": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.moving-average.MovingAverage.html",
72
- "isGlobalUnicast": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-global-unicast.isGlobalUnicast.html",
73
- "./multiaddr/is-global-unicast:isGlobalUnicast": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-global-unicast.isGlobalUnicast.html",
74
- "isIpBased": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-ip-based.isIpBased.html",
75
- "./multiaddr/is-ip-based:isIpBased": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-ip-based.isIpBased.html",
76
- "isLinkLocal": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-link-local.isLinkLocal.html",
77
- "./multiaddr/is-link-local:isLinkLocal": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-link-local.isLinkLocal.html",
78
- "isLoopback": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-loopback.isLoopback.html",
79
- "./multiaddr/is-loopback:isLoopback": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-loopback.isLoopback.html",
80
- "isNetworkAddress": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-network-address.isNetworkAddress.html",
81
- "./multiaddr/is-network-address:isNetworkAddress": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-network-address.isNetworkAddress.html",
82
- "isPrivate": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-private.isPrivate.html",
83
- "./multiaddr/is-private:isPrivate": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.multiaddr_is-private.isPrivate.html",
84
- "PeerQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.peer-queue.PeerQueue.html",
85
- "./peer-queue:PeerQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.peer-queue.PeerQueue.html",
86
- "PeerQueueJobOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.peer-queue.PeerQueueJobOptions.html",
87
- "./peer-queue:PeerQueueJobOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.peer-queue.PeerQueueJobOptions.html",
88
- "PriorityQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.priority-queue.PriorityQueue.html",
89
- "./priority-queue:PriorityQueue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.priority-queue.PriorityQueue.html",
90
- "PriorityQueueJobOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.priority-queue.PriorityQueueJobOptions.html",
91
- "./priority-queue:PriorityQueueJobOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.priority-queue.PriorityQueueJobOptions.html",
92
- "isPrivateIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.private-ip.isPrivateIp.html",
93
- "./private-ip:isPrivateIp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.private-ip.isPrivateIp.html",
94
- "Job": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.queue.Job.html",
95
- "JobRecipient": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.queue.JobRecipient.html",
96
- "Queue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.queue.Queue.html",
97
- "./queue:Queue": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.queue.Queue.html",
98
- "Comparator": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.Comparator.html",
99
- "./queue:Comparator": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.Comparator.html",
100
- "JobMatcher": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.JobMatcher.html",
101
- "./queue:JobMatcher": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.JobMatcher.html",
102
- "JobTimeline": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.JobTimeline.html",
103
- "QueueEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueEvents.html",
104
- "./queue:QueueEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueEvents.html",
105
- "QueueInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueInit.html",
106
- "./queue:QueueInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueInit.html",
107
- "QueueJobFailure": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueJobFailure.html",
108
- "./queue:QueueJobFailure": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueJobFailure.html",
109
- "QueueJobSuccess": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueJobSuccess.html",
110
- "./queue:QueueJobSuccess": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.QueueJobSuccess.html",
111
- "RunFunction": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.RunFunction.html",
112
- "./queue:RunFunction": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.queue.RunFunction.html",
113
- "JobStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_utils.queue.JobStatus.html",
114
- "./queue:JobStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_utils.queue.JobStatus.html",
115
- "MemoryStorage": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.rate-limiter.MemoryStorage.html",
116
- "./rate-limiter:MemoryStorage": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.rate-limiter.MemoryStorage.html",
117
- "RateLimiter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.rate-limiter.RateLimiter.html",
118
- "./rate-limiter:RateLimiter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_utils.rate-limiter.RateLimiter.html",
119
- "GetKeySecDurationOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate-limiter.GetKeySecDurationOptions.html",
120
- "./rate-limiter:GetKeySecDurationOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate-limiter.GetKeySecDurationOptions.html",
121
- "RateLimiterInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate-limiter.RateLimiterInit.html",
122
- "./rate-limiter:RateLimiterInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate-limiter.RateLimiterInit.html",
123
- "RateLimiterResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate-limiter.RateLimiterResult.html",
124
- "./rate-limiter:RateLimiterResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate-limiter.RateLimiterResult.html",
125
- "RateRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate-limiter.RateRecord.html",
126
- "./rate-limiter:RateRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.rate-limiter.RateRecord.html",
127
- "RepeatingTask": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.repeating-task.RepeatingTask.html",
128
- "./repeating-task:RepeatingTask": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.repeating-task.RepeatingTask.html",
129
- "RepeatingTaskOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.repeating-task.RepeatingTaskOptions.html",
130
- "./repeating-task:RepeatingTaskOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.repeating-task.RepeatingTaskOptions.html",
131
- "repeatingTask": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.repeating-task.repeatingTask.html",
132
- "./repeating-task:repeatingTask": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.repeating-task.repeatingTask.html",
133
- "StreamProperties": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.stream-to-ma-conn.StreamProperties.html",
134
- "./stream-to-ma-conn:StreamProperties": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.stream-to-ma-conn.StreamProperties.html",
135
- "streamToMaConnection": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.stream-to-ma-conn.streamToMaConnection.html",
136
- "./stream-to-ma-conn:streamToMaConnection": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.stream-to-ma-conn.streamToMaConnection.html",
137
- "CreateTrackedListInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked-list.CreateTrackedListInit.html",
138
- "./tracked-list:CreateTrackedListInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked-list.CreateTrackedListInit.html",
139
- "trackedList": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked-list.trackedList.html",
140
- "./tracked-list:trackedList": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked-list.trackedList.html",
141
- "CreateTrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked-map.CreateTrackedMapInit.html",
142
- "./tracked-map:CreateTrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked-map.CreateTrackedMapInit.html",
143
- "TrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked-map.TrackedMapInit.html",
144
- "./tracked-map:TrackedMapInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_utils.tracked-map.TrackedMapInit.html",
145
- "trackedMap": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked-map.trackedMap.html",
146
- "./tracked-map:trackedMap": "https://libp2p.github.io/js-libp2p/functions/_libp2p_utils.tracked-map.trackedMap.html"
147
- }