@seed-hypermedia/client 0.0.101 → 0.0.103
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.mjs +3 -3
- package/dist/blocks-to-markdown.mjs +2 -2
- package/dist/capability.mjs +2 -2
- package/dist/{chunk-KUCHTHLG.mjs → chunk-4MZHSZFQ.mjs} +7 -5
- package/dist/{chunk-QRXNROVO.mjs → chunk-DQR4RPYC.mjs} +5 -1
- package/dist/{chunk-GCBKFXKL.mjs → chunk-EZ5DM5TI.mjs} +1 -1
- package/dist/{chunk-PO3UBPBJ.mjs → chunk-G6AYTCLG.mjs} +1 -1
- package/dist/{chunk-7DXNZGR5.mjs → chunk-GIKXPGFZ.mjs} +1 -1
- package/dist/{chunk-OAIUNL5V.mjs → chunk-KDI4WJKM.mjs} +1 -1
- package/dist/{chunk-5ECP2AA6.mjs → chunk-MHICVQJI.mjs} +3 -3
- package/dist/{chunk-GJ3L3MYM.mjs → chunk-NSNLRZ3X.mjs} +1 -1
- package/dist/{chunk-TQLNIME2.mjs → chunk-P2FJTNNQ.mjs} +2 -2
- package/dist/{chunk-AVFMKA27.mjs → chunk-R6OYID6M.mjs} +3 -2
- package/dist/{chunk-VPEN5FUU.mjs → chunk-S4XBFD3S.mjs} +1 -1
- package/dist/{chunk-RBX7IGCN.mjs → chunk-SKIKB2TP.mjs} +29 -1
- package/dist/{chunk-YLWLQUUZ.mjs → chunk-UPYQNWW5.mjs} +4 -1
- package/dist/{chunk-TJFFZMRI.mjs → chunk-V5XCZMPG.mjs} +1 -1
- package/dist/client.mjs +2 -2
- package/dist/comment.mjs +2 -2
- package/dist/document-state.d.ts +2 -0
- package/dist/document-state.mjs +2 -2
- package/dist/editor-types.d.ts +1 -0
- package/dist/editorblock-to-hmblock.mjs +2 -2
- package/dist/hm-resolver.mjs +2 -2
- package/dist/hm-types.d.ts +293 -0
- package/dist/hm-types.mjs +7 -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/schema-resolve.mjs +2 -2
- package/dist/schema-subtypes.mjs +2 -2
- package/dist/tei-to-blocks.mjs +2 -2
- package/dist/unicode.mjs +1 -1
- package/package.json +1 -1
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-P2FJTNNQ.mjs";
|
|
8
8
|
import "./chunk-O5MHN2EO.mjs";
|
|
9
9
|
import "./chunk-PJ2RFT5A.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-R6OYID6M.mjs";
|
|
11
11
|
import "./chunk-LVAHHQIK.mjs";
|
|
12
12
|
import "./chunk-DR3HJ6BV.mjs";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-SKIKB2TP.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-UPYQNWW5.mjs";
|
|
11
|
+
import "./chunk-SKIKB2TP.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-KDI4WJKM.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-SKIKB2TP.mjs";
|
|
9
9
|
import "./chunk-3TPCJCVO.mjs";
|
|
10
10
|
import "./chunk-7P6ASYW6.mjs";
|
|
11
11
|
export {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
getSupportedHMQueryFilters,
|
|
2
3
|
isSurrogate
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SKIKB2TP.mjs";
|
|
4
5
|
|
|
5
6
|
// src/hmblock-to-editorblock.ts
|
|
6
7
|
function toEditorBlockType(hmBlockType) {
|
|
@@ -67,7 +68,7 @@ function hmBlocksToEditorContent(blocks, opts = { level: 1 }) {
|
|
|
67
68
|
}).filter((block) => block !== null);
|
|
68
69
|
}
|
|
69
70
|
function hmBlockToEditorBlock(block) {
|
|
70
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
71
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
71
72
|
const blockType = toEditorBlockType(block.type);
|
|
72
73
|
if (blockType === "unknown") {
|
|
73
74
|
return {
|
|
@@ -162,9 +163,10 @@ function hmBlockToEditorBlock(block) {
|
|
|
162
163
|
queryProps.columnCount = String(((_f = block.attributes) == null ? void 0 : _f.columnCount) || "");
|
|
163
164
|
queryProps.queryIncludes = JSON.stringify(((_h = (_g = block.attributes) == null ? void 0 : _g.query) == null ? void 0 : _h.includes) || []);
|
|
164
165
|
queryProps.querySort = JSON.stringify(((_j = (_i = block.attributes) == null ? void 0 : _i.query) == null ? void 0 : _j.sort) || {});
|
|
165
|
-
queryProps.
|
|
166
|
-
queryProps.
|
|
167
|
-
|
|
166
|
+
queryProps.queryFilters = JSON.stringify(getSupportedHMQueryFilters((_l = (_k = block.attributes) == null ? void 0 : _k.query) == null ? void 0 : _l.filters));
|
|
167
|
+
queryProps.banner = ((_m = block.attributes) == null ? void 0 : _m.banner) ? "true" : "false";
|
|
168
|
+
queryProps.queryLimit = String(((_o = (_n = block.attributes) == null ? void 0 : _n.query) == null ? void 0 : _o.limit) || "");
|
|
169
|
+
if ((_p = block.attributes) == null ? void 0 : _p.table) queryProps.tableConfig = JSON.stringify(block.attributes.table);
|
|
168
170
|
}
|
|
169
171
|
const blockText = block.text || "";
|
|
170
172
|
const leaves = out.content;
|
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
HMBlockButtonAlignmentSchema,
|
|
6
6
|
HMBlockSchema,
|
|
7
7
|
codePointLength,
|
|
8
|
+
parseHMQueryFiltersJSON,
|
|
8
9
|
toNumber
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SKIKB2TP.mjs";
|
|
10
11
|
|
|
11
12
|
// src/editorblock-to-hmblock.ts
|
|
12
13
|
function toHMBlockType(editorBlockType) {
|
|
@@ -248,6 +249,9 @@ function editorBlockToHMBlock(editorBlock) {
|
|
|
248
249
|
};
|
|
249
250
|
if (editorBlock.props.queryIncludes) query.includes = JSON.parse(editorBlock.props.queryIncludes);
|
|
250
251
|
if (editorBlock.props.querySort) query.sort = JSON.parse(editorBlock.props.querySort);
|
|
252
|
+
if (editorBlock.props.queryFilters) {
|
|
253
|
+
query.filters = parseHMQueryFiltersJSON(editorBlock.props.queryFilters);
|
|
254
|
+
}
|
|
251
255
|
if (editorBlock.props.queryLimit) query.limit = Number(editorBlock.props.queryLimit);
|
|
252
256
|
blockQuery.attributes.query = query;
|
|
253
257
|
blockQuery.attributes.banner = editorBlock.props.banner == "true";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-V5XCZMPG.mjs";
|
|
4
4
|
import {
|
|
5
5
|
createSeedClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-G6AYTCLG.mjs";
|
|
7
7
|
import {
|
|
8
8
|
unpackHmId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SKIKB2TP.mjs";
|
|
10
10
|
|
|
11
11
|
// src/resource-read.ts
|
|
12
12
|
async function resolveIdWithClient(rawId, options = {}) {
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from "./chunk-PJ2RFT5A.mjs";
|
|
8
8
|
import {
|
|
9
9
|
resolveDocumentState
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-R6OYID6M.mjs";
|
|
11
11
|
import {
|
|
12
12
|
entityQueryPathToHmIdPath,
|
|
13
13
|
packHmId,
|
|
14
14
|
unpackHmId
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SKIKB2TP.mjs";
|
|
16
16
|
|
|
17
17
|
// src/auto-link.ts
|
|
18
18
|
import { CID } from "multiformats/cid";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
packHmId,
|
|
3
3
|
unpackHmId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SKIKB2TP.mjs";
|
|
5
5
|
|
|
6
6
|
// src/document-state.ts
|
|
7
7
|
async function resolveDocumentState(client, targetId) {
|
|
@@ -93,7 +93,8 @@ async function followToDocument(client, id) {
|
|
|
93
93
|
id,
|
|
94
94
|
targetId: followed.targetId,
|
|
95
95
|
document: followed.resource.document,
|
|
96
|
-
redirect: first ? { republish: first.republish, target: first.to } : null
|
|
96
|
+
redirect: first ? { republish: first.republish, target: first.to } : null,
|
|
97
|
+
redirects: followed.redirects
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
async function resolveEditableDocument(client, id) {
|
|
@@ -507,13 +507,38 @@ var HMQuerySortSchema = z.object({
|
|
|
507
507
|
term: z.string().optional(),
|
|
508
508
|
reverse: z.boolean().optional()
|
|
509
509
|
}).transform(normalizeQuerySortEntry);
|
|
510
|
+
var HMQueryFilterSchema = z.discriminatedUnion("type", [
|
|
511
|
+
z.object({
|
|
512
|
+
type: z.literal("Author"),
|
|
513
|
+
uid: z.string()
|
|
514
|
+
})
|
|
515
|
+
]);
|
|
516
|
+
function getSupportedHMQueryFilters(val) {
|
|
517
|
+
if (!Array.isArray(val)) return [];
|
|
518
|
+
return val.filter(
|
|
519
|
+
(filter) => filter !== null && typeof filter === "object" && filter.type === "Author" && typeof filter.uid === "string"
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
function parseHMQueryFiltersJSON(rawFilters) {
|
|
523
|
+
if (!rawFilters) return [];
|
|
524
|
+
try {
|
|
525
|
+
return getSupportedHMQueryFilters(JSON.parse(rawFilters));
|
|
526
|
+
} catch {
|
|
527
|
+
return [];
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
function removeUnsupportedQueryFilters(val) {
|
|
531
|
+
if (val === void 0) return void 0;
|
|
532
|
+
return getSupportedHMQueryFilters(val);
|
|
533
|
+
}
|
|
510
534
|
var HMQuerySchema = z.object({
|
|
511
535
|
includes: z.array(HMQueryInclusionSchema),
|
|
512
536
|
sort: z.array(HMQuerySortSchema).optional(),
|
|
513
537
|
limit: z.preprocess(
|
|
514
538
|
(val) => val === "" || val === null || val === void 0 ? void 0 : val,
|
|
515
539
|
z.coerce.number().optional()
|
|
516
|
-
)
|
|
540
|
+
),
|
|
541
|
+
filters: z.preprocess(removeUnsupportedQueryFilters, z.array(HMQueryFilterSchema).optional())
|
|
517
542
|
});
|
|
518
543
|
var HMBlockTableSchema = z.object({
|
|
519
544
|
type: z.literal("Table"),
|
|
@@ -1740,6 +1765,9 @@ export {
|
|
|
1740
1765
|
normalizeQuerySortEntry,
|
|
1741
1766
|
normalizeQuerySort,
|
|
1742
1767
|
HMQuerySortSchema,
|
|
1768
|
+
HMQueryFilterSchema,
|
|
1769
|
+
getSupportedHMQueryFilters,
|
|
1770
|
+
parseHMQueryFiltersJSON,
|
|
1743
1771
|
HMQuerySchema,
|
|
1744
1772
|
HMBlockTableSchema,
|
|
1745
1773
|
HMBlockTableRowSchema,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeQuerySort,
|
|
3
3
|
unpackHmId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SKIKB2TP.mjs";
|
|
5
5
|
|
|
6
6
|
// src/blocks-to-markdown.ts
|
|
7
7
|
import { stringify as stringifyYaml } from "yaml";
|
|
@@ -618,6 +618,7 @@ async function resolveQuery(block, depth, ctx) {
|
|
|
618
618
|
const queryConfig = attrs == null ? void 0 : attrs.query;
|
|
619
619
|
let includes;
|
|
620
620
|
let sort;
|
|
621
|
+
let filters;
|
|
621
622
|
let limit;
|
|
622
623
|
if (queryConfig == null ? void 0 : queryConfig.includes) {
|
|
623
624
|
if (!((_a = queryConfig.includes[0]) == null ? void 0 : _a.space)) return ind + "<!-- Query: no space specified -->";
|
|
@@ -627,6 +628,7 @@ async function resolveQuery(block, depth, ctx) {
|
|
|
627
628
|
mode: inc.mode || "Children"
|
|
628
629
|
}));
|
|
629
630
|
sort = normalizeQuerySort(queryConfig.sort);
|
|
631
|
+
filters = queryConfig.filters;
|
|
630
632
|
limit = queryConfig.limit;
|
|
631
633
|
} else {
|
|
632
634
|
const space = (attrs == null ? void 0 : attrs.space) || "";
|
|
@@ -643,6 +645,7 @@ async function resolveQuery(block, depth, ctx) {
|
|
|
643
645
|
const results = await ctx.client.request("Query", {
|
|
644
646
|
includes,
|
|
645
647
|
sort: (sort == null ? void 0 : sort.length) ? sort : [{ term: "updated", reverse: true }],
|
|
648
|
+
filters,
|
|
646
649
|
limit: limit || 10
|
|
647
650
|
});
|
|
648
651
|
if (!((_b = results == null ? void 0 : results.results) == null ? void 0 : _b.length)) return ind + "<!-- Query: no results -->";
|
package/dist/client.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSeedClient,
|
|
3
3
|
deserializeQueryString
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-G6AYTCLG.mjs";
|
|
5
5
|
import "./chunk-CBELM7KX.mjs";
|
|
6
6
|
import "./chunk-O5MHN2EO.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-SKIKB2TP.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-EZ5DM5TI.mjs";
|
|
8
8
|
import "./chunk-JKKS35IS.mjs";
|
|
9
9
|
import "./chunk-LVAHHQIK.mjs";
|
|
10
10
|
import "./chunk-DR3HJ6BV.mjs";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-SKIKB2TP.mjs";
|
|
12
12
|
import "./chunk-7P6ASYW6.mjs";
|
|
13
13
|
export {
|
|
14
14
|
commentRecordIdFromBlob,
|
package/dist/document-state.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export type FollowedDocument = {
|
|
|
39
39
|
republish: boolean;
|
|
40
40
|
target: UnpackedHypermediaId;
|
|
41
41
|
} | null;
|
|
42
|
+
/** Every redirect followed from `id` to `targetId`, in order. */
|
|
43
|
+
redirects: RedirectHop[];
|
|
42
44
|
};
|
|
43
45
|
/** The full baseline needed to build a new Change at an address: {@link FollowedDocument} plus DAG state. */
|
|
44
46
|
export type EditableDocumentBase = FollowedDocument & {
|
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-R6OYID6M.mjs";
|
|
8
|
+
import "./chunk-SKIKB2TP.mjs";
|
|
9
9
|
import "./chunk-7P6ASYW6.mjs";
|
|
10
10
|
export {
|
|
11
11
|
describeRedirect,
|
package/dist/editor-types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
editorBlockToHMBlock,
|
|
3
3
|
editorBlocksToHMBlockNodes
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DQR4RPYC.mjs";
|
|
5
5
|
import "./chunk-JKKS35IS.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-SKIKB2TP.mjs";
|
|
7
7
|
import "./chunk-7P6ASYW6.mjs";
|
|
8
8
|
export {
|
|
9
9
|
editorBlockToHMBlock,
|
package/dist/hm-resolver.mjs
CHANGED