@helia/ipns 8.2.4 → 9.0.0-4d51f16d

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 (75) hide show
  1. package/README.md +31 -135
  2. package/dist/index.min.js +11 -11
  3. package/dist/index.min.js.map +4 -4
  4. package/dist/src/constants.d.ts +17 -0
  5. package/dist/src/constants.d.ts.map +1 -0
  6. package/dist/src/constants.js +19 -0
  7. package/dist/src/constants.js.map +1 -0
  8. package/dist/src/errors.d.ts +0 -4
  9. package/dist/src/errors.d.ts.map +1 -1
  10. package/dist/src/errors.js +0 -7
  11. package/dist/src/errors.js.map +1 -1
  12. package/dist/src/index.d.ts +131 -207
  13. package/dist/src/index.d.ts.map +1 -1
  14. package/dist/src/index.js +49 -416
  15. package/dist/src/index.js.map +1 -1
  16. package/dist/src/ipns/publisher.d.ts +29 -0
  17. package/dist/src/ipns/publisher.d.ts.map +1 -0
  18. package/dist/src/ipns/publisher.js +73 -0
  19. package/dist/src/ipns/publisher.js.map +1 -0
  20. package/dist/src/ipns/republisher.d.ts +30 -0
  21. package/dist/src/ipns/republisher.d.ts.map +1 -0
  22. package/dist/src/ipns/republisher.js +112 -0
  23. package/dist/src/ipns/republisher.js.map +1 -0
  24. package/dist/src/ipns/resolver.d.ts +26 -0
  25. package/dist/src/ipns/resolver.d.ts.map +1 -0
  26. package/dist/src/ipns/resolver.js +165 -0
  27. package/dist/src/ipns/resolver.js.map +1 -0
  28. package/dist/src/ipns.d.ts +20 -0
  29. package/dist/src/ipns.d.ts.map +1 -0
  30. package/dist/src/ipns.js +70 -0
  31. package/dist/src/ipns.js.map +1 -0
  32. package/dist/src/local-store.d.ts +42 -0
  33. package/dist/src/local-store.d.ts.map +1 -0
  34. package/dist/src/local-store.js +119 -0
  35. package/dist/src/local-store.js.map +1 -0
  36. package/dist/src/pb/metadata.d.ts +12 -0
  37. package/dist/src/pb/metadata.d.ts.map +1 -0
  38. package/dist/src/pb/metadata.js +57 -0
  39. package/dist/src/pb/metadata.js.map +1 -0
  40. package/dist/src/routing/index.d.ts +5 -3
  41. package/dist/src/routing/index.d.ts.map +1 -1
  42. package/dist/src/routing/index.js.map +1 -1
  43. package/dist/src/routing/local-store.d.ts +4 -19
  44. package/dist/src/routing/local-store.d.ts.map +1 -1
  45. package/dist/src/routing/local-store.js +7 -62
  46. package/dist/src/routing/local-store.js.map +1 -1
  47. package/dist/src/routing/pubsub.d.ts +21 -1
  48. package/dist/src/routing/pubsub.d.ts.map +1 -1
  49. package/dist/src/routing/pubsub.js +2 -2
  50. package/dist/src/routing/pubsub.js.map +1 -1
  51. package/dist/src/utils.d.ts +24 -0
  52. package/dist/src/utils.d.ts.map +1 -1
  53. package/dist/src/utils.js +56 -0
  54. package/dist/src/utils.js.map +1 -1
  55. package/package.json +21 -23
  56. package/src/constants.ts +24 -0
  57. package/src/errors.ts +0 -9
  58. package/src/index.ts +154 -548
  59. package/src/ipns/publisher.ts +97 -0
  60. package/src/ipns/republisher.ts +144 -0
  61. package/src/ipns/resolver.ts +217 -0
  62. package/src/ipns.ts +87 -0
  63. package/src/local-store.ts +162 -0
  64. package/src/pb/metadata.proto +9 -0
  65. package/src/pb/metadata.ts +74 -0
  66. package/src/routing/index.ts +5 -4
  67. package/src/routing/local-store.ts +9 -87
  68. package/src/routing/pubsub.ts +28 -4
  69. package/src/utils.ts +70 -0
  70. package/dist/src/dnslink.d.ts +0 -9
  71. package/dist/src/dnslink.d.ts.map +0 -1
  72. package/dist/src/dnslink.js +0 -138
  73. package/dist/src/dnslink.js.map +0 -1
  74. package/dist/typedoc-urls.json +0 -48
  75. package/src/dnslink.ts +0 -163
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helia/ipns",
3
- "version": "8.2.4",
3
+ "version": "9.0.0-4d51f16d",
4
4
  "description": "An implementation of IPNS for Helia",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/ipfs/helia/tree/main/packages/ipns#readme",
@@ -56,13 +56,6 @@
56
56
  "import": "./dist/src/routing/index.js"
57
57
  }
58
58
  },
59
- "eslintConfig": {
60
- "extends": "ipfs",
61
- "parserOptions": {
62
- "project": true,
63
- "sourceType": "module"
64
- }
65
- },
66
59
  "scripts": {
67
60
  "clean": "aegir clean",
68
61
  "lint": "aegir lint",
@@ -70,6 +63,7 @@
70
63
  "doc-check": "aegir doc-check",
71
64
  "build": "aegir build",
72
65
  "docs": "aegir docs",
66
+ "generate": "protons ./src/pb/metadata.proto",
73
67
  "test": "aegir test",
74
68
  "test:chrome": "aegir test -t browser --cov",
75
69
  "test:chrome-webworker": "aegir test -t webworker",
@@ -79,25 +73,29 @@
79
73
  "test:electron-main": "aegir test -t electron-main"
80
74
  },
81
75
  "dependencies": {
82
- "@helia/interface": "^5.4.0",
83
- "@libp2p/interface": "^2.2.1",
84
- "@libp2p/kad-dht": "^15.0.2",
85
- "@libp2p/logger": "^5.1.4",
86
- "@libp2p/peer-id": "^5.1.0",
87
- "@multiformats/dns": "^1.0.6",
88
- "interface-datastore": "^8.3.1",
89
- "ipns": "^10.0.0",
90
- "multiformats": "^13.3.1",
76
+ "@helia/interface": "6.0.0-4d51f16d",
77
+ "@libp2p/crypto": "^5.1.7",
78
+ "@libp2p/interface": "^3.0.2",
79
+ "@libp2p/kad-dht": "^16.0.5",
80
+ "@libp2p/keychain": "^6.0.5",
81
+ "@libp2p/logger": "^6.0.5",
82
+ "@libp2p/utils": "^7.0.5",
83
+ "interface-datastore": "^9.0.2",
84
+ "ipns": "^10.1.2",
85
+ "multiformats": "^13.4.1",
91
86
  "progress-events": "^1.0.1",
87
+ "protons-runtime": "^5.5.0",
88
+ "uint8arraylist": "^2.4.8",
92
89
  "uint8arrays": "^5.1.0"
93
90
  },
94
91
  "devDependencies": {
95
- "@libp2p/crypto": "^5.0.7",
96
- "@types/dns-packet": "^5.6.5",
97
- "aegir": "^47.0.7",
98
- "datastore-core": "^10.0.2",
99
- "it-drain": "^3.0.7",
100
- "sinon": "^20.0.0",
92
+ "@libp2p/crypto": "^5.1.12",
93
+ "@libp2p/peer-id": "^6.0.3",
94
+ "aegir": "^47.0.22",
95
+ "datastore-core": "^11.0.2",
96
+ "it-drain": "^3.0.10",
97
+ "protons": "^7.6.1",
98
+ "sinon": "^21.0.0",
101
99
  "sinon-ts": "^2.0.0"
102
100
  },
103
101
  "browser": {
@@ -0,0 +1,24 @@
1
+ const MINUTE = 60 * 1000
2
+ const HOUR = 60 * MINUTE
3
+
4
+ export const DEFAULT_LIFETIME_MS = 48 * HOUR
5
+
6
+ /**
7
+ * The default DHT record expiry
8
+ */
9
+ export const DHT_EXPIRY_MS = 48 * HOUR
10
+
11
+ /**
12
+ * How often to run the republish loop
13
+ */
14
+ export const DEFAULT_REPUBLISH_INTERVAL_MS = HOUR
15
+
16
+ /**
17
+ * Republish IPNS records when the expiry of our provider records is within this
18
+ * threshold
19
+ */
20
+ export const REPUBLISH_THRESHOLD = 24 * HOUR
21
+
22
+ export const DEFAULT_TTL_NS = BigInt(MINUTE) * 5_000_000n // 5 minutes
23
+
24
+ export const DEFAULT_REPUBLISH_CONCURRENCY = 5
package/src/errors.ts CHANGED
@@ -1,12 +1,3 @@
1
- export class DNSLinkNotFoundError extends Error {
2
- static name = 'DNSLinkNotFoundError'
3
-
4
- constructor (message = 'DNSLink not found') {
5
- super(message)
6
- this.name = 'DNSLinkNotFoundError'
7
- }
8
- }
9
-
10
1
  export class RecordsFailedValidationError extends Error {
11
2
  static name = 'RecordsFailedValidationError'
12
3