@xyo-network/huri
Advanced tools
Comparing version 2.110.19 to 2.111.0
@@ -13,12 +13,12 @@ { | ||
"dependencies": { | ||
"@xylabs/assert": "^3.6.6", | ||
"@xylabs/axios": "^3.6.6", | ||
"@xylabs/hex": "^3.6.6", | ||
"@xyo-network/account": "^2.110.19", | ||
"@xyo-network/payload-model": "^2.110.19" | ||
"@xylabs/assert": "^3.6.8", | ||
"@xylabs/axios": "^3.6.8", | ||
"@xylabs/hex": "^3.6.8", | ||
"@xyo-network/account": "^2.111.0", | ||
"@xyo-network/payload-model": "^2.111.0" | ||
}, | ||
"devDependencies": { | ||
"@xylabs/delay": "^3.6.6", | ||
"@xylabs/ts-scripts-yarn3": "^3.14.1", | ||
"@xylabs/tsconfig": "^3.14.1", | ||
"@xylabs/delay": "^3.6.8", | ||
"@xylabs/ts-scripts-yarn3": "^3.15.5", | ||
"@xylabs/tsconfig": "^3.15.5", | ||
"typescript": "^5.5.4" | ||
@@ -36,3 +36,3 @@ }, | ||
"types": "./dist/browser/index.d.mts", | ||
"default": "./dist/browser/index.js" | ||
"default": "./dist/browser/index.mjs" | ||
} | ||
@@ -47,3 +47,3 @@ }, | ||
"types": "./dist/node/index.d.mts", | ||
"default": "./dist/node/index.js" | ||
"default": "./dist/node/index.mjs" | ||
} | ||
@@ -55,3 +55,3 @@ } | ||
"main": "dist/node/index.cjs", | ||
"module": "dist/node/index.js", | ||
"module": "dist/node/index.mjs", | ||
"homepage": "https://xyo.network", | ||
@@ -68,4 +68,4 @@ "license": "LGPL-3.0-only", | ||
"types": "dist/node/index.d.ts", | ||
"version": "2.110.19", | ||
"version": "2.111.0", | ||
"type": "module" | ||
} |
@@ -11,3 +11,3 @@ import { assertEx } from '@xylabs/assert' | ||
/* | ||
/* | ||
Valid Huri: | ||
@@ -43,7 +43,9 @@ | ||
constructor(huri: Hash | Huri | string, { archivistUri, token }: HuriOptions = {}) { | ||
const huriString = | ||
Huri.isHuri(huri)?.href ?? | ||
(typeof huri === 'string' ? (huri as string) | ||
: huri instanceof ArrayBuffer ? new AddressValue(huri).hex | ||
: huri.href) | ||
const huriString | ||
= Huri.isHuri(huri)?.href | ||
?? (typeof huri === 'string' | ||
? (huri as string) | ||
: huri instanceof ArrayBuffer | ||
? new AddressValue(huri).hex | ||
: huri.href) | ||
this.originalHref = huriString | ||
@@ -59,3 +61,3 @@ | ||
//if archivistUri sent, overwrite protocol and archivist | ||
// if archivistUri sent, overwrite protocol and archivist | ||
if (archivistUri) { | ||
@@ -135,18 +137,19 @@ const archivistUriParts = archivistUri.split('://') | ||
//if the protocol was found, then there is not allowed to be a leading / | ||
// if the protocol was found, then there is not allowed to be a leading / | ||
assertEx(!(hasProtocol && pathParts[0].length === 0), () => 'Invalid protocol separator') | ||
//remove leading '/' if needed | ||
// remove leading '/' if needed | ||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions | ||
pathParts[0].length === 0 ? pathParts.shift() : null | ||
//hash is assumed to be the last part | ||
// hash is assumed to be the last part | ||
const hash = assertEx(pathParts.pop(), () => 'No hash specified') | ||
//archivist is assumed to be the first part | ||
// archivist is assumed to be the first part | ||
this.archivist = pathParts.shift() ?? 'api.archivist.xyo.network' | ||
//the archive is whatever is left | ||
// the archive is whatever is left | ||
this.archive = pathParts.pop() | ||
//after we pull off all the path parts, there should be nothing left | ||
// after we pull off all the path parts, there should be nothing left | ||
assertEx(pathParts.length === 0, () => 'Too many path parts') | ||
@@ -158,11 +161,11 @@ | ||
private validateParse() { | ||
//the archivist should not be zero length | ||
// the archivist should not be zero length | ||
assertEx(this.archivist?.length !== 0, () => 'Invalid archivist length') | ||
//the archivist should not be zero length (can be undefined) | ||
// the archivist should not be zero length (can be undefined) | ||
assertEx(this.archive?.length !== 0, () => 'Invalid archive length') | ||
//the archive should not be set if the archivist is not set | ||
// the archive should not be set if the archivist is not set | ||
assertEx(!(this.archive && !this.archivist), () => 'If specifying archive, archivist is also required') | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109959
916
Updated@xylabs/assert@^3.6.8
Updated@xylabs/axios@^3.6.8
Updated@xylabs/hex@^3.6.8