@seed-hypermedia/client 0.0.109 → 0.0.110
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 +4 -3
- package/dist/blocks-to-markdown.mjs +3 -2
- package/dist/capability.d.ts +9 -3
- package/dist/capability.mjs +3 -2
- package/dist/{chunk-34OBOF5O.mjs → chunk-3Y2LUQ2S.mjs} +1 -1
- package/dist/{chunk-Z3J6R5DN.mjs → chunk-4MLSRAHT.mjs} +1 -1
- package/dist/{chunk-2NM2JP5H.mjs → chunk-5N4GUBTC.mjs} +3 -3
- package/dist/{chunk-VN7F33SS.mjs → chunk-65UV5O57.mjs} +38 -0
- package/dist/chunk-AHQWDCHV.mjs +56 -0
- package/dist/{chunk-ICFYYWGD.mjs → chunk-APDALLCQ.mjs} +1 -1
- package/dist/{chunk-52RP7HHW.mjs → chunk-AUKAVTTK.mjs} +1 -1
- package/dist/{chunk-7IISPGNN.mjs → chunk-FPANFJPK.mjs} +23 -5
- package/dist/{chunk-GWV7ETLU.mjs → chunk-JITFCBJG.mjs} +2 -2
- package/dist/{chunk-IAS2V6ON.mjs → chunk-JXIRASEP.mjs} +1 -1
- package/dist/{chunk-KOQHARP5.mjs → chunk-JZO5T6RZ.mjs} +1 -1
- package/dist/{chunk-Y5XKORRF.mjs → chunk-MLR4UDOJ.mjs} +3 -3
- package/dist/{chunk-HLTKEZ7W.mjs → chunk-N2DIEFL4.mjs} +1 -1
- package/dist/{chunk-KNA3PBET.mjs → chunk-OBJQE4NK.mjs} +1 -1
- package/dist/{chunk-5MVCUZBD.mjs → chunk-ONSB56Z7.mjs} +6 -1
- package/dist/{chunk-G7CFO5W3.mjs → chunk-U3PAJ472.mjs} +1 -1
- package/dist/{chunk-BHESE4LH.mjs → chunk-XBZWF34J.mjs} +3 -3
- package/dist/{chunk-SQFGEPOQ.mjs → chunk-ZIWKVJCO.mjs} +10 -5
- package/dist/client.mjs +3 -2
- package/dist/comment.mjs +3 -2
- package/dist/document-state.mjs +3 -2
- package/dist/editorblock-to-hmblock.mjs +3 -2
- package/dist/file-to-ipfs.d.ts +19 -0
- package/dist/file-to-ipfs.mjs +5 -1
- package/dist/hm-resolver.mjs +3 -2
- package/dist/hm-types.d.ts +4522 -101
- package/dist/hm-types.mjs +2 -1
- package/dist/hmblock-to-editorblock.mjs +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +19 -14
- package/dist/page-input.d.ts +13 -0
- package/dist/page-input.mjs +15 -0
- package/dist/pdf-to-blocks.mjs +4 -3
- package/dist/resource-read.mjs +5 -4
- package/dist/schema-engine.mjs +2 -2
- package/dist/schema-registry.generated.mjs +1 -1
- package/dist/schema-resolve.mjs +5 -4
- package/dist/schema-subtypes.mjs +5 -4
- package/dist/schema-types.generated.d.ts +24 -0
- package/dist/signed-blob.mjs +2 -2
- package/dist/tei-to-blocks.mjs +3 -2
- package/dist/unicode.mjs +2 -1
- package/package.json +1 -1
|
@@ -2,7 +2,10 @@ import {
|
|
|
2
2
|
entityQueryPathToHmIdPath,
|
|
3
3
|
parseFragment,
|
|
4
4
|
unpackHmId
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FPANFJPK.mjs";
|
|
6
|
+
import {
|
|
7
|
+
pageParamsFromUrl
|
|
8
|
+
} from "./chunk-AHQWDCHV.mjs";
|
|
6
9
|
|
|
7
10
|
// src/hm-resolver.ts
|
|
8
11
|
async function resolveHypermediaUrl(url, opts) {
|
|
@@ -109,6 +112,7 @@ async function resolveHypermediaUrl(url, opts) {
|
|
|
109
112
|
id,
|
|
110
113
|
hmId: {
|
|
111
114
|
...hmId,
|
|
115
|
+
...pageParamsFromUrl(url) ? { pageParams: pageParamsFromUrl(url) } : {},
|
|
112
116
|
version: resolvedVersion,
|
|
113
117
|
latest,
|
|
114
118
|
blockRef,
|
|
@@ -181,6 +185,7 @@ function buildResolvedUrlFromDomainUid(parsedUrl, uid, {
|
|
|
181
185
|
blockRange,
|
|
182
186
|
hostname: siteHostname,
|
|
183
187
|
scheme: "hm",
|
|
188
|
+
...pageParamsFromUrl(parsedUrl.href) ? { pageParams: pageParamsFromUrl(parsedUrl.href) } : {},
|
|
184
189
|
latest
|
|
185
190
|
},
|
|
186
191
|
version,
|
|
@@ -10,17 +10,17 @@ import {
|
|
|
10
10
|
schemaForCid,
|
|
11
11
|
structFields,
|
|
12
12
|
validate
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-AUKAVTTK.mjs";
|
|
14
14
|
import {
|
|
15
15
|
HM_SCHEMAS
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MLR4UDOJ.mjs";
|
|
17
17
|
import {
|
|
18
18
|
parseCidString
|
|
19
19
|
} from "./chunk-VWSAFDOL.mjs";
|
|
20
20
|
import {
|
|
21
21
|
packHmId,
|
|
22
22
|
unpackHmId
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-FPANFJPK.mjs";
|
|
24
24
|
|
|
25
25
|
// src/schema-resolve.ts
|
|
26
26
|
var DAG_CBOR_CODE = 113;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
entityQueryPathToHmIdPath,
|
|
9
9
|
packBaseId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FPANFJPK.mjs";
|
|
11
11
|
|
|
12
12
|
// src/capability.ts
|
|
13
13
|
import { base58btc } from "multiformats/bases/base58";
|
|
@@ -21,7 +21,7 @@ async function createCapability2(input, signer) {
|
|
|
21
21
|
);
|
|
22
22
|
return toPublishInput(encoded.data);
|
|
23
23
|
}
|
|
24
|
-
async function resolveCapability(client, targetAccount, signerAccount, path) {
|
|
24
|
+
async function resolveCapability(client, targetAccount, signerAccount, path, capability) {
|
|
25
25
|
if (targetAccount === signerAccount) return void 0;
|
|
26
26
|
const pathSegments = path ? entityQueryPathToHmIdPath(path) : null;
|
|
27
27
|
const targetId = {
|
|
@@ -36,9 +36,14 @@ async function resolveCapability(client, targetAccount, signerAccount, path) {
|
|
|
36
36
|
scheme: null
|
|
37
37
|
};
|
|
38
38
|
const caps = await client.request("ListCapabilities", { targetId });
|
|
39
|
-
const match = caps.capabilities.find(
|
|
40
|
-
(
|
|
41
|
-
|
|
39
|
+
const match = caps.capabilities.find((c) => {
|
|
40
|
+
if (capability && c.id !== capability) return false;
|
|
41
|
+
if (c.delegate !== signerAccount || c.role !== "WRITER" && c.role !== "AGENT") return false;
|
|
42
|
+
if (c.account && c.account !== targetAccount) return false;
|
|
43
|
+
const scope = c.path || "";
|
|
44
|
+
const target = path || "";
|
|
45
|
+
return target === scope || !c.noRecursive && (scope === "" || target.startsWith(scope + "/"));
|
|
46
|
+
});
|
|
42
47
|
return match == null ? void 0 : match.id;
|
|
43
48
|
}
|
|
44
49
|
|
package/dist/client.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSeedClient,
|
|
3
3
|
deserializeQueryString
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JXIRASEP.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-FPANFJPK.mjs";
|
|
11
|
+
import "./chunk-AHQWDCHV.mjs";
|
|
11
12
|
import "./chunk-7P6ASYW6.mjs";
|
|
12
13
|
export {
|
|
13
14
|
createSeedClient,
|
package/dist/comment.mjs
CHANGED
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
deleteComment,
|
|
5
5
|
trimTrailingEmptyBlocks,
|
|
6
6
|
updateComment
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4MLSRAHT.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-FPANFJPK.mjs";
|
|
12
|
+
import "./chunk-AHQWDCHV.mjs";
|
|
12
13
|
import "./chunk-7P6ASYW6.mjs";
|
|
13
14
|
export {
|
|
14
15
|
commentRecordIdFromBlob,
|
package/dist/document-state.mjs
CHANGED
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
followToDocument,
|
|
5
5
|
resolveDocumentState,
|
|
6
6
|
resolveEditableDocument
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-APDALLCQ.mjs";
|
|
8
|
+
import "./chunk-FPANFJPK.mjs";
|
|
9
|
+
import "./chunk-AHQWDCHV.mjs";
|
|
9
10
|
import "./chunk-7P6ASYW6.mjs";
|
|
10
11
|
export {
|
|
11
12
|
describeRedirect,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
editorBlockToHMBlock,
|
|
3
3
|
editorBlocksToHMBlockNodes
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OBJQE4NK.mjs";
|
|
5
5
|
import "./chunk-JKKS35IS.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-FPANFJPK.mjs";
|
|
7
|
+
import "./chunk-AHQWDCHV.mjs";
|
|
7
8
|
import "./chunk-7P6ASYW6.mjs";
|
|
8
9
|
export {
|
|
9
10
|
editorBlockToHMBlock,
|
package/dist/file-to-ipfs.d.ts
CHANGED
|
@@ -31,6 +31,25 @@ export declare function filesToIpfsBlobs(binaries: Uint8Array[]): Promise<{
|
|
|
31
31
|
resultCIDs: string[];
|
|
32
32
|
blobs: CollectedBlob[];
|
|
33
33
|
}>;
|
|
34
|
+
/** One file of a folder to publish: a slash-separated path inside the folder and its bytes. */
|
|
35
|
+
export type IpfsDirectoryFile = {
|
|
36
|
+
path: string;
|
|
37
|
+
content: Uint8Array;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Builds a UnixFS directory from files, the way `ipfs add -r` does, so the folder's root CID
|
|
41
|
+
* resolves at `/ipfs/<cid>/<path>` on any gateway and in the Seed daemon. Nested paths create
|
|
42
|
+
* nested directories. Custom HTML pages publish such a folder (with an `index.html`) and reference
|
|
43
|
+
* the root CID from the document's `html` metadata attribute.
|
|
44
|
+
*
|
|
45
|
+
* Returns the root directory CID and every block that must be published alongside.
|
|
46
|
+
*/
|
|
47
|
+
export declare function directoryToIpfsBlobs(files: IpfsDirectoryFile[]): Promise<{
|
|
48
|
+
cid: string;
|
|
49
|
+
blobs: CollectedBlob[];
|
|
50
|
+
}>;
|
|
51
|
+
/** A folder path is relative, slash-separated, and never climbs out or hides in dot segments. */
|
|
52
|
+
export declare function normalizeDirectoryFilePath(path: string): string;
|
|
34
53
|
/**
|
|
35
54
|
* Resolve all file:// links in a block tree.
|
|
36
55
|
*
|
package/dist/file-to-ipfs.mjs
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
+
directoryToIpfsBlobs,
|
|
2
3
|
fileToIpfsBlobs,
|
|
3
4
|
filesToIpfsBlobs,
|
|
4
5
|
hasFileLinks,
|
|
6
|
+
normalizeDirectoryFilePath,
|
|
5
7
|
resolveFileLinksInBlocks
|
|
6
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-65UV5O57.mjs";
|
|
7
9
|
import "./chunk-7P6ASYW6.mjs";
|
|
8
10
|
export {
|
|
11
|
+
directoryToIpfsBlobs,
|
|
9
12
|
fileToIpfsBlobs,
|
|
10
13
|
filesToIpfsBlobs,
|
|
11
14
|
hasFileLinks,
|
|
15
|
+
normalizeDirectoryFilePath,
|
|
12
16
|
resolveFileLinksInBlocks
|
|
13
17
|
};
|
package/dist/hm-resolver.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveHypermediaUrl,
|
|
3
3
|
resolveId
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-ONSB56Z7.mjs";
|
|
5
|
+
import "./chunk-FPANFJPK.mjs";
|
|
6
|
+
import "./chunk-AHQWDCHV.mjs";
|
|
6
7
|
import "./chunk-7P6ASYW6.mjs";
|
|
7
8
|
export {
|
|
8
9
|
resolveHypermediaUrl,
|