@seed-hypermedia/client 0.0.113 → 0.0.114
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.
- package/dist/auto-link.mjs +3 -3
- package/dist/blocks-to-markdown.mjs +3 -2
- package/dist/capability.mjs +2 -2
- package/dist/{chunk-YF2CLLSQ.mjs → chunk-2NMNRO4D.mjs} +3 -3
- package/dist/{chunk-NLH5MKTK.mjs → chunk-3IWI5CPN.mjs} +1 -1
- package/dist/{chunk-3P4J4WDY.mjs → chunk-DQPKO37T.mjs} +1 -1
- package/dist/{chunk-3TERIXHU.mjs → chunk-GMSNTW7N.mjs} +6 -20
- package/dist/chunk-HSDV6WEU.mjs +10 -0
- package/dist/{chunk-UHAYFVBP.mjs → chunk-IIH2GY7Y.mjs} +15 -4
- package/dist/{chunk-2PRZIGCZ.mjs → chunk-MPZWQQ4T.mjs} +14 -5
- package/dist/{chunk-AUKAVTTK.mjs → chunk-MZMGRUTQ.mjs} +1 -1
- package/dist/{chunk-YC433TGZ.mjs → chunk-O4WGAS2C.mjs} +1 -1
- package/dist/{chunk-URLWDK7P.mjs → chunk-PODYPZBY.mjs} +1 -1
- package/dist/{chunk-OXZCRYUS.mjs → chunk-QMWFLXP7.mjs} +1 -1
- package/dist/{chunk-5VBVPSXD.mjs → chunk-SOYMAPYD.mjs} +2 -2
- package/dist/{chunk-LQTTR4ZP.mjs → chunk-VUQJUPXS.mjs} +1 -1
- package/dist/{chunk-GLY3UZ3W.mjs → chunk-VYZX3LHX.mjs} +1 -1
- package/dist/{chunk-KMACFX6U.mjs → chunk-XHMBAW2Z.mjs} +1 -1
- package/dist/{chunk-ALW35WVX.mjs → chunk-ZQZF75CE.mjs} +11 -5
- package/dist/client.mjs +2 -2
- package/dist/comment.mjs +2 -2
- package/dist/document-state.mjs +2 -2
- package/dist/editorblock-to-hmblock.mjs +2 -2
- package/dist/hm-resolver.d.ts +2 -0
- package/dist/hm-resolver.mjs +4 -2
- package/dist/hm-types.d.ts +5 -71
- package/dist/hm-types.mjs +1 -1
- package/dist/hmblock-to-editorblock.mjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +18 -16
- package/dist/pdf-to-blocks.mjs +3 -3
- package/dist/resource-read.mjs +4 -4
- package/dist/schema-engine.mjs +2 -2
- package/dist/schema-registry.generated.mjs +1 -1
- package/dist/schema-resolve.mjs +4 -4
- package/dist/schema-subtypes.mjs +4 -4
- package/dist/schema-types.generated.d.ts +14 -5
- package/dist/signed-blob.mjs +2 -2
- package/dist/tei-to-blocks.mjs +2 -2
- package/dist/unicode.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-MLR4UDOJ.mjs +0 -10
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveId
|
|
3
|
+
} from "./chunk-IIH2GY7Y.mjs";
|
|
1
4
|
import {
|
|
2
5
|
normalizeQuerySort,
|
|
3
6
|
unpackHmId
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GMSNTW7N.mjs";
|
|
5
8
|
|
|
6
9
|
// src/blocks-to-markdown.ts
|
|
7
10
|
import { stringify as stringifyYaml } from "yaml";
|
|
@@ -728,13 +731,20 @@ async function resolveInlineEmbed(ann, type, ctx) {
|
|
|
728
731
|
return `[\u2197 ${fallbackLabel(link)}`;
|
|
729
732
|
}
|
|
730
733
|
}
|
|
734
|
+
async function resolveMarkdownReferenceId(link, ctx) {
|
|
735
|
+
return resolveId(link, {
|
|
736
|
+
domainResolver: async (domain) => {
|
|
737
|
+
const info = await ctx.client.request("GetDomain", { domain });
|
|
738
|
+
return info.registeredAccountUid ? { registeredAccountUid: info.registeredAccountUid, isGateway: info.isGateway } : null;
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
}
|
|
731
742
|
async function resolveEmbeddedResource(link, ctx) {
|
|
732
743
|
var _a, _b;
|
|
733
744
|
const cacheKey = `embed:${link}`;
|
|
734
745
|
const cached = ctx.cache.get(cacheKey);
|
|
735
746
|
if (cached) return cached;
|
|
736
|
-
const id =
|
|
737
|
-
if (!id) throw new Error("Invalid HM link");
|
|
747
|
+
const id = await resolveMarkdownReferenceId(link, ctx);
|
|
738
748
|
const resource = await ctx.client.request("Resource", id);
|
|
739
749
|
let resolved;
|
|
740
750
|
if (resource.type === "document") {
|
|
@@ -771,8 +781,7 @@ async function resolveReference(link, ctx, mentionKind) {
|
|
|
771
781
|
const cacheKey = `${mentionKind || "legacy"}:${link}`;
|
|
772
782
|
const cached = ctx.cache.get(cacheKey);
|
|
773
783
|
if (cached) return cached;
|
|
774
|
-
const id =
|
|
775
|
-
if (!id) throw new Error("Invalid HM link");
|
|
784
|
+
const id = await resolveMarkdownReferenceId(link, ctx);
|
|
776
785
|
let resolved;
|
|
777
786
|
const profileAccountUid = ((_a = id.path) == null ? void 0 : _a[0]) === ":profile" ? id.path[1] || id.uid : !((_b = id.path) == null ? void 0 : _b.length) ? id.uid : null;
|
|
778
787
|
if (profileAccountUid && mentionKind !== "document") {
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from "./chunk-PJ2RFT5A.mjs";
|
|
8
8
|
import {
|
|
9
9
|
resolveDocumentState
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XHMBAW2Z.mjs";
|
|
11
11
|
import {
|
|
12
12
|
entityQueryPathToHmIdPath,
|
|
13
13
|
packHmId,
|
|
14
14
|
unpackHmId
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GMSNTW7N.mjs";
|
|
16
16
|
|
|
17
17
|
// src/auto-link.ts
|
|
18
18
|
import { CID } from "multiformats/cid";
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveId
|
|
3
|
-
} from "./chunk-UHAYFVBP.mjs";
|
|
4
1
|
import {
|
|
5
2
|
createSeedClient
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QMWFLXP7.mjs";
|
|
4
|
+
import {
|
|
5
|
+
hmDomainUrlToWebUrl,
|
|
6
|
+
resolveId
|
|
7
|
+
} from "./chunk-IIH2GY7Y.mjs";
|
|
7
8
|
import {
|
|
8
9
|
unpackHmId
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GMSNTW7N.mjs";
|
|
10
11
|
|
|
11
12
|
// src/resource-read.ts
|
|
12
13
|
async function resolveIdWithClient(rawId, options = {}) {
|
|
13
14
|
const commentId = extractCommentIdFromReadableUrl(rawId);
|
|
15
|
+
if (!commentId && hmDomainUrlToWebUrl(rawId)) {
|
|
16
|
+
const id2 = await resolveId(rawId, { domainResolver: options.domainResolver });
|
|
17
|
+
const client = options.client ?? createSeedClient(normalizeServerUrl(options.serverUrl || "https://hyper.media"));
|
|
18
|
+
return { id: id2, client, serverUrl: client.baseUrl };
|
|
19
|
+
}
|
|
14
20
|
const parsed = commentId ? commentIdToHmId(commentId) : unpackHmId(rawId);
|
|
15
21
|
if (parsed) {
|
|
16
22
|
if (isWebUrl(rawId)) {
|
package/dist/client.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSeedClient,
|
|
3
3
|
deserializeQueryString
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QMWFLXP7.mjs";
|
|
5
5
|
import "./chunk-CBELM7KX.mjs";
|
|
6
6
|
import "./chunk-O5MHN2EO.mjs";
|
|
7
7
|
import "./chunk-PJ2RFT5A.mjs";
|
|
8
8
|
import "./chunk-LVAHHQIK.mjs";
|
|
9
9
|
import "./chunk-DR3HJ6BV.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-GMSNTW7N.mjs";
|
|
11
11
|
import "./chunk-AHQWDCHV.mjs";
|
|
12
12
|
import "./chunk-7P6ASYW6.mjs";
|
|
13
13
|
export {
|
package/dist/comment.mjs
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
deleteComment,
|
|
5
5
|
trimTrailingEmptyBlocks,
|
|
6
6
|
updateComment
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3IWI5CPN.mjs";
|
|
8
8
|
import "./chunk-JKKS35IS.mjs";
|
|
9
9
|
import "./chunk-LVAHHQIK.mjs";
|
|
10
10
|
import "./chunk-DR3HJ6BV.mjs";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-GMSNTW7N.mjs";
|
|
12
12
|
import "./chunk-AHQWDCHV.mjs";
|
|
13
13
|
import "./chunk-7P6ASYW6.mjs";
|
|
14
14
|
export {
|
package/dist/document-state.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
followToDocument,
|
|
5
5
|
resolveDocumentState,
|
|
6
6
|
resolveEditableDocument
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-XHMBAW2Z.mjs";
|
|
8
|
+
import "./chunk-GMSNTW7N.mjs";
|
|
9
9
|
import "./chunk-AHQWDCHV.mjs";
|
|
10
10
|
import "./chunk-7P6ASYW6.mjs";
|
|
11
11
|
export {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
editorBlockToHMBlock,
|
|
3
3
|
editorBlocksToHMBlockNodes
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DQPKO37T.mjs";
|
|
5
5
|
import "./chunk-JKKS35IS.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-GMSNTW7N.mjs";
|
|
7
7
|
import "./chunk-AHQWDCHV.mjs";
|
|
8
8
|
import "./chunk-7P6ASYW6.mjs";
|
|
9
9
|
export {
|
package/dist/hm-resolver.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export type ResolvedUrl = {
|
|
|
35
35
|
type: string | null;
|
|
36
36
|
panel: string | null;
|
|
37
37
|
};
|
|
38
|
+
/** Converts a domain-based hm:// reference to its HTTPS resolution URL; canonical IDs return null. */
|
|
39
|
+
export declare function hmDomainUrlToWebUrl(input: string): string | null;
|
|
38
40
|
export declare function resolveHypermediaUrl(url: string, opts?: ResolveOptions): Promise<ResolvedUrl | null>;
|
|
39
41
|
/**
|
|
40
42
|
* Resolve a string that may be an hm:// ID, a gateway URL, or a site web URL
|
package/dist/hm-resolver.mjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
+
hmDomainUrlToWebUrl,
|
|
2
3
|
resolveHypermediaUrl,
|
|
3
4
|
resolveId
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-IIH2GY7Y.mjs";
|
|
6
|
+
import "./chunk-GMSNTW7N.mjs";
|
|
6
7
|
import "./chunk-AHQWDCHV.mjs";
|
|
7
8
|
import "./chunk-7P6ASYW6.mjs";
|
|
8
9
|
export {
|
|
10
|
+
hmDomainUrlToWebUrl,
|
|
9
11
|
resolveHypermediaUrl,
|
|
10
12
|
resolveId
|
|
11
13
|
};
|