@seed-hypermedia/client 0.0.4 → 0.0.5
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/{chunk-YIND2WNJ.mjs → chunk-B5WCMFR5.mjs} +18 -1
- package/dist/comment.d.ts +13 -0
- package/dist/hm-types.d.ts +939 -0
- package/dist/hm-types.mjs +7 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +29 -1
- package/package.json +1 -1
- package/src/index.ts +2 -2
package/dist/hm-types.mjs
CHANGED
|
@@ -74,6 +74,9 @@ import {
|
|
|
74
74
|
HMListCitationsInputSchema,
|
|
75
75
|
HMListCitationsOutputSchema,
|
|
76
76
|
HMListCitationsRequestSchema,
|
|
77
|
+
HMListCommentVersionsInputSchema,
|
|
78
|
+
HMListCommentVersionsOutputSchema,
|
|
79
|
+
HMListCommentVersionsRequestSchema,
|
|
77
80
|
HMListCommentsByAuthorInputSchema,
|
|
78
81
|
HMListCommentsByAuthorOutputSchema,
|
|
79
82
|
HMListCommentsByAuthorRequestSchema,
|
|
@@ -156,7 +159,7 @@ import {
|
|
|
156
159
|
toNumber,
|
|
157
160
|
unpackHmId,
|
|
158
161
|
unpackedHmIdSchema
|
|
159
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-B5WCMFR5.mjs";
|
|
160
163
|
export {
|
|
161
164
|
BlockRangeSchema,
|
|
162
165
|
BoldAnnotationSchema,
|
|
@@ -233,6 +236,9 @@ export {
|
|
|
233
236
|
HMListCitationsInputSchema,
|
|
234
237
|
HMListCitationsOutputSchema,
|
|
235
238
|
HMListCitationsRequestSchema,
|
|
239
|
+
HMListCommentVersionsInputSchema,
|
|
240
|
+
HMListCommentVersionsOutputSchema,
|
|
241
|
+
HMListCommentVersionsRequestSchema,
|
|
236
242
|
HMListCommentsByAuthorInputSchema,
|
|
237
243
|
HMListCommentsByAuthorOutputSchema,
|
|
238
244
|
HMListCommentsByAuthorRequestSchema,
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export { createChange, createChangeOps, createDocumentChange, createDocumentChan
|
|
|
4
4
|
export type { CreateChangeOpsInput, CreateDocumentChangeFromOpsInput, CreateDocumentChangeInput, DocumentOperation, SignDocumentChangeInput, } from './change';
|
|
5
5
|
export { createSeedClient } from './client';
|
|
6
6
|
export type { PublishDocumentInput, SeedClient, SeedClientOptions } from './client';
|
|
7
|
-
export { commentRecordIdFromBlob, createComment, deleteComment } from './comment';
|
|
8
|
-
export type { CommentAttachmentBlob, CreateCommentInput, DeleteCommentInput } from './comment';
|
|
7
|
+
export { commentRecordIdFromBlob, createComment, deleteComment, updateComment } from './comment';
|
|
8
|
+
export type { CommentAttachmentBlob, CreateCommentInput, DeleteCommentInput, UpdateCommentInput } from './comment';
|
|
9
9
|
export { contactRecordIdFromBlob, createContact, deleteContact, updateContact } from './contact';
|
|
10
10
|
export type { CreateContactInput, CreateContactResult, DeleteContactInput, UpdateContactInput } from './contact';
|
|
11
11
|
export { SeedClientError, SeedNetworkError, SeedValidationError } from './errors';
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
serializeBlockRange,
|
|
17
17
|
toNumber,
|
|
18
18
|
unpackHmId
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-B5WCMFR5.mjs";
|
|
20
20
|
|
|
21
21
|
// src/capability.ts
|
|
22
22
|
import { encode as cborEncode2 } from "@ipld/dag-cbor";
|
|
@@ -795,6 +795,33 @@ async function deleteComment(input, signer) {
|
|
|
795
795
|
const encoded = cborEncode6(tombstone);
|
|
796
796
|
return toPublishInput(encoded, []);
|
|
797
797
|
}
|
|
798
|
+
async function updateComment(input, signer) {
|
|
799
|
+
const parts = input.commentId.split("/");
|
|
800
|
+
const tsid = parts[1];
|
|
801
|
+
if (!tsid) {
|
|
802
|
+
throw new Error(`Invalid comment ID format: ${input.commentId}`);
|
|
803
|
+
}
|
|
804
|
+
const signerKey = await signer.getPublicKey();
|
|
805
|
+
cleanContentOfUndefined(input.content);
|
|
806
|
+
const trimmedContent = trimTrailingEmptyBlocks(input.content);
|
|
807
|
+
const comment = {
|
|
808
|
+
type: "Comment",
|
|
809
|
+
id: tsid,
|
|
810
|
+
body: blocksToPublishable(trimmedContent),
|
|
811
|
+
space: new Uint8Array(base58btc3.decode(input.targetAccount)),
|
|
812
|
+
path: input.targetPath,
|
|
813
|
+
version: input.targetVersion.split(".").map((v) => CID3.parse(v)),
|
|
814
|
+
signer: new Uint8Array(signerKey),
|
|
815
|
+
ts: BigInt(Date.now()),
|
|
816
|
+
sig: new Uint8Array(64)
|
|
817
|
+
};
|
|
818
|
+
if (input.replyParentVersion) comment.replyParent = CID3.parse(input.replyParentVersion);
|
|
819
|
+
if (input.rootReplyCommentVersion) comment.threadRoot = CID3.parse(input.rootReplyCommentVersion);
|
|
820
|
+
if (input.visibility) comment.visibility = input.visibility;
|
|
821
|
+
comment.sig = await signObject(signer, comment);
|
|
822
|
+
const encoded = cborEncode6(comment);
|
|
823
|
+
return toPublishInput(encoded, []);
|
|
824
|
+
}
|
|
798
825
|
async function commentRecordIdFromBlob(blobData) {
|
|
799
826
|
const decoded = cborDecode2(blobData);
|
|
800
827
|
if (decoded.type !== "Comment") {
|
|
@@ -3889,5 +3916,6 @@ export {
|
|
|
3889
3916
|
teiToBlocks,
|
|
3890
3917
|
trimTrailingEmptyBlocks,
|
|
3891
3918
|
unpackHmId,
|
|
3919
|
+
updateComment,
|
|
3892
3920
|
updateContact
|
|
3893
3921
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -18,8 +18,8 @@ export type {
|
|
|
18
18
|
} from './change'
|
|
19
19
|
export {createSeedClient} from './client'
|
|
20
20
|
export type {PublishDocumentInput, SeedClient, SeedClientOptions} from './client'
|
|
21
|
-
export {commentRecordIdFromBlob, createComment, deleteComment} from './comment'
|
|
22
|
-
export type {CommentAttachmentBlob, CreateCommentInput, DeleteCommentInput} from './comment'
|
|
21
|
+
export {commentRecordIdFromBlob, createComment, deleteComment, updateComment} from './comment'
|
|
22
|
+
export type {CommentAttachmentBlob, CreateCommentInput, DeleteCommentInput, UpdateCommentInput} from './comment'
|
|
23
23
|
export {contactRecordIdFromBlob, createContact, deleteContact, updateContact} from './contact'
|
|
24
24
|
export type {CreateContactInput, CreateContactResult, DeleteContactInput, UpdateContactInput} from './contact'
|
|
25
25
|
export {SeedClientError, SeedNetworkError, SeedValidationError} from './errors'
|