11import * as API from './api.js'
22
3- import { multiaddr , isMultiaddr } from '@multiformats /multiaddr'
3+ import { multiaddr , isMultiaddr } from '@vascosantos /multiaddr'
44import { CID } from 'multiformats/cid'
55
66/**
@@ -36,8 +36,8 @@ export function createUri({ base, path, providers = [] }) {
3636 const baseParts = provider . multiaddr . toString ( ) . split ( '/' )
3737 const hintParts = [ ...baseParts ]
3838
39- for ( const proto of provider . protos || [ ] ) {
40- if ( proto ) hintParts . push ( 'retrieval ' , proto )
39+ for ( const tag of provider . tags || [ ] ) {
40+ if ( tag ) hintParts . push ( 'tag ' , tag )
4141 }
4242
4343 const hint = '/' + hintParts . filter ( Boolean ) . join ( '/' )
@@ -49,7 +49,7 @@ export function createUri({ base, path, providers = [] }) {
4949
5050/**
5151 * Parse a provider-hinted URI into a CID and structured provider hints,
52- * preserving the full multiaddr including `/retrieval/<proto >` segments.
52+ * preserving the full multiaddr including `/tag/<tag-name >` segments.
5353 *
5454 * @param {string } uri
5555 * @returns {{ cid: API.CID, providers: API.ProviderHint[], path: string, protocol: string } }
@@ -82,16 +82,16 @@ export function parseQueryString(query) {
8282
8383 for ( const val of searchParams . getAll ( 'provider' ) ) {
8484 if ( ! val . startsWith ( '/' ) ) continue
85-
85+
8686 const protoParts = val . split ( '/' ) . filter ( Boolean )
8787 /** @type {string[] } */
88- const protos = [ ]
88+ const tags = [ ]
8989
9090 for ( let i = 0 ; i < protoParts . length ; ) {
91- if ( protoParts [ i ] === 'retrieval ' ) {
91+ if ( protoParts [ i ] === 'tag ' ) {
9292 i ++
9393 if ( i < protoParts . length ) {
94- protos . push ( protoParts [ i ] )
94+ tags . push ( protoParts [ i ] )
9595 i ++
9696 }
9797 } else {
@@ -101,7 +101,7 @@ export function parseQueryString(query) {
101101
102102 try {
103103 const m = multiaddr ( val )
104- providers . push ( { multiaddr : m , protos } )
104+ providers . push ( { multiaddr : m , tags } )
105105 } catch {
106106 // Skip malformed multiaddrs
107107 continue
0 commit comments