@leofcoin/peernet 1.1.58 → 1.1.59

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
- export default async () => prompt('enter password')
1
+ export default async () => prompt('enter password')
@@ -1,6 +1,6 @@
1
1
  import inquirer from 'inquirer'
2
2
 
3
3
  export default async () => {
4
- const answers = await inquirer.prompt({type: 'password', name: 'password', message: 'Enter password'})
4
+ const answers = await inquirer.prompt({ type: 'password', name: 'password', message: 'Enter password' })
5
5
  return answers.password
6
- }
6
+ }
@@ -2,5 +2,5 @@ export default {
2
2
  value: String(),
3
3
  author: String(),
4
4
  timestamp: Number(),
5
- files: [String()],
5
+ files: [String()]
6
6
  }
@@ -1,4 +1,4 @@
1
1
  export default {
2
2
  hash: String(),
3
- data: new Uint8Array(),
3
+ data: new Uint8Array()
4
4
  }
package/src/types.ts CHANGED
@@ -6,14 +6,12 @@ import DHT from './dht/dht.js'
6
6
  import { BufferToUint8Array, protoFor, target } from './utils/utils.js'
7
7
  import MessageHandler from './handlers/message.js'
8
8
  import dataHandler from './handlers/data.js'
9
- import { encapsulatedError, dhtError,
10
- nothingFoundError } from './errors/errors.js'
9
+ import { encapsulatedError, dhtError, nothingFoundError } from './errors/errors.js'
11
10
 
12
- import {LeofcoinStorage as LeofcoinStorageClass } from '@leofcoin/storage'
11
+ import { Storage as LeofcoinStorageClass } from '@leofcoin/storage'
13
12
  import { utils as codecUtils } from '@leofcoin/codecs'
14
13
  import Identity from './identity.js'
15
14
 
16
-
17
15
  declare global {
18
16
  var debug: (message) => string
19
17
  var globalSub: PubSub
@@ -21,8 +19,8 @@ declare global {
21
19
  var peernet: Peernet
22
20
  var LeofcoinStorage: typeof LeofcoinStorageClass
23
21
  var LeofcoinStorageClient
24
- var messageStore: typeof LeofcoinStorage
25
- var dataStore: typeof LeofcoinStorage
26
- var transactionStore: typeof LeofcoinStorage
27
- var blockStore: typeof LeofcoinStorage
28
- }
22
+ var messageStore: LeofcoinStorageClass
23
+ var dataStore: LeofcoinStorageClass
24
+ var transactionStore: LeofcoinStorageClass
25
+ var blockStore: LeofcoinStorageClass
26
+ }
@@ -1,6 +1,6 @@
1
1
  import { Codec } from '@leofcoin/codec-format-interface'
2
2
 
3
- export const BufferToUint8Array = data => {
3
+ export const BufferToUint8Array = (data) => {
4
4
  if (data.type === 'Buffer') {
5
5
  data = new Uint8Array(data.data)
6
6
  }
@@ -9,24 +9,23 @@ export const BufferToUint8Array = data => {
9
9
 
10
10
  export const expected = (expected, actual) => {
11
11
  const rule = (entry) => {
12
- return !entry ? `: undefined - ${entry} ` :`: ${typeof entry} - `
12
+ return !entry ? `: undefined - ${entry} ` : `: ${typeof entry} - `
13
13
  }
14
14
 
15
- const entries = Object.entries(actual)
16
- .map((entry) => entry.join(rule(entry[1])));
15
+ const entries = Object.entries(actual).map((entry) => entry.join(rule(entry[1])))
17
16
 
18
17
  return `\nExpected:
19
18
  ${expected.join('\n\t')}
20
19
 
21
20
  actual:
22
- ${entries.join('\n\t')}`;
21
+ ${entries.join('\n\t')}`
23
22
  }
24
23
 
25
24
  export const protoFor = (message) => {
26
25
  const codec = new Codec(message)
27
26
  if (!codec.name) throw new Error('proto not found')
28
27
  const Proto = globalThis.peernet.protos[codec.name]
29
- if (!Proto) throw (new Error(`No proto defined for ${codec.name}`))
28
+ if (!Proto) throw new Error(`No proto defined for ${codec.name}`)
30
29
  return new Proto(message)
31
30
  }
32
31
 
@@ -45,7 +44,7 @@ export const hasDaemon = async () => {
45
44
  }
46
45
 
47
46
  export const https = () => {
48
- if (!globalThis.location) return false;
47
+ if (!globalThis.location) return false
49
48
  return Boolean(globalThis.location.protocol === 'https:')
50
49
  }
51
50
 
@@ -74,5 +73,5 @@ export const target = async () => {
74
73
  let daemon = false
75
74
  if (!https()) daemon = await hasDaemon()
76
75
 
77
- return {daemon, environment: environment()}
76
+ return { daemon, environment: environment() }
78
77
  }