@seed-hypermedia/client 0.0.82 → 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.
- package/dist/auto-link.d.ts +3 -4
- package/dist/auto-link.mjs +3 -3
- package/dist/blocks-to-markdown.mjs +2 -2
- package/dist/capability.mjs +2 -2
- package/dist/{chunk-MZENVC36.mjs → chunk-2GOQZ3DV.mjs} +1 -1
- package/dist/{chunk-D2LTD2KZ.mjs → chunk-4VD46ULS.mjs} +1 -1
- package/dist/{chunk-C42YWLL2.mjs → chunk-CRMBYTZY.mjs} +1 -1
- package/dist/{chunk-2OMSCQ56.mjs → chunk-E4PGX55A.mjs} +1 -1
- package/dist/{chunk-TET43O3D.mjs → chunk-E6YSFT63.mjs} +8 -7
- package/dist/{chunk-IREIRKVP.mjs → chunk-IOXGTLKJ.mjs} +1 -1
- package/dist/{chunk-MZUGCZJ6.mjs → chunk-KMQYEO46.mjs} +38 -11
- package/dist/{chunk-LCKCG574.mjs → chunk-NVWWEHIS.mjs} +1 -1
- package/dist/{chunk-RCVLNXG6.mjs → chunk-QBYF2PVS.mjs} +1 -1
- package/dist/{chunk-55OXHA27.mjs → chunk-SIYJHDMJ.mjs} +4 -2
- package/dist/{chunk-WGOIXGRU.mjs → chunk-TUSTJXWH.mjs} +3 -3
- package/dist/{chunk-BO2QSSIU.mjs → chunk-V2UNLCDS.mjs} +1 -1
- package/dist/{chunk-AIQJ6BI3.mjs → chunk-WJRXPYFE.mjs} +1 -1
- package/dist/client.mjs +2 -2
- package/dist/comment.mjs +2 -2
- package/dist/document-state.mjs +2 -2
- package/dist/editorblock-to-hmblock.mjs +2 -2
- package/dist/hm-resolver.mjs +2 -2
- package/dist/hm-types.d.ts +216 -114
- package/dist/hm-types.mjs +5 -1
- package/dist/hmblock-to-editorblock.mjs +2 -2
- package/dist/index.mjs +13 -13
- package/dist/pdf-to-blocks.mjs +3 -3
- package/dist/resource-read.mjs +4 -4
- package/dist/tei-to-blocks.mjs +2 -2
- package/dist/unicode.mjs +1 -1
- package/package.json +1 -1
package/dist/auto-link.d.ts
CHANGED
|
@@ -22,10 +22,9 @@ export declare function documentContainsLinkToChild(document: HMDocument, childI
|
|
|
22
22
|
* Check if a document has a self-referential Query block
|
|
23
23
|
* (a query to itself that would automatically include children).
|
|
24
24
|
*
|
|
25
|
-
* A query block is self-referential when
|
|
26
|
-
*
|
|
27
|
-
* the
|
|
28
|
-
* represents an unconfigured query block, which the editor renders empty.
|
|
25
|
+
* A query block is self-referential when its target is implicit/empty or one
|
|
26
|
+
* of its `query.includes` entries targets the document. New Collections use
|
|
27
|
+
* the implicit empty target until it is resolved against their published ID.
|
|
29
28
|
*/
|
|
30
29
|
export declare function documentHasSelfQuery(document: HMDocument, documentId: UnpackedHypermediaId): boolean;
|
|
31
30
|
/**
|
package/dist/auto-link.mjs
CHANGED
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
documentContainsLinkToChild,
|
|
5
5
|
documentHasSelfQuery,
|
|
6
6
|
shouldAutoLinkParent
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SIYJHDMJ.mjs";
|
|
8
8
|
import "./chunk-JT57MV7Y.mjs";
|
|
9
9
|
import "./chunk-PJ2RFT5A.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-CRMBYTZY.mjs";
|
|
11
11
|
import "./chunk-LVAHHQIK.mjs";
|
|
12
12
|
import "./chunk-DR3HJ6BV.mjs";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-KMQYEO46.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-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-E6YSFT63.mjs";
|
|
11
|
+
import "./chunk-KMQYEO46.mjs";
|
|
12
12
|
import "./chunk-7P6ASYW6.mjs";
|
|
13
13
|
export {
|
|
14
14
|
blocksToMarkdown,
|
package/dist/capability.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCapability,
|
|
3
3
|
resolveCapability
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-V2UNLCDS.mjs";
|
|
5
5
|
import "./chunk-LVAHHQIK.mjs";
|
|
6
6
|
import "./chunk-NBCHK76Q.mjs";
|
|
7
7
|
import "./chunk-DR3HJ6BV.mjs";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-KMQYEO46.mjs";
|
|
9
9
|
import "./chunk-3TPCJCVO.mjs";
|
|
10
10
|
import "./chunk-7P6ASYW6.mjs";
|
|
11
11
|
export {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
normalizeQuerySort,
|
|
2
3
|
unpackHmId
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KMQYEO46.mjs";
|
|
4
5
|
|
|
5
6
|
// src/blocks-to-markdown.ts
|
|
6
7
|
import { stringify as stringifyYaml } from "yaml";
|
|
@@ -589,7 +590,7 @@ async function resolveBlockEmbed(block, depth, ctx) {
|
|
|
589
590
|
}
|
|
590
591
|
}
|
|
591
592
|
async function resolveQuery(block, depth, ctx) {
|
|
592
|
-
var _a
|
|
593
|
+
var _a;
|
|
593
594
|
const ind = resolvedIndent(depth);
|
|
594
595
|
try {
|
|
595
596
|
const attrs = block.attributes;
|
|
@@ -603,7 +604,7 @@ async function resolveQuery(block, depth, ctx) {
|
|
|
603
604
|
path: inc.path,
|
|
604
605
|
mode: inc.mode || "Children"
|
|
605
606
|
}));
|
|
606
|
-
sort = (
|
|
607
|
+
sort = normalizeQuerySort(queryConfig.sort);
|
|
607
608
|
limit = queryConfig.limit;
|
|
608
609
|
} else {
|
|
609
610
|
const space = (attrs == null ? void 0 : attrs.space) || "";
|
|
@@ -619,13 +620,13 @@ async function resolveQuery(block, depth, ctx) {
|
|
|
619
620
|
}
|
|
620
621
|
const results = await ctx.client.request("Query", {
|
|
621
622
|
includes,
|
|
622
|
-
sort: sort
|
|
623
|
+
sort: (sort == null ? void 0 : sort.length) ? sort : [{ term: "updated", reverse: true }],
|
|
623
624
|
limit: limit || 10
|
|
624
625
|
});
|
|
625
|
-
if (!((
|
|
626
|
+
if (!((_a = results == null ? void 0 : results.results) == null ? void 0 : _a.length)) return ind + "<!-- Query: no results -->";
|
|
626
627
|
return results.results.map((doc) => {
|
|
627
|
-
var _a2,
|
|
628
|
-
const name = ((_a2 = doc.metadata) == null ? void 0 : _a2.name) || ((
|
|
628
|
+
var _a2, _b;
|
|
629
|
+
const name = ((_a2 = doc.metadata) == null ? void 0 : _a2.name) || ((_b = doc.id.path) == null ? void 0 : _b.join("/")) || doc.id.uid;
|
|
629
630
|
return ind + `- [${name}](${doc.id.id})`;
|
|
630
631
|
}).join("\n");
|
|
631
632
|
} catch (error) {
|
|
@@ -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
|
-
|
|
479
|
-
|
|
480
|
-
|
|
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,
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from "./chunk-PJ2RFT5A.mjs";
|
|
8
8
|
import {
|
|
9
9
|
resolveDocumentState
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CRMBYTZY.mjs";
|
|
11
11
|
import {
|
|
12
12
|
entityQueryPathToHmIdPath,
|
|
13
13
|
packHmId,
|
|
14
14
|
unpackHmId
|
|
15
|
-
} from "./chunk-
|
|
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-
|
|
3
|
+
} from "./chunk-4VD46ULS.mjs";
|
|
4
4
|
import {
|
|
5
5
|
createSeedClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QBYF2PVS.mjs";
|
|
7
7
|
import {
|
|
8
8
|
unpackHmId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KMQYEO46.mjs";
|
|
10
10
|
|
|
11
11
|
// src/resource-read.ts
|
|
12
12
|
async function resolveIdWithClient(rawId, options = {}) {
|
package/dist/client.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSeedClient,
|
|
3
3
|
deserializeQueryString
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QBYF2PVS.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-
|
|
10
|
+
import "./chunk-KMQYEO46.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-
|
|
7
|
+
} from "./chunk-IOXGTLKJ.mjs";
|
|
8
8
|
import "./chunk-N3P7S5YZ.mjs";
|
|
9
9
|
import "./chunk-LVAHHQIK.mjs";
|
|
10
10
|
import "./chunk-DR3HJ6BV.mjs";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-KMQYEO46.mjs";
|
|
12
12
|
import "./chunk-7P6ASYW6.mjs";
|
|
13
13
|
export {
|
|
14
14
|
commentRecordIdFromBlob,
|
package/dist/document-state.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
followToDocument,
|
|
5
5
|
resolveDocumentState,
|
|
6
6
|
resolveEditableDocument
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-CRMBYTZY.mjs";
|
|
8
|
+
import "./chunk-KMQYEO46.mjs";
|
|
9
9
|
import "./chunk-7P6ASYW6.mjs";
|
|
10
10
|
export {
|
|
11
11
|
describeRedirect,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
editorBlockToHMBlock,
|
|
3
3
|
editorBlocksToHMBlockNodes
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-E4PGX55A.mjs";
|
|
5
5
|
import "./chunk-N3P7S5YZ.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-KMQYEO46.mjs";
|
|
7
7
|
import "./chunk-7P6ASYW6.mjs";
|
|
8
8
|
export {
|
|
9
9
|
editorBlockToHMBlock,
|
package/dist/hm-resolver.mjs
CHANGED