@seed-hypermedia/client 0.0.83 → 0.0.85

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.
Files changed (38) hide show
  1. package/dist/auto-link.mjs +4 -4
  2. package/dist/blocks-to-markdown.mjs +2 -2
  3. package/dist/capability.mjs +2 -2
  4. package/dist/change.d.ts +2 -0
  5. package/dist/change.mjs +1 -1
  6. package/dist/{chunk-TUSTJXWH.mjs → chunk-7DJW6A2P.mjs} +3 -3
  7. package/dist/{chunk-IOXGTLKJ.mjs → chunk-7QKG43UV.mjs} +2 -2
  8. package/dist/{chunk-4VD46ULS.mjs → chunk-DVJ3XGXS.mjs} +15 -1
  9. package/dist/{chunk-SIYJHDMJ.mjs → chunk-E2UOAVXB.mjs} +3 -3
  10. package/dist/{chunk-KMQYEO46.mjs → chunk-GIO2JLKT.mjs} +40 -0
  11. package/dist/{chunk-E4PGX55A.mjs → chunk-GN76IN3M.mjs} +8 -3
  12. package/dist/{chunk-E6YSFT63.mjs → chunk-GVFAXUKA.mjs} +10 -8
  13. package/dist/{chunk-V2UNLCDS.mjs → chunk-I273FRIR.mjs} +1 -1
  14. package/dist/{chunk-WJRXPYFE.mjs → chunk-IW5GLPEG.mjs} +5 -4
  15. package/dist/{chunk-N3P7S5YZ.mjs → chunk-JKKS35IS.mjs} +1 -1
  16. package/dist/{chunk-QBYF2PVS.mjs → chunk-NR2TW5BW.mjs} +9 -8
  17. package/dist/{chunk-NVWWEHIS.mjs → chunk-QRWRLUTY.mjs} +1 -1
  18. package/dist/{chunk-CRMBYTZY.mjs → chunk-STKAE4YB.mjs} +1 -1
  19. package/dist/{chunk-JT57MV7Y.mjs → chunk-W7H2UYQL.mjs} +2 -0
  20. package/dist/{chunk-2GOQZ3DV.mjs → chunk-ZVJGJE2L.mjs} +1 -1
  21. package/dist/client.d.ts +7 -1
  22. package/dist/client.mjs +3 -3
  23. package/dist/comment.mjs +3 -3
  24. package/dist/document-state.mjs +2 -2
  25. package/dist/editor-types.d.ts +2 -0
  26. package/dist/editorblock-to-hmblock.mjs +3 -3
  27. package/dist/hm-resolver.d.ts +2 -0
  28. package/dist/hm-resolver.mjs +2 -2
  29. package/dist/hm-types.d.ts +2530 -754
  30. package/dist/hm-types.mjs +5 -1
  31. package/dist/hmblock-to-editorblock.mjs +2 -2
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.mjs +15 -15
  34. package/dist/pdf-to-blocks.mjs +3 -3
  35. package/dist/resource-read.mjs +5 -5
  36. package/dist/tei-to-blocks.mjs +2 -2
  37. package/dist/unicode.mjs +2 -2
  38. package/package.json +1 -1
@@ -4,13 +4,13 @@ import {
4
4
  documentContainsLinkToChild,
5
5
  documentHasSelfQuery,
6
6
  shouldAutoLinkParent
7
- } from "./chunk-SIYJHDMJ.mjs";
8
- import "./chunk-JT57MV7Y.mjs";
7
+ } from "./chunk-E2UOAVXB.mjs";
8
+ import "./chunk-W7H2UYQL.mjs";
9
9
  import "./chunk-PJ2RFT5A.mjs";
10
- import "./chunk-CRMBYTZY.mjs";
10
+ import "./chunk-STKAE4YB.mjs";
11
11
  import "./chunk-LVAHHQIK.mjs";
12
12
  import "./chunk-DR3HJ6BV.mjs";
13
- import "./chunk-KMQYEO46.mjs";
13
+ import "./chunk-GIO2JLKT.mjs";
14
14
  import "./chunk-7P6ASYW6.mjs";
15
15
  export {
16
16
  autoLinkChildToParent,
@@ -7,8 +7,8 @@ import {
7
7
  emitFrontmatter,
8
8
  parseDraftFilename,
9
9
  slugify
10
- } from "./chunk-E6YSFT63.mjs";
11
- import "./chunk-KMQYEO46.mjs";
10
+ } from "./chunk-GVFAXUKA.mjs";
11
+ import "./chunk-GIO2JLKT.mjs";
12
12
  import "./chunk-7P6ASYW6.mjs";
13
13
  export {
14
14
  blocksToMarkdown,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createCapability,
3
3
  resolveCapability
4
- } from "./chunk-V2UNLCDS.mjs";
4
+ } from "./chunk-I273FRIR.mjs";
5
5
  import "./chunk-LVAHHQIK.mjs";
6
6
  import "./chunk-NBCHK76Q.mjs";
7
7
  import "./chunk-DR3HJ6BV.mjs";
8
- import "./chunk-KMQYEO46.mjs";
8
+ import "./chunk-GIO2JLKT.mjs";
9
9
  import "./chunk-3TPCJCVO.mjs";
10
10
  import "./chunk-7P6ASYW6.mjs";
11
11
  export {
package/dist/change.d.ts CHANGED
@@ -134,5 +134,7 @@ export type SignDocumentChangeInput = {
134
134
  */
135
135
  export declare function signDocumentChange(input: SignDocumentChangeInput, signer: AnySigner): Promise<{
136
136
  changeCid: CID;
137
+ genesis: string;
138
+ generation: number;
137
139
  publishInput: HMPublishBlobsInput;
138
140
  }>;
package/dist/change.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  signDocumentChange,
8
8
  signPreparedChange,
9
9
  visibilityToCbor
10
- } from "./chunk-JT57MV7Y.mjs";
10
+ } from "./chunk-W7H2UYQL.mjs";
11
11
  import "./chunk-PJ2RFT5A.mjs";
12
12
  import "./chunk-LVAHHQIK.mjs";
13
13
  import "./chunk-DR3HJ6BV.mjs";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  resolveId
3
- } from "./chunk-4VD46ULS.mjs";
3
+ } from "./chunk-DVJ3XGXS.mjs";
4
4
  import {
5
5
  createSeedClient
6
- } from "./chunk-QBYF2PVS.mjs";
6
+ } from "./chunk-NR2TW5BW.mjs";
7
7
  import {
8
8
  unpackHmId
9
- } from "./chunk-KMQYEO46.mjs";
9
+ } from "./chunk-GIO2JLKT.mjs";
10
10
 
11
11
  // src/resource-read.ts
12
12
  async function resolveIdWithClient(rawId, options = {}) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  validateExclusiveAnnotations
3
- } from "./chunk-N3P7S5YZ.mjs";
3
+ } from "./chunk-JKKS35IS.mjs";
4
4
  import {
5
5
  signObject,
6
6
  signerPublicKey,
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  hmIdPathToEntityQueryPath,
11
11
  packHmId
12
- } from "./chunk-KMQYEO46.mjs";
12
+ } from "./chunk-GIO2JLKT.mjs";
13
13
 
14
14
  // src/comment.ts
15
15
  import { decode as cborDecode, encode as cborEncode } from "@ipld/dag-cbor";
@@ -2,7 +2,7 @@ import {
2
2
  entityQueryPathToHmIdPath,
3
3
  parseFragment,
4
4
  unpackHmId
5
- } from "./chunk-KMQYEO46.mjs";
5
+ } from "./chunk-GIO2JLKT.mjs";
6
6
 
7
7
  // src/hm-resolver.ts
8
8
  async function resolveHypermediaUrl(url, opts) {
@@ -66,8 +66,21 @@ async function resolveHypermediaUrl(url, opts) {
66
66
  }
67
67
  throw error;
68
68
  }
69
+ if ((opts == null ? void 0 : opts.requireSuccessfulResponse) && response.status !== 200) {
70
+ throw new Error(`Hypermedia URL resolution failed with HTTP ${response.status}`);
71
+ }
69
72
  if (response.status === 200) {
70
73
  const rawId = response.headers.get("x-hypermedia-id");
74
+ if ((opts == null ? void 0 : opts.requireSuccessfulResponse) && !rawId && [
75
+ "x-hypermedia-id",
76
+ "x-hypermedia-version",
77
+ "x-hypermedia-title",
78
+ "x-hypermedia-target",
79
+ "x-hypermedia-authors",
80
+ "x-hypermedia-type"
81
+ ].some((header) => response.headers.has(header))) {
82
+ throw new Error("Missing Hypermedia identity response header");
83
+ }
71
84
  const id = rawId ? decodeURIComponent(rawId) : null;
72
85
  const version = response.headers.get("x-hypermedia-version");
73
86
  const encodedTitle = response.headers.get("x-hypermedia-title");
@@ -89,6 +102,7 @@ async function resolveHypermediaUrl(url, opts) {
89
102
  } catch {
90
103
  }
91
104
  if (!hmId) {
105
+ if (opts == null ? void 0 : opts.requireSuccessfulResponse) throw new Error("Invalid Hypermedia identity response header");
92
106
  return null;
93
107
  }
94
108
  return {
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  createChange,
3
3
  createChangeOps
4
- } from "./chunk-JT57MV7Y.mjs";
4
+ } from "./chunk-W7H2UYQL.mjs";
5
5
  import {
6
6
  createVersionRef
7
7
  } from "./chunk-PJ2RFT5A.mjs";
8
8
  import {
9
9
  resolveDocumentState
10
- } from "./chunk-CRMBYTZY.mjs";
10
+ } from "./chunk-STKAE4YB.mjs";
11
11
  import {
12
12
  entityQueryPathToHmIdPath,
13
13
  packHmId,
14
14
  unpackHmId
15
- } from "./chunk-KMQYEO46.mjs";
15
+ } from "./chunk-GIO2JLKT.mjs";
16
16
 
17
17
  // src/auto-link.ts
18
18
  import { CID } from "multiformats/cid";
@@ -76,6 +76,7 @@ var LinkAnnotationSchema = z.object({
76
76
  var InlineEmbedAnnotationSchema = z.object({
77
77
  type: z.literal("Embed"),
78
78
  ...baseAnnotationProperties,
79
+ attributes: z.object({ mentionKind: z.enum(["account", "document"]).optional() }).optional(),
79
80
  link: z.string()
80
81
  }).strict();
81
82
  var HighlightAnnotationSchema = z.object({
@@ -761,6 +762,10 @@ var HMNavigationItemSchema = z.object({
761
762
  link: z.string()
762
763
  });
763
764
  var HMDraftContentSchema = z.object({
765
+ /** Baselines superseded by reference maintenance; stale autosaves must not restore them. */
766
+ maintenancePreviousDeps: z.array(z.array(z.string())).optional(),
767
+ /** Monotonic local maintenance epoch; prevents stale same-version autosaves. */
768
+ maintenanceRevision: z.number().int().nonnegative().default(0),
764
769
  content: z.array(z.any()),
765
770
  // EditorBlock validation is handled elsewhere
766
771
  deps: z.array(z.string().min(1)).default([]),
@@ -771,6 +776,7 @@ var HMDraftContentSchema = z.object({
771
776
  * auto-rebase classifier to distinguish locally-edited blocks from incoming
772
777
  * remote edits. Persisted so reload-after-rebase keeps the touch history.
773
778
  */
779
+ removedChildDocumentIds: z.array(z.string()).optional(),
774
780
  mineTouchedIds: z.array(z.string()).optional(),
775
781
  /**
776
782
  * Snapshot of the published HMBlockNode[] tree at the time the draft was
@@ -875,6 +881,36 @@ var HMSearchRequestSchema = z.object({
875
881
  input: HMSearchInputSchema,
876
882
  output: HMSearchPayloadSchema
877
883
  });
884
+ var HMMentionCandidateSchema = z.object({
885
+ id: unpackedHmIdSchema,
886
+ type: z.enum(["account", "document"]),
887
+ title: z.string(),
888
+ icon: z.string(),
889
+ parentNames: z.array(z.string()),
890
+ searchQuery: z.string(),
891
+ /** Requested account identity before the daemon resolves an account alias. */
892
+ sourceAccountUid: z.string().optional(),
893
+ publicName: z.string().optional(),
894
+ petname: z.string().optional(),
895
+ activityTime: z.number().optional(),
896
+ activityType: z.enum(["publication", "comment"]).optional(),
897
+ accountRole: z.enum(["site-owner", "site-editor", "document-editor", "site-follower"]).optional(),
898
+ sameSite: z.boolean(),
899
+ issuedContact: z.boolean(),
900
+ hint: z.string().optional()
901
+ });
902
+ var HMMentionCandidatesRequestSchema = z.object({
903
+ key: z.literal("MentionCandidates"),
904
+ input: z.object({
905
+ mode: z.enum(["account", "document"]),
906
+ query: z.string().trim(),
907
+ perspectiveAccountUid: z.string().optional(),
908
+ siteUid: z.string().optional(),
909
+ documentId: unpackedHmIdSchema.optional(),
910
+ seedIds: z.array(unpackedHmIdSchema).max(20).optional()
911
+ }),
912
+ output: z.array(HMMentionCandidateSchema).max(100)
913
+ });
878
914
  var HMQueryRequestSchema = z.object({
879
915
  key: z.literal("Query"),
880
916
  input: HMQuerySchema,
@@ -1243,6 +1279,7 @@ var HMGetRequestSchema = z.discriminatedUnion("key", [
1243
1279
  HMAccountRequestSchema,
1244
1280
  HMCommentRequestSchema,
1245
1281
  HMSearchRequestSchema,
1282
+ HMMentionCandidatesRequestSchema,
1246
1283
  HMQueryRequestSchema,
1247
1284
  HMQueryBlockRequestSchema,
1248
1285
  HMAccountContactsRequestSchema,
@@ -1275,6 +1312,7 @@ var HMRequestSchema = z.discriminatedUnion("key", [
1275
1312
  HMAccountRequestSchema,
1276
1313
  HMCommentRequestSchema,
1277
1314
  HMSearchRequestSchema,
1315
+ HMMentionCandidatesRequestSchema,
1278
1316
  HMQueryRequestSchema,
1279
1317
  HMQueryBlockRequestSchema,
1280
1318
  HMAccountContactsRequestSchema,
@@ -1565,6 +1603,8 @@ export {
1565
1603
  HMSearchResultItemSchema,
1566
1604
  HMSearchPayloadSchema,
1567
1605
  HMSearchRequestSchema,
1606
+ HMMentionCandidateSchema,
1607
+ HMMentionCandidatesRequestSchema,
1568
1608
  HMQueryRequestSchema,
1569
1609
  HMQueryBlockInputSchema,
1570
1610
  HMListCommentsInputSchema,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  AnnotationSet
3
- } from "./chunk-N3P7S5YZ.mjs";
3
+ } from "./chunk-JKKS35IS.mjs";
4
4
  import {
5
5
  HMBlockButtonAlignmentSchema,
6
6
  HMBlockSchema,
7
7
  codePointLength,
8
8
  toNumber
9
- } from "./chunk-KMQYEO46.mjs";
9
+ } from "./chunk-GIO2JLKT.mjs";
10
10
 
11
11
  // src/editorblock-to-hmblock.ts
12
12
  function toHMBlockType(editorBlockType) {
@@ -108,7 +108,12 @@ function editorBlockToHMBlock(editorBlock) {
108
108
  annotations.addSpan("Math", null, start, end);
109
109
  }
110
110
  if (leaf.type == "inline-embed") {
111
- annotations.addSpan("Embed", { link: leaf.link }, start, end);
111
+ annotations.addSpan(
112
+ "Embed",
113
+ { link: leaf.link, ...leaf.mentionKind ? { mentionKind: leaf.mentionKind } : {} },
114
+ start,
115
+ end
116
+ );
112
117
  }
113
118
  if (leaf.type == "link") {
114
119
  annotations.addSpan("Link", { link: leaf.href }, start, end);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  normalizeQuerySort,
3
3
  unpackHmId
4
- } from "./chunk-KMQYEO46.mjs";
4
+ } from "./chunk-GIO2JLKT.mjs";
5
5
 
6
6
  // src/blocks-to-markdown.ts
7
7
  import { stringify as stringifyYaml } from "yaml";
@@ -691,12 +691,13 @@ async function getResolvedAnnotationMarker(ann, type, ctx) {
691
691
  }
692
692
  }
693
693
  async function resolveInlineEmbed(ann, type, ctx) {
694
+ var _a;
694
695
  const link = "link" in ann ? ann.link || "" : "";
695
696
  if (type === "close") return `](${link})`;
696
697
  if (!link) return "[\u2197 embed";
697
698
  try {
698
- const resolved = await resolveReference(link, ctx);
699
- const prefix = resolved.type === "account" ? "@" : "";
699
+ const resolved = await resolveReference(link, ctx, ann.type === "Embed" ? (_a = ann.attributes) == null ? void 0 : _a.mentionKind : void 0);
700
+ const prefix = resolved.type === "account" && !resolved.label.startsWith("@") ? "@" : "";
700
701
  return `[${prefix}${resolved.label}`;
701
702
  } catch {
702
703
  return `[\u2197 ${fallbackLabel(link)}`;
@@ -740,20 +741,21 @@ async function resolveEmbeddedResource(link, ctx) {
740
741
  ctx.cache.set(cacheKey, resolved);
741
742
  return resolved;
742
743
  }
743
- async function resolveReference(link, ctx) {
744
+ async function resolveReference(link, ctx, mentionKind) {
744
745
  var _a, _b, _c, _d, _e;
745
- const cached = ctx.cache.get(link);
746
+ const cacheKey = `${mentionKind || "legacy"}:${link}`;
747
+ const cached = ctx.cache.get(cacheKey);
746
748
  if (cached) return cached;
747
749
  const id = unpackHmId(link);
748
750
  if (!id) throw new Error("Invalid HM link");
749
751
  let resolved;
750
752
  const profileAccountUid = ((_a = id.path) == null ? void 0 : _a[0]) === ":profile" ? id.path[1] || id.uid : !((_b = id.path) == null ? void 0 : _b.length) ? id.uid : null;
751
- if (profileAccountUid) {
753
+ if (profileAccountUid && mentionKind !== "document") {
752
754
  try {
753
755
  const account = await ctx.client.request("Account", profileAccountUid);
754
756
  if (account.type === "account") {
755
757
  resolved = { label: ((_c = account.metadata) == null ? void 0 : _c.name) || fallbackUid(profileAccountUid), type: "account" };
756
- ctx.cache.set(link, resolved);
758
+ ctx.cache.set(cacheKey, resolved);
757
759
  return resolved;
758
760
  }
759
761
  } catch {
@@ -786,7 +788,7 @@ async function resolveReference(link, ctx) {
786
788
  } else {
787
789
  resolved = { label: fallbackLabel(link), type: "unknown" };
788
790
  }
789
- ctx.cache.set(link, resolved);
791
+ ctx.cache.set(cacheKey, resolved);
790
792
  return resolved;
791
793
  }
792
794
  function findBlockById(content, blockId) {
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  entityQueryPathToHmIdPath,
9
9
  packBaseId
10
- } from "./chunk-KMQYEO46.mjs";
10
+ } from "./chunk-GIO2JLKT.mjs";
11
11
 
12
12
  // src/capability.ts
13
13
  import { base58btc } from "multiformats/bases/base58";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSurrogate
3
- } from "./chunk-KMQYEO46.mjs";
3
+ } from "./chunk-GIO2JLKT.mjs";
4
4
 
5
5
  // src/hmblock-to-editorblock.ts
6
6
  function toEditorBlockType(hmBlockType) {
@@ -193,7 +193,8 @@ function hmBlockToEditorBlock(block) {
193
193
  leaves.push({
194
194
  type: "inline-embed",
195
195
  styles: {},
196
- link: inlineEmbed.link
196
+ link: inlineEmbed.link,
197
+ ...inlineEmbed.mentionKind ? { mentionKind: inlineEmbed.mentionKind } : {}
197
198
  });
198
199
  skipToCodepoint(inlineEmbed.end);
199
200
  textStart = i;
@@ -420,7 +421,7 @@ function hmBlockToEditorBlock(block) {
420
421
  return annotationsChanged;
421
422
  }
422
423
  function findInlineEmbedStartingAt(pos2) {
423
- var _a2, _b2;
424
+ var _a2, _b2, _c2;
424
425
  const blockAnnotations = block.annotations;
425
426
  if (!blockAnnotations) return null;
426
427
  for (const annotation of blockAnnotations) {
@@ -430,7 +431,7 @@ function hmBlockToEditorBlock(block) {
430
431
  if (spanIndex === -1) continue;
431
432
  const end = (_b2 = annotationData.ends) == null ? void 0 : _b2[spanIndex];
432
433
  if (typeof end !== "number" || end <= pos2) continue;
433
- return { link: annotationData.link || "", end };
434
+ return { link: annotationData.link || "", end, mentionKind: (_c2 = annotationData.attributes) == null ? void 0 : _c2.mentionKind };
434
435
  }
435
436
  return null;
436
437
  }
@@ -28,7 +28,7 @@ var AnnotationSet = class {
28
28
  _annotationId(type, attributes) {
29
29
  if (attributes) {
30
30
  if (attributes.link) {
31
- return `${type}-${attributes.link}`;
31
+ return JSON.stringify([type, attributes.link, attributes.mentionKind || null]);
32
32
  }
33
33
  if (attributes.href) {
34
34
  return `${type}-${attributes.href}`;
@@ -7,7 +7,7 @@ import {
7
7
  createDocumentChange,
8
8
  createGenesisChange,
9
9
  signDocumentChange
10
- } from "./chunk-JT57MV7Y.mjs";
10
+ } from "./chunk-W7H2UYQL.mjs";
11
11
  import {
12
12
  createVersionRef
13
13
  } from "./chunk-PJ2RFT5A.mjs";
@@ -15,7 +15,7 @@ import {
15
15
  HMActionSchema,
16
16
  HMRequestSchema,
17
17
  packHmId
18
- } from "./chunk-KMQYEO46.mjs";
18
+ } from "./chunk-GIO2JLKT.mjs";
19
19
 
20
20
  // src/client.ts
21
21
  import { encode as cborEncode } from "@ipld/dag-cbor";
@@ -178,7 +178,7 @@ function createSeedClient(baseUrl, options) {
178
178
  async function publishDocument(input, signer) {
179
179
  if (!input.genesis && !input.baseVersion && !input.path) {
180
180
  const genesisChange = await createGenesisChange(signer);
181
- const generation = input.generation != null ? Number(input.generation) : 1;
181
+ const generation2 = input.generation != null ? Number(input.generation) : 1;
182
182
  if (input.changes.every((change) => {
183
183
  var _a;
184
184
  return ((_a = change.op) == null ? void 0 : _a.case) === "setMetadata";
@@ -198,7 +198,7 @@ function createSeedClient(baseUrl, options) {
198
198
  path: "",
199
199
  genesis: genesisChange.cid.toString(),
200
200
  version: contentChange.cid.toString(),
201
- generation,
201
+ generation: generation2,
202
202
  capability: input.capability
203
203
  },
204
204
  signer
@@ -210,7 +210,7 @@ function createSeedClient(baseUrl, options) {
210
210
  ...ref.blobs
211
211
  ]
212
212
  });
213
- return;
213
+ return { version: contentChange.cid.toString(), genesis: genesisChange.cid.toString(), generation: generation2 };
214
214
  }
215
215
  const genesisRef = await createVersionRef(
216
216
  {
@@ -218,7 +218,7 @@ function createSeedClient(baseUrl, options) {
218
218
  path: "",
219
219
  genesis: genesisChange.cid.toString(),
220
220
  version: genesisChange.cid.toString(),
221
- generation,
221
+ generation: generation2,
222
222
  capability: input.capability
223
223
  },
224
224
  signer
@@ -230,7 +230,7 @@ function createSeedClient(baseUrl, options) {
230
230
  ...input,
231
231
  baseVersion: genesisChange.cid.toString(),
232
232
  genesis: genesisChange.cid.toString(),
233
- generation
233
+ generation: generation2
234
234
  };
235
235
  }
236
236
  const prepareInput = {
@@ -242,7 +242,7 @@ function createSeedClient(baseUrl, options) {
242
242
  visibility: input.visibility
243
243
  };
244
244
  const { unsignedChange } = await request("PrepareDocumentChange", prepareInput);
245
- const { publishInput } = await signDocumentChange(
245
+ const { publishInput, changeCid, genesis, generation } = await signDocumentChange(
246
246
  {
247
247
  account: input.account,
248
248
  path: input.path,
@@ -255,6 +255,7 @@ function createSeedClient(baseUrl, options) {
255
255
  signer
256
256
  );
257
257
  await publish(publishInput);
258
+ return { version: changeCid.toString(), genesis, generation };
258
259
  }
259
260
  return {
260
261
  baseUrl: normalizedBaseUrl,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  teiToBlocks
3
- } from "./chunk-2GOQZ3DV.mjs";
3
+ } from "./chunk-ZVJGJE2L.mjs";
4
4
  import {
5
5
  embeddedPdfToBlocks
6
6
  } from "./chunk-52P3E6H6.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  packHmId,
3
3
  unpackHmId
4
- } from "./chunk-KMQYEO46.mjs";
4
+ } from "./chunk-GIO2JLKT.mjs";
5
5
 
6
6
  // src/document-state.ts
7
7
  async function resolveDocumentState(client, targetId) {
@@ -118,6 +118,8 @@ async function signDocumentChange(input, signer) {
118
118
  );
119
119
  return {
120
120
  changeCid,
121
+ genesis: effectiveGenesis,
122
+ generation: effectiveGeneration,
121
123
  publishInput: {
122
124
  blobs: [{ data: normalizeBytes(signedBytes), cid: changeCid.toString() }, ...refBlobs.blobs]
123
125
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  codePointLength
3
- } from "./chunk-KMQYEO46.mjs";
3
+ } from "./chunk-GIO2JLKT.mjs";
4
4
 
5
5
  // src/tei-to-blocks.ts
6
6
  function generateBlockId() {
package/dist/client.d.ts CHANGED
@@ -6,6 +6,12 @@ import type { AnySigner } from './signer';
6
6
  * If the query contains only a __value key, returns the primitive value directly.
7
7
  */
8
8
  export declare function deserializeQueryString<T>(queryString: string, schema: z.ZodType<T>): T;
9
+ /** Identifiers of the signed publication, available before the document index catches up. */
10
+ export type PublishDocumentResult = {
11
+ version: string;
12
+ genesis: string;
13
+ generation: number;
14
+ };
9
15
  export type PublishDocumentInput = {
10
16
  account: string;
11
17
  changes: HMPrepareDocumentChangeInput['changes'];
@@ -35,7 +41,7 @@ export type SeedClient = {
35
41
  }>['output']>;
36
42
  publish(input: PublishBlobsRequest['input']): Promise<PublishBlobsRequest['output']>;
37
43
  publishBlobs(input: PublishBlobsRequest['input']): Promise<PublishBlobsRequest['output']>;
38
- publishDocument(input: PublishDocumentInput, signer: AnySigner): Promise<void>;
44
+ publishDocument(input: PublishDocumentInput, signer: AnySigner): Promise<PublishDocumentResult>;
39
45
  baseUrl: string;
40
46
  };
41
47
  export declare function createSeedClient(baseUrl: string, options?: SeedClientOptions): SeedClient;
package/dist/client.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createSeedClient,
3
3
  deserializeQueryString
4
- } from "./chunk-QBYF2PVS.mjs";
4
+ } from "./chunk-NR2TW5BW.mjs";
5
5
  import "./chunk-CBELM7KX.mjs";
6
- import "./chunk-JT57MV7Y.mjs";
6
+ import "./chunk-W7H2UYQL.mjs";
7
7
  import "./chunk-PJ2RFT5A.mjs";
8
8
  import "./chunk-LVAHHQIK.mjs";
9
9
  import "./chunk-DR3HJ6BV.mjs";
10
- import "./chunk-KMQYEO46.mjs";
10
+ import "./chunk-GIO2JLKT.mjs";
11
11
  import "./chunk-7P6ASYW6.mjs";
12
12
  export {
13
13
  createSeedClient,
package/dist/comment.mjs CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  deleteComment,
5
5
  trimTrailingEmptyBlocks,
6
6
  updateComment
7
- } from "./chunk-IOXGTLKJ.mjs";
8
- import "./chunk-N3P7S5YZ.mjs";
7
+ } from "./chunk-7QKG43UV.mjs";
8
+ import "./chunk-JKKS35IS.mjs";
9
9
  import "./chunk-LVAHHQIK.mjs";
10
10
  import "./chunk-DR3HJ6BV.mjs";
11
- import "./chunk-KMQYEO46.mjs";
11
+ import "./chunk-GIO2JLKT.mjs";
12
12
  import "./chunk-7P6ASYW6.mjs";
13
13
  export {
14
14
  commentRecordIdFromBlob,
@@ -4,8 +4,8 @@ import {
4
4
  followToDocument,
5
5
  resolveDocumentState,
6
6
  resolveEditableDocument
7
- } from "./chunk-CRMBYTZY.mjs";
8
- import "./chunk-KMQYEO46.mjs";
7
+ } from "./chunk-STKAE4YB.mjs";
8
+ import "./chunk-GIO2JLKT.mjs";
9
9
  import "./chunk-7P6ASYW6.mjs";
10
10
  export {
11
11
  describeRedirect,
@@ -158,6 +158,8 @@ export interface EditorLink {
158
158
  content: Array<HMInlineContent>;
159
159
  }
160
160
  export interface EditorInlineEmbed {
161
+ /** Explicit identity for new mentions; absent on legacy references. */
162
+ mentionKind?: 'account' | 'document';
161
163
  type: 'inline-embed';
162
164
  link: string;
163
165
  styles: EditorInlineStyles | {};
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  editorBlockToHMBlock,
3
3
  editorBlocksToHMBlockNodes
4
- } from "./chunk-E4PGX55A.mjs";
5
- import "./chunk-N3P7S5YZ.mjs";
6
- import "./chunk-KMQYEO46.mjs";
4
+ } from "./chunk-GN76IN3M.mjs";
5
+ import "./chunk-JKKS35IS.mjs";
6
+ import "./chunk-GIO2JLKT.mjs";
7
7
  import "./chunk-7P6ASYW6.mjs";
8
8
  export {
9
9
  editorBlockToHMBlock,
@@ -15,6 +15,8 @@ export type DomainResolverFn = (hostname: string) => Promise<DomainResolution>;
15
15
  export type DomainIdChangedCallback = (domain: string, oldUid: string, newUid: string) => void;
16
16
  export type ResolveOptions = {
17
17
  domainResolver?: DomainResolverFn;
18
+ /** Distinguish failed HTTP/malformed metadata from a verified ordinary web page. */
19
+ requireSuccessfulResponse?: boolean;
18
20
  };
19
21
  /**
20
22
  * Resolve a web URL to its Hypermedia metadata.
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  resolveHypermediaUrl,
3
3
  resolveId
4
- } from "./chunk-4VD46ULS.mjs";
5
- import "./chunk-KMQYEO46.mjs";
4
+ } from "./chunk-DVJ3XGXS.mjs";
5
+ import "./chunk-GIO2JLKT.mjs";
6
6
  import "./chunk-7P6ASYW6.mjs";
7
7
  export {
8
8
  resolveHypermediaUrl,