@seed-hypermedia/client 0.0.81 → 0.0.83

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.d.ts +3 -4
  2. package/dist/auto-link.mjs +3 -3
  3. package/dist/block-diff.mjs +1 -1
  4. package/dist/blocks-to-markdown.d.ts +16 -11
  5. package/dist/blocks-to-markdown.mjs +2 -2
  6. package/dist/capability.mjs +2 -2
  7. package/dist/{chunk-MZENVC36.mjs → chunk-2GOQZ3DV.mjs} +1 -1
  8. package/dist/{chunk-OZKQOI2X.mjs → chunk-3KLY2B27.mjs} +51 -4
  9. package/dist/{chunk-D2LTD2KZ.mjs → chunk-4VD46ULS.mjs} +1 -1
  10. package/dist/{chunk-C42YWLL2.mjs → chunk-CRMBYTZY.mjs} +1 -1
  11. package/dist/{chunk-2OMSCQ56.mjs → chunk-E4PGX55A.mjs} +1 -1
  12. package/dist/{chunk-YH52VFVR.mjs → chunk-E6YSFT63.mjs} +304 -185
  13. package/dist/{chunk-IREIRKVP.mjs → chunk-IOXGTLKJ.mjs} +1 -1
  14. package/dist/{chunk-MZUGCZJ6.mjs → chunk-KMQYEO46.mjs} +38 -11
  15. package/dist/{chunk-LCKCG574.mjs → chunk-NVWWEHIS.mjs} +1 -1
  16. package/dist/{chunk-RCVLNXG6.mjs → chunk-QBYF2PVS.mjs} +1 -1
  17. package/dist/{chunk-55OXHA27.mjs → chunk-SIYJHDMJ.mjs} +4 -2
  18. package/dist/{chunk-WGOIXGRU.mjs → chunk-TUSTJXWH.mjs} +3 -3
  19. package/dist/{chunk-BO2QSSIU.mjs → chunk-V2UNLCDS.mjs} +1 -1
  20. package/dist/{chunk-AIQJ6BI3.mjs → chunk-WJRXPYFE.mjs} +1 -1
  21. package/dist/chunk-XB6E7EVC.mjs +872 -0
  22. package/dist/client.mjs +2 -2
  23. package/dist/comment.mjs +2 -2
  24. package/dist/document-state.mjs +2 -2
  25. package/dist/editorblock-to-hmblock.mjs +2 -2
  26. package/dist/hm-resolver.mjs +2 -2
  27. package/dist/hm-types.d.ts +216 -114
  28. package/dist/hm-types.mjs +5 -1
  29. package/dist/hmblock-to-editorblock.mjs +2 -2
  30. package/dist/index.mjs +15 -15
  31. package/dist/markdown-to-blocks.d.ts +27 -32
  32. package/dist/markdown-to-blocks.mjs +3 -1
  33. package/dist/pdf-to-blocks.mjs +3 -3
  34. package/dist/resource-read.mjs +4 -4
  35. package/dist/tei-to-blocks.mjs +2 -2
  36. package/dist/unicode.mjs +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-H7L4TI6X.mjs +0 -705
@@ -36,6 +36,9 @@ var HMQueryTableColumnSchema = z.object({
36
36
  });
37
37
  var HMQueryTableConfigSchema = z.object({
38
38
  columns: z.array(HMQueryTableColumnSchema),
39
+ // Legacy `sorting` field from the pre-unification table config. Sort now lives
40
+ // in the query's `sort` field; this is tolerated (and ignored) so old
41
+ // persisted documents still validate without crashing.
39
42
  sorting: z.array(z.object({ id: z.string(), desc: z.boolean() })).optional()
40
43
  });
41
44
  var baseAnnotationProperties = {
@@ -474,17 +477,33 @@ var HMQueryInclusionSchema = z.object({
474
477
  path: z.string().optional(),
475
478
  mode: z.union([z.literal("Children"), z.literal("AllDescendants")])
476
479
  });
480
+ var legacySortTermMap = {
481
+ Title: "title",
482
+ Path: "path",
483
+ CreateTime: "created",
484
+ UpdateTime: "updated",
485
+ DisplayTime: "displayTime",
486
+ ActivityTime: "activity"
487
+ };
488
+ var legacyTimeSortTerms = /* @__PURE__ */ new Set(["CreateTime", "UpdateTime", "DisplayTime", "ActivityTime"]);
489
+ function normalizeQuerySortEntry(entry) {
490
+ const rawTerm = entry.term ?? "updated";
491
+ let reverse = entry.reverse ?? false;
492
+ const mapped = legacySortTermMap[rawTerm];
493
+ if (mapped !== void 0) {
494
+ if (legacyTimeSortTerms.has(rawTerm)) reverse = !reverse;
495
+ return { term: mapped, reverse };
496
+ }
497
+ return { term: rawTerm, reverse };
498
+ }
499
+ function normalizeQuerySort(sort) {
500
+ if (!Array.isArray(sort)) return [];
501
+ return sort.map(normalizeQuerySortEntry);
502
+ }
477
503
  var HMQuerySortSchema = z.object({
478
- reverse: z.boolean().default(false),
479
- term: z.union([
480
- z.literal("Path"),
481
- z.literal("Title"),
482
- z.literal("CreateTime"),
483
- z.literal("UpdateTime"),
484
- z.literal("DisplayTime"),
485
- z.literal("ActivityTime")
486
- ])
487
- });
504
+ term: z.string().optional(),
505
+ reverse: z.boolean().optional()
506
+ }).transform(normalizeQuerySortEntry);
488
507
  var HMQuerySchema = z.object({
489
508
  includes: z.array(HMQueryInclusionSchema),
490
509
  sort: z.array(HMQuerySortSchema).optional(),
@@ -757,7 +776,13 @@ var HMDraftContentSchema = z.object({
757
776
  * Snapshot of the published HMBlockNode[] tree at the time the draft was
758
777
  * started (or last rebased). Acts as the merge base for three-way diff.
759
778
  */
760
- baseBlocks: z.array(z.any()).optional()
779
+ baseBlocks: z.array(z.any()).optional(),
780
+ /**
781
+ * Optional path the user picked for this not-yet-published draft via the
782
+ * rename affordance in the publish popover. Persisted so it survives reloads
783
+ * and is honored at publish time instead of the title-derived slug.
784
+ */
785
+ publishPath: z.array(z.string()).optional()
761
786
  });
762
787
  var HMDraftMetaBaseSchema = z.object({
763
788
  id: z.string(),
@@ -1487,6 +1512,8 @@ export {
1487
1512
  HMSiteMemberSchema,
1488
1513
  HMAccountsMetadataSchema,
1489
1514
  HMQueryInclusionSchema,
1515
+ normalizeQuerySortEntry,
1516
+ normalizeQuerySort,
1490
1517
  HMQuerySortSchema,
1491
1518
  HMQuerySchema,
1492
1519
  HMBlockTableSchema,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  teiToBlocks
3
- } from "./chunk-MZENVC36.mjs";
3
+ } from "./chunk-2GOQZ3DV.mjs";
4
4
  import {
5
5
  embeddedPdfToBlocks
6
6
  } from "./chunk-52P3E6H6.mjs";
@@ -15,7 +15,7 @@ import {
15
15
  HMActionSchema,
16
16
  HMRequestSchema,
17
17
  packHmId
18
- } from "./chunk-MZUGCZJ6.mjs";
18
+ } from "./chunk-KMQYEO46.mjs";
19
19
 
20
20
  // src/client.ts
21
21
  import { encode as cborEncode } from "@ipld/dag-cbor";
@@ -7,12 +7,12 @@ import {
7
7
  } from "./chunk-PJ2RFT5A.mjs";
8
8
  import {
9
9
  resolveDocumentState
10
- } from "./chunk-C42YWLL2.mjs";
10
+ } from "./chunk-CRMBYTZY.mjs";
11
11
  import {
12
12
  entityQueryPathToHmIdPath,
13
13
  packHmId,
14
14
  unpackHmId
15
- } from "./chunk-MZUGCZJ6.mjs";
15
+ } from "./chunk-KMQYEO46.mjs";
16
16
 
17
17
  // src/auto-link.ts
18
18
  import { CID } from "multiformats/cid";
@@ -49,6 +49,7 @@ function documentHasSelfQuery(document, documentId) {
49
49
  const parentPathStr = (documentId.path || []).join("/");
50
50
  function isSelfMatch(include) {
51
51
  if (!include) return false;
52
+ if (!include.space && !include.path) return true;
52
53
  if (include.space !== documentId.uid) return false;
53
54
  const includePath = entityQueryPathToHmIdPath(include.path);
54
55
  return (includePath || []).join("/") === parentPathStr;
@@ -58,6 +59,7 @@ function documentHasSelfQuery(document, documentId) {
58
59
  for (const node of nodes) {
59
60
  if (node.block.type === "Query") {
60
61
  const includes = (_b = (_a = node.block.attributes) == null ? void 0 : _a.query) == null ? void 0 : _b.includes;
62
+ if (!includes || includes.length === 0) return true;
61
63
  if (includes == null ? void 0 : includes.some(isSelfMatch)) return true;
62
64
  }
63
65
  if (node.children && searchBlocks(node.children)) return true;
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  resolveId
3
- } from "./chunk-D2LTD2KZ.mjs";
3
+ } from "./chunk-4VD46ULS.mjs";
4
4
  import {
5
5
  createSeedClient
6
- } from "./chunk-RCVLNXG6.mjs";
6
+ } from "./chunk-QBYF2PVS.mjs";
7
7
  import {
8
8
  unpackHmId
9
- } from "./chunk-MZUGCZJ6.mjs";
9
+ } from "./chunk-KMQYEO46.mjs";
10
10
 
11
11
  // src/resource-read.ts
12
12
  async function resolveIdWithClient(rawId, options = {}) {
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  entityQueryPathToHmIdPath,
9
9
  packBaseId
10
- } from "./chunk-MZUGCZJ6.mjs";
10
+ } from "./chunk-KMQYEO46.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-MZUGCZJ6.mjs";
3
+ } from "./chunk-KMQYEO46.mjs";
4
4
 
5
5
  // src/hmblock-to-editorblock.ts
6
6
  function toEditorBlockType(hmBlockType) {