@seed-hypermedia/client 0.0.130 → 0.0.132

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 (50) hide show
  1. package/dist/apps.mjs +4 -4
  2. package/dist/auto-link.mjs +5 -5
  3. package/dist/block-diff.d.ts +14 -4
  4. package/dist/blocks-to-markdown.mjs +3 -3
  5. package/dist/capability.mjs +2 -2
  6. package/dist/change.d.ts +2 -0
  7. package/dist/change.mjs +1 -1
  8. package/dist/{chunk-D3PRDISB.mjs → chunk-325UCLMT.mjs} +3 -3
  9. package/dist/{chunk-IRP2ZGH3.mjs → chunk-6QBB3P3Q.mjs} +10 -6
  10. package/dist/{chunk-QU6XHE3U.mjs → chunk-DGNAMVGH.mjs} +5 -2
  11. package/dist/{chunk-2XNVA2GK.mjs → chunk-ETIDW7ZJ.mjs} +1 -1
  12. package/dist/{chunk-ANR3R5NH.mjs → chunk-FU7FIYHI.mjs} +1 -1
  13. package/dist/{chunk-HY4NWSHF.mjs → chunk-H2R4GYNV.mjs} +4 -3
  14. package/dist/{chunk-2LSZJ2IM.mjs → chunk-HL43SJUP.mjs} +1 -1
  15. package/dist/{chunk-JM4WXPLC.mjs → chunk-IFELP3LQ.mjs} +1 -1
  16. package/dist/{chunk-IXSAJRZA.mjs → chunk-JQKYF5NB.mjs} +3 -3
  17. package/dist/{chunk-O5MHN2EO.mjs → chunk-KM2NR4YA.mjs} +1 -0
  18. package/dist/{chunk-RPBGROOJ.mjs → chunk-LDCWJXIP.mjs} +1 -1
  19. package/dist/{chunk-JRJ6U6B2.mjs → chunk-NEUDKUBC.mjs} +1 -1
  20. package/dist/{chunk-4JFL3SUQ.mjs → chunk-Q7CWMEBZ.mjs} +1 -1
  21. package/dist/{chunk-QLR4OWHG.mjs → chunk-QS6PIRUE.mjs} +1 -1
  22. package/dist/{chunk-QRSUQQTZ.mjs → chunk-T7SWLR32.mjs} +2 -2
  23. package/dist/{chunk-WD332LPF.mjs → chunk-VSMUWHIY.mjs} +1 -1
  24. package/dist/{chunk-NWOYBZWP.mjs → chunk-Y4PWAEJ5.mjs} +2 -2
  25. package/dist/{chunk-APL23ACF.mjs → chunk-YRNPRWYG.mjs} +1 -1
  26. package/dist/{chunk-ETQZ6PRJ.mjs → chunk-Z7VKSY7P.mjs} +3 -3
  27. package/dist/client.d.ts +2 -0
  28. package/dist/client.mjs +3 -3
  29. package/dist/comment.mjs +2 -2
  30. package/dist/create-document.mjs +2 -2
  31. package/dist/document-state.mjs +2 -2
  32. package/dist/editorblock-to-hmblock.mjs +2 -2
  33. package/dist/hm-resolver.mjs +2 -2
  34. package/dist/hm-types.d.ts +9 -0
  35. package/dist/hm-types.mjs +1 -1
  36. package/dist/hmblock-to-editorblock.mjs +2 -2
  37. package/dist/index.mjs +16 -16
  38. package/dist/pdf-to-blocks.mjs +3 -3
  39. package/dist/prepare-change.d.ts +6 -0
  40. package/dist/prepare-change.mjs +4 -4
  41. package/dist/resource-read.mjs +5 -5
  42. package/dist/schema-engine.mjs +2 -2
  43. package/dist/schema-registry.generated.mjs +1 -1
  44. package/dist/schema-resolve.mjs +4 -4
  45. package/dist/schema-subtypes.mjs +4 -4
  46. package/dist/schema-types.generated.d.ts +2 -0
  47. package/dist/signed-blob.mjs +2 -2
  48. package/dist/tei-to-blocks.mjs +2 -2
  49. package/dist/unicode.mjs +1 -1
  50. package/package.json +1 -1
package/dist/apps.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  documentUpdateBlobs
3
- } from "./chunk-IRP2ZGH3.mjs";
3
+ } from "./chunk-6QBB3P3Q.mjs";
4
4
  import "./chunk-CBELM7KX.mjs";
5
- import "./chunk-O5MHN2EO.mjs";
5
+ import "./chunk-KM2NR4YA.mjs";
6
6
  import "./chunk-PJ2RFT5A.mjs";
7
7
  import {
8
8
  resolveEditableDocument
9
- } from "./chunk-QLR4OWHG.mjs";
9
+ } from "./chunk-QS6PIRUE.mjs";
10
10
  import {
11
11
  computeReplaceOps,
12
12
  createBlocksMap,
@@ -19,7 +19,7 @@ import {
19
19
  hmIdPathToEntityQueryPath,
20
20
  packHmId,
21
21
  unpackHmId
22
- } from "./chunk-QU6XHE3U.mjs";
22
+ } from "./chunk-DGNAMVGH.mjs";
23
23
  import "./chunk-AHQWDCHV.mjs";
24
24
  import "./chunk-7P6ASYW6.mjs";
25
25
 
@@ -4,15 +4,15 @@ import {
4
4
  documentContainsLinkToChild,
5
5
  documentHasSelfQuery,
6
6
  shouldAutoLinkParent
7
- } from "./chunk-D3PRDISB.mjs";
8
- import "./chunk-IRP2ZGH3.mjs";
7
+ } from "./chunk-325UCLMT.mjs";
8
+ import "./chunk-6QBB3P3Q.mjs";
9
9
  import "./chunk-CBELM7KX.mjs";
10
- import "./chunk-O5MHN2EO.mjs";
10
+ import "./chunk-KM2NR4YA.mjs";
11
11
  import "./chunk-PJ2RFT5A.mjs";
12
- import "./chunk-QLR4OWHG.mjs";
12
+ import "./chunk-QS6PIRUE.mjs";
13
13
  import "./chunk-LVAHHQIK.mjs";
14
14
  import "./chunk-DR3HJ6BV.mjs";
15
- import "./chunk-QU6XHE3U.mjs";
15
+ import "./chunk-DGNAMVGH.mjs";
16
16
  import "./chunk-AHQWDCHV.mjs";
17
17
  import "./chunk-7P6ASYW6.mjs";
18
18
  export {
@@ -68,13 +68,23 @@ export declare function matchBlockIds(oldNodes: APIBlockNode[], newNodes: BlockN
68
68
  */
69
69
  export declare function rebindTableIdentities(oldNodes: APIBlockNode[], newNodes: BlockNode[]): BlockNode[];
70
70
  /**
71
- * Compare the new block tree against the old blocks map and produce
72
- * the minimal set of DocumentOperations:
71
+ * Compare the new block tree against the old blocks map and produce the
72
+ * DocumentOperations that turn one into the other:
73
73
  *
74
- * - ReplaceBlock for new or content-changed blocks
75
- * - MoveBlocks for positioning (new blocks or position changes)
74
+ * - ReplaceBlock for new or content-changed blocks (an unchanged block gets none)
75
+ * - MoveBlocks for a level whose order changed (an unchanged level gets none)
76
76
  * - DeleteBlocks for blocks removed from the document
77
77
  *
78
+ * The replaces are minimal; the moves are not. A native MoveBlocks carries no
79
+ * anchor: it places its blocks at the start of the parent's children, in the
80
+ * order listed. So a level whose order changed in any way (a block added,
81
+ * removed or moved) is listed whole, the blocks already in place included.
82
+ * An update sent through `PrepareDocumentChange` (documentUpdateBlobs)
83
+ * drops the moves that change nothing, so the stored Change is minimal there;
84
+ * a Change built from these ops directly (createChangeOps) stores them all.
85
+ * Skipping unchanged blocks here still matters on the daemon path: it writes
86
+ * a block with a whole-number attribute again even when it is equal.
87
+ *
78
88
  * The delete pass is global: every old block whose id does not appear
79
89
  * anywhere in the new tree is deleted, including descendants of deleted
80
90
  * blocks (so removing a table row also removes its cells, leaving no
@@ -7,9 +7,9 @@ import {
7
7
  emitFrontmatter,
8
8
  parseDraftFilename,
9
9
  slugify
10
- } from "./chunk-NWOYBZWP.mjs";
11
- import "./chunk-4JFL3SUQ.mjs";
12
- import "./chunk-QU6XHE3U.mjs";
10
+ } from "./chunk-Y4PWAEJ5.mjs";
11
+ import "./chunk-Q7CWMEBZ.mjs";
12
+ import "./chunk-DGNAMVGH.mjs";
13
13
  import "./chunk-AHQWDCHV.mjs";
14
14
  import "./chunk-7P6ASYW6.mjs";
15
15
  export {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createCapability,
3
3
  resolveCapability
4
- } from "./chunk-RPBGROOJ.mjs";
4
+ } from "./chunk-LDCWJXIP.mjs";
5
5
  import "./chunk-LVAHHQIK.mjs";
6
6
  import "./chunk-GBSWXJGU.mjs";
7
7
  import "./chunk-3TPCJCVO.mjs";
8
8
  import "./chunk-DR3HJ6BV.mjs";
9
- import "./chunk-QU6XHE3U.mjs";
9
+ import "./chunk-DGNAMVGH.mjs";
10
10
  import "./chunk-AHQWDCHV.mjs";
11
11
  import "./chunk-7P6ASYW6.mjs";
12
12
  export {
package/dist/change.d.ts CHANGED
@@ -38,6 +38,8 @@ export type CreateChangeOpsInput = {
38
38
  depth?: number;
39
39
  /** Timestamp (defaults to Date.now()) */
40
40
  ts?: bigint;
41
+ /** Optional human-readable description of the change, like a commit message. */
42
+ message?: string;
41
43
  };
42
44
  /**
43
45
  * Build unsigned change CBOR bytes from native ops.
package/dist/change.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  signDocumentChange,
9
9
  signPreparedChange,
10
10
  visibilityToCbor
11
- } from "./chunk-O5MHN2EO.mjs";
11
+ } from "./chunk-KM2NR4YA.mjs";
12
12
  import "./chunk-PJ2RFT5A.mjs";
13
13
  import "./chunk-LVAHHQIK.mjs";
14
14
  import "./chunk-DR3HJ6BV.mjs";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  documentUpdateBlobs
3
- } from "./chunk-IRP2ZGH3.mjs";
3
+ } from "./chunk-6QBB3P3Q.mjs";
4
4
  import {
5
5
  resolveDocumentState
6
- } from "./chunk-QLR4OWHG.mjs";
6
+ } from "./chunk-QS6PIRUE.mjs";
7
7
  import {
8
8
  entityQueryPathToHmIdPath,
9
9
  packHmId,
10
10
  unpackHmId
11
- } from "./chunk-QU6XHE3U.mjs";
11
+ } from "./chunk-DGNAMVGH.mjs";
12
12
 
13
13
  // src/auto-link.ts
14
14
  function documentContainsLinkToChild(document, childId) {
@@ -6,13 +6,13 @@ import {
6
6
  createChangeOps,
7
7
  signDocumentChange,
8
8
  visibilityToCbor
9
- } from "./chunk-O5MHN2EO.mjs";
9
+ } from "./chunk-KM2NR4YA.mjs";
10
10
  import {
11
11
  createVersionRef
12
12
  } from "./chunk-PJ2RFT5A.mjs";
13
13
  import {
14
14
  sameDocumentVersion
15
- } from "./chunk-QLR4OWHG.mjs";
15
+ } from "./chunk-QS6PIRUE.mjs";
16
16
 
17
17
  // src/prepare-change.ts
18
18
  import { decode as cborDecode } from "@ipld/dag-cbor";
@@ -364,7 +364,8 @@ async function prepareDocumentUpdateBlobs(input) {
364
364
  baseVersion: input.baseVersion,
365
365
  changes,
366
366
  capability: input.capability,
367
- visibility: input.visibility
367
+ visibility: input.visibility,
368
+ message: input.message
368
369
  },
369
370
  { signal: input.signal }
370
371
  );
@@ -417,7 +418,8 @@ async function clientBuiltDocumentUpdateBlobs(input) {
417
418
  genesisCid: CID.parse(input.state.genesis),
418
419
  deps: input.state.heads.map((head) => CID.parse(head)),
419
420
  depth,
420
- ts: BigInt(headTs !== void 0 && Number.isFinite(headTs) && headTs >= now ? headTs + 1 : now)
421
+ ts: BigInt(headTs !== void 0 && Number.isFinite(headTs) && headTs >= now ? headTs + 1 : now),
422
+ message: input.message
421
423
  });
422
424
  const change = await createChange(unsignedBytes, input.signer);
423
425
  const generation = keptGeneration(input.currentGeneration, Number(ts));
@@ -463,7 +465,8 @@ async function documentUpdateBlobs(input) {
463
465
  capability: input.capability,
464
466
  currentGeneration: input.currentGeneration,
465
467
  visibility: input.visibility,
466
- now: input.now
468
+ now: input.now,
469
+ message: input.message
467
470
  });
468
471
  return { ...built, builtBy: "local", localReason };
469
472
  };
@@ -499,7 +502,8 @@ async function documentUpdateBlobs(input) {
499
502
  baseVersion: state.version,
500
503
  changes,
501
504
  capability: input.capability,
502
- visibility: input.visibility
505
+ visibility: input.visibility,
506
+ message: input.message
503
507
  },
504
508
  { signal: abort.signal }
505
509
  );
@@ -1258,7 +1258,8 @@ var HMRawDocumentChangeSchema = z.object({
1258
1258
  id: z.string().optional(),
1259
1259
  author: z.string().optional(),
1260
1260
  deps: z.array(z.string()).optional(),
1261
- createTime: z.string().optional()
1261
+ createTime: z.string().optional(),
1262
+ message: z.string().optional()
1262
1263
  });
1263
1264
  var HMListChangesOutputSchema = z.object({
1264
1265
  changes: z.array(HMRawDocumentChangeSchema),
@@ -1460,7 +1461,9 @@ var HMPrepareDocumentChangeInputSchema = z.object({
1460
1461
  baseVersion: z.string().optional(),
1461
1462
  changes: z.array(ProtoDocumentChangeSchema),
1462
1463
  capability: z.string().optional(),
1463
- visibility: z.number().int().optional()
1464
+ visibility: z.number().int().optional(),
1465
+ /** Optional human-readable description of the change, like a commit message. */
1466
+ message: z.string().optional()
1464
1467
  });
1465
1468
  var HMPrepareDocumentChangeOutputSchema = z.object({
1466
1469
  unsignedChange: z.custom((val) => ArrayBuffer.isView(val) && "byteLength" in val, {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getSupportedHMQueryFilters,
3
3
  isSurrogate
4
- } from "./chunk-QU6XHE3U.mjs";
4
+ } from "./chunk-DGNAMVGH.mjs";
5
5
 
6
6
  // src/hmblock-to-editorblock.ts
7
7
  function toEditorBlockType(hmBlockType) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  codePointLength
3
- } from "./chunk-QU6XHE3U.mjs";
3
+ } from "./chunk-DGNAMVGH.mjs";
4
4
 
5
5
  // src/tei-to-blocks.ts
6
6
  function generateBlockId() {
@@ -7,7 +7,7 @@ import {
7
7
  createDocumentChange,
8
8
  createHomeGenesisChange,
9
9
  signDocumentChange
10
- } from "./chunk-O5MHN2EO.mjs";
10
+ } from "./chunk-KM2NR4YA.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-QU6XHE3U.mjs";
18
+ } from "./chunk-DGNAMVGH.mjs";
19
19
 
20
20
  // src/client.ts
21
21
  import { encode as cborEncode } from "@ipld/dag-cbor";
@@ -292,7 +292,8 @@ function createSeedClient(baseUrl, options) {
292
292
  baseVersion: input.baseVersion,
293
293
  changes: input.changes,
294
294
  capability: input.capability,
295
- visibility: input.visibility
295
+ visibility: input.visibility,
296
+ message: input.message
296
297
  };
297
298
  const { unsignedChange } = await request("PrepareDocumentChange", prepareInput);
298
299
  const { publishInput, changeCid, genesis, generation } = await signDocumentChange(
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  hmIdPathToEntityQueryPath,
11
11
  packHmId
12
- } from "./chunk-QU6XHE3U.mjs";
12
+ } from "./chunk-DGNAMVGH.mjs";
13
13
 
14
14
  // src/comment.ts
15
15
  import { decode as cborDecode, encode as cborEncode } from "@ipld/dag-cbor";
@@ -7,7 +7,7 @@ import {
7
7
  codePointLength,
8
8
  parseHMQueryFiltersJSON,
9
9
  toNumber
10
- } from "./chunk-QU6XHE3U.mjs";
10
+ } from "./chunk-DGNAMVGH.mjs";
11
11
 
12
12
  // src/editorblock-to-hmblock.ts
13
13
  function toHMBlockType(editorBlockType) {
@@ -10,17 +10,17 @@ import {
10
10
  schemaForCid,
11
11
  structFields,
12
12
  validate
13
- } from "./chunk-JRJ6U6B2.mjs";
13
+ } from "./chunk-NEUDKUBC.mjs";
14
14
  import {
15
15
  HM_SCHEMAS
16
- } from "./chunk-QRSUQQTZ.mjs";
16
+ } from "./chunk-T7SWLR32.mjs";
17
17
  import {
18
18
  parseCidString
19
19
  } from "./chunk-VWSAFDOL.mjs";
20
20
  import {
21
21
  packHmId,
22
22
  unpackHmId
23
- } from "./chunk-QU6XHE3U.mjs";
23
+ } from "./chunk-DGNAMVGH.mjs";
24
24
 
25
25
  // src/schema-resolve.ts
26
26
  var DAG_CBOR_CODE = 113;
@@ -29,6 +29,7 @@ function createChangeOps(input) {
29
29
  unsigned.deps = input.deps ?? [];
30
30
  unsigned.depth = input.depth ?? 1;
31
31
  }
32
+ if (input.message) unsigned.message = input.message;
32
33
  return { unsignedBytes: cborEncode(unsigned), ts };
33
34
  }
34
35
  async function createChange(unsignedBytes, signer) {
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  entityQueryPathToHmIdPath,
9
9
  packBaseId
10
- } from "./chunk-QU6XHE3U.mjs";
10
+ } from "./chunk-DGNAMVGH.mjs";
11
11
 
12
12
  // src/capability.ts
13
13
  import { base58btc } from "multiformats/bases/base58";
@@ -2,7 +2,7 @@ import {
2
2
  HM_SCHEMAS,
3
3
  HM_SCHEMA_MANIFEST,
4
4
  HM_SCHEMA_PAGES
5
- } from "./chunk-QRSUQQTZ.mjs";
5
+ } from "./chunk-T7SWLR32.mjs";
6
6
 
7
7
  // src/schema-engine.ts
8
8
  var LIBRARY_AUTHORITY = "hyper.media";
@@ -2,7 +2,7 @@ import {
2
2
  entityQueryPathToHmIdPath,
3
3
  parseFragment,
4
4
  unpackHmId
5
- } from "./chunk-QU6XHE3U.mjs";
5
+ } from "./chunk-DGNAMVGH.mjs";
6
6
  import {
7
7
  pageParamsFromUrl
8
8
  } from "./chunk-AHQWDCHV.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  packHmId,
3
3
  unpackHmId
4
- } from "./chunk-QU6XHE3U.mjs";
4
+ } from "./chunk-DGNAMVGH.mjs";
5
5
 
6
6
  // src/document-state.ts
7
7
  async function resolveDocumentState(client, targetId) {