@seed-hypermedia/client 0.0.113 → 0.0.115
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-UHAYFVBP.mjs → chunk-3LMBGHBE.mjs} +75 -5
- package/dist/{chunk-3P4J4WDY.mjs → chunk-54K7Z3BG.mjs} +1 -1
- package/dist/{chunk-KMACFX6U.mjs → chunk-BGWUWAFJ.mjs} +1 -1
- package/dist/{chunk-URLWDK7P.mjs → chunk-BZOAANTM.mjs} +1 -1
- package/dist/{chunk-2PRZIGCZ.mjs → chunk-DQMPCZVZ.mjs} +14 -5
- package/dist/chunk-HSDV6WEU.mjs +10 -0
- package/dist/{chunk-5VBVPSXD.mjs → chunk-HZQXXBOH.mjs} +2 -2
- package/dist/chunk-JELXCUZJ.mjs +49 -0
- package/dist/{chunk-3TERIXHU.mjs → chunk-LWCFLZRZ.mjs} +7 -30
- package/dist/{chunk-OXZCRYUS.mjs → chunk-MJFOPYAB.mjs} +1 -1
- package/dist/{chunk-YF2CLLSQ.mjs → chunk-MTJRBDF2.mjs} +3 -3
- package/dist/{chunk-AUKAVTTK.mjs → chunk-MZMGRUTQ.mjs} +1 -1
- package/dist/{chunk-YC433TGZ.mjs → chunk-QIKOXXTT.mjs} +1 -1
- package/dist/{chunk-GLY3UZ3W.mjs → chunk-UQWQXOBZ.mjs} +1 -1
- package/dist/{chunk-LQTTR4ZP.mjs → chunk-V2XTXDGG.mjs} +1 -1
- package/dist/{chunk-NLH5MKTK.mjs → chunk-ZVPHEP3X.mjs} +1 -1
- 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 +13 -0
- package/dist/hm-resolver.mjs +6 -2
- package/dist/hm-types.d.ts +5 -452
- package/dist/hm-types.mjs +1 -3
- package/dist/hmblock-to-editorblock.mjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +20 -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-ALW35WVX.mjs +0 -75
- package/dist/chunk-MLR4UDOJ.mjs +0 -10
package/dist/hm-types.mjs
CHANGED
|
@@ -68,7 +68,6 @@ import {
|
|
|
68
68
|
HMDraftContentSchema,
|
|
69
69
|
HMDraftMetaSchema,
|
|
70
70
|
HMEmbedViewSchema,
|
|
71
|
-
HMExternalCommentGroupSchema,
|
|
72
71
|
HMGenerationInfoSchema,
|
|
73
72
|
HMGetCIDInputSchema,
|
|
74
73
|
HMGetCIDOutputSchema,
|
|
@@ -216,7 +215,7 @@ import {
|
|
|
216
215
|
toNumber,
|
|
217
216
|
unpackHmId,
|
|
218
217
|
unpackedHmIdSchema
|
|
219
|
-
} from "./chunk-
|
|
218
|
+
} from "./chunk-LWCFLZRZ.mjs";
|
|
220
219
|
import "./chunk-AHQWDCHV.mjs";
|
|
221
220
|
import "./chunk-7P6ASYW6.mjs";
|
|
222
221
|
export {
|
|
@@ -289,7 +288,6 @@ export {
|
|
|
289
288
|
HMDraftContentSchema,
|
|
290
289
|
HMDraftMetaSchema,
|
|
291
290
|
HMEmbedViewSchema,
|
|
292
|
-
HMExternalCommentGroupSchema,
|
|
293
291
|
HMGenerationInfoSchema,
|
|
294
292
|
HMGetCIDInputSchema,
|
|
295
293
|
HMGetCIDOutputSchema,
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
annotationContains,
|
|
3
3
|
hmBlockToEditorBlock,
|
|
4
4
|
hmBlocksToEditorContent
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-BZOAANTM.mjs";
|
|
6
|
+
import "./chunk-LWCFLZRZ.mjs";
|
|
7
7
|
import "./chunk-AHQWDCHV.mjs";
|
|
8
8
|
import "./chunk-7P6ASYW6.mjs";
|
|
9
9
|
export {
|
package/dist/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export { codePointLength, entityQueryPathToHmIdPath, getHMQueryString, hmIdPathT
|
|
|
25
25
|
export type { HMRequest, HMSigner, UnpackedHypermediaId } from './hm-types';
|
|
26
26
|
export { toHMSigner, toPrincipalSigner } from './signer';
|
|
27
27
|
export type { AnySigner, PrincipalSigner } from './signer';
|
|
28
|
-
export { resolveHypermediaUrl, resolveId } from './hm-resolver';
|
|
28
|
+
export { resolveHypermediaUrl, resolveId, hmDomainUrlToWebUrl, extractCommentIdFromUrl } from './hm-resolver';
|
|
29
29
|
export type { DomainResolverFn, DomainIdChangedCallback, ResolveOptions, ResolvedUrl } from './hm-resolver';
|
|
30
30
|
export { resolveIdWithClient } from './resource-read';
|
|
31
31
|
export type { ResolveIdWithClientOptions, ResolvedIdWithClient } from './resource-read';
|
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pdfToBlocks
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UQWQXOBZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
teiToBlocks
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QIKOXXTT.mjs";
|
|
7
7
|
import {
|
|
8
8
|
embeddedPdfToBlocks
|
|
9
9
|
} from "./chunk-2FJBS3V7.mjs";
|
|
10
10
|
import {
|
|
11
11
|
resolveIdWithClient
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JELXCUZJ.mjs";
|
|
13
13
|
import {
|
|
14
14
|
annotationContains,
|
|
15
15
|
hmBlockToEditorBlock,
|
|
16
16
|
hmBlocksToEditorContent
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-BZOAANTM.mjs";
|
|
18
18
|
import {
|
|
19
19
|
keyfile_exports
|
|
20
20
|
} from "./chunk-EY6RQVAP.mjs";
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
import {
|
|
37
37
|
editorBlockToHMBlock,
|
|
38
38
|
editorBlocksToHMBlockNodes
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-54K7Z3BG.mjs";
|
|
40
40
|
import {
|
|
41
41
|
encryption_exports
|
|
42
42
|
} from "./chunk-UOL3F6XQ.mjs";
|
|
@@ -53,13 +53,9 @@ import {
|
|
|
53
53
|
isGrobidAvailable,
|
|
54
54
|
processFulltextDocument
|
|
55
55
|
} from "./chunk-PPAY4WZX.mjs";
|
|
56
|
-
import {
|
|
57
|
-
resolveHypermediaUrl,
|
|
58
|
-
resolveId
|
|
59
|
-
} from "./chunk-UHAYFVBP.mjs";
|
|
60
56
|
import {
|
|
61
57
|
createSeedClient
|
|
62
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-MJFOPYAB.mjs";
|
|
63
59
|
import {
|
|
64
60
|
SeedClientError,
|
|
65
61
|
SeedNetworkError,
|
|
@@ -71,7 +67,7 @@ import {
|
|
|
71
67
|
deleteComment,
|
|
72
68
|
trimTrailingEmptyBlocks,
|
|
73
69
|
updateComment
|
|
74
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-ZVPHEP3X.mjs";
|
|
75
71
|
import {
|
|
76
72
|
AnnotationSet,
|
|
77
73
|
addSpanToAnnotation,
|
|
@@ -92,7 +88,7 @@ import {
|
|
|
92
88
|
documentContainsLinkToChild,
|
|
93
89
|
documentHasSelfQuery,
|
|
94
90
|
shouldAutoLinkParent
|
|
95
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-HZQXXBOH.mjs";
|
|
96
92
|
import {
|
|
97
93
|
createChange,
|
|
98
94
|
createChangeOps,
|
|
@@ -114,7 +110,7 @@ import {
|
|
|
114
110
|
followToDocument,
|
|
115
111
|
resolveDocumentState,
|
|
116
112
|
resolveEditableDocument
|
|
117
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-BGWUWAFJ.mjs";
|
|
118
114
|
import "./chunk-2MD3FXKB.mjs";
|
|
119
115
|
import {
|
|
120
116
|
computeReplaceOps,
|
|
@@ -133,11 +129,17 @@ import {
|
|
|
133
129
|
emitFrontmatter,
|
|
134
130
|
parseDraftFilename,
|
|
135
131
|
slugify
|
|
136
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-DQMPCZVZ.mjs";
|
|
133
|
+
import {
|
|
134
|
+
extractCommentIdFromUrl,
|
|
135
|
+
hmDomainUrlToWebUrl,
|
|
136
|
+
resolveHypermediaUrl,
|
|
137
|
+
resolveId
|
|
138
|
+
} from "./chunk-3LMBGHBE.mjs";
|
|
137
139
|
import {
|
|
138
140
|
createCapability,
|
|
139
141
|
resolveCapability
|
|
140
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-V2XTXDGG.mjs";
|
|
141
143
|
import "./chunk-LVAHHQIK.mjs";
|
|
142
144
|
import "./chunk-NBCHK76Q.mjs";
|
|
143
145
|
import {
|
|
@@ -157,7 +159,7 @@ import {
|
|
|
157
159
|
parseFragment,
|
|
158
160
|
serializeBlockRange,
|
|
159
161
|
unpackHmId
|
|
160
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-LWCFLZRZ.mjs";
|
|
161
163
|
import "./chunk-AHQWDCHV.mjs";
|
|
162
164
|
import "./chunk-3TPCJCVO.mjs";
|
|
163
165
|
import "./chunk-7P6ASYW6.mjs";
|
|
@@ -211,6 +213,7 @@ export {
|
|
|
211
213
|
embeddedPdfToBlocks,
|
|
212
214
|
emitFrontmatter,
|
|
213
215
|
entityQueryPathToHmIdPath,
|
|
216
|
+
extractCommentIdFromUrl,
|
|
214
217
|
fileToIpfsBlobs,
|
|
215
218
|
filesToIpfsBlobs,
|
|
216
219
|
flattenToOperations,
|
|
@@ -222,6 +225,7 @@ export {
|
|
|
222
225
|
hmBlockNodeToBlockNode,
|
|
223
226
|
hmBlockToEditorBlock,
|
|
224
227
|
hmBlocksToEditorContent,
|
|
228
|
+
hmDomainUrlToWebUrl,
|
|
225
229
|
hmIdPathToEntityQueryPath,
|
|
226
230
|
isGrobidAvailable,
|
|
227
231
|
isSurrogate,
|
package/dist/pdf-to-blocks.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pdfToBlocks
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-UQWQXOBZ.mjs";
|
|
4
|
+
import "./chunk-QIKOXXTT.mjs";
|
|
5
5
|
import "./chunk-2FJBS3V7.mjs";
|
|
6
6
|
import "./chunk-PPAY4WZX.mjs";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-LWCFLZRZ.mjs";
|
|
8
8
|
import "./chunk-AHQWDCHV.mjs";
|
|
9
9
|
import "./chunk-7P6ASYW6.mjs";
|
|
10
10
|
export {
|
package/dist/resource-read.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveIdWithClient
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-OXZCRYUS.mjs";
|
|
3
|
+
} from "./chunk-JELXCUZJ.mjs";
|
|
4
|
+
import "./chunk-MJFOPYAB.mjs";
|
|
6
5
|
import "./chunk-CBELM7KX.mjs";
|
|
7
6
|
import "./chunk-O5MHN2EO.mjs";
|
|
8
7
|
import "./chunk-PJ2RFT5A.mjs";
|
|
8
|
+
import "./chunk-3LMBGHBE.mjs";
|
|
9
9
|
import "./chunk-LVAHHQIK.mjs";
|
|
10
10
|
import "./chunk-DR3HJ6BV.mjs";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-LWCFLZRZ.mjs";
|
|
12
12
|
import "./chunk-AHQWDCHV.mjs";
|
|
13
13
|
import "./chunk-7P6ASYW6.mjs";
|
|
14
14
|
export {
|
package/dist/schema-engine.mjs
CHANGED
|
@@ -35,11 +35,11 @@ import {
|
|
|
35
35
|
typeOf,
|
|
36
36
|
validate,
|
|
37
37
|
validateAdvisory
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-MZMGRUTQ.mjs";
|
|
39
39
|
import {
|
|
40
40
|
HM_SCHEMAS,
|
|
41
41
|
HM_SCHEMA_MANIFEST
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-HSDV6WEU.mjs";
|
|
43
43
|
import "./chunk-7P6ASYW6.mjs";
|
|
44
44
|
export {
|
|
45
45
|
HM_SCHEMAS,
|
package/dist/schema-resolve.mjs
CHANGED
|
@@ -17,11 +17,11 @@ import {
|
|
|
17
17
|
resolveSchemaRef,
|
|
18
18
|
schemaDefinitionCid,
|
|
19
19
|
withoutSchemaLink
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-MTJRBDF2.mjs";
|
|
21
|
+
import "./chunk-MZMGRUTQ.mjs";
|
|
22
|
+
import "./chunk-HSDV6WEU.mjs";
|
|
23
23
|
import "./chunk-VWSAFDOL.mjs";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-LWCFLZRZ.mjs";
|
|
25
25
|
import "./chunk-AHQWDCHV.mjs";
|
|
26
26
|
import "./chunk-7P6ASYW6.mjs";
|
|
27
27
|
export {
|
package/dist/schema-subtypes.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
classifyRef
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MTJRBDF2.mjs";
|
|
4
4
|
import {
|
|
5
5
|
kindOf,
|
|
6
6
|
nameForCid,
|
|
7
7
|
nameToUrl,
|
|
8
8
|
schemaCid
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MZMGRUTQ.mjs";
|
|
10
10
|
import {
|
|
11
11
|
HM_SCHEMAS
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HSDV6WEU.mjs";
|
|
13
13
|
import "./chunk-VWSAFDOL.mjs";
|
|
14
14
|
import {
|
|
15
15
|
unpackHmId
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LWCFLZRZ.mjs";
|
|
17
17
|
import "./chunk-AHQWDCHV.mjs";
|
|
18
18
|
import "./chunk-7P6ASYW6.mjs";
|
|
19
19
|
|
|
@@ -15,6 +15,19 @@ export type HMBytes = Uint8Array | {
|
|
|
15
15
|
* Schema: hm://hyper.media/account
|
|
16
16
|
*/
|
|
17
17
|
export type HMAccount = string;
|
|
18
|
+
/**
|
|
19
|
+
* Seed Agents
|
|
20
|
+
* Seed Agents is the hosted agent runtime that lets an account run language-model agents which read and write Hypermedia through the Seed API with their own signing keys.
|
|
21
|
+
* Resource attributes for an agent mounted at a Hypermedia document. The server must also register the agent at this exact document ID.
|
|
22
|
+
* Schema: hm://hyper.media/agent
|
|
23
|
+
*/
|
|
24
|
+
export type HMAgent = {
|
|
25
|
+
type: 'hm://hyper.media/agent';
|
|
26
|
+
/** HTTP(S) agent server registering this resource's exact versionless HMID as the agent ID. */
|
|
27
|
+
agentServerUrl: HMUrl;
|
|
28
|
+
} & {
|
|
29
|
+
[key: string]: HMValue;
|
|
30
|
+
};
|
|
18
31
|
/**
|
|
19
32
|
* Blob
|
|
20
33
|
* The signed envelope every Hypermedia blob extends, with a type tag, the signer's public key, an Ed25519 signature over the canonical CBOR with the signature zeroed, and a millisecond timestamp.
|
|
@@ -1182,12 +1195,8 @@ export type HMMetadata = {
|
|
|
1182
1195
|
cover?: HMIpfsUrl;
|
|
1183
1196
|
/** The web address a space is published at; set on the home document when a site is registered. */
|
|
1184
1197
|
siteUrl?: HMUrl;
|
|
1185
|
-
/** The agents server
|
|
1198
|
+
/** The agents server that hosts the agent this document mounts (an http(s) origin); set with `type: hm://hyper.media/agent`. */
|
|
1186
1199
|
agentServerUrl?: HMUrl;
|
|
1187
|
-
/** Agents this space publishes to its readers: `{[agentId]: order}`, each id an agent on `agentServerUrl`; a removed agent leaves a null behind. */
|
|
1188
|
-
spaceAgents?: {
|
|
1189
|
-
[key: string]: HMValue;
|
|
1190
|
-
};
|
|
1191
1200
|
/** The attributes schema THIS document conforms to: the hm:// URL of a schema document (or ipfs://<cid> of a schema blob) whose struct describes the document's attributes. */
|
|
1192
1201
|
attributesSchema?: HMHmUrl;
|
|
1193
1202
|
/** The attributes schema this document's direct CHILDREN conform to (hm:// URL or ipfs://<cid>). A child may declare its own `attributesSchema` instead. */
|
package/dist/signed-blob.mjs
CHANGED
package/dist/tei-to-blocks.mjs
CHANGED
package/dist/unicode.mjs
CHANGED
package/package.json
CHANGED
package/dist/chunk-ALW35WVX.mjs
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveId
|
|
3
|
-
} from "./chunk-UHAYFVBP.mjs";
|
|
4
|
-
import {
|
|
5
|
-
createSeedClient
|
|
6
|
-
} from "./chunk-OXZCRYUS.mjs";
|
|
7
|
-
import {
|
|
8
|
-
unpackHmId
|
|
9
|
-
} from "./chunk-3TERIXHU.mjs";
|
|
10
|
-
|
|
11
|
-
// src/resource-read.ts
|
|
12
|
-
async function resolveIdWithClient(rawId, options = {}) {
|
|
13
|
-
const commentId = extractCommentIdFromReadableUrl(rawId);
|
|
14
|
-
const parsed = commentId ? commentIdToHmId(commentId) : unpackHmId(rawId);
|
|
15
|
-
if (parsed) {
|
|
16
|
-
if (isWebUrl(rawId)) {
|
|
17
|
-
const origin2 = new URL(rawId).origin;
|
|
18
|
-
return { id: parsed, client: createSeedClient(origin2), serverUrl: origin2 };
|
|
19
|
-
}
|
|
20
|
-
const client = options.client ?? createSeedClient(normalizeServerUrl(options.serverUrl || "https://hyper.media"));
|
|
21
|
-
return { id: parsed, client, serverUrl: client.baseUrl };
|
|
22
|
-
}
|
|
23
|
-
const id = await resolveId(rawId, { domainResolver: options.domainResolver });
|
|
24
|
-
const origin = new URL(rawId).origin;
|
|
25
|
-
return { id, client: createSeedClient(origin), serverUrl: origin };
|
|
26
|
-
}
|
|
27
|
-
var COMMENT_VIEW_TERMS = /* @__PURE__ */ new Set([":comments", ":comment", ":discussions"]);
|
|
28
|
-
function extractCommentIdFromReadableUrl(rawId) {
|
|
29
|
-
if (isWebUrl(rawId)) {
|
|
30
|
-
const url = new URL(rawId);
|
|
31
|
-
const panelCommentId = extractCommentIdFromPanel(url.searchParams.get("panel"));
|
|
32
|
-
if (panelCommentId) return panelCommentId;
|
|
33
|
-
return extractCommentIdFromPath(url.pathname.split("/").filter(Boolean));
|
|
34
|
-
}
|
|
35
|
-
const [withoutHash] = rawId.split("#");
|
|
36
|
-
const [withoutQuery] = withoutHash.split("?");
|
|
37
|
-
const parsed = unpackHmId(withoutQuery);
|
|
38
|
-
return (parsed == null ? void 0 : parsed.path) ? extractCommentIdFromPath(parsed.path) : null;
|
|
39
|
-
}
|
|
40
|
-
function extractCommentIdFromPanel(panel) {
|
|
41
|
-
if (!panel) return null;
|
|
42
|
-
const [viewTerm, first, second] = panel.split("/");
|
|
43
|
-
if (viewTerm !== "comments" && viewTerm !== "comment" && viewTerm !== "discussions") return null;
|
|
44
|
-
if (first && second) return `${first}/${second}`;
|
|
45
|
-
return first || null;
|
|
46
|
-
}
|
|
47
|
-
function extractCommentIdFromPath(pathParts) {
|
|
48
|
-
if (pathParts.length >= 3) {
|
|
49
|
-
const thirdToLast = pathParts[pathParts.length - 3];
|
|
50
|
-
if (thirdToLast && COMMENT_VIEW_TERMS.has(thirdToLast)) {
|
|
51
|
-
return `${pathParts[pathParts.length - 2]}/${pathParts[pathParts.length - 1]}`;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (pathParts.length >= 2) {
|
|
55
|
-
const secondToLast = pathParts[pathParts.length - 2];
|
|
56
|
-
if (secondToLast && COMMENT_VIEW_TERMS.has(secondToLast)) return pathParts[pathParts.length - 1] || null;
|
|
57
|
-
}
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
function commentIdToHmId(commentId) {
|
|
61
|
-
const parsed = unpackHmId(`hm://${commentId}`);
|
|
62
|
-
if (!parsed) throw new Error(`Invalid comment ID: ${commentId}`);
|
|
63
|
-
return parsed;
|
|
64
|
-
}
|
|
65
|
-
function isWebUrl(rawId) {
|
|
66
|
-
return rawId.startsWith("http://") || rawId.startsWith("https://");
|
|
67
|
-
}
|
|
68
|
-
function normalizeServerUrl(serverUrl) {
|
|
69
|
-
const withScheme = serverUrl.startsWith("http://") || serverUrl.startsWith("https://") ? serverUrl : `https://${serverUrl}`;
|
|
70
|
-
return withScheme.replace(/\/+$/, "");
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export {
|
|
74
|
-
resolveIdWithClient
|
|
75
|
-
};
|