@seed-hypermedia/client 0.0.68 → 0.0.70
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/LICENSE +201 -0
- package/dist/auth.d.ts +79 -0
- package/dist/auth.mjs +266 -0
- package/dist/auto-link.d.ts +3 -2
- package/dist/auto-link.mjs +21 -0
- package/dist/base64.mjs +9 -0
- package/dist/blobs.d.ts +170 -0
- package/dist/blobs.mjs +51 -0
- package/dist/block-diff.mjs +17 -0
- package/dist/blocks-to-markdown.mjs +22 -0
- package/dist/capability.d.ts +7 -2
- package/dist/capability.mjs +14 -0
- package/dist/cbor.d.ts +13 -0
- package/dist/cbor.mjs +13 -0
- package/dist/change.d.ts +8 -7
- package/dist/change.mjs +24 -0
- package/dist/chunk-2MD3FXKB.mjs +14 -0
- package/dist/chunk-37WRGUK4.mjs +125 -0
- package/dist/chunk-3KESF5XJ.mjs +297 -0
- package/dist/chunk-3TPCJCVO.mjs +24 -0
- package/dist/chunk-4Q3SAL5R.mjs +75 -0
- package/dist/chunk-52P3E6H6.mjs +459 -0
- package/dist/chunk-BUPMCRR4.mjs +48 -0
- package/dist/chunk-CBELM7KX.mjs +29 -0
- package/dist/{chunk-KCR3277A.mjs → chunk-DBHL3BYB.mjs} +9 -14
- package/dist/chunk-DR3HJ6BV.mjs +25 -0
- package/dist/chunk-EU36RFR3.mjs +159 -0
- package/dist/chunk-EY6RQVAP.mjs +138 -0
- package/dist/chunk-H7L4TI6X.mjs +705 -0
- package/dist/chunk-HBIVZA6C.mjs +102 -0
- package/dist/chunk-IT5LLTMP.mjs +209 -0
- package/dist/chunk-JT57MV7Y.mjs +136 -0
- package/dist/chunk-KO4XH5L2.mjs +475 -0
- package/dist/chunk-LVAHHQIK.mjs +41 -0
- package/dist/chunk-LYECQKZE.mjs +49 -0
- package/dist/chunk-N3P7S5YZ.mjs +118 -0
- package/dist/chunk-NPG76WUS.mjs +348 -0
- package/dist/chunk-NYWCMQTH.mjs +412 -0
- package/dist/chunk-OZKQOI2X.mjs +334 -0
- package/dist/chunk-PJ2RFT5A.mjs +113 -0
- package/dist/chunk-PPAY4WZX.mjs +40 -0
- package/dist/chunk-S2PVJK2P.mjs +517 -0
- package/dist/chunk-SHOAYNJY.mjs +289 -0
- package/dist/chunk-T5BTAJPW.mjs +725 -0
- package/dist/{chunk-EGCUJ6D6.mjs → chunk-UOL3F6XQ.mjs} +0 -12
- package/dist/chunk-VN7F33SS.mjs +108 -0
- package/dist/chunk-YNVFRCUH.mjs +171 -0
- package/dist/client.d.ts +3 -2
- package/dist/client.mjs +15 -0
- package/dist/comment.d.ts +5 -4
- package/dist/comment.mjs +19 -0
- package/dist/contact.d.ts +5 -4
- package/dist/contact.mjs +15 -0
- package/dist/document-state.mjs +8 -0
- package/dist/editor-types.mjs +0 -0
- package/dist/editorblock-to-hmblock.mjs +11 -0
- package/dist/encryption.mjs +13 -0
- package/dist/errors.mjs +11 -0
- package/dist/file-to-ipfs.mjs +13 -0
- package/dist/grobid.mjs +11 -0
- package/dist/hm-resolver.mjs +10 -0
- package/dist/hmauth.d.ts +169 -0
- package/dist/hmauth.mjs +53 -0
- package/dist/hmblock-to-editorblock.mjs +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +132 -5453
- package/dist/keyfile.mjs +19 -0
- package/dist/markdown-to-blocks.mjs +15 -0
- package/dist/pdf-to-blocks-embedded.mjs +7 -0
- package/dist/pdf-to-blocks.mjs +11 -0
- package/dist/ref.d.ts +5 -4
- package/dist/ref.mjs +13 -0
- package/dist/resource-read.mjs +15 -0
- package/dist/signer.d.ts +42 -0
- package/dist/signer.mjs +9 -0
- package/dist/signing.d.ts +10 -2
- package/dist/signing.mjs +16 -0
- package/dist/tei-to-blocks.mjs +8 -0
- package/dist/unicode.mjs +19 -0
- package/dist/vault-local.mjs +10 -6
- package/dist/vault.d.ts +14 -4
- package/dist/vault.mjs +6 -2
- package/package.json +18 -28
- package/src/index.ts +0 -144
|
@@ -2,16 +2,6 @@ import {
|
|
|
2
2
|
__export
|
|
3
3
|
} from "./chunk-7P6ASYW6.mjs";
|
|
4
4
|
|
|
5
|
-
// src/base64.ts
|
|
6
|
-
import "core-js/modules/es.uint8-array.from-base64.js";
|
|
7
|
-
import "core-js/modules/es.uint8-array.to-base64.js";
|
|
8
|
-
function encode(data) {
|
|
9
|
-
return data.toBase64({ alphabet: "base64url", omitPadding: true });
|
|
10
|
-
}
|
|
11
|
-
function decode(data) {
|
|
12
|
-
return Uint8Array.fromBase64(data, { alphabet: "base64url" });
|
|
13
|
-
}
|
|
14
|
-
|
|
15
5
|
// src/encryption.ts
|
|
16
6
|
var encryption_exports = {};
|
|
17
7
|
__export(encryption_exports, {
|
|
@@ -55,8 +45,6 @@ async function decrypt(data, key) {
|
|
|
55
45
|
}
|
|
56
46
|
|
|
57
47
|
export {
|
|
58
|
-
encode,
|
|
59
|
-
decode,
|
|
60
48
|
DEFAULT_PARAMS,
|
|
61
49
|
deriveKeyFromPassword,
|
|
62
50
|
encrypt,
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// src/file-to-ipfs.ts
|
|
2
|
+
import { MemoryBlockstore } from "blockstore-core/memory";
|
|
3
|
+
import { importer as unixFSImporter } from "ipfs-unixfs-importer";
|
|
4
|
+
async function fileToIpfsBlobs(data) {
|
|
5
|
+
const blockstore = new MemoryBlockstore();
|
|
6
|
+
const results = unixFSImporter([{ content: data }], blockstore);
|
|
7
|
+
const result = await results.next();
|
|
8
|
+
if (!result.value) {
|
|
9
|
+
throw new Error("Failed to chunk file into IPFS blocks");
|
|
10
|
+
}
|
|
11
|
+
const rootCid = result.value.cid.toString();
|
|
12
|
+
const blobs = [];
|
|
13
|
+
for await (const pair of blockstore.getAll()) {
|
|
14
|
+
blobs.push({
|
|
15
|
+
cid: pair.cid.toString(),
|
|
16
|
+
data: pair.block
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return { cid: rootCid, blobs };
|
|
20
|
+
}
|
|
21
|
+
async function filesToIpfsBlobs(binaries) {
|
|
22
|
+
const blockstore = new MemoryBlockstore();
|
|
23
|
+
const resultCIDs = [];
|
|
24
|
+
for (const binary of binaries) {
|
|
25
|
+
const results = unixFSImporter([{ content: binary }], blockstore);
|
|
26
|
+
const result = await results.next();
|
|
27
|
+
if (!result.value) {
|
|
28
|
+
throw new Error("Failed to chunk file into IPFS blocks");
|
|
29
|
+
}
|
|
30
|
+
resultCIDs.push(result.value.cid.toString());
|
|
31
|
+
}
|
|
32
|
+
const blobs = [];
|
|
33
|
+
for await (const pair of blockstore.getAll()) {
|
|
34
|
+
blobs.push({
|
|
35
|
+
cid: pair.cid.toString(),
|
|
36
|
+
data: pair.block
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return { resultCIDs, blobs };
|
|
40
|
+
}
|
|
41
|
+
var FILE_PROTOCOL = "file://";
|
|
42
|
+
function getBlockLink(block) {
|
|
43
|
+
const b = block;
|
|
44
|
+
return typeof b.link === "string" ? b.link : void 0;
|
|
45
|
+
}
|
|
46
|
+
function setBlockLink(block, link) {
|
|
47
|
+
return { ...block, link };
|
|
48
|
+
}
|
|
49
|
+
async function resolveFileLinksInBlocks(nodes, readFile) {
|
|
50
|
+
const blockstore = new MemoryBlockstore();
|
|
51
|
+
const cidMap = /* @__PURE__ */ new Map();
|
|
52
|
+
const resolved = await resolveNodes(nodes, blockstore, cidMap, readFile);
|
|
53
|
+
const blobs = [];
|
|
54
|
+
for await (const pair of blockstore.getAll()) {
|
|
55
|
+
blobs.push({
|
|
56
|
+
cid: pair.cid.toString(),
|
|
57
|
+
data: pair.block
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return { nodes: resolved, blobs };
|
|
61
|
+
}
|
|
62
|
+
async function resolveNodes(nodes, blockstore, cidMap, readFile) {
|
|
63
|
+
const result = [];
|
|
64
|
+
for (const node of nodes) {
|
|
65
|
+
let resolvedBlock = node.block;
|
|
66
|
+
const link = getBlockLink(resolvedBlock);
|
|
67
|
+
if (link && link.startsWith(FILE_PROTOCOL)) {
|
|
68
|
+
const filePath = link.slice(FILE_PROTOCOL.length);
|
|
69
|
+
const ipfsUrl = await resolveFileToCid(filePath, blockstore, cidMap, readFile);
|
|
70
|
+
resolvedBlock = setBlockLink(resolvedBlock, ipfsUrl);
|
|
71
|
+
}
|
|
72
|
+
const resolvedChildren = node.children ? await resolveNodes(node.children, blockstore, cidMap, readFile) : void 0;
|
|
73
|
+
result.push({ block: resolvedBlock, children: resolvedChildren });
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
async function resolveFileToCid(filePath, blockstore, cidMap, readFile) {
|
|
78
|
+
const cached = cidMap.get(filePath);
|
|
79
|
+
if (cached) return cached;
|
|
80
|
+
const data = await readFile(filePath);
|
|
81
|
+
const results = unixFSImporter([{ content: data }], blockstore);
|
|
82
|
+
const result = await results.next();
|
|
83
|
+
if (!result.value) {
|
|
84
|
+
throw new Error(`Failed to process file for IPFS: ${filePath}`);
|
|
85
|
+
}
|
|
86
|
+
const ipfsUrl = `ipfs://${result.value.cid.toString()}`;
|
|
87
|
+
cidMap.set(filePath, ipfsUrl);
|
|
88
|
+
return ipfsUrl;
|
|
89
|
+
}
|
|
90
|
+
function hasFileLinks(nodes) {
|
|
91
|
+
for (const node of nodes) {
|
|
92
|
+
const link = getBlockLink(node.block);
|
|
93
|
+
if (link && link.startsWith(FILE_PROTOCOL)) {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
if (node.children && hasFileLinks(node.children)) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
fileToIpfsBlobs,
|
|
105
|
+
filesToIpfsBlobs,
|
|
106
|
+
resolveFileLinksInBlocks,
|
|
107
|
+
hasFileLinks
|
|
108
|
+
};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
entityQueryPathToHmIdPath,
|
|
3
|
+
parseFragment,
|
|
4
|
+
unpackHmId
|
|
5
|
+
} from "./chunk-SQEUO7FO.mjs";
|
|
6
|
+
|
|
7
|
+
// src/hm-resolver.ts
|
|
8
|
+
async function resolveHypermediaUrl(url, opts) {
|
|
9
|
+
let latest = false;
|
|
10
|
+
let blockRef = null;
|
|
11
|
+
let blockRange = null;
|
|
12
|
+
let panel = null;
|
|
13
|
+
let parsedUrl = null;
|
|
14
|
+
try {
|
|
15
|
+
parsedUrl = new URL(url);
|
|
16
|
+
const hasVersion = parsedUrl.searchParams.has("v");
|
|
17
|
+
const hasLatest = parsedUrl.searchParams.has("l");
|
|
18
|
+
panel = parsedUrl.searchParams.get("panel");
|
|
19
|
+
if (parsedUrl.hash) {
|
|
20
|
+
const fragment = parseFragment(parsedUrl.hash.slice(1));
|
|
21
|
+
if (fragment) {
|
|
22
|
+
blockRef = fragment.blockId;
|
|
23
|
+
if ("start" in fragment && fragment.start !== void 0) {
|
|
24
|
+
blockRange = { start: fragment.start, end: fragment.end };
|
|
25
|
+
} else if ("expanded" in fragment && fragment.expanded) {
|
|
26
|
+
blockRange = { expanded: fragment.expanded };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
latest = blockRef ? false : hasLatest || !hasVersion;
|
|
31
|
+
} catch {
|
|
32
|
+
}
|
|
33
|
+
if ((opts == null ? void 0 : opts.domainResolver) && parsedUrl) {
|
|
34
|
+
try {
|
|
35
|
+
const uid = await opts.domainResolver(parsedUrl.hostname);
|
|
36
|
+
if (uid) {
|
|
37
|
+
return buildResolvedUrlFromDomainUid(parsedUrl, uid, {
|
|
38
|
+
latest,
|
|
39
|
+
blockRef,
|
|
40
|
+
blockRange,
|
|
41
|
+
panel
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
let response;
|
|
48
|
+
try {
|
|
49
|
+
response = await fetch(url, {
|
|
50
|
+
method: "OPTIONS"
|
|
51
|
+
});
|
|
52
|
+
} catch (error) {
|
|
53
|
+
if ((opts == null ? void 0 : opts.domainResolver) && parsedUrl) {
|
|
54
|
+
try {
|
|
55
|
+
const uid = await opts.domainResolver(parsedUrl.hostname);
|
|
56
|
+
if (uid) {
|
|
57
|
+
return buildResolvedUrlFromDomainUid(parsedUrl, uid, {
|
|
58
|
+
latest,
|
|
59
|
+
blockRef,
|
|
60
|
+
blockRange,
|
|
61
|
+
panel
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
} catch {
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
if (response.status === 200) {
|
|
70
|
+
const rawId = response.headers.get("x-hypermedia-id");
|
|
71
|
+
const id = rawId ? decodeURIComponent(rawId) : null;
|
|
72
|
+
const version = response.headers.get("x-hypermedia-version");
|
|
73
|
+
const encodedTitle = response.headers.get("x-hypermedia-title");
|
|
74
|
+
const title = encodedTitle ? decodeURIComponent(encodedTitle) : null;
|
|
75
|
+
const rawTarget = response.headers.get("x-hypermedia-target");
|
|
76
|
+
const target = rawTarget ? unpackHmId(decodeURIComponent(rawTarget)) : null;
|
|
77
|
+
const rawAuthors = response.headers.get("x-hypermedia-authors");
|
|
78
|
+
const authors = rawAuthors ? decodeURIComponent(rawAuthors).split(",").map((author) => unpackHmId(author)).filter((author) => author !== null) : null;
|
|
79
|
+
const type = response.headers.get("x-hypermedia-type");
|
|
80
|
+
if (id) {
|
|
81
|
+
const hmId = unpackHmId(id);
|
|
82
|
+
const resolvedVersion = version ?? (hmId == null ? void 0 : hmId.version) ?? null;
|
|
83
|
+
let siteHostname = null;
|
|
84
|
+
try {
|
|
85
|
+
const inputUrl = new URL(url);
|
|
86
|
+
if (!inputUrl.pathname.startsWith("/hm/")) {
|
|
87
|
+
siteHostname = inputUrl.origin;
|
|
88
|
+
}
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
91
|
+
if (!hmId) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
id,
|
|
96
|
+
hmId: {
|
|
97
|
+
...hmId,
|
|
98
|
+
version: resolvedVersion,
|
|
99
|
+
latest,
|
|
100
|
+
blockRef,
|
|
101
|
+
blockRange,
|
|
102
|
+
hostname: siteHostname || hmId.hostname
|
|
103
|
+
},
|
|
104
|
+
version,
|
|
105
|
+
title,
|
|
106
|
+
target,
|
|
107
|
+
authors,
|
|
108
|
+
type,
|
|
109
|
+
panel
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
async function resolveId(input, opts) {
|
|
117
|
+
const parsed = unpackHmId(input);
|
|
118
|
+
if (parsed) return parsed;
|
|
119
|
+
if (input.startsWith("http://") || input.startsWith("https://")) {
|
|
120
|
+
const resolved = await resolveHypermediaUrl(input, opts);
|
|
121
|
+
if (resolved == null ? void 0 : resolved.hmId) return resolved.hmId;
|
|
122
|
+
throw new Error(`URL does not appear to be a Seed Hypermedia resource: ${input}`);
|
|
123
|
+
}
|
|
124
|
+
throw new Error(`Invalid Hypermedia ID: ${input}`);
|
|
125
|
+
}
|
|
126
|
+
function buildResolvedUrlFromDomainUid(parsedUrl, uid, {
|
|
127
|
+
latest,
|
|
128
|
+
blockRef,
|
|
129
|
+
blockRange,
|
|
130
|
+
panel
|
|
131
|
+
}) {
|
|
132
|
+
const pathSegments = entityQueryPathToHmIdPath(parsedUrl.pathname);
|
|
133
|
+
const profilePath = resolveProfilePath(uid, pathSegments);
|
|
134
|
+
const resolvedUid = (profilePath == null ? void 0 : profilePath.uid) || uid;
|
|
135
|
+
const path = (profilePath == null ? void 0 : profilePath.path) || (pathSegments.length > 0 ? pathSegments : null);
|
|
136
|
+
const version = parsedUrl.searchParams.get("v") || null;
|
|
137
|
+
const pathStr = path ? "/" + path.join("/") : "";
|
|
138
|
+
const siteHostname = parsedUrl.origin;
|
|
139
|
+
return {
|
|
140
|
+
id: `hm://${resolvedUid}${pathStr}`,
|
|
141
|
+
hmId: {
|
|
142
|
+
id: `hm://${resolvedUid}${pathStr}`,
|
|
143
|
+
uid: resolvedUid,
|
|
144
|
+
path,
|
|
145
|
+
version,
|
|
146
|
+
blockRef,
|
|
147
|
+
blockRange,
|
|
148
|
+
hostname: siteHostname,
|
|
149
|
+
scheme: "hm",
|
|
150
|
+
latest
|
|
151
|
+
},
|
|
152
|
+
version,
|
|
153
|
+
title: null,
|
|
154
|
+
target: null,
|
|
155
|
+
authors: null,
|
|
156
|
+
type: null,
|
|
157
|
+
panel
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function resolveProfilePath(siteUid, pathSegments) {
|
|
161
|
+
if (pathSegments[0] !== ":profile") return null;
|
|
162
|
+
return {
|
|
163
|
+
uid: pathSegments[1] || siteUid,
|
|
164
|
+
path: [":profile"]
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
resolveHypermediaUrl,
|
|
170
|
+
resolveId
|
|
171
|
+
};
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type HMPrepareDocumentChangeInput, type HMRequest
|
|
2
|
+
import { type HMPrepareDocumentChangeInput, type HMRequest } from './hm-types';
|
|
3
|
+
import type { AnySigner } from './signer';
|
|
3
4
|
/**
|
|
4
5
|
* Deserializes a URL query string using a Zod schema.
|
|
5
6
|
* If the query contains only a __value key, returns the primitive value directly.
|
|
@@ -34,7 +35,7 @@ export type SeedClient = {
|
|
|
34
35
|
}>['output']>;
|
|
35
36
|
publish(input: PublishBlobsRequest['input']): Promise<PublishBlobsRequest['output']>;
|
|
36
37
|
publishBlobs(input: PublishBlobsRequest['input']): Promise<PublishBlobsRequest['output']>;
|
|
37
|
-
publishDocument(input: PublishDocumentInput, signer:
|
|
38
|
+
publishDocument(input: PublishDocumentInput, signer: AnySigner): Promise<void>;
|
|
38
39
|
baseUrl: string;
|
|
39
40
|
};
|
|
40
41
|
export declare function createSeedClient(baseUrl: string, options?: SeedClientOptions): SeedClient;
|
package/dist/client.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSeedClient,
|
|
3
|
+
deserializeQueryString
|
|
4
|
+
} from "./chunk-3KESF5XJ.mjs";
|
|
5
|
+
import "./chunk-CBELM7KX.mjs";
|
|
6
|
+
import "./chunk-JT57MV7Y.mjs";
|
|
7
|
+
import "./chunk-PJ2RFT5A.mjs";
|
|
8
|
+
import "./chunk-LVAHHQIK.mjs";
|
|
9
|
+
import "./chunk-DR3HJ6BV.mjs";
|
|
10
|
+
import "./chunk-SQEUO7FO.mjs";
|
|
11
|
+
import "./chunk-7P6ASYW6.mjs";
|
|
12
|
+
export {
|
|
13
|
+
createSeedClient,
|
|
14
|
+
deserializeQueryString
|
|
15
|
+
};
|
package/dist/comment.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { HMBlockNode, HMPublishBlobsInput,
|
|
1
|
+
import type { HMBlockNode, HMPublishBlobsInput, UnpackedHypermediaId } from './hm-types';
|
|
2
|
+
import type { AnySigner } from './signer';
|
|
2
3
|
/**
|
|
3
4
|
* Removes trailing empty blocks from comment content before publishing.
|
|
4
5
|
* The editor always keeps a trailing empty paragraph for UX, but we
|
|
@@ -46,7 +47,7 @@ export type CreateCommentInput = (CreateCommentBaseInput & {
|
|
|
46
47
|
}>;
|
|
47
48
|
prepareAttachments?: PrepareAttachments;
|
|
48
49
|
});
|
|
49
|
-
export declare function createComment(input: CreateCommentInput, signer:
|
|
50
|
+
export declare function createComment(input: CreateCommentInput, signer: AnySigner): Promise<HMPublishBlobsInput>;
|
|
50
51
|
export type DeleteCommentInput = {
|
|
51
52
|
commentId: string;
|
|
52
53
|
targetAccount: string;
|
|
@@ -54,7 +55,7 @@ export type DeleteCommentInput = {
|
|
|
54
55
|
targetVersion: string;
|
|
55
56
|
visibility?: 'Private' | '';
|
|
56
57
|
};
|
|
57
|
-
export declare function deleteComment(input: DeleteCommentInput, signer:
|
|
58
|
+
export declare function deleteComment(input: DeleteCommentInput, signer: AnySigner): Promise<HMPublishBlobsInput>;
|
|
58
59
|
/** Input for updating an existing comment. */
|
|
59
60
|
export type UpdateCommentInput = {
|
|
60
61
|
commentId: string;
|
|
@@ -67,7 +68,7 @@ export type UpdateCommentInput = {
|
|
|
67
68
|
visibility?: 'Private' | '';
|
|
68
69
|
};
|
|
69
70
|
/** Creates a signed update blob for an existing comment. */
|
|
70
|
-
export declare function updateComment(input: UpdateCommentInput, signer:
|
|
71
|
+
export declare function updateComment(input: UpdateCommentInput, signer: AnySigner): Promise<HMPublishBlobsInput>;
|
|
71
72
|
/**
|
|
72
73
|
* Compute the record ID ("authority/tsid") from raw CBOR-encoded comment blob bytes.
|
|
73
74
|
* The TSID is a 10-byte base58btc value: 6 bytes ms timestamp + 4 bytes SHA256 prefix.
|
package/dist/comment.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
commentRecordIdFromBlob,
|
|
3
|
+
createComment,
|
|
4
|
+
deleteComment,
|
|
5
|
+
trimTrailingEmptyBlocks,
|
|
6
|
+
updateComment
|
|
7
|
+
} from "./chunk-NYWCMQTH.mjs";
|
|
8
|
+
import "./chunk-N3P7S5YZ.mjs";
|
|
9
|
+
import "./chunk-LVAHHQIK.mjs";
|
|
10
|
+
import "./chunk-DR3HJ6BV.mjs";
|
|
11
|
+
import "./chunk-SQEUO7FO.mjs";
|
|
12
|
+
import "./chunk-7P6ASYW6.mjs";
|
|
13
|
+
export {
|
|
14
|
+
commentRecordIdFromBlob,
|
|
15
|
+
createComment,
|
|
16
|
+
deleteComment,
|
|
17
|
+
trimTrailingEmptyBlocks,
|
|
18
|
+
updateComment
|
|
19
|
+
};
|
package/dist/contact.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { HMPublishBlobsInput
|
|
1
|
+
import type { HMPublishBlobsInput } from './hm-types';
|
|
2
|
+
import type { AnySigner } from './signer';
|
|
2
3
|
export type ContactSubscribe = {
|
|
3
4
|
site?: boolean;
|
|
4
5
|
profile?: boolean;
|
|
@@ -39,16 +40,16 @@ export type CreateContactResult = HMPublishBlobsInput & {
|
|
|
39
40
|
* Create a new contact blob and compute its record ID.
|
|
40
41
|
* Returns the publish input plus a `recordId` in "authority/tsid" format.
|
|
41
42
|
*/
|
|
42
|
-
export declare function createContact(input: CreateContactInput, signer:
|
|
43
|
+
export declare function createContact(input: CreateContactInput, signer: AnySigner): Promise<CreateContactResult>;
|
|
43
44
|
/**
|
|
44
45
|
* Update an existing contact blob. Reuses the original TSID.
|
|
45
46
|
*/
|
|
46
|
-
export declare function updateContact(input: UpdateContactInput, signer:
|
|
47
|
+
export declare function updateContact(input: UpdateContactInput, signer: AnySigner): Promise<HMPublishBlobsInput>;
|
|
47
48
|
/**
|
|
48
49
|
* Delete a contact by publishing a tombstone blob.
|
|
49
50
|
* A tombstone has the same TSID but no subject and no name.
|
|
50
51
|
*/
|
|
51
|
-
export declare function deleteContact(input: DeleteContactInput, signer:
|
|
52
|
+
export declare function deleteContact(input: DeleteContactInput, signer: AnySigner): Promise<HMPublishBlobsInput>;
|
|
52
53
|
/**
|
|
53
54
|
* Compute the record ID ("authority/tsid") from raw CBOR-encoded contact blob bytes.
|
|
54
55
|
* Useful for resolving a CID to a record ID after fetching the blob.
|
package/dist/contact.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
contactRecordIdFromBlob,
|
|
3
|
+
createContact,
|
|
4
|
+
deleteContact,
|
|
5
|
+
updateContact
|
|
6
|
+
} from "./chunk-37WRGUK4.mjs";
|
|
7
|
+
import "./chunk-LVAHHQIK.mjs";
|
|
8
|
+
import "./chunk-DR3HJ6BV.mjs";
|
|
9
|
+
import "./chunk-7P6ASYW6.mjs";
|
|
10
|
+
export {
|
|
11
|
+
contactRecordIdFromBlob,
|
|
12
|
+
createContact,
|
|
13
|
+
deleteContact,
|
|
14
|
+
updateContact
|
|
15
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
editorBlockToHMBlock,
|
|
3
|
+
editorBlocksToHMBlockNodes
|
|
4
|
+
} from "./chunk-NPG76WUS.mjs";
|
|
5
|
+
import "./chunk-N3P7S5YZ.mjs";
|
|
6
|
+
import "./chunk-SQEUO7FO.mjs";
|
|
7
|
+
import "./chunk-7P6ASYW6.mjs";
|
|
8
|
+
export {
|
|
9
|
+
editorBlockToHMBlock,
|
|
10
|
+
editorBlocksToHMBlockNodes
|
|
11
|
+
};
|
package/dist/errors.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fileToIpfsBlobs,
|
|
3
|
+
filesToIpfsBlobs,
|
|
4
|
+
hasFileLinks,
|
|
5
|
+
resolveFileLinksInBlocks
|
|
6
|
+
} from "./chunk-VN7F33SS.mjs";
|
|
7
|
+
import "./chunk-7P6ASYW6.mjs";
|
|
8
|
+
export {
|
|
9
|
+
fileToIpfsBlobs,
|
|
10
|
+
filesToIpfsBlobs,
|
|
11
|
+
hasFileLinks,
|
|
12
|
+
resolveFileLinksInBlocks
|
|
13
|
+
};
|
package/dist/grobid.mjs
ADDED