@helia/ipns 2.0.1 → 2.0.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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Record } from '@libp2p/kad-dht';
|
|
2
2
|
import { Key } from 'interface-datastore';
|
|
3
3
|
import { CustomProgressEvent } from 'progress-events';
|
|
4
4
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
|
|
@@ -16,7 +16,7 @@ export function localStore(datastore) {
|
|
|
16
16
|
try {
|
|
17
17
|
const key = dhtRoutingKey(routingKey);
|
|
18
18
|
// Marshal to libp2p record as the DHT does
|
|
19
|
-
const record = new
|
|
19
|
+
const record = new Record(routingKey, marshalledRecord, new Date());
|
|
20
20
|
options.onProgress?.(new CustomProgressEvent('ipns:routing:datastore:put'));
|
|
21
21
|
await datastore.put(key, record.serialize(), options);
|
|
22
22
|
}
|
|
@@ -31,7 +31,7 @@ export function localStore(datastore) {
|
|
|
31
31
|
options.onProgress?.(new CustomProgressEvent('ipns:routing:datastore:get'));
|
|
32
32
|
const buf = await datastore.get(key, options);
|
|
33
33
|
// Unmarshal libp2p record as the DHT does
|
|
34
|
-
const record =
|
|
34
|
+
const record = Record.deserialize(buf);
|
|
35
35
|
return record.value;
|
|
36
36
|
}
|
|
37
37
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-store.js","sourceRoot":"","sources":["../../../src/routing/local-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"local-store.js","sourceRoot":"","sources":["../../../src/routing/local-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAkB,GAAG,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAsB,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,QAAQ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AC,CAAA;gBAEtC,OAAO,MAAM,CAAC,KAAK,CAAA;aACpB;YAAC,OAAO,GAAQ,EAAE;gBACjB,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,mBAAmB,CAAQ,8BAA8B,EAAE,GAAG,CAAC,CAAC,CAAA;gBACzF,MAAM,GAAG,CAAA;aACV;QACH,CAAC;QACD,KAAK,CAAC,GAAG,CAAE,UAAsB,EAAE,UAAwB,EAAE;YAC3D,MAAM,GAAG,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;YACrC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACpC,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/ipns",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
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-ipns/tree/master/packages/ipns#readme",
|
|
@@ -156,9 +156,9 @@
|
|
|
156
156
|
},
|
|
157
157
|
"dependencies": {
|
|
158
158
|
"@libp2p/interface": "^0.1.2",
|
|
159
|
+
"@libp2p/kad-dht": "^10.0.11",
|
|
159
160
|
"@libp2p/logger": "^3.0.2",
|
|
160
161
|
"@libp2p/peer-id": "^3.0.2",
|
|
161
|
-
"@libp2p/record": "^3.0.0",
|
|
162
162
|
"hashlru": "^2.3.0",
|
|
163
163
|
"interface-datastore": "^8.0.0",
|
|
164
164
|
"ipns": "^7.0.1",
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
"@libp2p/peer-id-factory": "^3.0.3",
|
|
173
173
|
"aegir": "^41.0.0",
|
|
174
174
|
"datastore-core": "^9.0.3",
|
|
175
|
-
"sinon": "^
|
|
175
|
+
"sinon": "^17.0.0",
|
|
176
176
|
"sinon-ts": "^1.0.0"
|
|
177
177
|
},
|
|
178
178
|
"browser": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Record } from '@libp2p/kad-dht'
|
|
2
2
|
import { type Datastore, Key } from 'interface-datastore'
|
|
3
3
|
import { CustomProgressEvent, type ProgressEvent } from 'progress-events'
|
|
4
4
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
|
|
@@ -30,7 +30,7 @@ export function localStore (datastore: Datastore): LocalStore {
|
|
|
30
30
|
const key = dhtRoutingKey(routingKey)
|
|
31
31
|
|
|
32
32
|
// Marshal to libp2p record as the DHT does
|
|
33
|
-
const record = new
|
|
33
|
+
const record = new Record(routingKey, marshalledRecord, new Date())
|
|
34
34
|
|
|
35
35
|
options.onProgress?.(new CustomProgressEvent('ipns:routing:datastore:put'))
|
|
36
36
|
await datastore.put(key, record.serialize(), options)
|
|
@@ -47,7 +47,7 @@ export function localStore (datastore: Datastore): LocalStore {
|
|
|
47
47
|
const buf = await datastore.get(key, options)
|
|
48
48
|
|
|
49
49
|
// Unmarshal libp2p record as the DHT does
|
|
50
|
-
const record =
|
|
50
|
+
const record = Record.deserialize(buf)
|
|
51
51
|
|
|
52
52
|
return record.value
|
|
53
53
|
} catch (err: any) {
|