-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reduce dagPb and dagCbor handler complexity (#45)
- Loading branch information
Showing
4 changed files
with
108 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
import { type AbortOptions } from '@libp2p/interface' | ||
import { type CID } from 'multiformats/cid' | ||
import type { VerifiedFetchInit } from './index.js' | ||
|
||
export type RequestFormatShorthand = 'raw' | 'car' | 'tar' | 'ipns-record' | 'dag-json' | 'dag-cbor' | 'json' | 'cbor' | ||
|
||
export type SupportedBodyTypes = string | ArrayBuffer | Blob | ReadableStream<Uint8Array> | null | ||
|
||
export interface FetchHandlerFunctionArg { | ||
cid: CID | ||
path: string | ||
|
||
/** | ||
* Whether to use a session during fetch operations | ||
* | ||
* @default true | ||
*/ | ||
session: boolean | ||
|
||
options?: Omit<VerifiedFetchInit, 'signal'> & AbortOptions | ||
|
||
/** | ||
* If present, the user has sent an accept header with this value - if the | ||
* content cannot be represented in this format a 406 should be returned | ||
*/ | ||
accept?: string | ||
|
||
/** | ||
* The originally requested resource | ||
*/ | ||
resource: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters