@helia/ipns 9.1.9-2c225e85 → 9.1.9-397f2d86
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.
- package/dist/index.min.js +9 -9
- package/dist/index.min.js.map +4 -4
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.js +3 -3
- package/dist/src/ipns/publisher.d.ts +3 -3
- package/dist/src/ipns/republisher.d.ts +2 -2
- package/dist/src/ipns/republisher.js +1 -1
- package/dist/src/ipns/resolver.d.ts +3 -3
- package/dist/src/ipns/resolver.js +2 -2
- package/dist/src/ipns.d.ts +2 -2
- package/dist/src/ipns.js +2 -2
- package/dist/src/local-store.d.ts +2 -2
- package/dist/src/local-store.js +2 -2
- package/dist/src/pb/metadata.d.ts +11 -2
- package/dist/src/pb/metadata.d.ts.map +1 -1
- package/dist/src/pb/metadata.js +36 -5
- package/dist/src/pb/metadata.js.map +1 -1
- package/dist/src/routing/helia.d.ts +2 -2
- package/dist/src/routing/index.d.ts +6 -6
- package/dist/src/routing/index.js +2 -2
- package/dist/src/routing/pubsub.d.ts +1 -1
- package/dist/src/routing/pubsub.js +2 -2
- package/package.json +6 -6
- package/src/index.ts +6 -6
- package/src/ipns/publisher.ts +3 -3
- package/src/ipns/republisher.ts +3 -3
- package/src/ipns/resolver.ts +5 -5
- package/src/ipns.ts +5 -5
- package/src/local-store.ts +3 -3
- package/src/pb/metadata.ts +44 -3
- package/src/routing/helia.ts +2 -2
- package/src/routing/index.ts +6 -6
- package/src/routing/pubsub.ts +4 -4
package/dist/src/index.d.ts
CHANGED
|
@@ -180,8 +180,8 @@
|
|
|
180
180
|
*/
|
|
181
181
|
import { ipnsValidator } from 'ipns/validator';
|
|
182
182
|
import { CID } from 'multiformats/cid';
|
|
183
|
-
import type { IPNSResolverComponents } from './ipns/resolver.
|
|
184
|
-
import type { IPNSRouting, IPNSRoutingProgressEvents } from './routing/index.
|
|
183
|
+
import type { IPNSResolverComponents } from './ipns/resolver.ts';
|
|
184
|
+
import type { IPNSRouting, IPNSRoutingProgressEvents } from './routing/index.ts';
|
|
185
185
|
import type { Routing, HeliaEvents } from '@helia/interface';
|
|
186
186
|
import type { AbortOptions, ComponentLogger, Libp2p, PeerId, PublicKey, TypedEventEmitter } from '@libp2p/interface';
|
|
187
187
|
import type { Keychain } from '@libp2p/keychain';
|
|
@@ -318,7 +318,7 @@ export interface IPNS {
|
|
|
318
318
|
*/
|
|
319
319
|
unpublish(keyName: string, options?: AbortOptions): Promise<void>;
|
|
320
320
|
}
|
|
321
|
-
export type { IPNSRouting } from './routing/index.
|
|
321
|
+
export type { IPNSRouting } from './routing/index.ts';
|
|
322
322
|
export type { IPNSRecord } from 'ipns';
|
|
323
323
|
export interface IPNSComponents {
|
|
324
324
|
datastore: Datastore;
|
package/dist/src/index.js
CHANGED
|
@@ -180,10 +180,10 @@
|
|
|
180
180
|
*/
|
|
181
181
|
import { ipnsValidator } from 'ipns/validator';
|
|
182
182
|
import { CID } from 'multiformats/cid';
|
|
183
|
-
import { IPNSResolver as IPNSResolverClass } from
|
|
184
|
-
import { IPNS as IPNSClass } from
|
|
183
|
+
import { IPNSResolver as IPNSResolverClass } from "./ipns/resolver.js";
|
|
184
|
+
import { IPNS as IPNSClass } from "./ipns.js";
|
|
185
185
|
import { localStore } from "./local-store.js";
|
|
186
|
-
import { helia } from
|
|
186
|
+
import { helia } from "./routing/index.js";
|
|
187
187
|
import { localStoreRouting } from "./routing/local-store.js";
|
|
188
188
|
export function ipns(components, options = {}) {
|
|
189
189
|
return new IPNSClass(components, options);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CID } from 'multiformats/cid';
|
|
2
|
-
import type { IPNSPublishResult, PublishOptions } from '../index.
|
|
3
|
-
import type { LocalStore } from '../local-store.
|
|
4
|
-
import type { IPNSRouting } from '../routing/index.
|
|
2
|
+
import type { IPNSPublishResult, PublishOptions } from '../index.ts';
|
|
3
|
+
import type { LocalStore } from '../local-store.ts';
|
|
4
|
+
import type { IPNSRouting } from '../routing/index.ts';
|
|
5
5
|
import type { AbortOptions, ComponentLogger, Libp2p, PeerId, PublicKey } from '@libp2p/interface';
|
|
6
6
|
import type { Keychain } from '@libp2p/keychain';
|
|
7
7
|
import type { Datastore } from 'interface-datastore';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { LocalStore } from '../local-store.
|
|
2
|
-
import type { IPNSRouting } from '../routing/index.
|
|
1
|
+
import type { LocalStore } from '../local-store.ts';
|
|
2
|
+
import type { IPNSRouting } from '../routing/index.ts';
|
|
3
3
|
import type { ComponentLogger, Libp2p } from '@libp2p/interface';
|
|
4
4
|
import type { Keychain } from '@libp2p/keychain';
|
|
5
5
|
export interface IPNSRepublisherComponents {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Queue, repeatingTask } from '@libp2p/utils';
|
|
2
2
|
import { createIPNSRecord, marshalIPNSRecord, unmarshalIPNSRecord } from 'ipns';
|
|
3
3
|
import { DEFAULT_REPUBLISH_CONCURRENCY, DEFAULT_REPUBLISH_INTERVAL_MS, DEFAULT_TTL_NS } from "../constants.js";
|
|
4
|
-
import { shouldRepublish } from
|
|
4
|
+
import { shouldRepublish } from "../utils.js";
|
|
5
5
|
export class IPNSRepublisher {
|
|
6
6
|
routers;
|
|
7
7
|
localStore;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CID } from 'multiformats/cid';
|
|
2
|
-
import type { IPNSResolveResult, ResolveOptions } from '../index.
|
|
3
|
-
import type { LocalStore } from '../local-store.
|
|
4
|
-
import type { IPNSRouting } from '../routing/index.
|
|
2
|
+
import type { IPNSResolveResult, ResolveOptions } from '../index.ts';
|
|
3
|
+
import type { LocalStore } from '../local-store.ts';
|
|
4
|
+
import type { IPNSRouting } from '../routing/index.ts';
|
|
5
5
|
import type { Routing } from '@helia/interface';
|
|
6
6
|
import type { ComponentLogger, PeerId, PublicKey } from '@libp2p/interface';
|
|
7
7
|
import type { Datastore } from 'interface-datastore';
|
|
@@ -7,8 +7,8 @@ import { base58btc } from 'multiformats/bases/base58';
|
|
|
7
7
|
import { CID } from 'multiformats/cid';
|
|
8
8
|
import * as Digest from 'multiformats/hashes/digest';
|
|
9
9
|
import { DEFAULT_TTL_NS } from "../constants.js";
|
|
10
|
-
import { InvalidValueError, RecordNotFoundError, RecordsFailedValidationError, UnsupportedMultibasePrefixError, UnsupportedMultihashCodecError } from
|
|
11
|
-
import { isCodec, IDENTITY_CODEC, SHA2_256_CODEC, isLibp2pCID } from
|
|
10
|
+
import { InvalidValueError, RecordNotFoundError, RecordsFailedValidationError, UnsupportedMultibasePrefixError, UnsupportedMultihashCodecError } from "../errors.js";
|
|
11
|
+
import { isCodec, IDENTITY_CODEC, SHA2_256_CODEC, isLibp2pCID } from "../utils.js";
|
|
12
12
|
const bases = {
|
|
13
13
|
[base36.prefix]: base36,
|
|
14
14
|
[base58btc.prefix]: base58btc
|
package/dist/src/ipns.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CID } from 'multiformats/cid';
|
|
2
|
-
import type { IPNSComponents, IPNS as IPNSInterface, IPNSOptions, IPNSPublishResult, IPNSResolveResult, PublishOptions, ResolveOptions } from './index.
|
|
3
|
-
import type { IPNSRouting } from './routing/index.
|
|
2
|
+
import type { IPNSComponents, IPNS as IPNSInterface, IPNSOptions, IPNSPublishResult, IPNSResolveResult, PublishOptions, ResolveOptions } from './index.ts';
|
|
3
|
+
import type { IPNSRouting } from './routing/index.ts';
|
|
4
4
|
import type { AbortOptions, PeerId, PublicKey, Startable } from '@libp2p/interface';
|
|
5
5
|
import type { MultihashDigest } from 'multiformats/hashes/interface';
|
|
6
6
|
export declare class IPNS implements IPNSInterface, Startable {
|
package/dist/src/ipns.js
CHANGED
|
@@ -2,8 +2,8 @@ import { CID } from 'multiformats/cid';
|
|
|
2
2
|
import { IPNSPublisher } from "./ipns/publisher.js";
|
|
3
3
|
import { IPNSRepublisher } from "./ipns/republisher.js";
|
|
4
4
|
import { IPNSResolver } from "./ipns/resolver.js";
|
|
5
|
-
import { localStore } from
|
|
6
|
-
import { helia } from
|
|
5
|
+
import { localStore } from "./local-store.js";
|
|
6
|
+
import { helia } from "./routing/helia.js";
|
|
7
7
|
import { localStoreRouting } from "./routing/local-store.js";
|
|
8
8
|
export class IPNS {
|
|
9
9
|
routers;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IPNSPublishMetadata } from './pb/metadata.
|
|
2
|
-
import type { DatastoreProgressEvents, GetOptions, PutOptions } from './routing/index.
|
|
1
|
+
import { IPNSPublishMetadata } from './pb/metadata.ts';
|
|
2
|
+
import type { DatastoreProgressEvents, GetOptions, PutOptions } from './routing/index.ts';
|
|
3
3
|
import type { AbortOptions, Logger } from '@libp2p/interface';
|
|
4
4
|
import type { Datastore } from 'interface-datastore';
|
|
5
5
|
export interface GetResult {
|
package/dist/src/local-store.js
CHANGED
|
@@ -2,8 +2,8 @@ import { Record } from '@libp2p/kad-dht';
|
|
|
2
2
|
import { CustomProgressEvent } from 'progress-events';
|
|
3
3
|
import { equals as uint8ArrayEquals } from 'uint8arrays/equals';
|
|
4
4
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
5
|
-
import { IPNSPublishMetadata } from
|
|
6
|
-
import { dhtRoutingKey, DHT_RECORD_PREFIX, ipnsMetadataKey } from
|
|
5
|
+
import { IPNSPublishMetadata } from "./pb/metadata.js";
|
|
6
|
+
import { dhtRoutingKey, DHT_RECORD_PREFIX, ipnsMetadataKey } from "./utils.js";
|
|
7
7
|
/**
|
|
8
8
|
* Read/write IPNS records to the datastore as DHT records.
|
|
9
9
|
*
|
|
@@ -6,7 +6,16 @@ export interface IPNSPublishMetadata {
|
|
|
6
6
|
}
|
|
7
7
|
export declare namespace IPNSPublishMetadata {
|
|
8
8
|
const codec: () => Codec<IPNSPublishMetadata>;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
interface IPNSPublishMetadataKeyNameFieldEvent {
|
|
10
|
+
field: '$.keyName';
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
interface IPNSPublishMetadataLifetimeFieldEvent {
|
|
14
|
+
field: '$.lifetime';
|
|
15
|
+
value: number;
|
|
16
|
+
}
|
|
17
|
+
function encode(obj: Partial<IPNSPublishMetadata>): Uint8Array;
|
|
18
|
+
function decode(buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<IPNSPublishMetadata>): IPNSPublishMetadata;
|
|
19
|
+
function stream(buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<IPNSPublishMetadata>): Generator<IPNSPublishMetadataKeyNameFieldEvent | IPNSPublishMetadataLifetimeFieldEvent>;
|
|
11
20
|
}
|
|
12
21
|
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/pb/metadata.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,yBAAiB,mBAAmB,CAAC;IAG5B,MAAM,KAAK,QAAO,KAAK,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/pb/metadata.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,yBAAiB,mBAAmB,CAAC;IAG5B,MAAM,KAAK,QAAO,KAAK,CAAC,mBAAmB,CA+EjD,CAAA;IAED,UAAiB,oCAAoC;QACnD,KAAK,EAAE,WAAW,CAAA;QAClB,KAAK,EAAE,MAAM,CAAA;KACd;IAED,UAAiB,qCAAqC;QACpD,KAAK,EAAE,YAAY,CAAA;QACnB,KAAK,EAAE,MAAM,CAAA;KACd;IAED,SAAgB,MAAM,CAAE,GAAG,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,UAAU,CAErE;IAED,SAAgB,MAAM,CAAE,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,IAAI,CAAC,EAAE,aAAa,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAExH;IAED,SAAgB,MAAM,CAAE,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,IAAI,CAAC,EAAE,aAAa,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC,oCAAoC,GAAG,qCAAqC,CAAC,CAE5L;CACF"}
|
package/dist/src/pb/metadata.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decodeMessage, encodeMessage, message } from 'protons-runtime';
|
|
1
|
+
import { decodeMessage, encodeMessage, message, streamMessage } from 'protons-runtime';
|
|
2
2
|
export var IPNSPublishMetadata;
|
|
3
3
|
(function (IPNSPublishMetadata) {
|
|
4
4
|
let _codec;
|
|
@@ -43,15 +43,46 @@ export var IPNSPublishMetadata;
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
return obj;
|
|
46
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
47
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
48
|
+
while (reader.pos < end) {
|
|
49
|
+
const tag = reader.uint32();
|
|
50
|
+
switch (tag >>> 3) {
|
|
51
|
+
case 1: {
|
|
52
|
+
yield {
|
|
53
|
+
field: `${prefix}.keyName`,
|
|
54
|
+
value: reader.string()
|
|
55
|
+
};
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case 2: {
|
|
59
|
+
yield {
|
|
60
|
+
field: `${prefix}.lifetime`,
|
|
61
|
+
value: reader.uint32()
|
|
62
|
+
};
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
default: {
|
|
66
|
+
reader.skipType(tag & 7);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
46
71
|
});
|
|
47
72
|
}
|
|
48
73
|
return _codec;
|
|
49
74
|
};
|
|
50
|
-
|
|
75
|
+
function encode(obj) {
|
|
51
76
|
return encodeMessage(obj, IPNSPublishMetadata.codec());
|
|
52
|
-
}
|
|
53
|
-
IPNSPublishMetadata.
|
|
77
|
+
}
|
|
78
|
+
IPNSPublishMetadata.encode = encode;
|
|
79
|
+
function decode(buf, opts) {
|
|
54
80
|
return decodeMessage(buf, IPNSPublishMetadata.codec(), opts);
|
|
55
|
-
}
|
|
81
|
+
}
|
|
82
|
+
IPNSPublishMetadata.decode = decode;
|
|
83
|
+
function stream(buf, opts) {
|
|
84
|
+
return streamMessage(buf, IPNSPublishMetadata.codec(), opts);
|
|
85
|
+
}
|
|
86
|
+
IPNSPublishMetadata.stream = stream;
|
|
56
87
|
})(IPNSPublishMetadata || (IPNSPublishMetadata = {}));
|
|
57
88
|
//# sourceMappingURL=metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/pb/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/pb/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAStF,MAAM,KAAW,mBAAmB,CAyGnC;AAzGD,WAAiB,mBAAmB;IAClC,IAAI,MAAkC,CAAA;IAEzB,yBAAK,GAAG,GAA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,GAAG,CAAC,CAAC,CAAA;4BACxB,MAAK;wBACP,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;IAYD,SAAgB,MAAM,CAAE,GAAiC;QACvD,OAAO,aAAa,CAAC,GAAG,EAAE,mBAAmB,CAAC,KAAK,EAAE,CAAC,CAAA;IACxD,CAAC;IAFe,0BAAM,SAErB,CAAA;IAED,SAAgB,MAAM,CAAE,GAAgC,EAAE,IAAyC;QACjG,OAAO,aAAa,CAAC,GAAG,EAAE,mBAAmB,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,CAAA;IAC9D,CAAC;IAFe,0BAAM,SAErB,CAAA;IAED,SAAgB,MAAM,CAAE,GAAgC,EAAE,IAAyC;QACjG,OAAO,aAAa,CAAC,GAAG,EAAE,mBAAmB,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,CAAA;IAC9D,CAAC;IAFe,0BAAM,SAErB,CAAA;AACH,CAAC,EAzGgB,mBAAmB,KAAnB,mBAAmB,QAyGnC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GetOptions, PutOptions } from './index.
|
|
2
|
-
import type { IPNSRouting } from '../index.
|
|
1
|
+
import type { GetOptions, PutOptions } from './index.ts';
|
|
2
|
+
import type { IPNSRouting } from '../index.ts';
|
|
3
3
|
import type { Routing } from '@helia/interface';
|
|
4
4
|
import type { ProgressEvent } from 'progress-events';
|
|
5
5
|
export interface HeliaRoutingComponents {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { HeliaRoutingProgressEvents } from './helia.
|
|
2
|
-
import type { DatastoreProgressEvents } from '../index.
|
|
3
|
-
import type { PubSubProgressEvents } from './pubsub.
|
|
1
|
+
import type { HeliaRoutingProgressEvents } from './helia.ts';
|
|
2
|
+
import type { DatastoreProgressEvents } from '../index.ts';
|
|
3
|
+
import type { PubSubProgressEvents } from './pubsub.ts';
|
|
4
4
|
import type { IPNSPublishMetadata } from '../pb/metadata.ts';
|
|
5
5
|
import type { AbortOptions } from '@libp2p/interface';
|
|
6
6
|
import type { ProgressOptions } from 'progress-events';
|
|
@@ -23,7 +23,7 @@ export type { DatastoreProgressEvents };
|
|
|
23
23
|
export type { HeliaRoutingProgressEvents };
|
|
24
24
|
export type { PubSubProgressEvents };
|
|
25
25
|
export type IPNSRoutingProgressEvents = DatastoreProgressEvents | HeliaRoutingProgressEvents | PubSubProgressEvents;
|
|
26
|
-
export { helia } from './helia.
|
|
27
|
-
export { pubsub } from './pubsub.
|
|
28
|
-
export type { PubsubRoutingComponents, PubSub, Message, PublishResult, PubSubEvents } from './pubsub.
|
|
26
|
+
export { helia } from './helia.ts';
|
|
27
|
+
export { pubsub } from './pubsub.ts';
|
|
28
|
+
export type { PubsubRoutingComponents, PubSub, Message, PublishResult, PubSubEvents } from './pubsub.ts';
|
|
29
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { helia } from
|
|
2
|
-
export { pubsub } from
|
|
1
|
+
export { helia } from "./helia.js";
|
|
2
|
+
export { pubsub } from "./pubsub.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IPNSRouting } from './index.
|
|
1
|
+
import type { IPNSRouting } from './index.ts';
|
|
2
2
|
import type { PeerId, TypedEventTarget, ComponentLogger } from '@libp2p/interface';
|
|
3
3
|
import type { Datastore } from 'interface-datastore';
|
|
4
4
|
import type { ProgressEvent } from 'progress-events';
|
|
@@ -7,8 +7,8 @@ import { CustomProgressEvent } from 'progress-events';
|
|
|
7
7
|
import { equals as uint8ArrayEquals } from 'uint8arrays/equals';
|
|
8
8
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
9
9
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
|
|
10
|
-
import { InvalidTopicError } from
|
|
11
|
-
import { localStore } from
|
|
10
|
+
import { InvalidTopicError } from "../errors.js";
|
|
11
|
+
import { localStore } from "../local-store.js";
|
|
12
12
|
const log = logger('helia:ipns:routing:pubsub');
|
|
13
13
|
class PubSubRouting {
|
|
14
14
|
subscriptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/ipns",
|
|
3
|
-
"version": "9.1.9-
|
|
3
|
+
"version": "9.1.9-397f2d86",
|
|
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",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"test:electron-main": "aegir test -t electron-main"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@helia/interface": "6.1.1-
|
|
76
|
+
"@helia/interface": "6.1.1-397f2d86",
|
|
77
77
|
"@libp2p/crypto": "^5.1.7",
|
|
78
|
-
"@libp2p/interface": "^3.
|
|
78
|
+
"@libp2p/interface": "^3.2.0",
|
|
79
79
|
"@libp2p/kad-dht": "^16.1.0",
|
|
80
80
|
"@libp2p/keychain": "^6.0.5",
|
|
81
81
|
"@libp2p/logger": "^6.0.5",
|
|
@@ -84,17 +84,17 @@
|
|
|
84
84
|
"ipns": "^10.1.2",
|
|
85
85
|
"multiformats": "^13.4.1",
|
|
86
86
|
"progress-events": "^1.0.1",
|
|
87
|
-
"protons-runtime": "^
|
|
87
|
+
"protons-runtime": "^6.0.1",
|
|
88
88
|
"uint8arraylist": "^2.4.8",
|
|
89
89
|
"uint8arrays": "^5.1.0"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@libp2p/crypto": "^5.1.12",
|
|
93
|
-
"@libp2p/peer-id": "^6.0.
|
|
93
|
+
"@libp2p/peer-id": "^6.0.6",
|
|
94
94
|
"aegir": "^47.0.22",
|
|
95
95
|
"datastore-core": "^11.0.2",
|
|
96
96
|
"it-drain": "^3.0.10",
|
|
97
|
-
"protons": "^
|
|
97
|
+
"protons": "^8.1.1",
|
|
98
98
|
"sinon": "^21.0.0",
|
|
99
99
|
"sinon-ts": "^2.0.0"
|
|
100
100
|
},
|
package/src/index.ts
CHANGED
|
@@ -181,13 +181,13 @@
|
|
|
181
181
|
|
|
182
182
|
import { ipnsValidator } from 'ipns/validator'
|
|
183
183
|
import { CID } from 'multiformats/cid'
|
|
184
|
-
import { IPNSResolver as IPNSResolverClass } from './ipns/resolver.
|
|
185
|
-
import { IPNS as IPNSClass } from './ipns.
|
|
184
|
+
import { IPNSResolver as IPNSResolverClass } from './ipns/resolver.ts'
|
|
185
|
+
import { IPNS as IPNSClass } from './ipns.ts'
|
|
186
186
|
import { localStore } from './local-store.ts'
|
|
187
|
-
import { helia } from './routing/index.
|
|
187
|
+
import { helia } from './routing/index.ts'
|
|
188
188
|
import { localStoreRouting } from './routing/local-store.ts'
|
|
189
|
-
import type { IPNSResolverComponents } from './ipns/resolver.
|
|
190
|
-
import type { IPNSRouting, IPNSRoutingProgressEvents } from './routing/index.
|
|
189
|
+
import type { IPNSResolverComponents } from './ipns/resolver.ts'
|
|
190
|
+
import type { IPNSRouting, IPNSRoutingProgressEvents } from './routing/index.ts'
|
|
191
191
|
import type { Routing, HeliaEvents } from '@helia/interface'
|
|
192
192
|
import type { AbortOptions, ComponentLogger, Libp2p, PeerId, PublicKey, TypedEventEmitter } from '@libp2p/interface'
|
|
193
193
|
import type { Keychain } from '@libp2p/keychain'
|
|
@@ -355,7 +355,7 @@ export interface IPNS {
|
|
|
355
355
|
unpublish(keyName: string, options?: AbortOptions): Promise<void>
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
export type { IPNSRouting } from './routing/index.
|
|
358
|
+
export type { IPNSRouting } from './routing/index.ts'
|
|
359
359
|
|
|
360
360
|
export type { IPNSRecord } from 'ipns'
|
|
361
361
|
|
package/src/ipns/publisher.ts
CHANGED
|
@@ -4,9 +4,9 @@ import { createIPNSRecord, marshalIPNSRecord, multihashToIPNSRoutingKey, unmarsh
|
|
|
4
4
|
import { CID } from 'multiformats/cid'
|
|
5
5
|
import { CustomProgressEvent } from 'progress-events'
|
|
6
6
|
import { DEFAULT_LIFETIME_MS, DEFAULT_TTL_NS } from '../constants.ts'
|
|
7
|
-
import type { IPNSPublishResult, PublishOptions } from '../index.
|
|
8
|
-
import type { LocalStore } from '../local-store.
|
|
9
|
-
import type { IPNSRouting } from '../routing/index.
|
|
7
|
+
import type { IPNSPublishResult, PublishOptions } from '../index.ts'
|
|
8
|
+
import type { LocalStore } from '../local-store.ts'
|
|
9
|
+
import type { IPNSRouting } from '../routing/index.ts'
|
|
10
10
|
import type { AbortOptions, ComponentLogger, Libp2p, PeerId, PrivateKey, PublicKey } from '@libp2p/interface'
|
|
11
11
|
import type { Keychain } from '@libp2p/keychain'
|
|
12
12
|
import type { Datastore } from 'interface-datastore'
|
package/src/ipns/republisher.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Queue, repeatingTask } from '@libp2p/utils'
|
|
2
2
|
import { createIPNSRecord, marshalIPNSRecord, unmarshalIPNSRecord } from 'ipns'
|
|
3
3
|
import { DEFAULT_REPUBLISH_CONCURRENCY, DEFAULT_REPUBLISH_INTERVAL_MS, DEFAULT_TTL_NS } from '../constants.ts'
|
|
4
|
-
import { shouldRepublish } from '../utils.
|
|
5
|
-
import type { LocalStore } from '../local-store.
|
|
6
|
-
import type { IPNSRouting } from '../routing/index.
|
|
4
|
+
import { shouldRepublish } from '../utils.ts'
|
|
5
|
+
import type { LocalStore } from '../local-store.ts'
|
|
6
|
+
import type { IPNSRouting } from '../routing/index.ts'
|
|
7
7
|
import type { AbortOptions, ComponentLogger, Libp2p, Logger, PrivateKey } from '@libp2p/interface'
|
|
8
8
|
import type { Keychain } from '@libp2p/keychain'
|
|
9
9
|
import type { RepeatingTask } from '@libp2p/utils'
|
package/src/ipns/resolver.ts
CHANGED
|
@@ -7,11 +7,11 @@ import { base58btc } from 'multiformats/bases/base58'
|
|
|
7
7
|
import { CID } from 'multiformats/cid'
|
|
8
8
|
import * as Digest from 'multiformats/hashes/digest'
|
|
9
9
|
import { DEFAULT_TTL_NS } from '../constants.ts'
|
|
10
|
-
import { InvalidValueError, RecordNotFoundError, RecordsFailedValidationError, UnsupportedMultibasePrefixError, UnsupportedMultihashCodecError } from '../errors.
|
|
11
|
-
import { isCodec, IDENTITY_CODEC, SHA2_256_CODEC, isLibp2pCID } from '../utils.
|
|
12
|
-
import type { IPNSResolveResult, ResolveOptions, ResolveResult } from '../index.
|
|
13
|
-
import type { LocalStore } from '../local-store.
|
|
14
|
-
import type { IPNSRouting } from '../routing/index.
|
|
10
|
+
import { InvalidValueError, RecordNotFoundError, RecordsFailedValidationError, UnsupportedMultibasePrefixError, UnsupportedMultihashCodecError } from '../errors.ts'
|
|
11
|
+
import { isCodec, IDENTITY_CODEC, SHA2_256_CODEC, isLibp2pCID } from '../utils.ts'
|
|
12
|
+
import type { IPNSResolveResult, ResolveOptions, ResolveResult } from '../index.ts'
|
|
13
|
+
import type { LocalStore } from '../local-store.ts'
|
|
14
|
+
import type { IPNSRouting } from '../routing/index.ts'
|
|
15
15
|
import type { Routing } from '@helia/interface'
|
|
16
16
|
import type { ComponentLogger, Logger, PeerId, PublicKey } from '@libp2p/interface'
|
|
17
17
|
import type { Datastore } from 'interface-datastore'
|
package/src/ipns.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { CID } from 'multiformats/cid'
|
|
|
2
2
|
import { IPNSPublisher } from './ipns/publisher.ts'
|
|
3
3
|
import { IPNSRepublisher } from './ipns/republisher.ts'
|
|
4
4
|
import { IPNSResolver } from './ipns/resolver.ts'
|
|
5
|
-
import { localStore } from './local-store.
|
|
6
|
-
import { helia } from './routing/helia.
|
|
5
|
+
import { localStore } from './local-store.ts'
|
|
6
|
+
import { helia } from './routing/helia.ts'
|
|
7
7
|
import { localStoreRouting } from './routing/local-store.ts'
|
|
8
|
-
import type { IPNSComponents, IPNS as IPNSInterface, IPNSOptions, IPNSPublishResult, IPNSResolveResult, PublishOptions, ResolveOptions } from './index.
|
|
9
|
-
import type { LocalStore } from './local-store.
|
|
10
|
-
import type { IPNSRouting } from './routing/index.
|
|
8
|
+
import type { IPNSComponents, IPNS as IPNSInterface, IPNSOptions, IPNSPublishResult, IPNSResolveResult, PublishOptions, ResolveOptions } from './index.ts'
|
|
9
|
+
import type { LocalStore } from './local-store.ts'
|
|
10
|
+
import type { IPNSRouting } from './routing/index.ts'
|
|
11
11
|
import type { AbortOptions, PeerId, PublicKey, Startable } from '@libp2p/interface'
|
|
12
12
|
import type { MultihashDigest } from 'multiformats/hashes/interface'
|
|
13
13
|
|
package/src/local-store.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { Record } from '@libp2p/kad-dht'
|
|
|
2
2
|
import { CustomProgressEvent } from 'progress-events'
|
|
3
3
|
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
|
|
4
4
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
5
|
-
import { IPNSPublishMetadata } from './pb/metadata.
|
|
6
|
-
import { dhtRoutingKey, DHT_RECORD_PREFIX, ipnsMetadataKey } from './utils.
|
|
7
|
-
import type { DatastoreProgressEvents, GetOptions, PutOptions } from './routing/index.
|
|
5
|
+
import { IPNSPublishMetadata } from './pb/metadata.ts'
|
|
6
|
+
import { dhtRoutingKey, DHT_RECORD_PREFIX, ipnsMetadataKey } from './utils.ts'
|
|
7
|
+
import type { DatastoreProgressEvents, GetOptions, PutOptions } from './routing/index.ts'
|
|
8
8
|
import type { AbortOptions, Logger } from '@libp2p/interface'
|
|
9
9
|
import type { Datastore } from 'interface-datastore'
|
|
10
10
|
|
package/src/pb/metadata.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decodeMessage, encodeMessage, message } from 'protons-runtime'
|
|
1
|
+
import { decodeMessage, encodeMessage, message, streamMessage } from 'protons-runtime'
|
|
2
2
|
import type { Codec, DecodeOptions } from 'protons-runtime'
|
|
3
3
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
4
4
|
|
|
@@ -58,17 +58,58 @@ export namespace IPNSPublishMetadata {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
return obj
|
|
61
|
+
}, function * (reader, length, prefix, opts = {}) {
|
|
62
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
63
|
+
|
|
64
|
+
while (reader.pos < end) {
|
|
65
|
+
const tag = reader.uint32()
|
|
66
|
+
|
|
67
|
+
switch (tag >>> 3) {
|
|
68
|
+
case 1: {
|
|
69
|
+
yield {
|
|
70
|
+
field: `${prefix}.keyName`,
|
|
71
|
+
value: reader.string()
|
|
72
|
+
}
|
|
73
|
+
break
|
|
74
|
+
}
|
|
75
|
+
case 2: {
|
|
76
|
+
yield {
|
|
77
|
+
field: `${prefix}.lifetime`,
|
|
78
|
+
value: reader.uint32()
|
|
79
|
+
}
|
|
80
|
+
break
|
|
81
|
+
}
|
|
82
|
+
default: {
|
|
83
|
+
reader.skipType(tag & 7)
|
|
84
|
+
break
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
61
88
|
})
|
|
62
89
|
}
|
|
63
90
|
|
|
64
91
|
return _codec
|
|
65
92
|
}
|
|
66
93
|
|
|
67
|
-
export
|
|
94
|
+
export interface IPNSPublishMetadataKeyNameFieldEvent {
|
|
95
|
+
field: '$.keyName'
|
|
96
|
+
value: string
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface IPNSPublishMetadataLifetimeFieldEvent {
|
|
100
|
+
field: '$.lifetime'
|
|
101
|
+
value: number
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function encode (obj: Partial<IPNSPublishMetadata>): Uint8Array {
|
|
68
105
|
return encodeMessage(obj, IPNSPublishMetadata.codec())
|
|
69
106
|
}
|
|
70
107
|
|
|
71
|
-
export
|
|
108
|
+
export function decode (buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<IPNSPublishMetadata>): IPNSPublishMetadata {
|
|
72
109
|
return decodeMessage(buf, IPNSPublishMetadata.codec(), opts)
|
|
73
110
|
}
|
|
111
|
+
|
|
112
|
+
export function stream (buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<IPNSPublishMetadata>): Generator<IPNSPublishMetadataKeyNameFieldEvent | IPNSPublishMetadataLifetimeFieldEvent> {
|
|
113
|
+
return streamMessage(buf, IPNSPublishMetadata.codec(), opts)
|
|
114
|
+
}
|
|
74
115
|
}
|
package/src/routing/helia.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CustomProgressEvent } from 'progress-events'
|
|
2
|
-
import type { GetOptions, PutOptions } from './index.
|
|
3
|
-
import type { IPNSRouting } from '../index.
|
|
2
|
+
import type { GetOptions, PutOptions } from './index.ts'
|
|
3
|
+
import type { IPNSRouting } from '../index.ts'
|
|
4
4
|
import type { Routing } from '@helia/interface'
|
|
5
5
|
import type { ProgressEvent } from 'progress-events'
|
|
6
6
|
|
package/src/routing/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { HeliaRoutingProgressEvents } from './helia.
|
|
2
|
-
import type { DatastoreProgressEvents } from '../index.
|
|
3
|
-
import type { PubSubProgressEvents } from './pubsub.
|
|
1
|
+
import type { HeliaRoutingProgressEvents } from './helia.ts'
|
|
2
|
+
import type { DatastoreProgressEvents } from '../index.ts'
|
|
3
|
+
import type { PubSubProgressEvents } from './pubsub.ts'
|
|
4
4
|
import type { IPNSPublishMetadata } from '../pb/metadata.ts'
|
|
5
5
|
import type { AbortOptions } from '@libp2p/interface'
|
|
6
6
|
import type { ProgressOptions } from 'progress-events'
|
|
@@ -32,6 +32,6 @@ export type IPNSRoutingProgressEvents =
|
|
|
32
32
|
HeliaRoutingProgressEvents |
|
|
33
33
|
PubSubProgressEvents
|
|
34
34
|
|
|
35
|
-
export { helia } from './helia.
|
|
36
|
-
export { pubsub } from './pubsub.
|
|
37
|
-
export type { PubsubRoutingComponents, PubSub, Message, PublishResult, PubSubEvents } from './pubsub.
|
|
35
|
+
export { helia } from './helia.ts'
|
|
36
|
+
export { pubsub } from './pubsub.ts'
|
|
37
|
+
export type { PubsubRoutingComponents, PubSub, Message, PublishResult, PubSubEvents } from './pubsub.ts'
|
package/src/routing/pubsub.ts
CHANGED
|
@@ -7,10 +7,10 @@ import { CustomProgressEvent } from 'progress-events'
|
|
|
7
7
|
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
|
|
8
8
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
9
9
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
|
|
10
|
-
import { InvalidTopicError } from '../errors.
|
|
11
|
-
import { localStore } from '../local-store.
|
|
12
|
-
import type { GetOptions, IPNSRouting, PutOptions } from './index.
|
|
13
|
-
import type { LocalStore } from '../local-store.
|
|
10
|
+
import { InvalidTopicError } from '../errors.ts'
|
|
11
|
+
import { localStore } from '../local-store.ts'
|
|
12
|
+
import type { GetOptions, IPNSRouting, PutOptions } from './index.ts'
|
|
13
|
+
import type { LocalStore } from '../local-store.ts'
|
|
14
14
|
import type { PeerId, PublicKey, TypedEventTarget, ComponentLogger } from '@libp2p/interface'
|
|
15
15
|
import type { Datastore } from 'interface-datastore'
|
|
16
16
|
import type { MultihashDigest } from 'multiformats/hashes/interface'
|