@seed-hypermedia/client 0.0.132 → 0.0.133

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/index.d.ts CHANGED
@@ -31,15 +31,17 @@ export { resolveIdWithClient } from './resource-read';
31
31
  export type { ResolveIdWithClientOptions, ResolvedIdWithClient } from './resource-read';
32
32
  export { fileToIpfsBlobs, filesToIpfsBlobs, directoryToIpfsBlobs, normalizeDirectoryFilePath, resolveFileLinksInBlocks, hasFileLinks, } from './file-to-ipfs';
33
33
  export type { CollectedBlob, IpfsDirectoryFile } from './file-to-ipfs';
34
- export { parseMarkdown, flattenToOperations, parseInlineFormatting, parseFrontmatter, markdownBlockNodesToHMBlockNodes, hmAccountMentionUid, MarkdownFrontmatterError, } from './markdown-to-blocks';
34
+ export { parseMarkdown, flattenToOperations, parseInlineFormatting, parseFrontmatter, markdownBlockNodesToHMBlockNodes, hmAccountMentionUid, MarkdownFrontmatterError, MarkdownResolvedRangeError, stripResolvedRanges, } from './markdown-to-blocks';
35
35
  export type { BlockNode, SeedBlock, Annotation, ParseMarkdownOptions } from './markdown-to-blocks';
36
36
  export { collectMermaidBlocks, validateMermaidBlocks, assertValidMermaid, InvalidMermaidError, } from './mermaid-validation';
37
37
  export type { MermaidParser, MermaidDiagramError, MermaidBlockLike } from './mermaid-validation';
38
38
  export { blocksToMarkdown, emitFrontmatter, slugify, draftFilename, parseDraftFilename, documentToResolvedMarkdown, commentToResolvedMarkdown, contentToResolvedMarkdown, } from './blocks-to-markdown';
39
39
  export type { ResolvedMarkdownOptions } from './blocks-to-markdown';
40
40
  export type { BlocksToMarkdownOptions } from './blocks-to-markdown';
41
- export { createBlocksMap, matchBlockIds, computeReplaceOps, hmBlockNodeToBlockNode, rebindTableIdentities, toAPIBlockNode, } from './block-diff';
42
- export type { APIBlockNode, APIBlock } from './block-diff';
41
+ export { createBlocksMap, matchBlockIds, computeReplaceOps, hmBlockNodeToBlockNode, rebindTableIdentities, toAPIBlockNode, markdownUpdateTree, describeContentChange, } from './block-diff';
42
+ export type { APIBlockNode, APIBlock, ContentChange } from './block-diff';
43
+ export { applyBlockEdits, BlockEditError } from './block-edits';
44
+ export type { BlockEditResult } from './block-edits';
43
45
  export { autoLinkChildToParent, createAutoLinkOps, documentContainsLinkToChild, documentHasSelfQuery, shouldAutoLinkParent, } from './auto-link';
44
46
  export type { AutoLinkChildToParentOptions } from './auto-link';
45
47
  export { clientBuiltDocumentUpdateBlobs, DEFAULT_MAX_PREPARED_CHANGE_BYTES, DEFAULT_PREPARE_TIMEOUT_MS, documentOperationsToChanges, documentUpdateBlobs, implausiblePreparedChange, isEmptyPreparedChange, nativeBlockToProtoBlock, preparableDocumentChanges, prepareDocumentUpdateBlobs, UnpreparableDocumentUpdateError, } from './prepare-change';
package/dist/index.mjs CHANGED
@@ -1,3 +1,9 @@
1
+ import {
2
+ InvalidMermaidError,
3
+ assertValidMermaid,
4
+ collectMermaidBlocks,
5
+ validateMermaidBlocks
6
+ } from "./chunk-TGCGGVEU.mjs";
1
7
  import {
2
8
  pdfToBlocks
3
9
  } from "./chunk-YRNPRWYG.mjs";
@@ -18,21 +24,6 @@ import {
18
24
  import {
19
25
  keyfile_exports
20
26
  } from "./chunk-EY6RQVAP.mjs";
21
- import {
22
- MarkdownFrontmatterError,
23
- flattenToOperations,
24
- hmAccountMentionUid,
25
- markdownBlockNodesToHMBlockNodes,
26
- parseFrontmatter,
27
- parseInlineFormatting,
28
- parseMarkdown
29
- } from "./chunk-SUVJSSHG.mjs";
30
- import {
31
- InvalidMermaidError,
32
- assertValidMermaid,
33
- collectMermaidBlocks,
34
- validateMermaidBlocks
35
- } from "./chunk-TGCGGVEU.mjs";
36
27
  import {
37
28
  editorBlockToHMBlock,
38
29
  editorBlocksToHMBlockNodes
@@ -53,6 +44,10 @@ import {
53
44
  isGrobidAvailable,
54
45
  processFulltextDocument
55
46
  } from "./chunk-PPAY4WZX.mjs";
47
+ import {
48
+ createCapability,
49
+ resolveCapability
50
+ } from "./chunk-LDCWJXIP.mjs";
56
51
  import {
57
52
  createSeedClient
58
53
  } from "./chunk-H2R4GYNV.mjs";
@@ -83,7 +78,7 @@ import {
83
78
  documentContainsLinkToChild,
84
79
  documentHasSelfQuery,
85
80
  shouldAutoLinkParent
86
- } from "./chunk-325UCLMT.mjs";
81
+ } from "./chunk-O36UBGLF.mjs";
87
82
  import {
88
83
  DEFAULT_MAX_PREPARED_CHANGE_BYTES,
89
84
  DEFAULT_PREPARE_TIMEOUT_MS,
@@ -96,7 +91,16 @@ import {
96
91
  nativeBlockToProtoBlock,
97
92
  preparableDocumentChanges,
98
93
  prepareDocumentUpdateBlobs
99
- } from "./chunk-6QBB3P3Q.mjs";
94
+ } from "./chunk-KAZNQFXV.mjs";
95
+ import {
96
+ describeRedirect,
97
+ editRefGeneration,
98
+ followRedirects,
99
+ followToDocument,
100
+ resolveDocumentState,
101
+ resolveEditableDocument,
102
+ sameDocumentVersion
103
+ } from "./chunk-QS6PIRUE.mjs";
100
104
  import {
101
105
  SeedClientError,
102
106
  SeedNetworkError,
@@ -117,24 +121,39 @@ import {
117
121
  createTombstoneRef,
118
122
  createVersionRef
119
123
  } from "./chunk-PJ2RFT5A.mjs";
120
- import {
121
- describeRedirect,
122
- editRefGeneration,
123
- followRedirects,
124
- followToDocument,
125
- resolveDocumentState,
126
- resolveEditableDocument,
127
- sameDocumentVersion
128
- } from "./chunk-QS6PIRUE.mjs";
124
+ import "./chunk-LVAHHQIK.mjs";
129
125
  import "./chunk-2MD3FXKB.mjs";
126
+ import "./chunk-GBSWXJGU.mjs";
127
+ import "./chunk-3TPCJCVO.mjs";
128
+ import {
129
+ toHMSigner,
130
+ toPrincipalSigner
131
+ } from "./chunk-DR3HJ6BV.mjs";
130
132
  import {
131
133
  computeReplaceOps,
132
134
  createBlocksMap,
135
+ describeContentChange,
133
136
  hmBlockNodeToBlockNode,
137
+ markdownUpdateTree,
134
138
  matchBlockIds,
135
139
  rebindTableIdentities,
136
140
  toAPIBlockNode
137
- } from "./chunk-3KLY2B27.mjs";
141
+ } from "./chunk-7FPJWOXB.mjs";
142
+ import {
143
+ MarkdownFrontmatterError,
144
+ MarkdownResolvedRangeError,
145
+ flattenToOperations,
146
+ hmAccountMentionUid,
147
+ markdownBlockNodesToHMBlockNodes,
148
+ parseFrontmatter,
149
+ parseInlineFormatting,
150
+ parseMarkdown,
151
+ stripResolvedRanges
152
+ } from "./chunk-4ELQ4LJL.mjs";
153
+ import {
154
+ BlockEditError,
155
+ applyBlockEdits
156
+ } from "./chunk-53PY4AWT.mjs";
138
157
  import {
139
158
  blocksToMarkdown,
140
159
  commentToResolvedMarkdown,
@@ -144,24 +163,13 @@ import {
144
163
  emitFrontmatter,
145
164
  parseDraftFilename,
146
165
  slugify
147
- } from "./chunk-Y4PWAEJ5.mjs";
166
+ } from "./chunk-QFIEZZYJ.mjs";
148
167
  import {
149
168
  extractCommentIdFromUrl,
150
169
  hmDomainUrlToWebUrl,
151
170
  resolveHypermediaUrl,
152
171
  resolveId
153
172
  } from "./chunk-Q7CWMEBZ.mjs";
154
- import {
155
- createCapability,
156
- resolveCapability
157
- } from "./chunk-LDCWJXIP.mjs";
158
- import "./chunk-LVAHHQIK.mjs";
159
- import "./chunk-GBSWXJGU.mjs";
160
- import "./chunk-3TPCJCVO.mjs";
161
- import {
162
- toHMSigner,
163
- toPrincipalSigner
164
- } from "./chunk-DR3HJ6BV.mjs";
165
173
  import {
166
174
  HYPERMEDIA_SCHEME,
167
175
  codePointLength,
@@ -180,18 +188,21 @@ import "./chunk-AHQWDCHV.mjs";
180
188
  import "./chunk-7P6ASYW6.mjs";
181
189
  export {
182
190
  AnnotationSet,
191
+ BlockEditError,
183
192
  DEFAULT_GROBID_URL,
184
193
  DEFAULT_MAX_PREPARED_CHANGE_BYTES,
185
194
  DEFAULT_PREPARE_TIMEOUT_MS,
186
195
  HYPERMEDIA_SCHEME,
187
196
  InvalidMermaidError,
188
197
  MarkdownFrontmatterError,
198
+ MarkdownResolvedRangeError,
189
199
  SeedClientError,
190
200
  SeedNetworkError,
191
201
  SeedValidationError,
192
202
  UnpreparableDocumentUpdateError,
193
203
  addSpanToAnnotation,
194
204
  annotationContains,
205
+ applyBlockEdits,
195
206
  assertValidMermaid,
196
207
  autoLinkChildToParent,
197
208
  blocksToMarkdown,
@@ -221,6 +232,7 @@ export {
221
232
  createVersionRef,
222
233
  deleteComment,
223
234
  deleteContact,
235
+ describeContentChange,
224
236
  describeRedirect,
225
237
  directoryToIpfsBlobs,
226
238
  documentContainsLinkToChild,
@@ -256,6 +268,7 @@ export {
256
268
  encryption_exports as keyEncryption,
257
269
  keyfile_exports as keyfile,
258
270
  markdownBlockNodesToHMBlockNodes,
271
+ markdownUpdateTree,
259
272
  matchBlockIds,
260
273
  nativeBlockToProtoBlock,
261
274
  normalizeDirectoryFilePath,
@@ -286,6 +299,7 @@ export {
286
299
  signDocumentChange,
287
300
  signPreparedChange,
288
301
  slugify,
302
+ stripResolvedRanges,
289
303
  teiToBlocks,
290
304
  toAPIBlockNode,
291
305
  toHMSigner,
@@ -86,20 +86,40 @@ export type ParseMarkdownOptions = {
86
86
  * paths that must render whatever they are given.
87
87
  */
88
88
  strictFrontmatter?: boolean;
89
+ /**
90
+ * `true` (default) throws {@link MarkdownResolvedRangeError} on a `<!-- resolved -->` range that
91
+ * is never closed. `false` drops everything after it, for display paths.
92
+ */
93
+ strictResolvedRanges?: boolean;
89
94
  };
90
95
  export declare function parseFrontmatter(markdown: string, options?: ParseMarkdownOptions): {
91
96
  content: string;
92
97
  metadata: HMMetadata;
93
98
  };
94
99
  /**
95
- * Turns each resolved embed back into the embed it came from. Resolved markdown (what an agent's
96
- * `read` returns) prints an embed as its target's content between `<!-- embed: URL; title: …;
97
- * view: … -->` and `<!-- /embed: URL -->`. Written back, that range must become the Embed block
98
- * again, not paragraphs copied out of the embedded document, so a read-then-write round trip keeps
99
- * the document's embeds. Nested embeds inside the range belong to the embedded document and go
100
+ * Turns each embed written the earlier way back into the embed it came from. Resolved markdown used
101
+ * to print an embed as its target's content between `<!-- embed: URL; title: …; view: … -->` and
102
+ * `<!-- /embed: URL -->`; it now writes the embed block itself and shows the content in a
103
+ * `<!-- resolved -->` range ({@link stripResolvedRanges}). Markdown read before that change is
104
+ * still written back, so the old range still becomes the Embed block, not paragraphs copied out of
105
+ * the embedded document. Nested embeds inside the range belong to the embedded document and go
100
106
  * with it. Lines inside code fences are left alone.
101
107
  */
102
108
  export declare function collapseResolvedEmbeds(markdown: string): string;
109
+ /** Thrown when a `<!-- resolved -->` range is never closed: what follows it cannot be told from what it shows. */
110
+ export declare class MarkdownResolvedRangeError extends Error {
111
+ constructor(message: string);
112
+ }
113
+ /**
114
+ * Drops what resolved markdown shows for the reader. `documentToResolvedMarkdown` follows an embed
115
+ * with its target's content, and a query with its results, between `<!-- resolved: … -->` and
116
+ * `<!-- /resolved -->`. None of that is part of the document: the embed or query block on the line
117
+ * above is. Ranges nest (an embedded document has embeds of its own), and a marker inside a code
118
+ * or math block is text.
119
+ */
120
+ export declare function stripResolvedRanges(markdown: string, options?: {
121
+ strict?: boolean;
122
+ }): string;
103
123
  export declare function parseMarkdown(markdown: string, options?: ParseMarkdownOptions): {
104
124
  tree: BlockNode[];
105
125
  metadata: HMMetadata;
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  MarkdownFrontmatterError,
3
+ MarkdownResolvedRangeError,
3
4
  collapseResolvedEmbeds,
4
5
  flattenToOperations,
5
6
  hmAccountMentionUid,
@@ -7,11 +8,13 @@ import {
7
8
  mergeAdjacentAnnotations,
8
9
  parseFrontmatter,
9
10
  parseInlineFormatting,
10
- parseMarkdown
11
- } from "./chunk-SUVJSSHG.mjs";
11
+ parseMarkdown,
12
+ stripResolvedRanges
13
+ } from "./chunk-4ELQ4LJL.mjs";
12
14
  import "./chunk-7P6ASYW6.mjs";
13
15
  export {
14
16
  MarkdownFrontmatterError,
17
+ MarkdownResolvedRangeError,
15
18
  collapseResolvedEmbeds,
16
19
  flattenToOperations,
17
20
  hmAccountMentionUid,
@@ -19,5 +22,6 @@ export {
19
22
  mergeAdjacentAnnotations,
20
23
  parseFrontmatter,
21
24
  parseInlineFormatting,
22
- parseMarkdown
25
+ parseMarkdown,
26
+ stripResolvedRanges
23
27
  };
@@ -10,11 +10,11 @@ import {
10
10
  nativeBlockToProtoBlock,
11
11
  preparableDocumentChanges,
12
12
  prepareDocumentUpdateBlobs
13
- } from "./chunk-6QBB3P3Q.mjs";
13
+ } from "./chunk-KAZNQFXV.mjs";
14
+ import "./chunk-QS6PIRUE.mjs";
14
15
  import "./chunk-CBELM7KX.mjs";
15
16
  import "./chunk-KM2NR4YA.mjs";
16
17
  import "./chunk-PJ2RFT5A.mjs";
17
- import "./chunk-QS6PIRUE.mjs";
18
18
  import "./chunk-LVAHHQIK.mjs";
19
19
  import "./chunk-DR3HJ6BV.mjs";
20
20
  import "./chunk-DGNAMVGH.mjs";
@@ -5,9 +5,9 @@ import "./chunk-H2R4GYNV.mjs";
5
5
  import "./chunk-CBELM7KX.mjs";
6
6
  import "./chunk-KM2NR4YA.mjs";
7
7
  import "./chunk-PJ2RFT5A.mjs";
8
- import "./chunk-Q7CWMEBZ.mjs";
9
8
  import "./chunk-LVAHHQIK.mjs";
10
9
  import "./chunk-DR3HJ6BV.mjs";
10
+ import "./chunk-Q7CWMEBZ.mjs";
11
11
  import "./chunk-DGNAMVGH.mjs";
12
12
  import "./chunk-AHQWDCHV.mjs";
13
13
  import "./chunk-7P6ASYW6.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-hypermedia/client",
3
- "version": "0.0.132",
3
+ "version": "0.0.133",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/seed-hypermedia/seed",
@@ -1,3 +1,6 @@
1
+ import {
2
+ sameDocumentVersion
3
+ } from "./chunk-QS6PIRUE.mjs";
1
4
  import {
2
5
  SeedClientError
3
6
  } from "./chunk-CBELM7KX.mjs";
@@ -10,9 +13,6 @@ import {
10
13
  import {
11
14
  createVersionRef
12
15
  } from "./chunk-PJ2RFT5A.mjs";
13
- import {
14
- sameDocumentVersion
15
- } from "./chunk-QS6PIRUE.mjs";
16
16
 
17
17
  // src/prepare-change.ts
18
18
  import { decode as cborDecode } from "@ipld/dag-cbor";