helia 6.1.4 → 7.0.0
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 +65 -55
- package/dist/index.min.js.map +4 -4
- package/dist/src/block-storage.d.ts +62 -0
- package/dist/src/block-storage.d.ts.map +1 -0
- package/dist/src/block-storage.js +159 -0
- package/dist/src/block-storage.js.map +1 -0
- package/dist/src/datastore-version.d.ts +3 -0
- package/dist/src/datastore-version.d.ts.map +1 -0
- package/dist/src/datastore-version.js +20 -0
- package/dist/src/datastore-version.js.map +1 -0
- package/dist/src/get-codec.d.ts +4 -0
- package/dist/src/get-codec.d.ts.map +1 -0
- package/dist/src/get-codec.js +31 -0
- package/dist/src/get-codec.js.map +1 -0
- package/dist/src/get-crypto.d.ts +4 -0
- package/dist/src/get-crypto.d.ts.map +1 -0
- package/dist/src/get-crypto.js +35 -0
- package/dist/src/get-crypto.js.map +1 -0
- package/dist/src/get-hasher.d.ts +4 -0
- package/dist/src/get-hasher.d.ts.map +1 -0
- package/dist/src/get-hasher.js +31 -0
- package/dist/src/get-hasher.js.map +1 -0
- package/dist/src/helia.d.ts +165 -0
- package/dist/src/helia.d.ts.map +1 -0
- package/dist/src/helia.js +165 -0
- package/dist/src/helia.js.map +1 -0
- package/dist/src/index.d.ts +30 -19
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +78 -12
- package/dist/src/index.js.map +1 -1
- package/dist/src/networked-storage.d.ts +28 -0
- package/dist/src/networked-storage.d.ts.map +1 -0
- package/dist/src/networked-storage.js +52 -0
- package/dist/src/networked-storage.js.map +1 -0
- package/dist/src/pins.d.ts +21 -0
- package/dist/src/pins.d.ts.map +1 -0
- package/dist/src/pins.js +140 -0
- package/dist/src/pins.js.map +1 -0
- package/dist/src/routing.d.ts +51 -0
- package/dist/src/routing.d.ts.map +1 -0
- package/dist/src/routing.js +311 -0
- package/dist/src/routing.js.map +1 -0
- package/dist/src/session-storage.d.ts +47 -0
- package/dist/src/session-storage.d.ts.map +1 -0
- package/dist/src/session-storage.js +148 -0
- package/dist/src/session-storage.js.map +1 -0
- package/dist/src/storage.d.ts +55 -0
- package/dist/src/storage.d.ts.map +1 -0
- package/dist/src/storage.js +225 -0
- package/dist/src/storage.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/typedoc-urls.json +3 -6
- package/package.json +38 -41
- package/src/block-storage.ts +194 -0
- package/src/datastore-version.ts +25 -0
- package/src/get-codec.ts +39 -0
- package/src/get-crypto.ts +44 -0
- package/src/get-hasher.ts +39 -0
- package/src/helia.ts +364 -0
- package/src/index.ts +58 -30
- package/src/networked-storage.ts +74 -0
- package/src/pins.ts +208 -0
- package/src/routing.ts +389 -0
- package/src/session-storage.ts +174 -0
- package/src/storage.ts +294 -0
- package/src/version.ts +1 -1
- package/dist/src/utils/bootstrappers.d.ts +0 -4
- package/dist/src/utils/bootstrappers.d.ts.map +0 -1
- package/dist/src/utils/bootstrappers.js +0 -13
- package/dist/src/utils/bootstrappers.js.map +0 -1
- package/dist/src/utils/helia-defaults.d.ts +0 -48
- package/dist/src/utils/helia-defaults.d.ts.map +0 -1
- package/dist/src/utils/helia-defaults.js +0 -85
- package/dist/src/utils/helia-defaults.js.map +0 -1
- package/dist/src/utils/libp2p-defaults.browser.d.ts +0 -19
- package/dist/src/utils/libp2p-defaults.browser.d.ts.map +0 -1
- package/dist/src/utils/libp2p-defaults.browser.js +0 -73
- package/dist/src/utils/libp2p-defaults.browser.js.map +0 -1
- package/dist/src/utils/libp2p-defaults.d.ts +0 -49
- package/dist/src/utils/libp2p-defaults.d.ts.map +0 -1
- package/dist/src/utils/libp2p-defaults.js +0 -113
- package/dist/src/utils/libp2p-defaults.js.map +0 -1
- package/dist/src/utils/libp2p.d.ts +0 -19
- package/dist/src/utils/libp2p.d.ts.map +0 -1
- package/dist/src/utils/libp2p.js +0 -19
- package/dist/src/utils/libp2p.js.map +0 -1
- package/src/utils/bootstrappers.ts +0 -12
- package/src/utils/helia-defaults.ts +0 -92
- package/src/utils/libp2p-defaults.browser.ts +0 -92
- package/src/utils/libp2p-defaults.ts +0 -137
- package/src/utils/libp2p.ts +0 -42
package/src/utils/libp2p.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { loadOrCreateSelfKey } from '@libp2p/config'
|
|
2
|
-
import { createLibp2p as create } from 'libp2p'
|
|
3
|
-
import { libp2pDefaults } from './libp2p-defaults.ts'
|
|
4
|
-
import type { ComponentLogger, Libp2p, PrivateKey } from '@libp2p/interface'
|
|
5
|
-
import type { KeychainInit } from '@libp2p/keychain'
|
|
6
|
-
import type { DNS } from '@multiformats/dns'
|
|
7
|
-
import type { Datastore } from 'interface-datastore'
|
|
8
|
-
import type { Libp2pOptions } from 'libp2p'
|
|
9
|
-
|
|
10
|
-
export interface CreateLibp2pOptions<T extends Record<string, unknown>> {
|
|
11
|
-
datastore: Datastore
|
|
12
|
-
libp2p?: Libp2pOptions<T>
|
|
13
|
-
logger?: ComponentLogger
|
|
14
|
-
keychain?: KeychainInit
|
|
15
|
-
start?: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface Libp2pDefaultsOptions {
|
|
19
|
-
privateKey?: PrivateKey
|
|
20
|
-
keychain?: KeychainInit
|
|
21
|
-
dns?: DNS
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export async function createLibp2p <T extends Record<string, unknown>> (options: CreateLibp2pOptions<T>): Promise<Libp2p<T>> {
|
|
25
|
-
const libp2pOptions = options.libp2p ?? {}
|
|
26
|
-
|
|
27
|
-
// if no peer id was passed, try to load it from the keychain
|
|
28
|
-
if (libp2pOptions.privateKey == null && options.datastore != null) {
|
|
29
|
-
libp2pOptions.privateKey = await loadOrCreateSelfKey(options.datastore, options.keychain)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const defaults: any = libp2pDefaults(libp2pOptions)
|
|
33
|
-
defaults.datastore = defaults.datastore ?? options.datastore
|
|
34
|
-
|
|
35
|
-
const node = await create<T>({
|
|
36
|
-
...defaults,
|
|
37
|
-
...libp2pOptions,
|
|
38
|
-
start: false
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
return node
|
|
42
|
-
}
|