@seed-hypermedia/client 0.0.69 → 0.0.71
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/auth.mjs +3 -2
- package/dist/auto-link.d.ts +3 -2
- package/dist/auto-link.mjs +7 -6
- package/dist/blobs.d.ts +6 -4
- package/dist/blobs.mjs +2 -1
- package/dist/blocks-to-markdown.mjs +2 -2
- package/dist/capability.d.ts +7 -2
- package/dist/capability.mjs +6 -3
- package/dist/change.d.ts +8 -7
- package/dist/change.mjs +4 -3
- package/dist/{chunk-NX7YFFRX.mjs → chunk-37WRGUK4.mjs} +5 -4
- package/dist/{chunk-NPG76WUS.mjs → chunk-4L2LE3JW.mjs} +1 -1
- package/dist/{chunk-T5BTAJPW.mjs → chunk-ALT5YCCW.mjs} +1 -1
- package/dist/{chunk-HBIVZA6C.mjs → chunk-AOB3PMFZ.mjs} +1 -1
- package/dist/{chunk-5EWV4OPF.mjs → chunk-DBHL3BYB.mjs} +8 -13
- package/dist/chunk-DR3HJ6BV.mjs +25 -0
- package/dist/{chunk-LYECQKZE.mjs → chunk-FNETXNBK.mjs} +1 -1
- package/dist/{chunk-MKUWQB5W.mjs → chunk-FUSG27NF.mjs} +3 -3
- package/dist/{chunk-S2PVJK2P.mjs → chunk-H34UYMNW.mjs} +1 -1
- package/dist/{chunk-FYUZZ3HT.mjs → chunk-IT5LLTMP.mjs} +15 -5
- package/dist/{chunk-I3YUHKYW.mjs → chunk-JT57MV7Y.mjs} +6 -5
- package/dist/{chunk-QS7TPMYT.mjs → chunk-KY6WRGXY.mjs} +6 -5
- package/dist/{chunk-YZX54L3G.mjs → chunk-LVAHHQIK.mjs} +8 -0
- package/dist/{chunk-KO4XH5L2.mjs → chunk-NUIZU7KO.mjs} +1 -1
- package/dist/{chunk-XI2LXZM7.mjs → chunk-PJ2RFT5A.mjs} +5 -4
- package/dist/{chunk-YNVFRCUH.mjs → chunk-QYA75XPV.mjs} +37 -17
- package/dist/{chunk-W4OGV22Y.mjs → chunk-RL3OEUFZ.mjs} +15 -24
- package/dist/{chunk-DXDF36H5.mjs → chunk-SHOAYNJY.mjs} +1 -1
- package/dist/{chunk-GKGWSN6J.mjs → chunk-TXVEL22U.mjs} +3 -3
- package/dist/{chunk-SQEUO7FO.mjs → chunk-W3FLBRBH.mjs} +1 -0
- package/dist/{chunk-WJQSJ6UM.mjs → chunk-X6OJRM5W.mjs} +4 -4
- package/dist/client.d.ts +3 -2
- package/dist/client.mjs +6 -5
- package/dist/comment.d.ts +5 -4
- package/dist/comment.mjs +4 -3
- package/dist/contact.d.ts +5 -4
- package/dist/contact.mjs +3 -2
- package/dist/document-state.mjs +2 -2
- package/dist/editorblock-to-hmblock.mjs +2 -2
- package/dist/hm-resolver.d.ts +7 -3
- package/dist/hm-resolver.mjs +2 -2
- package/dist/hm-types.d.ts +610 -566
- package/dist/hm-types.mjs +1 -1
- package/dist/hmauth.mjs +3 -2
- package/dist/hmblock-to-editorblock.mjs +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +25 -17
- package/dist/pdf-to-blocks.mjs +3 -3
- package/dist/ref.d.ts +5 -4
- package/dist/ref.mjs +3 -2
- package/dist/resource-read.mjs +8 -7
- package/dist/signer.d.ts +42 -0
- package/dist/signer.mjs +9 -0
- package/dist/signing.d.ts +10 -2
- package/dist/signing.mjs +4 -1
- package/dist/tei-to-blocks.mjs +2 -2
- package/dist/unicode.mjs +1 -1
- package/dist/vault-local.mjs +4 -1
- package/dist/vault.d.ts +14 -4
- package/dist/vault.mjs +4 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
entityQueryPathToHmIdPath,
|
|
3
3
|
parseFragment,
|
|
4
4
|
unpackHmId
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-W3FLBRBH.mjs";
|
|
6
6
|
|
|
7
7
|
// src/hm-resolver.ts
|
|
8
8
|
async function resolveHypermediaUrl(url, opts) {
|
|
@@ -32,14 +32,14 @@ async function resolveHypermediaUrl(url, opts) {
|
|
|
32
32
|
}
|
|
33
33
|
if ((opts == null ? void 0 : opts.domainResolver) && parsedUrl) {
|
|
34
34
|
try {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
const resolved = await resolveFromDomainResolver(opts.domainResolver, url, parsedUrl, {
|
|
36
|
+
latest,
|
|
37
|
+
blockRef,
|
|
38
|
+
blockRange,
|
|
39
|
+
panel
|
|
40
|
+
});
|
|
41
|
+
if (resolved) {
|
|
42
|
+
return resolved;
|
|
43
43
|
}
|
|
44
44
|
} catch {
|
|
45
45
|
}
|
|
@@ -52,14 +52,14 @@ async function resolveHypermediaUrl(url, opts) {
|
|
|
52
52
|
} catch (error) {
|
|
53
53
|
if ((opts == null ? void 0 : opts.domainResolver) && parsedUrl) {
|
|
54
54
|
try {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
const resolved = await resolveFromDomainResolver(opts.domainResolver, url, parsedUrl, {
|
|
56
|
+
latest,
|
|
57
|
+
blockRef,
|
|
58
|
+
blockRange,
|
|
59
|
+
panel
|
|
60
|
+
});
|
|
61
|
+
if (resolved) {
|
|
62
|
+
return resolved;
|
|
63
63
|
}
|
|
64
64
|
} catch {
|
|
65
65
|
}
|
|
@@ -123,6 +123,26 @@ async function resolveId(input, opts) {
|
|
|
123
123
|
}
|
|
124
124
|
throw new Error(`Invalid Hypermedia ID: ${input}`);
|
|
125
125
|
}
|
|
126
|
+
async function resolveFromDomainResolver(domainResolver, url, parsedUrl, opts) {
|
|
127
|
+
const domainResolution = await domainResolver(parsedUrl.hostname);
|
|
128
|
+
const uid = typeof domainResolution === "string" ? domainResolution : (domainResolution == null ? void 0 : domainResolution.registeredAccountUid) ?? null;
|
|
129
|
+
if (!uid) return null;
|
|
130
|
+
const isGateway = typeof domainResolution === "object" && !!(domainResolution == null ? void 0 : domainResolution.isGateway);
|
|
131
|
+
const gatewayHmId = isGateway && parsedUrl.pathname.startsWith("/hm/") ? unpackHmId(url) : null;
|
|
132
|
+
if (gatewayHmId) {
|
|
133
|
+
return {
|
|
134
|
+
id: gatewayHmId.id,
|
|
135
|
+
hmId: gatewayHmId,
|
|
136
|
+
version: gatewayHmId.version,
|
|
137
|
+
title: null,
|
|
138
|
+
target: null,
|
|
139
|
+
authors: null,
|
|
140
|
+
type: null,
|
|
141
|
+
panel: opts.panel
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return buildResolvedUrlFromDomainUid(parsedUrl, uid, opts);
|
|
145
|
+
}
|
|
126
146
|
function buildResolvedUrlFromDomainUid(parsedUrl, uid, {
|
|
127
147
|
latest,
|
|
128
148
|
blockRef,
|
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
|
-
signObject,
|
|
3
2
|
toPublishInput
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LVAHHQIK.mjs";
|
|
4
|
+
import {
|
|
5
|
+
createCapability
|
|
6
|
+
} from "./chunk-IT5LLTMP.mjs";
|
|
5
7
|
import {
|
|
6
8
|
entityQueryPathToHmIdPath,
|
|
7
9
|
packBaseId
|
|
8
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-W3FLBRBH.mjs";
|
|
9
11
|
|
|
10
12
|
// src/capability.ts
|
|
11
|
-
import { encode as cborEncode } from "@ipld/dag-cbor";
|
|
12
13
|
import { base58btc } from "multiformats/bases/base58";
|
|
13
|
-
async function
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
role: input.role
|
|
23
|
-
};
|
|
24
|
-
if (input.path) {
|
|
25
|
-
unsigned.path = input.path;
|
|
26
|
-
}
|
|
27
|
-
if (input.label) {
|
|
28
|
-
unsigned.label = input.label;
|
|
29
|
-
}
|
|
30
|
-
unsigned.sig = await signObject(signer, unsigned);
|
|
31
|
-
return toPublishInput(cborEncode(unsigned));
|
|
14
|
+
async function createCapability2(input, signer) {
|
|
15
|
+
const encoded = await createCapability(
|
|
16
|
+
signer,
|
|
17
|
+
new Uint8Array(base58btc.decode(input.delegateUid)),
|
|
18
|
+
input.role,
|
|
19
|
+
Date.now(),
|
|
20
|
+
{ path: input.path || void 0, label: input.label || void 0 }
|
|
21
|
+
);
|
|
22
|
+
return toPublishInput(encoded.data);
|
|
32
23
|
}
|
|
33
24
|
async function resolveCapability(client, targetAccount, signerAccount, path) {
|
|
34
25
|
if (targetAccount === signerAccount) return void 0;
|
|
@@ -52,6 +43,6 @@ async function resolveCapability(client, targetAccount, signerAccount, path) {
|
|
|
52
43
|
}
|
|
53
44
|
|
|
54
45
|
export {
|
|
55
|
-
createCapability,
|
|
46
|
+
createCapability2 as createCapability,
|
|
56
47
|
resolveCapability
|
|
57
48
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QYA75XPV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
createSeedClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FUSG27NF.mjs";
|
|
7
7
|
import {
|
|
8
8
|
unpackHmId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-W3FLBRBH.mjs";
|
|
10
10
|
|
|
11
11
|
// src/resource-read.ts
|
|
12
12
|
async function resolveIdWithClient(rawId, options = {}) {
|
|
@@ -1135,6 +1135,7 @@ var HMDomainInfoSchema = z.object({
|
|
|
1135
1135
|
lastSuccess: z.date().nullable(),
|
|
1136
1136
|
registeredAccountUid: z.string().nullable(),
|
|
1137
1137
|
peerId: z.string().nullable(),
|
|
1138
|
+
isGateway: z.boolean(),
|
|
1138
1139
|
lastError: z.string().nullable()
|
|
1139
1140
|
});
|
|
1140
1141
|
var HMGetDomainInputSchema = z.object({
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createChange,
|
|
3
3
|
createChangeOps
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JT57MV7Y.mjs";
|
|
5
5
|
import {
|
|
6
6
|
createVersionRef
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PJ2RFT5A.mjs";
|
|
8
8
|
import {
|
|
9
9
|
resolveDocumentState
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AOB3PMFZ.mjs";
|
|
11
11
|
import {
|
|
12
12
|
entityQueryPathToHmIdPath,
|
|
13
13
|
packHmId,
|
|
14
14
|
unpackHmId
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-W3FLBRBH.mjs";
|
|
16
16
|
|
|
17
17
|
// src/auto-link.ts
|
|
18
18
|
import { CID } from "multiformats/cid";
|
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
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSeedClient,
|
|
3
3
|
deserializeQueryString
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FUSG27NF.mjs";
|
|
5
5
|
import "./chunk-CBELM7KX.mjs";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-JT57MV7Y.mjs";
|
|
7
|
+
import "./chunk-PJ2RFT5A.mjs";
|
|
8
|
+
import "./chunk-LVAHHQIK.mjs";
|
|
9
|
+
import "./chunk-DR3HJ6BV.mjs";
|
|
10
|
+
import "./chunk-W3FLBRBH.mjs";
|
|
10
11
|
import "./chunk-7P6ASYW6.mjs";
|
|
11
12
|
export {
|
|
12
13
|
createSeedClient,
|
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
CHANGED
|
@@ -4,10 +4,11 @@ import {
|
|
|
4
4
|
deleteComment,
|
|
5
5
|
trimTrailingEmptyBlocks,
|
|
6
6
|
updateComment
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KY6WRGXY.mjs";
|
|
8
8
|
import "./chunk-N3P7S5YZ.mjs";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-LVAHHQIK.mjs";
|
|
10
|
+
import "./chunk-DR3HJ6BV.mjs";
|
|
11
|
+
import "./chunk-W3FLBRBH.mjs";
|
|
11
12
|
import "./chunk-7P6ASYW6.mjs";
|
|
12
13
|
export {
|
|
13
14
|
commentRecordIdFromBlob,
|
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
CHANGED
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
createContact,
|
|
4
4
|
deleteContact,
|
|
5
5
|
updateContact
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-37WRGUK4.mjs";
|
|
7
|
+
import "./chunk-LVAHHQIK.mjs";
|
|
8
|
+
import "./chunk-DR3HJ6BV.mjs";
|
|
8
9
|
import "./chunk-7P6ASYW6.mjs";
|
|
9
10
|
export {
|
|
10
11
|
contactRecordIdFromBlob,
|
package/dist/document-state.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
editorBlockToHMBlock,
|
|
3
3
|
editorBlocksToHMBlockNodes
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4L2LE3JW.mjs";
|
|
5
5
|
import "./chunk-N3P7S5YZ.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-W3FLBRBH.mjs";
|
|
7
7
|
import "./chunk-7P6ASYW6.mjs";
|
|
8
8
|
export {
|
|
9
9
|
editorBlockToHMBlock,
|
package/dist/hm-resolver.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { type UnpackedHypermediaId } from './hm-types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Domain metadata from the daemon's domain store. The string form is kept
|
|
4
|
+
* for older/simple resolvers that only return an account UID.
|
|
5
5
|
*/
|
|
6
|
-
export type
|
|
6
|
+
export type DomainResolution = string | {
|
|
7
|
+
registeredAccountUid: string;
|
|
8
|
+
isGateway?: boolean;
|
|
9
|
+
} | null;
|
|
10
|
+
export type DomainResolverFn = (hostname: string) => Promise<DomainResolution>;
|
|
7
11
|
/**
|
|
8
12
|
* Callback fired when a background domain check detects that a domain
|
|
9
13
|
* now points to a different account UID than what was cached.
|
package/dist/hm-resolver.mjs
CHANGED