Compare commits

...

3 Commits

Author SHA1 Message Date
semantic-release-bot af58582550 chore(release): 0.2.0-develop.46 [skip ci]
# [0.2.0-develop.46](https://git.lumeweb.com/LumeWeb/libweb/compare/v0.2.0-develop.45...v0.2.0-develop.46) (2023-09-04)

### Bug Fixes

* if has is a CID, override arguments with the CID properties unless we have an argument set already ([2c56658](2c56658a6c))
2023-09-04 01:31:16 +00:00
Derrick Hammer 1db8cb7427
Merge remote-tracking branch 'origin/develop' into develop 2023-09-03 21:29:58 -04:00
Derrick Hammer 2c56658a6c
fix: if has is a CID, override arguments with the CID properties unless we have an argument set already 2023-09-03 21:29:51 -04:00
4 changed files with 24 additions and 4 deletions

View File

@ -1,3 +1,10 @@
# [0.2.0-develop.46](https://git.lumeweb.com/LumeWeb/libweb/compare/v0.2.0-develop.45...v0.2.0-develop.46) (2023-09-04)
### Bug Fixes
* if has is a CID, override arguments with the CID properties unless we have an argument set already ([2c56658](https://git.lumeweb.com/LumeWeb/libweb/commit/2c56658a6c06c51e6f079232c35cce05a6ca72c3))
# [0.2.0-develop.45](https://git.lumeweb.com/LumeWeb/libweb/compare/v0.2.0-develop.44...v0.2.0-develop.45) (2023-09-04)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/libweb",
"version": "0.2.0-develop.45",
"version": "0.2.0-develop.46",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/libweb",
"version": "0.2.0-develop.45",
"version": "0.2.0-develop.46",
"dependencies": {
"@lumeweb/community-portals": "^0.1.0-develop.6",
"@lumeweb/libportal": "0.2.0-develop.23",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/libweb",
"version": "0.2.0-develop.45",
"version": "0.2.0-develop.46",
"main": "lib/index.js",
"type": "module",
"repository": {

View File

@ -22,13 +22,26 @@ export function encodeCid(
hashType?: number,
raw?: boolean,
): ErrTuple<string | Uint8Array>;
export function encodeCid(
hash: CID,
size?: bigint,
type?: number,
hashType?: number,
raw?: boolean,
): ErrTuple<string | Uint8Array>;
export function encodeCid(
hash: any,
size: bigint,
size?: bigint,
type?: number,
hashType?: number,
raw: boolean = false,
): ErrTuple<string | Uint8Array> {
if (typeof hash !== "string" && !(hash instanceof Uint8Array)) {
size = hash.size;
type = type ?? hash.type;
hashType = hashType ?? hash.type;
hash = hash.hash;
}
try {
return [encodeCidPortal(hash, size, type, hashType, raw), null];
} catch (e) {