@seed-hypermedia/client 0.0.71 → 0.0.73

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 (34) hide show
  1. package/dist/auto-link.mjs +3 -3
  2. package/dist/blocks-to-markdown.mjs +2 -2
  3. package/dist/capability.mjs +2 -2
  4. package/dist/{chunk-4L2LE3JW.mjs → chunk-3EGHHN2R.mjs} +2 -1
  5. package/dist/{chunk-RL3OEUFZ.mjs → chunk-5UVCHY2K.mjs} +1 -1
  6. package/dist/{chunk-X6OJRM5W.mjs → chunk-BSGKCLPU.mjs} +2 -2
  7. package/dist/{chunk-FNETXNBK.mjs → chunk-DBMFM4LP.mjs} +1 -1
  8. package/dist/{chunk-TXVEL22U.mjs → chunk-HTZ4OPYT.mjs} +3 -3
  9. package/dist/{chunk-AOB3PMFZ.mjs → chunk-IY5MEOZF.mjs} +56 -2
  10. package/dist/{chunk-NUIZU7KO.mjs → chunk-J4XARUNV.mjs} +2 -1
  11. package/dist/{chunk-W3FLBRBH.mjs → chunk-KHIMIB5T.mjs} +7 -0
  12. package/dist/{chunk-QYA75XPV.mjs → chunk-MUEUAUFH.mjs} +1 -1
  13. package/dist/{chunk-ALT5YCCW.mjs → chunk-MXIRCOZH.mjs} +2 -2
  14. package/dist/{chunk-H34UYMNW.mjs → chunk-NBIMKM77.mjs} +1 -1
  15. package/dist/{chunk-FUSG27NF.mjs → chunk-RP2RXTJI.mjs} +1 -1
  16. package/dist/{chunk-KY6WRGXY.mjs → chunk-ZVN2S7SB.mjs} +9 -1
  17. package/dist/client.mjs +2 -2
  18. package/dist/comment.mjs +2 -2
  19. package/dist/document-state.d.ts +80 -0
  20. package/dist/document-state.mjs +12 -4
  21. package/dist/editor-types.d.ts +5 -2
  22. package/dist/editorblock-to-hmblock.mjs +2 -2
  23. package/dist/hm-resolver.mjs +2 -2
  24. package/dist/hm-types.d.ts +127 -1
  25. package/dist/hm-types.mjs +3 -1
  26. package/dist/hmblock-to-editorblock.d.ts +0 -1
  27. package/dist/hmblock-to-editorblock.mjs +2 -2
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.mjs +22 -14
  30. package/dist/pdf-to-blocks.mjs +3 -3
  31. package/dist/resource-read.mjs +4 -4
  32. package/dist/tei-to-blocks.mjs +2 -2
  33. package/dist/unicode.mjs +1 -1
  34. package/package.json +1 -1
@@ -4,13 +4,13 @@ import {
4
4
  documentContainsLinkToChild,
5
5
  documentHasSelfQuery,
6
6
  shouldAutoLinkParent
7
- } from "./chunk-X6OJRM5W.mjs";
7
+ } from "./chunk-BSGKCLPU.mjs";
8
8
  import "./chunk-JT57MV7Y.mjs";
9
9
  import "./chunk-PJ2RFT5A.mjs";
10
- import "./chunk-AOB3PMFZ.mjs";
10
+ import "./chunk-IY5MEOZF.mjs";
11
11
  import "./chunk-LVAHHQIK.mjs";
12
12
  import "./chunk-DR3HJ6BV.mjs";
13
- import "./chunk-W3FLBRBH.mjs";
13
+ import "./chunk-KHIMIB5T.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-ALT5YCCW.mjs";
11
- import "./chunk-W3FLBRBH.mjs";
10
+ } from "./chunk-MXIRCOZH.mjs";
11
+ import "./chunk-KHIMIB5T.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-RL3OEUFZ.mjs";
4
+ } from "./chunk-5UVCHY2K.mjs";
5
5
  import "./chunk-LVAHHQIK.mjs";
6
6
  import "./chunk-IT5LLTMP.mjs";
7
7
  import "./chunk-DR3HJ6BV.mjs";
8
- import "./chunk-W3FLBRBH.mjs";
8
+ import "./chunk-KHIMIB5T.mjs";
9
9
  import "./chunk-3TPCJCVO.mjs";
10
10
  import "./chunk-7P6ASYW6.mjs";
11
11
  export {
@@ -6,7 +6,7 @@ import {
6
6
  HMBlockSchema,
7
7
  codePointLength,
8
8
  toNumber
9
- } from "./chunk-W3FLBRBH.mjs";
9
+ } from "./chunk-KHIMIB5T.mjs";
10
10
 
11
11
  // src/editorblock-to-hmblock.ts
12
12
  function toHMBlockType(editorBlockType) {
@@ -24,6 +24,7 @@ function toHMBlockType(editorBlockType) {
24
24
  if (editorBlockType === "table") return "Table";
25
25
  if (editorBlockType === "tableRow") return "TableRow";
26
26
  if (editorBlockType === "tableColumn") return "TableColumn";
27
+ if (editorBlockType === "slot") return "Slot";
27
28
  return void 0;
28
29
  }
29
30
  function toImageWidthNumber(width) {
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  entityQueryPathToHmIdPath,
9
9
  packBaseId
10
- } from "./chunk-W3FLBRBH.mjs";
10
+ } from "./chunk-KHIMIB5T.mjs";
11
11
 
12
12
  // src/capability.ts
13
13
  import { base58btc } from "multiformats/bases/base58";
@@ -7,12 +7,12 @@ import {
7
7
  } from "./chunk-PJ2RFT5A.mjs";
8
8
  import {
9
9
  resolveDocumentState
10
- } from "./chunk-AOB3PMFZ.mjs";
10
+ } from "./chunk-IY5MEOZF.mjs";
11
11
  import {
12
12
  entityQueryPathToHmIdPath,
13
13
  packHmId,
14
14
  unpackHmId
15
- } from "./chunk-W3FLBRBH.mjs";
15
+ } from "./chunk-KHIMIB5T.mjs";
16
16
 
17
17
  // src/auto-link.ts
18
18
  import { CID } from "multiformats/cid";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  teiToBlocks
3
- } from "./chunk-H34UYMNW.mjs";
3
+ } from "./chunk-NBIMKM77.mjs";
4
4
  import {
5
5
  embeddedPdfToBlocks
6
6
  } from "./chunk-52P3E6H6.mjs";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  resolveId
3
- } from "./chunk-QYA75XPV.mjs";
3
+ } from "./chunk-MUEUAUFH.mjs";
4
4
  import {
5
5
  createSeedClient
6
- } from "./chunk-FUSG27NF.mjs";
6
+ } from "./chunk-RP2RXTJI.mjs";
7
7
  import {
8
8
  unpackHmId
9
- } from "./chunk-W3FLBRBH.mjs";
9
+ } from "./chunk-KHIMIB5T.mjs";
10
10
 
11
11
  // src/resource-read.ts
12
12
  async function resolveIdWithClient(rawId, options = {}) {
@@ -1,6 +1,7 @@
1
1
  import {
2
+ packHmId,
2
3
  unpackHmId
3
- } from "./chunk-W3FLBRBH.mjs";
4
+ } from "./chunk-KHIMIB5T.mjs";
4
5
 
5
6
  // src/document-state.ts
6
7
  async function resolveDocumentState(client, targetId) {
@@ -51,6 +52,55 @@ async function resolveDocumentState(client, targetId) {
51
52
  version
52
53
  };
53
54
  }
55
+ var MAX_REDIRECT_HOPS = 5;
56
+ async function followRedirects(client, id) {
57
+ const seen = /* @__PURE__ */ new Set([packHmId(id)]);
58
+ const redirects = [];
59
+ let current = id;
60
+ for (let hop = 0; hop <= MAX_REDIRECT_HOPS; hop++) {
61
+ const resource = await client.request("Resource", current);
62
+ if (resource.type !== "redirect") {
63
+ return { id, targetId: current, resource, redirects };
64
+ }
65
+ redirects.push({ from: current, to: resource.redirectTarget, republish: resource.republish === true });
66
+ const next = packHmId(resource.redirectTarget);
67
+ if (seen.has(next)) throw new Error(`Redirect cycle detected at ${next}`);
68
+ seen.add(next);
69
+ current = resource.redirectTarget;
70
+ }
71
+ throw new Error(`Too many redirects while resolving ${packHmId(id)} (limit ${MAX_REDIRECT_HOPS})`);
72
+ }
73
+ function describeRedirect(followed) {
74
+ const first = followed.redirects[0];
75
+ if (!first) return null;
76
+ const from = packHmId(followed.id);
77
+ const to = packHmId(followed.targetId);
78
+ const via = followed.redirects.length > 1 ? ` (via ${followed.redirects.length} redirects)` : "";
79
+ if (first.republish) {
80
+ return `${from} republishes ${to}${via}: the content shown is the latest version of ${to}. To edit the shared original, write to ${to}. Writing to ${from} replaces the republish with an independent copy that no longer follows ${to}.`;
81
+ }
82
+ return `${from} has moved to ${to}${via}: the content shown is the latest version of ${to}. Write to ${to}. Writing to ${from} would revive it as an independent copy that no longer follows ${to}.`;
83
+ }
84
+ async function followToDocument(client, id) {
85
+ const followed = await followRedirects(client, id);
86
+ const first = followed.redirects[0];
87
+ if (followed.resource.type !== "document") {
88
+ throw new Error(
89
+ `Cannot edit ${packHmId(followed.targetId)}: resource is ${followed.resource.type}` + (first ? ` (followed redirect from ${packHmId(id)})` : "")
90
+ );
91
+ }
92
+ return {
93
+ id,
94
+ targetId: followed.targetId,
95
+ document: followed.resource.document,
96
+ redirect: first ? { republish: first.republish, target: first.to } : null
97
+ };
98
+ }
99
+ async function resolveEditableDocument(client, id) {
100
+ const followed = await followToDocument(client, id);
101
+ const state = await resolveDocumentState(client, packHmId(followed.targetId));
102
+ return { ...followed, state };
103
+ }
54
104
  function computeDepths(changesResp) {
55
105
  const depthMap = /* @__PURE__ */ new Map();
56
106
  const depsMap = /* @__PURE__ */ new Map();
@@ -98,5 +148,9 @@ function computeDepths(changesResp) {
98
148
  }
99
149
 
100
150
  export {
101
- resolveDocumentState
151
+ resolveDocumentState,
152
+ followRedirects,
153
+ describeRedirect,
154
+ followToDocument,
155
+ resolveEditableDocument
102
156
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSurrogate
3
- } from "./chunk-W3FLBRBH.mjs";
3
+ } from "./chunk-KHIMIB5T.mjs";
4
4
 
5
5
  // src/hmblock-to-editorblock.ts
6
6
  function toEditorBlockType(hmBlockType) {
@@ -18,6 +18,7 @@ function toEditorBlockType(hmBlockType) {
18
18
  if (hmBlockType === "Table") return "table";
19
19
  if (hmBlockType === "TableRow") return "tableRow";
20
20
  if (hmBlockType === "TableColumn") return "tableColumn";
21
+ if (hmBlockType === "Slot") return "slot";
21
22
  return "unknown";
22
23
  }
23
24
  function hmBlocksToEditorContent(blocks, opts = { level: 1 }) {
@@ -505,6 +505,11 @@ var HMBlockGroupSchema = z.object({
505
505
  type: z.literal("Group"),
506
506
  id: z.string()
507
507
  });
508
+ var HMBlockSlotSchema = z.object({
509
+ type: z.literal("Slot"),
510
+ ...blockBaseProperties,
511
+ attributes: z.object(parentBlockAttributes).optional().default({})
512
+ }).strict();
508
513
  var HMBlockLinkSchema = z.object({
509
514
  type: z.literal("Link"),
510
515
  id: z.string(),
@@ -528,6 +533,7 @@ var HMBlockKnownSchema = z.discriminatedUnion("type", [
528
533
  HMBlockTableColumnSchema,
529
534
  HMBlockQuerySchema,
530
535
  HMBlockGroupSchema,
536
+ HMBlockSlotSchema,
531
537
  HMBlockLinkSchema
532
538
  ]);
533
539
  var HMBlockUnknownSchema = z.object({
@@ -1456,6 +1462,7 @@ export {
1456
1462
  HMBlockTableColumnSchema,
1457
1463
  HMBlockQuerySchema,
1458
1464
  HMBlockGroupSchema,
1465
+ HMBlockSlotSchema,
1459
1466
  HMBlockLinkSchema,
1460
1467
  HMBlockKnownSchema,
1461
1468
  HMBlockUnknownSchema,
@@ -2,7 +2,7 @@ import {
2
2
  entityQueryPathToHmIdPath,
3
3
  parseFragment,
4
4
  unpackHmId
5
- } from "./chunk-W3FLBRBH.mjs";
5
+ } from "./chunk-KHIMIB5T.mjs";
6
6
 
7
7
  // src/hm-resolver.ts
8
8
  async function resolveHypermediaUrl(url, opts) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpackHmId
3
- } from "./chunk-W3FLBRBH.mjs";
3
+ } from "./chunk-KHIMIB5T.mjs";
4
4
 
5
5
  // src/blocks-to-markdown.ts
6
6
  var FM_STRING_KEYS = [
@@ -77,7 +77,7 @@ function blockNodeToMarkdown(node, depth, opts) {
77
77
  return tableToMarkdown(node, depth, (text, annotations) => applyAnnotations(text, annotations));
78
78
  }
79
79
  const childrenType = (_a = block.attributes) == null ? void 0 : _a.childrenType;
80
- const isListContainer = block.type === "Paragraph" && !block.text && (childrenType === "Ordered" || childrenType === "Unordered" || childrenType === "Blockquote");
80
+ const isListContainer = (block.type === "Paragraph" || block.type === "Slot") && !block.text && (childrenType === "Ordered" || childrenType === "Unordered" || childrenType === "Blockquote");
81
81
  let result;
82
82
  if (isListContainer) {
83
83
  result = idComment(block.id);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  codePointLength
3
- } from "./chunk-W3FLBRBH.mjs";
3
+ } from "./chunk-KHIMIB5T.mjs";
4
4
 
5
5
  // src/tei-to-blocks.ts
6
6
  function generateBlockId() {
@@ -15,7 +15,7 @@ import {
15
15
  HMActionSchema,
16
16
  HMRequestSchema,
17
17
  packHmId
18
- } from "./chunk-W3FLBRBH.mjs";
18
+ } from "./chunk-KHIMIB5T.mjs";
19
19
 
20
20
  // src/client.ts
21
21
  import { encode as cborEncode } from "@ipld/dag-cbor";
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  hmIdPathToEntityQueryPath,
11
11
  packHmId
12
- } from "./chunk-W3FLBRBH.mjs";
12
+ } from "./chunk-KHIMIB5T.mjs";
13
13
 
14
14
  // src/comment.ts
15
15
  import { decode as cborDecode, encode as cborEncode } from "@ipld/dag-cbor";
@@ -174,6 +174,14 @@ function blockToPublishable(blockNode) {
174
174
  children: blocksToPublishable(blockNode.children || [])
175
175
  };
176
176
  }
177
+ if (block.type === "Slot") {
178
+ return {
179
+ id: block.id,
180
+ type: "Slot",
181
+ ...block.attributes,
182
+ children: blocksToPublishable(blockNode.children || [])
183
+ };
184
+ }
177
185
  throw new Error(`Unsupported block type: ${block.type}`);
178
186
  }
179
187
  function blocksToPublishable(blockNodes) {
package/dist/client.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createSeedClient,
3
3
  deserializeQueryString
4
- } from "./chunk-FUSG27NF.mjs";
4
+ } from "./chunk-RP2RXTJI.mjs";
5
5
  import "./chunk-CBELM7KX.mjs";
6
6
  import "./chunk-JT57MV7Y.mjs";
7
7
  import "./chunk-PJ2RFT5A.mjs";
8
8
  import "./chunk-LVAHHQIK.mjs";
9
9
  import "./chunk-DR3HJ6BV.mjs";
10
- import "./chunk-W3FLBRBH.mjs";
10
+ import "./chunk-KHIMIB5T.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-KY6WRGXY.mjs";
7
+ } from "./chunk-ZVN2S7SB.mjs";
8
8
  import "./chunk-N3P7S5YZ.mjs";
9
9
  import "./chunk-LVAHHQIK.mjs";
10
10
  import "./chunk-DR3HJ6BV.mjs";
11
- import "./chunk-W3FLBRBH.mjs";
11
+ import "./chunk-KHIMIB5T.mjs";
12
12
  import "./chunk-7P6ASYW6.mjs";
13
13
  export {
14
14
  commentRecordIdFromBlob,
@@ -6,6 +6,7 @@
6
6
  * genesis has depth 0, each subsequent change has depth = max(dep depths) + 1.
7
7
  */
8
8
  import type { SeedClient } from './client';
9
+ import type { HMDocument, HMResource, UnpackedHypermediaId } from './hm-types';
9
10
  /** The resolved state of a document's change DAG. */
10
11
  export type DocumentState = {
11
12
  /** CID of the genesis change blob. */
@@ -21,3 +22,82 @@ export type DocumentState = {
21
22
  * Resolves the current document state including head depth.
22
23
  */
23
24
  export declare function resolveDocumentState(client: SeedClient, targetId: string): Promise<DocumentState>;
25
+ /** A document address resolved through redirects to the document it currently presents. */
26
+ export type FollowedDocument = {
27
+ /** The address that was resolved — where a new Ref should be published to affect this path. */
28
+ id: UnpackedHypermediaId;
29
+ /** Where the document actually lives after following redirects (same as `id` for a plain document). */
30
+ targetId: UnpackedHypermediaId;
31
+ /** The current document at the target — the content baseline for edits, forks, and moves. */
32
+ document: HMDocument;
33
+ /**
34
+ * Non-null when `id` currently holds a redirect Ref. Publishing a Version Ref at `id` with the
35
+ * target's genesis and a fresh (current-timestamp) generation replaces the redirect: the path
36
+ * becomes a live document continuing the target's change history, and stops following the target.
37
+ */
38
+ redirect: {
39
+ republish: boolean;
40
+ target: UnpackedHypermediaId;
41
+ } | null;
42
+ };
43
+ /** The full baseline needed to build a new Change at an address: {@link FollowedDocument} plus DAG state. */
44
+ export type EditableDocumentBase = FollowedDocument & {
45
+ /** Change-DAG state of the target (genesis/heads/depth) for building the next Change. */
46
+ state: DocumentState;
47
+ };
48
+ /** One redirect Ref that was followed while resolving an address. */
49
+ export type RedirectHop = {
50
+ /** The address holding the redirect Ref. */
51
+ from: UnpackedHypermediaId;
52
+ /** Where it points. */
53
+ to: UnpackedHypermediaId;
54
+ /**
55
+ * `true` for a "republish" redirect (the path re-publishes the target's latest content as its
56
+ * own), `false` for a move redirect (the path has moved away).
57
+ */
58
+ republish: boolean;
59
+ };
60
+ /** A resource read through any redirect Refs on the way, plus the trail of redirects followed. */
61
+ export type FollowedResource = {
62
+ /** The address that was asked for. */
63
+ id: UnpackedHypermediaId;
64
+ /** The address the resource was actually read from (equals `id` when nothing was followed). */
65
+ targetId: UnpackedHypermediaId;
66
+ /** The resource at `targetId` — never a redirect. */
67
+ resource: Exclude<HMResource, {
68
+ type: 'redirect';
69
+ }>;
70
+ /** Every redirect followed, in order. Empty when `id` holds no redirect. */
71
+ redirects: RedirectHop[];
72
+ };
73
+ /**
74
+ * Reads the resource at an address, following redirect Refs (bounded, cycle-safe) and reporting
75
+ * every hop that was taken.
76
+ *
77
+ * Readers that follow redirects must never present the result as if it lived at the requested
78
+ * address: the content belongs to `targetId`, and a write to `id` behaves differently from a write
79
+ * to `targetId` (see {@link describeRedirect}). Callers surface `redirects` to the user or agent.
80
+ */
81
+ export declare function followRedirects(client: SeedClient, id: UnpackedHypermediaId): Promise<FollowedResource>;
82
+ /**
83
+ * One plain sentence explaining a followed redirect and what a write to either address does —
84
+ * shared by the CLI and the agents read tool so every surface tells the same story.
85
+ */
86
+ export declare function describeRedirect(followed: Pick<FollowedResource, 'id' | 'targetId' | 'redirects'>): string | null;
87
+ /**
88
+ * Resolves an address to the document it currently presents, following redirect Refs.
89
+ *
90
+ * A path that holds a redirect Ref (including a "republish" redirect, which re-publishes the
91
+ * target's latest content at this path) has no document of its own: the `Resource` API reports
92
+ * `type: 'redirect'`. Operations on such a path (edit, fork, move, delete) act on the redirect
93
+ * target's document, so this follows the chain (bounded, cycle-safe) to that document.
94
+ */
95
+ export declare function followToDocument(client: SeedClient, id: UnpackedHypermediaId): Promise<FollowedDocument>;
96
+ /**
97
+ * Resolves an address to the state needed to edit the document there, following redirects.
98
+ *
99
+ * Edits at a redirected address must build the Change on the redirect target's DAG (the source
100
+ * path has no changes of its own — `ListChanges` returns nothing for it) and publish a Version
101
+ * Ref at the source path with a fresh generation, which supersedes the redirect Ref.
102
+ */
103
+ export declare function resolveEditableDocument(client: SeedClient, id: UnpackedHypermediaId): Promise<EditableDocumentBase>;
@@ -1,8 +1,16 @@
1
1
  import {
2
- resolveDocumentState
3
- } from "./chunk-AOB3PMFZ.mjs";
4
- import "./chunk-W3FLBRBH.mjs";
2
+ describeRedirect,
3
+ followRedirects,
4
+ followToDocument,
5
+ resolveDocumentState,
6
+ resolveEditableDocument
7
+ } from "./chunk-IY5MEOZF.mjs";
8
+ import "./chunk-KHIMIB5T.mjs";
5
9
  import "./chunk-7P6ASYW6.mjs";
6
10
  export {
7
- resolveDocumentState
11
+ describeRedirect,
12
+ followRedirects,
13
+ followToDocument,
14
+ resolveDocumentState,
15
+ resolveEditableDocument
8
16
  };
@@ -1,5 +1,5 @@
1
1
  import type { HMBlockChildrenType } from './hm-types';
2
- export type EditorBlock = EditorParagraphBlock | EditorHeadingBlock | EditorCodeBlock | EditorImageBlock | EditorVideoBlock | EditorFileBlock | EditorButtonBlock | EditorEmbedBlock | EditorWebEmbedBlock | EditorMathBlock | EditorNostrBlock | EditorQueryBlock | EditorTableBlock | EditorTableRowBlock | EditorTableColumnBlock | EditorUnknownBlock;
2
+ export type EditorBlock = EditorParagraphBlock | EditorHeadingBlock | EditorCodeBlock | EditorImageBlock | EditorVideoBlock | EditorFileBlock | EditorButtonBlock | EditorEmbedBlock | EditorWebEmbedBlock | EditorMathBlock | EditorNostrBlock | EditorQueryBlock | EditorTableBlock | EditorTableRowBlock | EditorTableColumnBlock | EditorSlotBlock | EditorUnknownBlock;
3
3
  export type HMInlineContent = EditorText | EditorInlineEmbed | EditorLink;
4
4
  export interface EditorBaseBlock {
5
5
  id: string;
@@ -9,7 +9,6 @@ export interface EditorBaseBlock {
9
9
  export interface EditorBlockProps {
10
10
  childrenType?: HMBlockChildrenType;
11
11
  columnCount?: string;
12
- listLevel?: string;
13
12
  level?: number | string;
14
13
  ref?: string;
15
14
  revision?: string;
@@ -135,6 +134,10 @@ export interface EditorTableColumnBlock extends EditorBaseBlock {
135
134
  };
136
135
  content: Array<HMInlineContent>;
137
136
  }
137
+ export interface EditorSlotBlock extends EditorBaseBlock {
138
+ type: 'slot';
139
+ content: Array<HMInlineContent>;
140
+ }
138
141
  export type EditorUnknownBlock = EditorBaseBlock & {
139
142
  type: 'unknown';
140
143
  props: EditorBlockProps & {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  editorBlockToHMBlock,
3
3
  editorBlocksToHMBlockNodes
4
- } from "./chunk-4L2LE3JW.mjs";
4
+ } from "./chunk-3EGHHN2R.mjs";
5
5
  import "./chunk-N3P7S5YZ.mjs";
6
- import "./chunk-W3FLBRBH.mjs";
6
+ import "./chunk-KHIMIB5T.mjs";
7
7
  import "./chunk-7P6ASYW6.mjs";
8
8
  export {
9
9
  editorBlockToHMBlock,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  resolveHypermediaUrl,
3
3
  resolveId
4
- } from "./chunk-QYA75XPV.mjs";
5
- import "./chunk-W3FLBRBH.mjs";
4
+ } from "./chunk-MUEUAUFH.mjs";
5
+ import "./chunk-KHIMIB5T.mjs";
6
6
  import "./chunk-7P6ASYW6.mjs";
7
7
  export {
8
8
  resolveHypermediaUrl,
@@ -2740,7 +2740,14 @@ export type HMPublishableBlockWebEmbed = {
2740
2740
  link: string;
2741
2741
  children?: HMPublishableBlock[];
2742
2742
  };
2743
- export type HMPublishableBlock = HMPublishableBlockParagraph | HMPublishableBlockHeading | HMPublishableBlockMath | HMPublishableBlockCode | HMPublishableBlockImage | HMPublishableBlockVideo | HMPublishableBlockFile | HMPublishableBlockButton | HMPublishableBlockEmbed | HMPublishableBlockWebEmbed;
2743
+ export type HMPublishableBlockSlot = {
2744
+ id: string;
2745
+ type: 'Slot';
2746
+ childrenType?: HMBlockChildrenType;
2747
+ columnCount?: number;
2748
+ children?: HMPublishableBlock[];
2749
+ };
2750
+ export type HMPublishableBlock = HMPublishableBlockParagraph | HMPublishableBlockHeading | HMPublishableBlockMath | HMPublishableBlockCode | HMPublishableBlockImage | HMPublishableBlockVideo | HMPublishableBlockFile | HMPublishableBlockButton | HMPublishableBlockEmbed | HMPublishableBlockWebEmbed | HMPublishableBlockSlot;
2744
2751
  export type HMBlockNode = {
2745
2752
  children?: HMBlockNode[];
2746
2753
  block: HMBlock;
@@ -6202,6 +6209,46 @@ export declare const HMBlockGroupSchema: z.ZodObject<{
6202
6209
  type: "Group";
6203
6210
  id: string;
6204
6211
  }>;
6212
+ export declare const HMBlockSlotSchema: z.ZodObject<{
6213
+ attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
6214
+ childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
6215
+ columnCount: z.ZodOptional<z.ZodNumber>;
6216
+ }, "strip", z.ZodTypeAny, {
6217
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
6218
+ columnCount?: number | undefined;
6219
+ }, {
6220
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
6221
+ columnCount?: number | undefined;
6222
+ }>>>;
6223
+ id: z.ZodString;
6224
+ revision: z.ZodOptional<z.ZodString>;
6225
+ annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
6226
+ text: z.ZodOptional<z.ZodLiteral<"">>;
6227
+ link: z.ZodOptional<z.ZodLiteral<"">>;
6228
+ type: z.ZodLiteral<"Slot">;
6229
+ }, "strict", z.ZodTypeAny, {
6230
+ type: "Slot";
6231
+ id: string;
6232
+ attributes: {
6233
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
6234
+ columnCount?: number | undefined;
6235
+ };
6236
+ link?: "" | undefined;
6237
+ text?: "" | undefined;
6238
+ annotations?: never[] | undefined;
6239
+ revision?: string | undefined;
6240
+ }, {
6241
+ type: "Slot";
6242
+ id: string;
6243
+ link?: "" | undefined;
6244
+ attributes?: {
6245
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
6246
+ columnCount?: number | undefined;
6247
+ } | undefined;
6248
+ text?: "" | undefined;
6249
+ annotations?: never[] | undefined;
6250
+ revision?: string | undefined;
6251
+ }>;
6205
6252
  export declare const HMBlockLinkSchema: z.ZodObject<{
6206
6253
  type: z.ZodLiteral<"Link">;
6207
6254
  id: z.ZodString;
@@ -8276,6 +8323,45 @@ export declare const HMBlockKnownSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
8276
8323
  }, {
8277
8324
  type: "Group";
8278
8325
  id: string;
8326
+ }>, z.ZodObject<{
8327
+ attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
8328
+ childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
8329
+ columnCount: z.ZodOptional<z.ZodNumber>;
8330
+ }, "strip", z.ZodTypeAny, {
8331
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
8332
+ columnCount?: number | undefined;
8333
+ }, {
8334
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
8335
+ columnCount?: number | undefined;
8336
+ }>>>;
8337
+ id: z.ZodString;
8338
+ revision: z.ZodOptional<z.ZodString>;
8339
+ annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
8340
+ text: z.ZodOptional<z.ZodLiteral<"">>;
8341
+ link: z.ZodOptional<z.ZodLiteral<"">>;
8342
+ type: z.ZodLiteral<"Slot">;
8343
+ }, "strict", z.ZodTypeAny, {
8344
+ type: "Slot";
8345
+ id: string;
8346
+ attributes: {
8347
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
8348
+ columnCount?: number | undefined;
8349
+ };
8350
+ link?: "" | undefined;
8351
+ text?: "" | undefined;
8352
+ annotations?: never[] | undefined;
8353
+ revision?: string | undefined;
8354
+ }, {
8355
+ type: "Slot";
8356
+ id: string;
8357
+ link?: "" | undefined;
8358
+ attributes?: {
8359
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
8360
+ columnCount?: number | undefined;
8361
+ } | undefined;
8362
+ text?: "" | undefined;
8363
+ annotations?: never[] | undefined;
8364
+ revision?: string | undefined;
8279
8365
  }>, z.ZodObject<{
8280
8366
  type: z.ZodLiteral<"Link">;
8281
8367
  id: z.ZodString;
@@ -10375,6 +10461,45 @@ export declare const HMBlockSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type",
10375
10461
  }, {
10376
10462
  type: "Group";
10377
10463
  id: string;
10464
+ }>, z.ZodObject<{
10465
+ attributes: z.ZodDefault<z.ZodOptional<z.ZodObject<{
10466
+ childrenType: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"Group">, z.ZodLiteral<"Ordered">, z.ZodLiteral<"Unordered">, z.ZodLiteral<"Blockquote">, z.ZodLiteral<"Grid">]>>>;
10467
+ columnCount: z.ZodOptional<z.ZodNumber>;
10468
+ }, "strip", z.ZodTypeAny, {
10469
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
10470
+ columnCount?: number | undefined;
10471
+ }, {
10472
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
10473
+ columnCount?: number | undefined;
10474
+ }>>>;
10475
+ id: z.ZodString;
10476
+ revision: z.ZodOptional<z.ZodString>;
10477
+ annotations: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
10478
+ text: z.ZodOptional<z.ZodLiteral<"">>;
10479
+ link: z.ZodOptional<z.ZodLiteral<"">>;
10480
+ type: z.ZodLiteral<"Slot">;
10481
+ }, "strict", z.ZodTypeAny, {
10482
+ type: "Slot";
10483
+ id: string;
10484
+ attributes: {
10485
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
10486
+ columnCount?: number | undefined;
10487
+ };
10488
+ link?: "" | undefined;
10489
+ text?: "" | undefined;
10490
+ annotations?: never[] | undefined;
10491
+ revision?: string | undefined;
10492
+ }, {
10493
+ type: "Slot";
10494
+ id: string;
10495
+ link?: "" | undefined;
10496
+ attributes?: {
10497
+ childrenType?: "Group" | "Ordered" | "Unordered" | "Blockquote" | "Grid" | null | undefined;
10498
+ columnCount?: number | undefined;
10499
+ } | undefined;
10500
+ text?: "" | undefined;
10501
+ annotations?: never[] | undefined;
10502
+ revision?: string | undefined;
10378
10503
  }>, z.ZodObject<{
10379
10504
  type: z.ZodLiteral<"Link">;
10380
10505
  id: z.ZodString;
@@ -10428,6 +10553,7 @@ export type HMBlockButton = z.infer<typeof HMBlockButtonSchema>;
10428
10553
  export type HMBlockEmbed = z.infer<typeof HMBlockEmbedSchema>;
10429
10554
  export type HMBlockWebEmbed = z.infer<typeof HMBlockWebEmbedSchema>;
10430
10555
  export type HMBlockQuery = z.infer<typeof HMBlockQuerySchema>;
10556
+ export type HMBlockSlot = z.infer<typeof HMBlockSlotSchema>;
10431
10557
  export type HMBlock = z.infer<typeof HMBlockKnownSchema>;
10432
10558
  export type HMBlockNostr = z.infer<typeof HMBlockNostrSchema>;
10433
10559
  export type HMBlockTable = z.infer<typeof HMBlockTableSchema>;
package/dist/hm-types.mjs CHANGED
@@ -32,6 +32,7 @@ import {
32
32
  HMBlockParagraphSchema,
33
33
  HMBlockQuerySchema,
34
34
  HMBlockSchema,
35
+ HMBlockSlotSchema,
35
36
  HMBlockTableColumnSchema,
36
37
  HMBlockTableRowSchema,
37
38
  HMBlockTableSchema,
@@ -185,7 +186,7 @@ import {
185
186
  toNumber,
186
187
  unpackHmId,
187
188
  unpackedHmIdSchema
188
- } from "./chunk-W3FLBRBH.mjs";
189
+ } from "./chunk-KHIMIB5T.mjs";
189
190
  import "./chunk-7P6ASYW6.mjs";
190
191
  export {
191
192
  BUILTIN_METADATA_KEYS,
@@ -221,6 +222,7 @@ export {
221
222
  HMBlockParagraphSchema,
222
223
  HMBlockQuerySchema,
223
224
  HMBlockSchema,
225
+ HMBlockSlotSchema,
224
226
  HMBlockTableColumnSchema,
225
227
  HMBlockTableRowSchema,
226
228
  HMBlockTableSchema,
@@ -10,7 +10,6 @@ type ServerToEditorRecursiveOpts = {
10
10
  * orphan table row and column blocks that ended up outside a table parent. */
11
11
  export declare function hmBlocksToEditorContent(blocks: HMBlockNode[], opts?: ServerToEditorRecursiveOpts & {
12
12
  childrenType?: HMBlockChildrenType;
13
- listLevel?: string;
14
13
  start?: string;
15
14
  parentType?: HMBlockType;
16
15
  }): Array<EditorBlock>;
@@ -2,8 +2,8 @@ import {
2
2
  annotationContains,
3
3
  hmBlockToEditorBlock,
4
4
  hmBlocksToEditorContent
5
- } from "./chunk-NUIZU7KO.mjs";
6
- import "./chunk-W3FLBRBH.mjs";
5
+ } from "./chunk-J4XARUNV.mjs";
6
+ import "./chunk-KHIMIB5T.mjs";
7
7
  import "./chunk-7P6ASYW6.mjs";
8
8
  export {
9
9
  annotationContains,
package/dist/index.d.ts CHANGED
@@ -39,8 +39,8 @@ export { createBlocksMap, matchBlockIds, computeReplaceOps, hmBlockNodeToBlockNo
39
39
  export type { APIBlockNode, APIBlock } from './block-diff';
40
40
  export { autoLinkChildToParent, createAutoLinkOps, documentContainsLinkToChild, documentHasSelfQuery, shouldAutoLinkParent, } from './auto-link';
41
41
  export type { AutoLinkChildToParentOptions } from './auto-link';
42
- export { resolveDocumentState } from './document-state';
43
- export type { DocumentState } from './document-state';
42
+ export { describeRedirect, followRedirects, followToDocument, resolveDocumentState, resolveEditableDocument, } from './document-state';
43
+ export type { DocumentState, EditableDocumentBase, FollowedDocument, FollowedResource, RedirectHop, } from './document-state';
44
44
  export { editorBlockToHMBlock, editorBlocksToHMBlockNodes } from './editorblock-to-hmblock';
45
45
  export { hmBlocksToEditorContent, hmBlockToEditorBlock, annotationContains } from './hmblock-to-editorblock';
46
46
  export { AnnotationSet, addSpanToAnnotation, pushSpanToAnnotation } from './unicode';
package/dist/index.mjs CHANGED
@@ -10,16 +10,16 @@ import {
10
10
  } from "./chunk-H7L4TI6X.mjs";
11
11
  import {
12
12
  pdfToBlocks
13
- } from "./chunk-FNETXNBK.mjs";
13
+ } from "./chunk-DBMFM4LP.mjs";
14
14
  import {
15
15
  teiToBlocks
16
- } from "./chunk-H34UYMNW.mjs";
16
+ } from "./chunk-NBIMKM77.mjs";
17
17
  import {
18
18
  embeddedPdfToBlocks
19
19
  } from "./chunk-52P3E6H6.mjs";
20
20
  import {
21
21
  resolveIdWithClient
22
- } from "./chunk-TXVEL22U.mjs";
22
+ } from "./chunk-HTZ4OPYT.mjs";
23
23
  import {
24
24
  fileToIpfsBlobs,
25
25
  filesToIpfsBlobs,
@@ -34,15 +34,15 @@ import {
34
34
  import {
35
35
  resolveHypermediaUrl,
36
36
  resolveId
37
- } from "./chunk-QYA75XPV.mjs";
37
+ } from "./chunk-MUEUAUFH.mjs";
38
38
  import {
39
39
  annotationContains,
40
40
  hmBlockToEditorBlock,
41
41
  hmBlocksToEditorContent
42
- } from "./chunk-NUIZU7KO.mjs";
42
+ } from "./chunk-J4XARUNV.mjs";
43
43
  import {
44
44
  createSeedClient
45
- } from "./chunk-FUSG27NF.mjs";
45
+ } from "./chunk-RP2RXTJI.mjs";
46
46
  import {
47
47
  SeedClientError,
48
48
  SeedNetworkError,
@@ -54,7 +54,7 @@ import {
54
54
  deleteComment,
55
55
  trimTrailingEmptyBlocks,
56
56
  updateComment
57
- } from "./chunk-KY6WRGXY.mjs";
57
+ } from "./chunk-ZVN2S7SB.mjs";
58
58
  import {
59
59
  contactRecordIdFromBlob,
60
60
  createContact,
@@ -64,7 +64,7 @@ import {
64
64
  import {
65
65
  editorBlockToHMBlock,
66
66
  editorBlocksToHMBlockNodes
67
- } from "./chunk-4L2LE3JW.mjs";
67
+ } from "./chunk-3EGHHN2R.mjs";
68
68
  import {
69
69
  AnnotationSet,
70
70
  addSpanToAnnotation,
@@ -79,7 +79,7 @@ import {
79
79
  documentContainsLinkToChild,
80
80
  documentHasSelfQuery,
81
81
  shouldAutoLinkParent
82
- } from "./chunk-X6OJRM5W.mjs";
82
+ } from "./chunk-BSGKCLPU.mjs";
83
83
  import {
84
84
  createChange,
85
85
  createChangeOps,
@@ -95,8 +95,12 @@ import {
95
95
  createVersionRef
96
96
  } from "./chunk-PJ2RFT5A.mjs";
97
97
  import {
98
- resolveDocumentState
99
- } from "./chunk-AOB3PMFZ.mjs";
98
+ describeRedirect,
99
+ followRedirects,
100
+ followToDocument,
101
+ resolveDocumentState,
102
+ resolveEditableDocument
103
+ } from "./chunk-IY5MEOZF.mjs";
100
104
  import "./chunk-2MD3FXKB.mjs";
101
105
  import {
102
106
  computeReplaceOps,
@@ -115,11 +119,11 @@ import {
115
119
  emitFrontmatter,
116
120
  parseDraftFilename,
117
121
  slugify
118
- } from "./chunk-ALT5YCCW.mjs";
122
+ } from "./chunk-MXIRCOZH.mjs";
119
123
  import {
120
124
  createCapability,
121
125
  resolveCapability
122
- } from "./chunk-RL3OEUFZ.mjs";
126
+ } from "./chunk-5UVCHY2K.mjs";
123
127
  import "./chunk-LVAHHQIK.mjs";
124
128
  import "./chunk-IT5LLTMP.mjs";
125
129
  import {
@@ -139,7 +143,7 @@ import {
139
143
  parseFragment,
140
144
  serializeBlockRange,
141
145
  unpackHmId
142
- } from "./chunk-W3FLBRBH.mjs";
146
+ } from "./chunk-KHIMIB5T.mjs";
143
147
  import "./chunk-3TPCJCVO.mjs";
144
148
  import "./chunk-7P6ASYW6.mjs";
145
149
  export {
@@ -175,6 +179,7 @@ export {
175
179
  createVersionRef,
176
180
  deleteComment,
177
181
  deleteContact,
182
+ describeRedirect,
178
183
  documentContainsLinkToChild,
179
184
  documentHasSelfQuery,
180
185
  documentToResolvedMarkdown,
@@ -187,6 +192,8 @@ export {
187
192
  fileToIpfsBlobs,
188
193
  filesToIpfsBlobs,
189
194
  flattenToOperations,
195
+ followRedirects,
196
+ followToDocument,
190
197
  getHMQueryString,
191
198
  hasFileLinks,
192
199
  hmBlockNodeToBlockNode,
@@ -213,6 +220,7 @@ export {
213
220
  rebindTableIdentities,
214
221
  resolveCapability,
215
222
  resolveDocumentState,
223
+ resolveEditableDocument,
216
224
  resolveFileLinksInBlocks,
217
225
  resolveHypermediaUrl,
218
226
  resolveId,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  pdfToBlocks
3
- } from "./chunk-FNETXNBK.mjs";
4
- import "./chunk-H34UYMNW.mjs";
3
+ } from "./chunk-DBMFM4LP.mjs";
4
+ import "./chunk-NBIMKM77.mjs";
5
5
  import "./chunk-52P3E6H6.mjs";
6
6
  import "./chunk-PPAY4WZX.mjs";
7
- import "./chunk-W3FLBRBH.mjs";
7
+ import "./chunk-KHIMIB5T.mjs";
8
8
  import "./chunk-7P6ASYW6.mjs";
9
9
  export {
10
10
  pdfToBlocks
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  resolveIdWithClient
3
- } from "./chunk-TXVEL22U.mjs";
4
- import "./chunk-QYA75XPV.mjs";
5
- import "./chunk-FUSG27NF.mjs";
3
+ } from "./chunk-HTZ4OPYT.mjs";
4
+ import "./chunk-MUEUAUFH.mjs";
5
+ import "./chunk-RP2RXTJI.mjs";
6
6
  import "./chunk-CBELM7KX.mjs";
7
7
  import "./chunk-JT57MV7Y.mjs";
8
8
  import "./chunk-PJ2RFT5A.mjs";
9
9
  import "./chunk-LVAHHQIK.mjs";
10
10
  import "./chunk-DR3HJ6BV.mjs";
11
- import "./chunk-W3FLBRBH.mjs";
11
+ import "./chunk-KHIMIB5T.mjs";
12
12
  import "./chunk-7P6ASYW6.mjs";
13
13
  export {
14
14
  resolveIdWithClient
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  teiToBlocks
3
- } from "./chunk-H34UYMNW.mjs";
4
- import "./chunk-W3FLBRBH.mjs";
3
+ } from "./chunk-NBIMKM77.mjs";
4
+ import "./chunk-KHIMIB5T.mjs";
5
5
  import "./chunk-7P6ASYW6.mjs";
6
6
  export {
7
7
  teiToBlocks
package/dist/unicode.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  codePointLength,
9
9
  isSurrogate
10
- } from "./chunk-W3FLBRBH.mjs";
10
+ } from "./chunk-KHIMIB5T.mjs";
11
11
  import "./chunk-7P6ASYW6.mjs";
12
12
  export {
13
13
  AnnotationSet,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-hypermedia/client",
3
- "version": "0.0.71",
3
+ "version": "0.0.73",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/seed-hypermedia/seed",