@libp2p/gossipsub 15.0.17 → 15.0.19-8ddbb9e81

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,12 +1,12 @@
1
1
  import { TypedEventEmitter, serviceCapabilities, serviceDependencies } from '@libp2p/interface';
2
2
  import { StrictNoSign, StrictSign, TopicValidatorResult } from './index.ts';
3
- import { RPC } from './message/rpc.js';
4
- import { PeerScore } from './score/index.js';
5
- import { InboundStream, OutboundStream } from './stream.js';
6
- import { IWantTracer } from './tracer.js';
3
+ import { RPC } from './message/rpc.ts';
4
+ import { PeerScore } from './score/index.ts';
5
+ import { InboundStream, OutboundStream } from './stream.ts';
6
+ import { IWantTracer } from './tracer.ts';
7
7
  import type { GossipSubComponents, GossipSubEvents, GossipsubOpts, PublishResult, TopicValidatorFn } from './index.ts';
8
- import type { PeerScoreParams, PeerScoreThresholds, PeerScoreStatsDump } from './score/index.js';
9
- import type { TopicStr, MsgIdStr, PeerIdStr, PublishOpts } from './types.js';
8
+ import type { PeerScoreParams, PeerScoreThresholds, PeerScoreStatsDump } from './score/index.ts';
9
+ import type { TopicStr, MsgIdStr, PeerIdStr, PublishOpts } from './types.ts';
10
10
  import type { PeerId, Logger, TypedEventTarget } from '@libp2p/interface';
11
11
  interface GossipOptions extends GossipsubOpts {
12
12
  scoreParams: PeerScoreParams;
@@ -4,26 +4,26 @@ import { encode } from 'it-length-prefixed';
4
4
  import { pipe } from 'it-pipe';
5
5
  import { pushable } from 'it-pushable';
6
6
  import * as Digest from 'multiformats/hashes/digest';
7
- import * as constants from './constants.js';
8
- import { ACCEPT_FROM_WHITELIST_DURATION_MS, ACCEPT_FROM_WHITELIST_MAX_MESSAGES, ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE, BACKOFF_SLACK } from './constants.js';
7
+ import * as constants from "./constants.js";
8
+ import { ACCEPT_FROM_WHITELIST_DURATION_MS, ACCEPT_FROM_WHITELIST_MAX_MESSAGES, ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE, BACKOFF_SLACK } from "./constants.js";
9
9
  import { StrictNoSign, StrictSign, TopicValidatorResult } from "./index.js";
10
- import { defaultDecodeRpcLimits } from './message/decodeRpc.js';
11
- import { RPC } from './message/rpc.js';
12
- import { MessageCache } from './message-cache.js';
13
- import { ChurnReason, getMetrics, IHaveIgnoreReason, InclusionReason, ScorePenalty } from './metrics.js';
14
- import { PeerScore, createPeerScoreParams, createPeerScoreThresholds } from './score/index.js';
15
- import { computeAllPeersScoreWeights } from './score/scoreMetrics.js';
16
- import { InboundStream, OutboundStream } from './stream.js';
17
- import { IWantTracer } from './tracer.js';
18
- import { ValidateError, MessageStatus, RejectReason, rejectReasonFromAcceptance } from './types.js';
19
- import { buildRawMessage, validateToRawMessage } from './utils/buildRawMessage.js';
20
- import { createGossipRpc, ensureControl } from './utils/create-gossip-rpc.js';
21
- import { shuffle, messageIdToString } from './utils/index.js';
22
- import { msgIdFnStrictNoSign, msgIdFnStrictSign } from './utils/msgIdFn.js';
23
- import { multiaddrToIPStr } from './utils/multiaddr.js';
24
- import { getPublishConfigFromPeerId } from './utils/publishConfig.js';
25
- import { removeFirstNItemsFromSet, removeItemsFromSet } from './utils/set.js';
26
- import { SimpleTimeCache } from './utils/time-cache.js';
10
+ import { defaultDecodeRpcLimits } from "./message/decodeRpc.js";
11
+ import { RPC } from "./message/rpc.js";
12
+ import { MessageCache } from "./message-cache.js";
13
+ import { ChurnReason, getMetrics, IHaveIgnoreReason, InclusionReason, ScorePenalty } from "./metrics.js";
14
+ import { PeerScore, createPeerScoreParams, createPeerScoreThresholds } from "./score/index.js";
15
+ import { computeAllPeersScoreWeights } from "./score/scoreMetrics.js";
16
+ import { InboundStream, OutboundStream } from "./stream.js";
17
+ import { IWantTracer } from "./tracer.js";
18
+ import { ValidateError, MessageStatus, RejectReason, rejectReasonFromAcceptance } from "./types.js";
19
+ import { buildRawMessage, validateToRawMessage } from "./utils/buildRawMessage.js";
20
+ import { createGossipRpc, ensureControl } from "./utils/create-gossip-rpc.js";
21
+ import { shuffle, messageIdToString } from "./utils/index.js";
22
+ import { msgIdFnStrictNoSign, msgIdFnStrictSign } from "./utils/msgIdFn.js";
23
+ import { multiaddrToIPStr } from "./utils/multiaddr.js";
24
+ import { getPublishConfigFromPeerId } from "./utils/publishConfig.js";
25
+ import { removeFirstNItemsFromSet, removeItemsFromSet } from "./utils/set.js";
26
+ import { SimpleTimeCache } from "./utils/time-cache.js";
27
27
  var GossipStatusCode;
28
28
  (function (GossipStatusCode) {
29
29
  GossipStatusCode[GossipStatusCode["started"] = 0] = "started";
@@ -1,9 +1,9 @@
1
- import { MessageCache } from './message-cache.js';
2
- import type { GossipsubOptsSpec } from './config.js';
3
- import type { DecodeRPCLimits } from './message/decodeRpc.js';
4
- import type { MetricsRegister, TopicStrToLabel } from './metrics.js';
5
- import type { PeerScoreParams, PeerScoreThresholds } from './score/index.js';
6
- import type { MsgIdFn, MsgIdStr, FastMsgIdFn, AddrInfo, DataTransform, MsgIdToStrFn } from './types.js';
1
+ import { MessageCache } from './message-cache.ts';
2
+ import type { GossipsubOptsSpec } from './config.ts';
3
+ import type { DecodeRPCLimits } from './message/decodeRpc.ts';
4
+ import type { MetricsRegister, TopicStrToLabel } from './metrics.ts';
5
+ import type { PeerScoreParams, PeerScoreThresholds } from './score/index.ts';
6
+ import type { MsgIdFn, MsgIdStr, FastMsgIdFn, AddrInfo, DataTransform, MsgIdToStrFn } from './types.ts';
7
7
  import type { PeerId, PeerStore, ComponentLogger, PrivateKey, PublicKey, TypedEventTarget, MessageStreamDirection } from '@libp2p/interface';
8
8
  import type { ConnectionManager, Registrar } from '@libp2p/interface-internal';
9
9
  /**
package/dist/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import * as constants from './constants.js';
1
+ import * as constants from "./constants.js";
2
2
  import { GossipSub as GossipSubClass } from "./gossipsub.js";
3
- import { MessageCache } from './message-cache.js';
3
+ import { MessageCache } from "./message-cache.js";
4
4
  /**
5
5
  * On the producing side:
6
6
  * - Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields.
@@ -1,2 +1,2 @@
1
- export * from './rpc.js';
1
+ export * from './rpc.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './rpc.js';
1
+ export * from "./rpc.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import type { RPC } from './message/rpc.js';
2
- import type { MessageId, MsgIdStr, PeerIdStr, TopicStr, MsgIdToStrFn } from './types.js';
1
+ import type { RPC } from './message/rpc.ts';
2
+ import type { MessageId, MsgIdStr, PeerIdStr, TopicStr, MsgIdToStrFn } from './types.ts';
3
3
  export type CacheEntry = MessageId & {
4
4
  topic: TopicStr;
5
5
  };
@@ -1,8 +1,8 @@
1
1
  import { TopicValidatorResult } from './index.ts';
2
- import { MessageStatus, RejectReason } from './types.js';
3
- import type { RPC } from './message/rpc.js';
4
- import type { PeerScoreThresholds } from './score/peer-score-thresholds.js';
5
- import type { PeerIdStr, RejectReasonObj, TopicStr, ValidateError } from './types.js';
2
+ import { MessageStatus, RejectReason } from './types.ts';
3
+ import type { RPC } from './message/rpc.ts';
4
+ import type { PeerScoreThresholds } from './score/peer-score-thresholds.ts';
5
+ import type { PeerIdStr, RejectReasonObj, TopicStr, ValidateError } from './types.ts';
6
6
  /** Topic label as provided in `topicStrToLabel` */
7
7
  export type TopicLabel = string;
8
8
  export type TopicStrToLabel = Map<TopicStr, TopicLabel>;
@@ -1,5 +1,5 @@
1
1
  import { TopicValidatorResult } from "./index.js";
2
- import { MessageStatus, RejectReason } from './types.js';
2
+ import { MessageStatus, RejectReason } from "./types.js";
3
3
  export var MessageSource;
4
4
  (function (MessageSource) {
5
5
  MessageSource["forward"] = "forward";
@@ -1,4 +1,4 @@
1
- import type { PeerScoreParams } from './peer-score-params.js';
2
- import type { PeerStats } from './peer-stats.js';
1
+ import type { PeerScoreParams } from './peer-score-params.ts';
2
+ import type { PeerStats } from './peer-stats.ts';
3
3
  export declare function computeScore(peer: string, pstats: PeerStats, params: PeerScoreParams, peerIPs: Map<string, Set<string>>): number;
4
4
  //# sourceMappingURL=compute-score.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from './peer-score-params.js';
2
- export * from './peer-score-thresholds.js';
3
- export * from './peer-score.js';
1
+ export * from './peer-score-params.ts';
2
+ export * from './peer-score-thresholds.ts';
3
+ export * from './peer-score.ts';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from './peer-score-params.js';
2
- export * from './peer-score-thresholds.js';
3
- export * from './peer-score.js';
1
+ export * from "./peer-score-params.js";
2
+ export * from "./peer-score-thresholds.js";
3
+ export * from "./peer-score.js";
4
4
  //# sourceMappingURL=index.js.map
@@ -1,10 +1,10 @@
1
1
  import { RejectReason } from '../types.js';
2
2
  import { MapDef } from '../utils/set.js';
3
- import { computeScore } from './compute-score.js';
4
- import { MessageDeliveries } from './message-deliveries.js';
3
+ import { computeScore } from './compute-score.ts';
4
+ import { MessageDeliveries } from './message-deliveries.ts';
5
5
  import type { MsgIdStr, PeerIdStr, TopicStr } from '../types.js';
6
- import type { PeerScoreParams } from './peer-score-params.js';
7
- import type { PeerStats } from './peer-stats.js';
6
+ import type { PeerScoreParams } from './peer-score-params.ts';
7
+ import type { PeerStats } from './peer-stats.ts';
8
8
  import type { Metrics, ScorePenalty } from '../metrics.js';
9
9
  import type { ComponentLogger } from '@libp2p/interface';
10
10
  interface PeerScoreOpts {
@@ -1,8 +1,8 @@
1
1
  import { RejectReason } from '../types.js';
2
2
  import { MapDef } from '../utils/set.js';
3
- import { computeScore } from './compute-score.js';
4
- import { MessageDeliveries, DeliveryRecordStatus } from './message-deliveries.js';
5
- import { validatePeerScoreParams } from './peer-score-params.js';
3
+ import { computeScore } from "./compute-score.js";
4
+ import { MessageDeliveries, DeliveryRecordStatus } from "./message-deliveries.js";
5
+ import { validatePeerScoreParams } from "./peer-score-params.js";
6
6
  export class PeerScore {
7
7
  params;
8
8
  metrics;
@@ -1,5 +1,5 @@
1
- import type { PeerScoreParams } from './peer-score-params.js';
2
- import type { PeerStats } from './peer-stats.js';
1
+ import type { PeerScoreParams } from './peer-score-params.ts';
2
+ import type { PeerStats } from './peer-stats.ts';
3
3
  type TopicLabel = string;
4
4
  type TopicStr = string;
5
5
  type TopicStrToLabel = Map<TopicStr, TopicLabel>;
@@ -1,6 +1,6 @@
1
- import { RejectReason } from './types.js';
2
- import type { Metrics } from './metrics.js';
3
- import type { MsgIdStr, MsgIdToStrFn, PeerIdStr } from './types.js';
1
+ import { RejectReason } from './types.ts';
2
+ import type { Metrics } from './metrics.ts';
3
+ import type { MsgIdStr, MsgIdToStrFn, PeerIdStr } from './types.ts';
4
4
  /**
5
5
  * IWantTracer is an internal tracer that tracks IWANT requests in order to penalize
6
6
  * peers who don't follow up on IWANT requests after an IHAVE advertisement.
@@ -1,4 +1,4 @@
1
- import { RejectReason } from './types.js';
1
+ import { RejectReason } from "./types.js";
2
2
  /**
3
3
  * IWantTracer is an internal tracer that tracks IWANT requests in order to penalize
4
4
  * peers who don't follow up on IWANT requests after an IHAVE advertisement.
@@ -1,6 +1,6 @@
1
1
  import { TopicValidatorResult } from './index.ts';
2
2
  import type { Message } from './index.ts';
3
- import type { RPC } from './message/rpc.js';
3
+ import type { RPC } from './message/rpc.ts';
4
4
  import type { PrivateKey, PeerId } from '@libp2p/interface';
5
5
  import type { Multiaddr } from '@multiformats/multiaddr';
6
6
  export type MsgIdStr = string;
@@ -1,4 +1,4 @@
1
- export * from './shuffle.js';
2
- export * from './messageIdToString.js';
3
- export { getPublishConfigFromPeerId } from './publishConfig.js';
1
+ export * from './shuffle.ts';
2
+ export * from './messageIdToString.ts';
3
+ export { getPublishConfigFromPeerId } from './publishConfig.ts';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from './shuffle.js';
2
- export * from './messageIdToString.js';
3
- export { getPublishConfigFromPeerId } from './publishConfig.js';
1
+ export * from "./shuffle.js";
2
+ export * from "./messageIdToString.js";
3
+ export { getPublishConfigFromPeerId } from "./publishConfig.js";
4
4
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/gossipsub",
3
- "version": "15.0.17",
3
+ "version": "15.0.19-8ddbb9e81",
4
4
  "description": "A typescript implementation of gossipsub",
5
5
  "files": [
6
6
  "src",
@@ -13,23 +13,28 @@
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./dist/src/index.d.ts",
16
- "import": "./dist/src/index.js"
17
- },
18
- "./metrics": {
19
- "types": "./dist/src/metrics.d.ts",
20
- "import": "./dist/src/metrics.js"
16
+ "import": "./dist/src/index.js",
17
+ "module-sync": "./dist/src/index.js"
21
18
  },
22
19
  "./message": {
23
20
  "types": "./dist/src/message/index.d.ts",
24
- "import": "./dist/src/message/index.js"
21
+ "import": "./dist/src/message/index.js",
22
+ "module-sync": "./dist/src/message/index.js"
23
+ },
24
+ "./metrics": {
25
+ "types": "./dist/src/metrics.d.ts",
26
+ "import": "./dist/src/metrics.js",
27
+ "module-sync": "./dist/src/metrics.js"
25
28
  },
26
29
  "./score": {
27
30
  "types": "./dist/src/score/index.d.ts",
28
- "import": "./dist/src/score/index.js"
31
+ "import": "./dist/src/score/index.js",
32
+ "module-sync": "./dist/src/score/index.js"
29
33
  },
30
34
  "./types": {
31
35
  "types": "./dist/src/types.d.ts",
32
- "import": "./dist/src/types.js"
36
+ "import": "./dist/src/types.js",
37
+ "module-sync": "./dist/src/types.js"
33
38
  }
34
39
  },
35
40
  "typesVersions": {
@@ -60,7 +65,7 @@
60
65
  },
61
66
  "repository": {
62
67
  "type": "git",
63
- "url": "git+https://github.com/ChainSafe/js-libp2p-gossipsub.git"
68
+ "url": "git+https://github.com/libp2p/js-libp2p.git"
64
69
  },
65
70
  "keywords": [
66
71
  "libp2p",
@@ -70,15 +75,15 @@
70
75
  "author": "Cayman Nava",
71
76
  "license": "Apache-2.0",
72
77
  "bugs": {
73
- "url": "https://github.com/ChainSafe/js-libp2p-gossipsub/issues"
78
+ "url": "https://github.com/libp2p/js-libp2p/issues"
74
79
  },
75
- "homepage": "https://github.com/ChainSafe/js-libp2p-gossipsub#readme",
80
+ "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/gossipsub#readme",
76
81
  "dependencies": {
77
- "@libp2p/crypto": "^5.1.15",
78
- "@libp2p/interface": "^3.2.0",
79
- "@libp2p/interface-internal": "^3.1.0",
80
- "@libp2p/peer-id": "^6.0.6",
81
- "@libp2p/utils": "^7.0.15",
82
+ "@libp2p/crypto": "5.1.17-8ddbb9e81",
83
+ "@libp2p/interface": "3.2.2-8ddbb9e81",
84
+ "@libp2p/interface-internal": "3.1.2-8ddbb9e81",
85
+ "@libp2p/peer-id": "6.0.8-8ddbb9e81",
86
+ "@libp2p/utils": "7.0.17-8ddbb9e81",
82
87
  "@multiformats/multiaddr": "^13.0.1",
83
88
  "denque": "^2.1.0",
84
89
  "it-length-prefixed": "^10.0.1",
@@ -92,11 +97,11 @@
92
97
  "devDependencies": {
93
98
  "@chainsafe/as-sha256": "^1.2.0",
94
99
  "@dapplion/benchmark": "^1.0.0",
95
- "@libp2p/floodsub": "^11.0.16",
96
- "@libp2p/logger": "^6.2.4",
97
- "@libp2p/peer-store": "^12.0.15",
100
+ "@libp2p/floodsub": "11.0.18-8ddbb9e81",
101
+ "@libp2p/logger": "6.2.6-8ddbb9e81",
102
+ "@libp2p/peer-store": "12.0.17-8ddbb9e81",
98
103
  "@types/node": "^22.18.1",
99
- "@types/sinon": "^20.0.0",
104
+ "@types/sinon": "^21.0.1",
100
105
  "abortable-iterator": "^5.1.0",
101
106
  "aegir": "^47.0.21",
102
107
  "datastore-core": "^11.0.1",
@@ -105,7 +110,7 @@
105
110
  "mkdirp": "^3.0.1",
106
111
  "p-defer": "^4.0.0",
107
112
  "p-event": "^7.0.0",
108
- "p-retry": "^7.0.0",
113
+ "p-retry": "^8.0.0",
109
114
  "p-wait-for": "^6.0.0",
110
115
  "protons": "^8.1.1",
111
116
  "sinon": "^21.0.0",
package/src/gossipsub.ts CHANGED
@@ -4,17 +4,17 @@ import { encode } from 'it-length-prefixed'
4
4
  import { pipe } from 'it-pipe'
5
5
  import { pushable } from 'it-pushable'
6
6
  import * as Digest from 'multiformats/hashes/digest'
7
- import * as constants from './constants.js'
7
+ import * as constants from './constants.ts'
8
8
  import {
9
9
  ACCEPT_FROM_WHITELIST_DURATION_MS,
10
10
  ACCEPT_FROM_WHITELIST_MAX_MESSAGES,
11
11
  ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE,
12
12
  BACKOFF_SLACK
13
- } from './constants.js'
13
+ } from './constants.ts'
14
14
  import { StrictNoSign, StrictSign, TopicValidatorResult } from './index.ts'
15
- import { defaultDecodeRpcLimits } from './message/decodeRpc.js'
16
- import { RPC } from './message/rpc.js'
17
- import { MessageCache } from './message-cache.js'
15
+ import { defaultDecodeRpcLimits } from './message/decodeRpc.ts'
16
+ import { RPC } from './message/rpc.ts'
17
+ import { MessageCache } from './message-cache.ts'
18
18
  import {
19
19
  ChurnReason,
20
20
  getMetrics,
@@ -23,17 +23,17 @@ import {
23
23
 
24
24
  ScorePenalty
25
25
 
26
- } from './metrics.js'
26
+ } from './metrics.ts'
27
27
  import {
28
28
  PeerScore,
29
29
 
30
30
  createPeerScoreParams,
31
31
  createPeerScoreThresholds
32
32
 
33
- } from './score/index.js'
34
- import { computeAllPeersScoreWeights } from './score/scoreMetrics.js'
35
- import { InboundStream, OutboundStream } from './stream.js'
36
- import { IWantTracer } from './tracer.js'
33
+ } from './score/index.ts'
34
+ import { computeAllPeersScoreWeights } from './score/scoreMetrics.ts'
35
+ import { InboundStream, OutboundStream } from './stream.ts'
36
+ import { IWantTracer } from './tracer.ts'
37
37
  import {
38
38
 
39
39
  ValidateError,
@@ -43,21 +43,21 @@ import {
43
43
 
44
44
  rejectReasonFromAcceptance
45
45
 
46
- } from './types.js'
47
- import { buildRawMessage, validateToRawMessage } from './utils/buildRawMessage.js'
48
- import { createGossipRpc, ensureControl } from './utils/create-gossip-rpc.js'
49
- import { shuffle, messageIdToString } from './utils/index.js'
50
- import { msgIdFnStrictNoSign, msgIdFnStrictSign } from './utils/msgIdFn.js'
51
- import { multiaddrToIPStr } from './utils/multiaddr.js'
52
- import { getPublishConfigFromPeerId } from './utils/publishConfig.js'
53
- import { removeFirstNItemsFromSet, removeItemsFromSet } from './utils/set.js'
54
- import { SimpleTimeCache } from './utils/time-cache.js'
46
+ } from './types.ts'
47
+ import { buildRawMessage, validateToRawMessage } from './utils/buildRawMessage.ts'
48
+ import { createGossipRpc, ensureControl } from './utils/create-gossip-rpc.ts'
49
+ import { shuffle, messageIdToString } from './utils/index.ts'
50
+ import { msgIdFnStrictNoSign, msgIdFnStrictSign } from './utils/msgIdFn.ts'
51
+ import { multiaddrToIPStr } from './utils/multiaddr.ts'
52
+ import { getPublishConfigFromPeerId } from './utils/publishConfig.ts'
53
+ import { removeFirstNItemsFromSet, removeItemsFromSet } from './utils/set.ts'
54
+ import { SimpleTimeCache } from './utils/time-cache.ts'
55
55
  import type { GossipSubComponents, GossipSubEvents, GossipsubMessage, GossipsubOpts, MeshPeer, Message, PublishResult, SubscriptionChangeData, TopicValidatorFn } from './index.ts'
56
- import type { DecodeRPCLimits } from './message/decodeRpc.js'
57
- import type { MessageCacheRecord } from './message-cache.js'
58
- import type { Metrics, ToSendGroupCount } from './metrics.js'
59
- import type { PeerScoreParams, PeerScoreThresholds, PeerScoreStatsDump } from './score/index.js'
60
- import type { MsgIdFn, PublishConfig, TopicStr, MsgIdStr, PeerIdStr, RejectReasonObj, FastMsgIdFn, DataTransform, MsgIdToStrFn, MessageId, PublishOpts } from './types.js'
56
+ import type { DecodeRPCLimits } from './message/decodeRpc.ts'
57
+ import type { MessageCacheRecord } from './message-cache.ts'
58
+ import type { Metrics, ToSendGroupCount } from './metrics.ts'
59
+ import type { PeerScoreParams, PeerScoreThresholds, PeerScoreStatsDump } from './score/index.ts'
60
+ import type { MsgIdFn, PublishConfig, TopicStr, MsgIdStr, PeerIdStr, RejectReasonObj, FastMsgIdFn, DataTransform, MsgIdToStrFn, MessageId, PublishOpts } from './types.ts'
61
61
  import type {
62
62
  Connection, Stream, PeerId, Peer,
63
63
  Logger,
package/src/index.ts CHANGED
@@ -1,11 +1,11 @@
1
- import * as constants from './constants.js'
1
+ import * as constants from './constants.ts'
2
2
  import { GossipSub as GossipSubClass } from './gossipsub.ts'
3
- import { MessageCache } from './message-cache.js'
4
- import type { GossipsubOptsSpec } from './config.js'
5
- import type { DecodeRPCLimits } from './message/decodeRpc.js'
6
- import type { MetricsRegister, TopicStrToLabel } from './metrics.js'
7
- import type { PeerScoreParams, PeerScoreThresholds } from './score/index.js'
8
- import type { MsgIdFn, MsgIdStr, FastMsgIdFn, AddrInfo, DataTransform, MsgIdToStrFn } from './types.js'
3
+ import { MessageCache } from './message-cache.ts'
4
+ import type { GossipsubOptsSpec } from './config.ts'
5
+ import type { DecodeRPCLimits } from './message/decodeRpc.ts'
6
+ import type { MetricsRegister, TopicStrToLabel } from './metrics.ts'
7
+ import type { PeerScoreParams, PeerScoreThresholds } from './score/index.ts'
8
+ import type { MsgIdFn, MsgIdStr, FastMsgIdFn, AddrInfo, DataTransform, MsgIdToStrFn } from './types.ts'
9
9
  import type {
10
10
  PeerId, PeerStore,
11
11
  ComponentLogger,
@@ -1 +1 @@
1
- export * from './rpc.js'
1
+ export * from './rpc.ts'
@@ -1,5 +1,5 @@
1
- import type { RPC } from './message/rpc.js'
2
- import type { MessageId, MsgIdStr, PeerIdStr, TopicStr, MsgIdToStrFn } from './types.js'
1
+ import type { RPC } from './message/rpc.ts'
2
+ import type { MessageId, MsgIdStr, PeerIdStr, TopicStr, MsgIdToStrFn } from './types.ts'
3
3
 
4
4
  export type CacheEntry = MessageId & {
5
5
  topic: TopicStr
package/src/metrics.ts CHANGED
@@ -4,10 +4,10 @@ import {
4
4
 
5
5
  RejectReason
6
6
 
7
- } from './types.js'
8
- import type { RPC } from './message/rpc.js'
9
- import type { PeerScoreThresholds } from './score/peer-score-thresholds.js'
10
- import type { PeerIdStr, RejectReasonObj, TopicStr, ValidateError } from './types.js'
7
+ } from './types.ts'
8
+ import type { RPC } from './message/rpc.ts'
9
+ import type { PeerScoreThresholds } from './score/peer-score-thresholds.ts'
10
+ import type { PeerIdStr, RejectReasonObj, TopicStr, ValidateError } from './types.ts'
11
11
 
12
12
  /** Topic label as provided in `topicStrToLabel` */
13
13
  export type TopicLabel = string
@@ -1,5 +1,5 @@
1
- import type { PeerScoreParams } from './peer-score-params.js'
2
- import type { PeerStats } from './peer-stats.js'
1
+ import type { PeerScoreParams } from './peer-score-params.ts'
2
+ import type { PeerStats } from './peer-stats.ts'
3
3
 
4
4
  export function computeScore (
5
5
  peer: string,
@@ -1,3 +1,3 @@
1
- export * from './peer-score-params.js'
2
- export * from './peer-score-thresholds.js'
3
- export * from './peer-score.js'
1
+ export * from './peer-score-params.ts'
2
+ export * from './peer-score-thresholds.ts'
3
+ export * from './peer-score.ts'
@@ -1,11 +1,11 @@
1
1
  import { RejectReason } from '../types.js'
2
2
  import { MapDef } from '../utils/set.js'
3
- import { computeScore } from './compute-score.js'
4
- import { MessageDeliveries, DeliveryRecordStatus } from './message-deliveries.js'
5
- import { validatePeerScoreParams } from './peer-score-params.js'
3
+ import { computeScore } from './compute-score.ts'
4
+ import { MessageDeliveries, DeliveryRecordStatus } from './message-deliveries.ts'
5
+ import { validatePeerScoreParams } from './peer-score-params.ts'
6
6
  import type { MsgIdStr, PeerIdStr, TopicStr, IPStr } from '../types.js'
7
- import type { PeerScoreParams } from './peer-score-params.js'
8
- import type { PeerStats, TopicStats } from './peer-stats.js'
7
+ import type { PeerScoreParams } from './peer-score-params.ts'
8
+ import type { PeerStats, TopicStats } from './peer-stats.ts'
9
9
  import type { Metrics, ScorePenalty } from '../metrics.js'
10
10
  import type { ComponentLogger, Logger } from '@libp2p/interface'
11
11
 
@@ -1,5 +1,5 @@
1
- import type { PeerScoreParams } from './peer-score-params.js'
2
- import type { PeerStats } from './peer-stats.js'
1
+ import type { PeerScoreParams } from './peer-score-params.ts'
2
+ import type { PeerStats } from './peer-stats.ts'
3
3
 
4
4
  type TopicLabel = string
5
5
  type TopicStr = string
package/src/tracer.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { RejectReason } from './types.js'
2
- import type { Metrics } from './metrics.js'
3
- import type { MsgIdStr, MsgIdToStrFn, PeerIdStr } from './types.js'
1
+ import { RejectReason } from './types.ts'
2
+ import type { Metrics } from './metrics.ts'
3
+ import type { MsgIdStr, MsgIdToStrFn, PeerIdStr } from './types.ts'
4
4
 
5
5
  /**
6
6
  * IWantTracer is an internal tracer that tracks IWANT requests in order to penalize
package/src/types.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TopicValidatorResult } from './index.ts'
2
2
  import type { Message } from './index.ts'
3
- import type { RPC } from './message/rpc.js'
3
+ import type { RPC } from './message/rpc.ts'
4
4
  import type { PrivateKey, PeerId } from '@libp2p/interface'
5
5
  import type { Multiaddr } from '@multiformats/multiaddr'
6
6
 
@@ -1,3 +1,3 @@
1
- export * from './shuffle.js'
2
- export * from './messageIdToString.js'
3
- export { getPublishConfigFromPeerId } from './publishConfig.js'
1
+ export * from './shuffle.ts'
2
+ export * from './messageIdToString.ts'
3
+ export { getPublishConfigFromPeerId } from './publishConfig.ts'