@seed-hypermedia/client 0.0.91 → 0.0.92

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 (35) 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-5H44WPFO.mjs → chunk-7RJYOV4D.mjs} +1 -1
  5. package/dist/{chunk-P5R4E4AU.mjs → chunk-BRMAKS6Z.mjs} +1 -1
  6. package/dist/{chunk-LZOORGGJ.mjs → chunk-EB45YSE7.mjs} +1 -1
  7. package/dist/{chunk-5ZHBEPRC.mjs → chunk-HEATDM6O.mjs} +1 -1
  8. package/dist/{chunk-GOKN5MFV.mjs → chunk-IB26JMU5.mjs} +1 -1
  9. package/dist/{chunk-6FBJVBS6.mjs → chunk-IJOMB2VD.mjs} +3 -3
  10. package/dist/{chunk-EBGUVS7T.mjs → chunk-IO44LDKK.mjs} +2 -2
  11. package/dist/{chunk-UQL3R7WC.mjs → chunk-J6LPZ3QP.mjs} +1 -1
  12. package/dist/{chunk-HMTFZNX7.mjs → chunk-J6N6AF3R.mjs} +1 -1
  13. package/dist/{chunk-OIL62HNH.mjs → chunk-JOFKLKIC.mjs} +1 -1
  14. package/dist/{chunk-RPXAWYOC.mjs → chunk-M6GKXROC.mjs} +2 -2
  15. package/dist/{chunk-2X45222K.mjs → chunk-MK35Y35R.mjs} +145 -1
  16. package/dist/{chunk-TZMLZHCZ.mjs → chunk-RWKSRJA3.mjs} +1 -1
  17. package/dist/{chunk-IS7QPOMQ.mjs → chunk-WY7T2TES.mjs} +1 -1
  18. package/dist/client.mjs +2 -2
  19. package/dist/comment.mjs +2 -2
  20. package/dist/document-state.mjs +2 -2
  21. package/dist/editorblock-to-hmblock.mjs +2 -2
  22. package/dist/explore-query.d.ts +112 -0
  23. package/dist/explore-query.mjs +455 -0
  24. package/dist/hm-resolver.mjs +2 -2
  25. package/dist/hm-types.d.ts +2412 -0
  26. package/dist/hm-types.mjs +33 -1
  27. package/dist/hmblock-to-editorblock.mjs +2 -2
  28. package/dist/index.mjs +13 -13
  29. package/dist/pdf-to-blocks.mjs +3 -3
  30. package/dist/resource-read.mjs +4 -4
  31. package/dist/schema-resolve.mjs +2 -2
  32. package/dist/schema-subtypes.mjs +2 -2
  33. package/dist/tei-to-blocks.mjs +2 -2
  34. package/dist/unicode.mjs +1 -1
  35. package/package.json +1 -1
@@ -4,13 +4,13 @@ import {
4
4
  documentContainsLinkToChild,
5
5
  documentHasSelfQuery,
6
6
  shouldAutoLinkParent
7
- } from "./chunk-EBGUVS7T.mjs";
7
+ } from "./chunk-IO44LDKK.mjs";
8
8
  import "./chunk-O5MHN2EO.mjs";
9
9
  import "./chunk-PJ2RFT5A.mjs";
10
- import "./chunk-OIL62HNH.mjs";
10
+ import "./chunk-JOFKLKIC.mjs";
11
11
  import "./chunk-LVAHHQIK.mjs";
12
12
  import "./chunk-DR3HJ6BV.mjs";
13
- import "./chunk-2X45222K.mjs";
13
+ import "./chunk-MK35Y35R.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-IS7QPOMQ.mjs";
11
- import "./chunk-2X45222K.mjs";
10
+ } from "./chunk-WY7T2TES.mjs";
11
+ import "./chunk-MK35Y35R.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-HMTFZNX7.mjs";
4
+ } from "./chunk-J6N6AF3R.mjs";
5
5
  import "./chunk-LVAHHQIK.mjs";
6
6
  import "./chunk-NBCHK76Q.mjs";
7
7
  import "./chunk-DR3HJ6BV.mjs";
8
- import "./chunk-2X45222K.mjs";
8
+ import "./chunk-MK35Y35R.mjs";
9
9
  import "./chunk-3TPCJCVO.mjs";
10
10
  import "./chunk-7P6ASYW6.mjs";
11
11
  export {
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  hmIdPathToEntityQueryPath,
11
11
  packHmId
12
- } from "./chunk-2X45222K.mjs";
12
+ } from "./chunk-MK35Y35R.mjs";
13
13
 
14
14
  // src/comment.ts
15
15
  import { decode as cborDecode, encode as cborEncode } from "@ipld/dag-cbor";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  teiToBlocks
3
- } from "./chunk-GOKN5MFV.mjs";
3
+ } from "./chunk-IB26JMU5.mjs";
4
4
  import {
5
5
  embeddedPdfToBlocks
6
6
  } from "./chunk-2FJBS3V7.mjs";
@@ -6,7 +6,7 @@ import {
6
6
  HMBlockSchema,
7
7
  codePointLength,
8
8
  toNumber
9
- } from "./chunk-2X45222K.mjs";
9
+ } from "./chunk-MK35Y35R.mjs";
10
10
 
11
11
  // src/editorblock-to-hmblock.ts
12
12
  function toHMBlockType(editorBlockType) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSurrogate
3
- } from "./chunk-2X45222K.mjs";
3
+ } from "./chunk-MK35Y35R.mjs";
4
4
 
5
5
  // src/hmblock-to-editorblock.ts
6
6
  function toEditorBlockType(hmBlockType) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  codePointLength
3
- } from "./chunk-2X45222K.mjs";
3
+ } from "./chunk-MK35Y35R.mjs";
4
4
 
5
5
  // src/tei-to-blocks.ts
6
6
  function generateBlockId() {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  resolveId
3
- } from "./chunk-UQL3R7WC.mjs";
3
+ } from "./chunk-J6LPZ3QP.mjs";
4
4
  import {
5
5
  createSeedClient
6
- } from "./chunk-RPXAWYOC.mjs";
6
+ } from "./chunk-M6GKXROC.mjs";
7
7
  import {
8
8
  unpackHmId
9
- } from "./chunk-2X45222K.mjs";
9
+ } from "./chunk-MK35Y35R.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-OIL62HNH.mjs";
10
+ } from "./chunk-JOFKLKIC.mjs";
11
11
  import {
12
12
  entityQueryPathToHmIdPath,
13
13
  packHmId,
14
14
  unpackHmId
15
- } from "./chunk-2X45222K.mjs";
15
+ } from "./chunk-MK35Y35R.mjs";
16
16
 
17
17
  // src/auto-link.ts
18
18
  import { CID } from "multiformats/cid";
@@ -2,7 +2,7 @@ import {
2
2
  entityQueryPathToHmIdPath,
3
3
  parseFragment,
4
4
  unpackHmId
5
- } from "./chunk-2X45222K.mjs";
5
+ } from "./chunk-MK35Y35R.mjs";
6
6
 
7
7
  // src/hm-resolver.ts
8
8
  async function resolveHypermediaUrl(url, opts) {
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  entityQueryPathToHmIdPath,
9
9
  packBaseId
10
- } from "./chunk-2X45222K.mjs";
10
+ } from "./chunk-MK35Y35R.mjs";
11
11
 
12
12
  // src/capability.ts
13
13
  import { base58btc } from "multiformats/bases/base58";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  packHmId,
3
3
  unpackHmId
4
- } from "./chunk-2X45222K.mjs";
4
+ } from "./chunk-MK35Y35R.mjs";
5
5
 
6
6
  // src/document-state.ts
7
7
  async function resolveDocumentState(client, targetId) {
@@ -15,7 +15,7 @@ import {
15
15
  HMActionSchema,
16
16
  HMRequestSchema,
17
17
  packHmId
18
- } from "./chunk-2X45222K.mjs";
18
+ } from "./chunk-MK35Y35R.mjs";
19
19
 
20
20
  // src/client.ts
21
21
  import { encode as cborEncode } from "@ipld/dag-cbor";
@@ -172,7 +172,7 @@ function createSeedClient(baseUrl, options) {
172
172
  );
173
173
  }
174
174
  const rawJson = await response.json();
175
- const deserialized = deserialize(rawJson);
175
+ const deserialized = rawJson && typeof rawJson === "object" && !Array.isArray(rawJson) && "json" in rawJson ? deserialize(rawJson) : rawJson;
176
176
  return requestSchema.shape.output.parse(deserialized);
177
177
  }
178
178
  function publish(input) {
@@ -883,6 +883,128 @@ var HMSearchRequestSchema = z.object({
883
883
  input: HMSearchInputSchema,
884
884
  output: HMSearchPayloadSchema
885
885
  });
886
+ var HMAttributeValueSchema = z.object({
887
+ stringValue: z.string().optional(),
888
+ intValue: z.union([z.number(), z.string()]).optional(),
889
+ boolValue: z.boolean().optional(),
890
+ nullValue: z.union([z.object({}), z.null()]).optional()
891
+ }).strict();
892
+ var HMDocumentFilterComparisonOperatorSchema = z.enum([
893
+ "EQUAL",
894
+ "NOT_EQUAL",
895
+ "LESS_THAN",
896
+ "LESS_THAN_OR_EQUAL",
897
+ "GREATER_THAN",
898
+ "GREATER_THAN_OR_EQUAL"
899
+ ]);
900
+ var HMDocumentFilterSchema = z.lazy(
901
+ () => z.object({
902
+ and: z.object({ filters: z.array(HMDocumentFilterSchema) }).optional(),
903
+ or: z.object({ filters: z.array(HMDocumentFilterSchema) }).optional(),
904
+ not: z.object({ filter: HMDocumentFilterSchema }).optional(),
905
+ comparison: z.object({ key: z.string(), operator: HMDocumentFilterComparisonOperatorSchema, value: HMAttributeValueSchema }).optional(),
906
+ exists: z.object({ key: z.string() }).optional(),
907
+ missing: z.object({ key: z.string() }).optional(),
908
+ stringMatch: z.object({
909
+ key: z.string(),
910
+ value: z.string(),
911
+ caseSensitive: z.boolean().optional(),
912
+ prefix: z.boolean().optional()
913
+ }).optional(),
914
+ urlMatch: z.object({ url: z.string(), prefix: z.boolean().optional() }).optional(),
915
+ spaceMatch: z.object({ space: z.string() }).optional(),
916
+ pathMatch: z.object({ path: z.string(), prefix: z.boolean().optional() }).optional()
917
+ }).strict()
918
+ );
919
+ var HMBuiltinSortAttributeSchema = z.enum([
920
+ "BUILTIN_SORT_ATTRIBUTE_NAME",
921
+ "BUILTIN_SORT_ATTRIBUTE_PATH",
922
+ "BUILTIN_SORT_ATTRIBUTE_CREATE_TIME",
923
+ "BUILTIN_SORT_ATTRIBUTE_UPDATE_TIME",
924
+ "BUILTIN_SORT_ATTRIBUTE_ACTIVITY_TIME",
925
+ "BUILTIN_SORT_ATTRIBUTE_COMMENT_COUNT"
926
+ ]);
927
+ var HMDocumentSortSchema = z.object({
928
+ key: z.string().optional(),
929
+ attribute: HMBuiltinSortAttributeSchema.optional(),
930
+ descending: z.boolean().optional()
931
+ }).strict();
932
+ var HMQueryDocumentsInputSchema = z.object({
933
+ filter: HMDocumentFilterSchema.optional(),
934
+ sort: z.array(HMDocumentSortSchema).optional(),
935
+ pageSize: z.number().int().positive().optional(),
936
+ pageToken: z.string().optional()
937
+ }).strict();
938
+ var HMRawDocumentInfoSchema = z.object({
939
+ account: z.string(),
940
+ /** The document path, `/`-prefixed; empty for the space's home document. */
941
+ path: z.string().optional(),
942
+ metadata: z.record(z.unknown()).optional(),
943
+ authors: z.array(z.string()).optional(),
944
+ createTime: z.string().optional(),
945
+ updateTime: z.string().optional(),
946
+ genesis: z.string().optional(),
947
+ version: z.string().optional()
948
+ }).passthrough();
949
+ var HMQueryDocumentsOutputSchema = z.object({
950
+ documents: z.array(HMRawDocumentInfoSchema).optional(),
951
+ nextPageToken: z.string().optional()
952
+ }).passthrough();
953
+ var HMQueryDocumentsRequestSchema = z.object({
954
+ key: z.literal("QueryDocuments"),
955
+ input: HMQueryDocumentsInputSchema,
956
+ output: HMQueryDocumentsOutputSchema
957
+ });
958
+ var HMDocumentAttributeKindSchema = z.enum([
959
+ "DOCUMENT_ATTRIBUTE_KIND_UNSPECIFIED",
960
+ "DOCUMENT_ATTRIBUTE_KIND_OBJECT",
961
+ "DOCUMENT_ATTRIBUTE_KIND_STRING",
962
+ "DOCUMENT_ATTRIBUTE_KIND_INT",
963
+ "DOCUMENT_ATTRIBUTE_KIND_BOOL"
964
+ ]);
965
+ var HMListDocumentAttributeNamesInputSchema = z.object({
966
+ /** Space whose attribute names come first; omitted = ordered globally. */
967
+ account: z.string().optional(),
968
+ /** Parent object path; results are its direct children. */
969
+ parentPath: z.array(z.string()).optional(),
970
+ prefix: z.string().optional(),
971
+ pageSize: z.number().int().positive().optional(),
972
+ pageToken: z.string().optional(),
973
+ /** Complete dotted scalar paths instead of direct children. */
974
+ recursive: z.boolean().optional()
975
+ }).strict();
976
+ var HMListDocumentAttributeNamesOutputSchema = z.object({
977
+ names: z.array(
978
+ z.object({
979
+ name: z.string(),
980
+ kinds: z.array(z.object({ kind: HMDocumentAttributeKindSchema.optional() }).passthrough()).optional()
981
+ }).passthrough()
982
+ ).optional(),
983
+ nextPageToken: z.string().optional()
984
+ }).passthrough();
985
+ var HMListDocumentAttributeNamesRequestSchema = z.object({
986
+ key: z.literal("ListDocumentAttributeNames"),
987
+ input: HMListDocumentAttributeNamesInputSchema,
988
+ output: HMListDocumentAttributeNamesOutputSchema
989
+ });
990
+ var HMListDocumentAttributeValuesInputSchema = z.object({
991
+ /** Exact nested path of the attribute. */
992
+ path: z.array(z.string()),
993
+ kind: HMDocumentAttributeKindSchema,
994
+ account: z.string().optional(),
995
+ prefix: z.string().optional(),
996
+ pageSize: z.number().int().positive().optional(),
997
+ pageToken: z.string().optional()
998
+ }).strict();
999
+ var HMListDocumentAttributeValuesOutputSchema = z.object({
1000
+ values: z.array(z.object({ value: HMAttributeValueSchema.optional() }).passthrough()).optional(),
1001
+ nextPageToken: z.string().optional()
1002
+ }).passthrough();
1003
+ var HMListDocumentAttributeValuesRequestSchema = z.object({
1004
+ key: z.literal("ListDocumentAttributeValues"),
1005
+ input: HMListDocumentAttributeValuesInputSchema,
1006
+ output: HMListDocumentAttributeValuesOutputSchema
1007
+ });
886
1008
  var HMMentionCandidateSchema = z.object({
887
1009
  id: unpackedHmIdSchema,
888
1010
  type: z.enum(["account", "document"]),
@@ -1332,10 +1454,16 @@ var HMGetRequestSchema = z.discriminatedUnion("key", [
1332
1454
  ]);
1333
1455
  var HMActionSchema = z.discriminatedUnion("key", [
1334
1456
  HMPublishBlobsRequestSchema,
1335
- HMPrepareDocumentChangeRequestSchema
1457
+ HMPrepareDocumentChangeRequestSchema,
1458
+ HMQueryDocumentsRequestSchema,
1459
+ HMListDocumentAttributeNamesRequestSchema,
1460
+ HMListDocumentAttributeValuesRequestSchema
1336
1461
  ]);
1337
1462
  var HMRequestSchema = z.discriminatedUnion("key", [
1338
1463
  HMResourceRequestSchema,
1464
+ HMQueryDocumentsRequestSchema,
1465
+ HMListDocumentAttributeNamesRequestSchema,
1466
+ HMListDocumentAttributeValuesRequestSchema,
1339
1467
  HMResourceMetadataRequestSchema,
1340
1468
  HMAccountRequestSchema,
1341
1469
  HMCommentRequestSchema,
@@ -1632,6 +1760,22 @@ export {
1632
1760
  HMSearchResultItemSchema,
1633
1761
  HMSearchPayloadSchema,
1634
1762
  HMSearchRequestSchema,
1763
+ HMAttributeValueSchema,
1764
+ HMDocumentFilterComparisonOperatorSchema,
1765
+ HMDocumentFilterSchema,
1766
+ HMBuiltinSortAttributeSchema,
1767
+ HMDocumentSortSchema,
1768
+ HMQueryDocumentsInputSchema,
1769
+ HMRawDocumentInfoSchema,
1770
+ HMQueryDocumentsOutputSchema,
1771
+ HMQueryDocumentsRequestSchema,
1772
+ HMDocumentAttributeKindSchema,
1773
+ HMListDocumentAttributeNamesInputSchema,
1774
+ HMListDocumentAttributeNamesOutputSchema,
1775
+ HMListDocumentAttributeNamesRequestSchema,
1776
+ HMListDocumentAttributeValuesInputSchema,
1777
+ HMListDocumentAttributeValuesOutputSchema,
1778
+ HMListDocumentAttributeValuesRequestSchema,
1635
1779
  HMMentionCandidateSchema,
1636
1780
  HMMentionCandidatesRequestSchema,
1637
1781
  HMQueryRequestSchema,
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  packHmId,
22
22
  unpackHmId
23
- } from "./chunk-2X45222K.mjs";
23
+ } from "./chunk-MK35Y35R.mjs";
24
24
 
25
25
  // src/schema-resolve.ts
26
26
  var DAG_CBOR_CODE = 113;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  normalizeQuerySort,
3
3
  unpackHmId
4
- } from "./chunk-2X45222K.mjs";
4
+ } from "./chunk-MK35Y35R.mjs";
5
5
 
6
6
  // src/blocks-to-markdown.ts
7
7
  import { stringify as stringifyYaml } from "yaml";
package/dist/client.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createSeedClient,
3
3
  deserializeQueryString
4
- } from "./chunk-RPXAWYOC.mjs";
4
+ } from "./chunk-M6GKXROC.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-2X45222K.mjs";
10
+ import "./chunk-MK35Y35R.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-5H44WPFO.mjs";
7
+ } from "./chunk-7RJYOV4D.mjs";
8
8
  import "./chunk-JKKS35IS.mjs";
9
9
  import "./chunk-LVAHHQIK.mjs";
10
10
  import "./chunk-DR3HJ6BV.mjs";
11
- import "./chunk-2X45222K.mjs";
11
+ import "./chunk-MK35Y35R.mjs";
12
12
  import "./chunk-7P6ASYW6.mjs";
13
13
  export {
14
14
  commentRecordIdFromBlob,
@@ -4,8 +4,8 @@ import {
4
4
  followToDocument,
5
5
  resolveDocumentState,
6
6
  resolveEditableDocument
7
- } from "./chunk-OIL62HNH.mjs";
8
- import "./chunk-2X45222K.mjs";
7
+ } from "./chunk-JOFKLKIC.mjs";
8
+ import "./chunk-MK35Y35R.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-LZOORGGJ.mjs";
4
+ } from "./chunk-EB45YSE7.mjs";
5
5
  import "./chunk-JKKS35IS.mjs";
6
- import "./chunk-2X45222K.mjs";
6
+ import "./chunk-MK35Y35R.mjs";
7
7
  import "./chunk-7P6ASYW6.mjs";
8
8
  export {
9
9
  editorBlockToHMBlock,
@@ -0,0 +1,112 @@
1
+ import type { HMDocumentFilter } from './hm-types';
2
+ export type ExploreScalar = string | number | boolean;
3
+ /** The result types the Explore surface can show; `type:` predicates name one. */
4
+ export type HMExploreResultType = 'document' | 'block' | 'comment' | 'space' | 'contact';
5
+ /** Attribute predicates in the Explore query AST. */
6
+ export type ExploreAttributePredicate = {
7
+ kind: 'attribute';
8
+ key: string;
9
+ operator: 'comparison';
10
+ comparison: ExploreComparisonOperator;
11
+ value: ExploreScalar;
12
+ } | {
13
+ kind: 'attribute';
14
+ key: string;
15
+ operator: 'contains' | 'prefix';
16
+ value: string;
17
+ } | {
18
+ kind: 'attribute';
19
+ key: string;
20
+ operator: 'exists' | 'missing';
21
+ };
22
+ /** Scope predicates in the Explore query AST. */
23
+ export type ExploreScopePredicate = {
24
+ kind: 'scope';
25
+ scope: 'space' | 'url';
26
+ value: string;
27
+ } | {
28
+ kind: 'scope';
29
+ scope: 'path';
30
+ value: string;
31
+ prefix: boolean;
32
+ };
33
+ /** Leaf predicates in the Explore query AST. */
34
+ export type ExplorePredicate = ExploreAttributePredicate | ExploreScopePredicate | {
35
+ kind: 'type';
36
+ value: HMExploreResultType;
37
+ };
38
+ /** Boolean Explore query AST. */
39
+ export type ExploreQueryNode = {
40
+ kind: 'text';
41
+ value: string;
42
+ phrase: boolean;
43
+ } | {
44
+ kind: 'predicate';
45
+ predicate: ExplorePredicate;
46
+ } | {
47
+ kind: 'and' | 'or';
48
+ children: ExploreQueryNode[];
49
+ } | {
50
+ kind: 'not';
51
+ child: ExploreQueryNode;
52
+ };
53
+ /** A multi-key document sort directive. */
54
+ export type ExploreSortRule = {
55
+ key: string;
56
+ direction: 'asc' | 'desc';
57
+ };
58
+ /** Presentation directives kept separate from the boolean query tree. */
59
+ /** Result view names. */
60
+ export type ExploreView = 'list' | 'card' | 'table';
61
+ /** Presentation directives kept separate from the boolean query tree. */
62
+ export type ExplorePresentation = {
63
+ view?: ExploreView;
64
+ columns?: string[];
65
+ sort?: ExploreSortRule[];
66
+ };
67
+ /** A recoverable parser diagnostic. */
68
+ export type ExploreDiagnostic = {
69
+ message: string;
70
+ start: number;
71
+ end: number;
72
+ severity: 'warning' | 'error';
73
+ };
74
+ /** The parsed query and its presentation directives. */
75
+ export type ParsedExploreQuery = {
76
+ ast: ExploreQueryNode | null;
77
+ presentation: ExplorePresentation;
78
+ diagnostics: ExploreDiagnostic[];
79
+ };
80
+ export type ExploreComparisonOperator = '=' | '!=' | '<' | '<=' | '>' | '>=';
81
+ /** Where a query runs: the whole node, or one site (a document subtree, by its canonical `hm://` URL). */
82
+ export type ExploreQueryContext = {
83
+ type: 'node';
84
+ } | {
85
+ type: 'site';
86
+ url: string;
87
+ };
88
+ /** Quotes a value for the grammar when it contains whitespace, parentheses, quotes, or operators. */
89
+ export declare function quoteExploreValue(value: string): string;
90
+ /** Parses an Explore query into a forgiving boolean AST and presentation directives. */
91
+ export declare function parseExploreQuery(query: string): ParsedExploreQuery;
92
+ /** Serializes a parsed query's AST and presentation directives into a stable q string. */
93
+ export declare function serializeExploreQuery(query: ParsedExploreQuery | ExploreQueryNode | null, presentation?: ExplorePresentation): string;
94
+ /** The compiled document-side query and the projections the Explore surface needs. */
95
+ export type ExploreCompilation = {
96
+ /** The `DocumentFilter` for `QueryDocuments`, in protobuf JSON; undefined when nothing constrains documents. */
97
+ filter?: HMDocumentFilter;
98
+ documentPredicates: ExplorePredicate[];
99
+ textTerms: Array<{
100
+ value: string;
101
+ phrase: boolean;
102
+ }>;
103
+ requestedTypes: HMExploreResultType[];
104
+ excludedTypes: HMExploreResultType[];
105
+ positiveScopes: Array<Extract<ExplorePredicate, {
106
+ kind: 'scope';
107
+ }>>;
108
+ presentation: ExplorePresentation;
109
+ diagnostics: ExploreDiagnostic[];
110
+ };
111
+ /** Compiles the AST while preserving boolean structure and reporting dropped search terms. */
112
+ export declare function compileExploreQuery(parsed: ParsedExploreQuery, context: ExploreQueryContext): ExploreCompilation;