Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

fix: fix types #3662

Merged
merged 4 commits into from
May 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/ipfs-core-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"license": "(Apache-2.0 OR MIT)",
"dependencies": {
"cids": "^1.1.6",
"interface-datastore": "^4.0.0",
"ipld": "^0.30.0",
"ipld-block": "^0.11.1",
"multiaddr": "^9.0.1",
"multibase": "^4.0.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ipfs-core-types/src/object/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export interface API<OptionExtension = {}> {
put: (obj: DAGNode | DAGNodeLike | Uint8Array, options?: PutOptions & OptionExtension) => Promise<CID>
get: (cid: CID, options?: AbortOptions & PreloadOptions & OptionExtension) => Promise<DAGNode>
data: (cid: CID, options?: AbortOptions & PreloadOptions & OptionExtension) => Promise<Uint8Array>
links: (cid, options?: AbortOptions & PreloadOptions & OptionExtension) => Promise<DAGLink[]>
stat: (cid, options?: AbortOptions & PreloadOptions & OptionExtension) => Promise<StatResult>
links: (cid: CID, options?: AbortOptions & PreloadOptions & OptionExtension) => Promise<DAGLink[]>
stat: (cid: CID, options?: AbortOptions & PreloadOptions & OptionExtension) => Promise<StatResult>

patch: PatchAPI
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ipfs-core-types/src/pin/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AbortOptions, AwaitIterable } from '../utils'
import type CID from 'cids'
import type { API as remote } from './remote'
import type { API as Remote } from './remote'

export interface API<OptionExtension = {}> {
/**
Expand Down Expand Up @@ -92,7 +92,7 @@ export interface API<OptionExtension = {}> {
*/
rmAll: (source: AwaitIterable<RmAllInput>, options?: AbortOptions & OptionExtension) => AsyncIterable<CID>

remote
remote: Remote<OptionExtension>
}

export interface AddOptions extends AbortOptions {
Expand Down
14 changes: 8 additions & 6 deletions packages/ipfs-core-types/src/utils.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import CID from 'cids'
import { Mtime, MtimeLike } from 'ipfs-unixfs'
import { Options as DatastoreOptions, Key, Query, KeyQuery } from 'interface-datastore'
import Block from 'ipld-block'

export type Entry<Content extends AsyncIterable<Uint8Array>|Blob> =
| FileEntry<Content>
Expand Down Expand Up @@ -133,17 +135,17 @@ export interface BufferStore {
}

export interface Blockstore {
open: () => Promise<Void>
open: () => Promise<void>

/**
* Query the store
*/
query: (Query, options?: DatastoreOptions) => AsyncIterable<Block>
query: (query: Query, options?: DatastoreOptions) => AsyncIterable<Block>

/**
* Query the store, returning only keys
*/
queryKeys: (query: KeyQuery, options?: DatastoreOptions) => AsyncIterable<CID>
queryKeys: (query: KeyQuery, options?: DatastoreOptions) => AsyncIterable<CID>

/**
* Get a single block by CID
Expand Down Expand Up @@ -173,15 +175,15 @@ export interface Blockstore {
/**
* Delete a block from the store
*/
delete: (cid: CID, options?: DatastoreOptions) => Promise<Void>
delete: (cid: CID, options?: DatastoreOptions) => Promise<void>

/**
* Delete a block from the store
*/
deleteMany: (cids: AwaitIterable<any>, options?: DatastoreOptions) => AsyncIterable<Key>
deleteMany: (cids: AwaitIterable<CID>, options?: DatastoreOptions) => AsyncIterable<CID>

/**
* Close the store
*/
close: () => Promise<Void>
close: () => Promise<void>
}
17 changes: 8 additions & 9 deletions packages/ipfs-core/src/components/pin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ class PinAPI {
this.rm = createRm({ rmAll })
this.ls = createLs({ ipld, pinManager })

const notImplemented = () => Promise.reject(new Error('Not implemented'))

/** @type {import('ipfs-core-types/src/pin/remote').API} */
this.remote = {
add: notImplemented,
ls: notImplemented,
rm: notImplemented,
rmAll: notImplemented,
add: (cid, options = {}) => Promise.reject(new Error('Not implemented')),
ls: async function * (query, options = {}) { return Promise.reject(new Error('Not implemented')) }, // eslint-disable-line require-yield
rm: (query, options = {}) => Promise.reject(new Error('Not implemented')),
rmAll: (query, options = {}) => Promise.reject(new Error('Not implemented')),
service: {
add: notImplemented,
rm: notImplemented,
ls: notImplemented
add: (name, credentials) => Promise.reject(new Error('Not implemented')),
rm: (name, options = {}) => Promise.reject(new Error('Not implemented')),
ls: (options = {}) => Promise.reject(new Error('Not implemented'))
}
}
}
Expand Down