@olane/o-config 0.1.1 → 0.1.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 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAMpC,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,oBAAoB,CAAC,EAAE,GAAG,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,mBAAmB,EAAE,YAwBjC,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAKpC,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,oBAAoB,CAAC,EAAE,GAAG,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,mBAAmB,EAAE,YAwBjC,CAAC"}
@@ -1,34 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultLibp2pConfig = void 0;
4
- const tcp_1 = require("@libp2p/tcp");
5
- const libp2p_noise_1 = require("@chainsafe/libp2p-noise");
6
- const libp2p_yamux_1 = require("@chainsafe/libp2p-yamux");
7
- const ping_1 = require("@libp2p/ping");
8
- const identify_1 = require("@libp2p/identify");
9
- const libp2p_gossipsub_1 = require("@chainsafe/libp2p-gossipsub");
10
- const kad_dht_1 = require("@libp2p/kad-dht");
11
- const pubsub_peer_discovery_1 = require("@libp2p/pubsub-peer-discovery");
12
- exports.defaultLibp2pConfig = {
1
+ import { tcp } from '@libp2p/tcp';
2
+ import { noise } from '@chainsafe/libp2p-noise';
3
+ import { yamux } from '@chainsafe/libp2p-yamux';
4
+ import { ping } from '@libp2p/ping';
5
+ import { identify } from '@libp2p/identify';
6
+ import { gossipsub } from '@chainsafe/libp2p-gossipsub';
7
+ import { kadDHT, removePublicAddressesMapper } from '@libp2p/kad-dht';
8
+ import { pubsubPeerDiscovery } from '@libp2p/pubsub-peer-discovery';
9
+ export const defaultLibp2pConfig = {
13
10
  listeners: ['/ip4/0.0.0.0/tcp/0'],
14
- transports: [(0, tcp_1.tcp)()],
15
- connectionEncrypters: [(0, libp2p_noise_1.noise)()],
16
- streamMuxers: [(0, libp2p_yamux_1.yamux)()],
11
+ transports: [tcp()],
12
+ connectionEncrypters: [noise()],
13
+ streamMuxers: [yamux()],
17
14
  services: {
18
- ping: (0, ping_1.ping)(),
19
- identify: (0, identify_1.identify)(),
20
- pubsub: (0, libp2p_gossipsub_1.gossipsub)({
15
+ ping: ping(),
16
+ identify: identify(),
17
+ pubsub: gossipsub({
21
18
  // Enable message signing for security
22
19
  globalSignaturePolicy: 'StrictSign',
23
20
  }),
24
- dht: (0, kad_dht_1.kadDHT)({
21
+ dht: kadDHT({
25
22
  // protocol: '/ipfs/lan/kad/1.0.0',
26
- peerInfoMapper: kad_dht_1.removePublicAddressesMapper,
23
+ peerInfoMapper: removePublicAddressesMapper,
27
24
  clientMode: false, // DO NOT CHANGE THIS, it will break the network
28
25
  kBucketSize: 20, // peer size
29
26
  }),
30
27
  },
31
- peerDiscovery: [(0, pubsub_peer_discovery_1.pubsubPeerDiscovery)()],
28
+ peerDiscovery: [pubsubPeerDiscovery()],
32
29
  // peerRouters: [dht as any],
33
30
  // contentRouters: [dht as any],
34
31
  // Content routing is handled by the DHT service automatically
@@ -1,17 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./config.js"), exports);
1
+ export * from './config.js';
package/dist/index.js CHANGED
@@ -1,53 +1,26 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.prometheusMetrics = exports.pipe = exports.all = exports.protocols = exports.multiaddr = exports.serviceCapabilities = exports.transportSymbol = exports.persistentPeerStore = void 0;
21
- __exportStar(require("libp2p"), exports);
22
- __exportStar(require("@libp2p/tcp"), exports);
23
- __exportStar(require("@chainsafe/libp2p-noise"), exports);
24
- __exportStar(require("@chainsafe/libp2p-yamux"), exports);
25
- __exportStar(require("@libp2p/kad-dht"), exports);
26
- __exportStar(require("@libp2p/mdns"), exports);
27
- __exportStar(require("@libp2p/ping"), exports);
28
- __exportStar(require("@libp2p/crypto/keys"), exports);
29
- var peer_store_1 = require("@libp2p/peer-store");
30
- Object.defineProperty(exports, "persistentPeerStore", { enumerable: true, get: function () { return peer_store_1.persistentPeerStore; } });
31
- __exportStar(require("./node/index.js"), exports);
32
- __exportStar(require("./config/index.js"), exports);
33
- __exportStar(require("uint8arraylist"), exports);
34
- __exportStar(require("it-pushable"), exports);
35
- __exportStar(require("@libp2p/interface-peer-id"), exports);
36
- __exportStar(require("@libp2p/interface-keychain"), exports);
37
- __exportStar(require("datastore-fs"), exports);
38
- __exportStar(require("@libp2p/peer-id-factory"), exports);
39
- __exportStar(require("@libp2p/bootstrap"), exports);
40
- __exportStar(require("@libp2p/circuit-relay-v2"), exports);
41
- __exportStar(require("@libp2p/memory"), exports);
42
- var interface_1 = require("@libp2p/interface");
43
- Object.defineProperty(exports, "transportSymbol", { enumerable: true, get: function () { return interface_1.transportSymbol; } });
44
- Object.defineProperty(exports, "serviceCapabilities", { enumerable: true, get: function () { return interface_1.serviceCapabilities; } });
45
- var multiaddr_1 = require("@multiformats/multiaddr");
46
- Object.defineProperty(exports, "multiaddr", { enumerable: true, get: function () { return multiaddr_1.multiaddr; } });
47
- Object.defineProperty(exports, "protocols", { enumerable: true, get: function () { return multiaddr_1.protocols; } });
48
- const it_all_1 = __importDefault(require("it-all"));
49
- exports.all = it_all_1.default;
50
- var it_pipe_1 = require("it-pipe");
51
- Object.defineProperty(exports, "pipe", { enumerable: true, get: function () { return it_pipe_1.pipe; } });
52
- var prometheus_metrics_1 = require("@libp2p/prometheus-metrics");
53
- Object.defineProperty(exports, "prometheusMetrics", { enumerable: true, get: function () { return prometheus_metrics_1.prometheusMetrics; } });
1
+ export * from 'libp2p';
2
+ export * from '@libp2p/tcp';
3
+ export * from '@chainsafe/libp2p-noise';
4
+ export * from '@chainsafe/libp2p-yamux';
5
+ export * from '@libp2p/kad-dht';
6
+ export * from '@libp2p/mdns';
7
+ export * from '@libp2p/ping';
8
+ export * from '@libp2p/crypto/keys';
9
+ export { persistentPeerStore } from '@libp2p/peer-store';
10
+ export * from './node/index.js';
11
+ export * from './config/index.js';
12
+ export * from 'uint8arraylist';
13
+ export * from 'it-pushable';
14
+ export * from '@libp2p/interface-peer-id';
15
+ export * from '@libp2p/interface-keychain';
16
+ export * from 'datastore-fs';
17
+ export * from '@libp2p/peer-id-factory';
18
+ export * from '@libp2p/bootstrap';
19
+ export * from '@libp2p/circuit-relay-v2';
20
+ export * from '@libp2p/memory';
21
+ export { transportSymbol, serviceCapabilities, } from '@libp2p/interface';
22
+ export { multiaddr, protocols } from '@multiformats/multiaddr';
23
+ import all from 'it-all';
24
+ export { all };
25
+ export { pipe } from 'it-pipe';
26
+ export { prometheusMetrics } from '@libp2p/prometheus-metrics';
@@ -1,17 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./node.js"), exports);
1
+ export * from './node.js';
package/dist/node/node.js CHANGED
@@ -1,32 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createNode = createNode;
4
- const libp2p_1 = require("libp2p");
5
- const config_js_1 = require("../config/config.js");
6
- async function createNode(config = {}) {
1
+ import { createLibp2p } from 'libp2p';
2
+ import { defaultLibp2pConfig } from '../config/config.js';
3
+ export async function createNode(config = {}) {
7
4
  const mergedConfig = {
8
- ...config_js_1.defaultLibp2pConfig,
5
+ ...defaultLibp2pConfig,
9
6
  ...config,
10
7
  addresses: {
11
- ...{ listen: config.listeners || config_js_1.defaultLibp2pConfig.listeners },
8
+ ...{ listen: config.listeners || defaultLibp2pConfig.listeners },
12
9
  ...config.addresses,
13
10
  },
14
11
  services: {
15
- ...config_js_1.defaultLibp2pConfig.services,
12
+ ...defaultLibp2pConfig.services,
16
13
  ...config.services,
17
14
  },
18
15
  peerDiscovery: [
19
- ...(config_js_1.defaultLibp2pConfig.peerDiscovery || []),
16
+ ...(defaultLibp2pConfig.peerDiscovery || []),
20
17
  ...(config.peerDiscovery || []),
21
18
  ],
22
19
  peerRouters: [
23
- ...(config_js_1.defaultLibp2pConfig.peerRouters || []),
20
+ ...(defaultLibp2pConfig.peerRouters || []),
24
21
  ...(config.peerRouters || []),
25
22
  ],
26
23
  contentRouters: [
27
- ...(config_js_1.defaultLibp2pConfig.contentRouters || []),
24
+ ...(defaultLibp2pConfig.contentRouters || []),
28
25
  ...(config.contentRouters || []),
29
26
  ],
30
27
  };
31
- return await (0, libp2p_1.createLibp2p)(mergedConfig);
28
+ return await createLibp2p(mergedConfig);
32
29
  }
package/dist/utils.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initDynamicImports = initDynamicImports;
4
1
  const dynamicImport = async (packageName) => new Function(`return import('${packageName}')`)();
5
- async function initDynamicImports(libs) {
2
+ export async function initDynamicImports(libs) {
6
3
  return await Promise.all(libs.map((lib) => dynamicImport(lib)));
7
4
  }
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@olane/o-config",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
+ "type": "module",
4
5
  "main": "dist/index.js",
5
6
  "types": "dist/index.d.ts",
6
7
  "exports": {
7
8
  ".": {
8
- "default": "./dist/index.js",
9
- "types": "./dist/index.d.ts"
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
10
11
  }
11
12
  },
12
13
  "files": [
@@ -41,6 +42,7 @@
41
42
  "@typescript-eslint/eslint-plugin": "^8.34.1",
42
43
  "@typescript-eslint/parser": "^8.34.1",
43
44
  "babel-loader": "^10.0.0",
45
+ "buffer": "^6.0.3",
44
46
  "eslint": "^9.29.0",
45
47
  "eslint-config-prettier": "^10.1.5",
46
48
  "eslint-plugin-prettier": "^5.5.0",
@@ -48,12 +50,15 @@
48
50
  "jest": "^30.0.0",
49
51
  "nodemon": "^3.1.10",
50
52
  "prettier": "^3.5.3",
53
+ "process": "^0.11.10",
54
+ "stream-browserify": "^3.0.0",
51
55
  "ts-jest": "^29.4.0",
52
56
  "ts-loader": "^9.5.2",
53
57
  "ts-node": "^10.9.2",
54
58
  "tsconfig-paths": "^4.2.0",
55
59
  "tsx": "^4.20.3",
56
60
  "typescript": "^5.8.3",
61
+ "util": "^0.12.5",
57
62
  "webpack": "^5.99.9",
58
63
  "webpack-cli": "^6.0.1",
59
64
  "webpack-dev-server": "^5.2.2"