@seed-hypermedia/client 0.0.36 → 0.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +13 -4
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -2200,15 +2200,17 @@ async function resolveHypermediaUrl(url, opts) {
2200
2200
  const uid = await opts.domainResolver(parsedHostname);
2201
2201
  if (uid) {
2202
2202
  const pathSegments = parsedUrl.pathname.split("/").filter(Boolean);
2203
- const path = pathSegments.length > 0 ? pathSegments : null;
2203
+ const profilePath = resolveProfilePath(uid, pathSegments);
2204
+ const resolvedUid = (profilePath == null ? void 0 : profilePath.uid) || uid;
2205
+ const path = (profilePath == null ? void 0 : profilePath.path) || (pathSegments.length > 0 ? pathSegments : null);
2204
2206
  const version = parsedUrl.searchParams.get("v") || null;
2205
2207
  const pathStr = path ? "/" + path.join("/") : "";
2206
2208
  const siteHostname = parsedUrl.origin;
2207
2209
  return {
2208
- id: `hm://${uid}${pathStr}`,
2210
+ id: `hm://${resolvedUid}${pathStr}`,
2209
2211
  hmId: {
2210
- id: `hm://${uid}${pathStr}`,
2211
- uid,
2212
+ id: `hm://${resolvedUid}${pathStr}`,
2213
+ uid: resolvedUid,
2212
2214
  path,
2213
2215
  version,
2214
2216
  blockRef,
@@ -2288,6 +2290,13 @@ async function resolveId(input, opts) {
2288
2290
  }
2289
2291
  throw new Error(`Invalid Hypermedia ID: ${input}`);
2290
2292
  }
2293
+ function resolveProfilePath(siteUid, pathSegments) {
2294
+ if (pathSegments[0] !== ":profile") return null;
2295
+ return {
2296
+ uid: pathSegments[1] || siteUid,
2297
+ path: [":profile"]
2298
+ };
2299
+ }
2291
2300
 
2292
2301
  // src/file-to-ipfs.ts
2293
2302
  import { MemoryBlockstore } from "blockstore-core/memory";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-hypermedia/client",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/seed-hypermedia/seed",