-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: upgrades to multiformats@10 (#117)
* chore: update interface to multiformats@10 * feat: upgrade to multiformat@10 * chore: undo irrelevant chages
- Loading branch information
Showing
27 changed files
with
2,139 additions
and
1,004 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
import { assert, use } from 'chai' | ||
import subset from 'chai-subset' | ||
use(subset) | ||
import { assert } from 'chai' | ||
|
||
export const test = it | ||
export { assert } |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1 @@ | ||
import { CID } from 'multiformats' | ||
import * as API from '@ucanto/interface' | ||
|
||
/** | ||
* @template {number} Code | ||
* @template {number} Alg | ||
* @param {Code} code | ||
* @param {API.MultihashDigest<Alg>} digest | ||
* @return {API.Link<unknown, Code, Alg>} | ||
*/ | ||
export const create = (code, digest) => | ||
/** @type {any} */ (CID.createV1(code, digest)) | ||
|
||
/** | ||
* @template {number} Alg | ||
* @param {API.MultihashDigest<Alg>} digest | ||
* @return {API.Link<unknown, 0x70, Alg, 0>} | ||
*/ | ||
export const createV0 = digest => /** @type {any} */ (CID.createV0(digest)) | ||
|
||
/** | ||
* Type predicate returns true if value is the link. | ||
* | ||
* @template {API.Link} L | ||
* @param {unknown} value | ||
* @returns {value is L} | ||
*/ | ||
export const isLink = value => | ||
value != null && /** @type {{asCID: unknown}} */ (value).asCID === value | ||
|
||
export const asLink = | ||
/** @type {<L extends API.Link<unknown, number, number, API.UCAN.CIDVersion>>(value:L|unknown) => L|null} */ | ||
(CID.asCID) | ||
|
||
export const parse = | ||
/** @type {<P extends string>(source:string, base?:API.MultibaseDecoder<P>) => API.Link<unknown, number, number, API.UCAN.CIDVersion>} */ | ||
(CID.parse) | ||
|
||
export const decode = | ||
/** @type {(bytes:Uint8Array) => API.Link<unknown, number, number, API.UCAN.CIDVersion>} */ | ||
(CID.decode) | ||
export * from 'multiformats/link' |
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 was deleted.
Oops, something went wrong.
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,6 +1,4 @@ | ||
import { assert, use } from 'chai' | ||
import subset from 'chai-subset' | ||
use(subset) | ||
|
||
export const test = it | ||
export { assert } |
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
Oops, something went wrong.