@seed-hypermedia/client 0.0.91 → 0.0.93
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-OIL62HNH.mjs → chunk-6GFFLR72.mjs} +1 -1
- package/dist/{chunk-5H44WPFO.mjs → chunk-D5RC44SE.mjs} +1 -1
- package/dist/{chunk-P5R4E4AU.mjs → chunk-HWCGZF52.mjs} +1 -1
- package/dist/{chunk-5ZHBEPRC.mjs → chunk-JFNPQEUD.mjs} +1 -1
- package/dist/{chunk-IS7QPOMQ.mjs → chunk-KACXO543.mjs} +1 -1
- package/dist/{chunk-LZOORGGJ.mjs → chunk-KMRULMJF.mjs} +1 -1
- package/dist/{chunk-UQL3R7WC.mjs → chunk-NDQHXVP4.mjs} +1 -1
- package/dist/{chunk-EBGUVS7T.mjs → chunk-OO2BEP54.mjs} +2 -2
- package/dist/{chunk-GOKN5MFV.mjs → chunk-QSQCVGXA.mjs} +1 -1
- package/dist/{chunk-2X45222K.mjs → chunk-SU2G6KVP.mjs} +154 -2
- package/dist/{chunk-TZMLZHCZ.mjs → chunk-UBBG2AKS.mjs} +1 -1
- package/dist/{chunk-RPXAWYOC.mjs → chunk-WQ2GBQWJ.mjs} +2 -2
- package/dist/{chunk-6FBJVBS6.mjs → chunk-WRPRFXOC.mjs} +3 -3
- package/dist/{chunk-HMTFZNX7.mjs → chunk-ZXUKRFF4.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/explore-query.d.ts +112 -0
- package/dist/explore-query.mjs +455 -0
- package/dist/hm-resolver.mjs +2 -2
- package/dist/hm-types.d.ts +2424 -0
- package/dist/hm-types.mjs +33 -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-OO2BEP54.mjs";
|
|
8
8
|
import "./chunk-O5MHN2EO.mjs";
|
|
9
9
|
import "./chunk-PJ2RFT5A.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-6GFFLR72.mjs";
|
|
11
11
|
import "./chunk-LVAHHQIK.mjs";
|
|
12
12
|
import "./chunk-DR3HJ6BV.mjs";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-SU2G6KVP.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-KACXO543.mjs";
|
|
11
|
+
import "./chunk-SU2G6KVP.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-ZXUKRFF4.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-SU2G6KVP.mjs";
|
|
9
9
|
import "./chunk-3TPCJCVO.mjs";
|
|
10
10
|
import "./chunk-7P6ASYW6.mjs";
|
|
11
11
|
export {
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from "./chunk-PJ2RFT5A.mjs";
|
|
8
8
|
import {
|
|
9
9
|
resolveDocumentState
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6GFFLR72.mjs";
|
|
11
11
|
import {
|
|
12
12
|
entityQueryPathToHmIdPath,
|
|
13
13
|
packHmId,
|
|
14
14
|
unpackHmId
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SU2G6KVP.mjs";
|
|
16
16
|
|
|
17
17
|
// src/auto-link.ts
|
|
18
18
|
import { CID } from "multiformats/cid";
|
|
@@ -790,7 +790,15 @@ var HMDraftContentSchema = z.object({
|
|
|
790
790
|
* rename affordance in the publish popover. Persisted so it survives reloads
|
|
791
791
|
* and is honored at publish time instead of the title-derived slug.
|
|
792
792
|
*/
|
|
793
|
-
publishPath: z.array(z.string()).optional()
|
|
793
|
+
publishPath: z.array(z.string()).optional(),
|
|
794
|
+
/**
|
|
795
|
+
* The working schema object of a draft whose document defines a type, while it is being
|
|
796
|
+
* authored. Not metadata: publish freezes it into a DAG-CBOR blob and writes the document's
|
|
797
|
+
* `schemaDefinition: ipfs://<cid>` attribute.
|
|
798
|
+
*/
|
|
799
|
+
schemaDraft: z.record(z.string(), z.any()).optional(),
|
|
800
|
+
/** The working attributes schemas behind `attributesSchema` / `childAttributesSchema`, by key; frozen into IPFS objects at publish. */
|
|
801
|
+
bindingSchemaDrafts: z.record(z.string(), z.record(z.string(), z.any())).optional()
|
|
794
802
|
});
|
|
795
803
|
var HMDraftMetaBaseSchema = z.object({
|
|
796
804
|
id: z.string(),
|
|
@@ -883,6 +891,128 @@ var HMSearchRequestSchema = z.object({
|
|
|
883
891
|
input: HMSearchInputSchema,
|
|
884
892
|
output: HMSearchPayloadSchema
|
|
885
893
|
});
|
|
894
|
+
var HMAttributeValueSchema = z.object({
|
|
895
|
+
stringValue: z.string().optional(),
|
|
896
|
+
intValue: z.union([z.number(), z.string()]).optional(),
|
|
897
|
+
boolValue: z.boolean().optional(),
|
|
898
|
+
nullValue: z.union([z.object({}), z.null()]).optional()
|
|
899
|
+
}).strict();
|
|
900
|
+
var HMDocumentFilterComparisonOperatorSchema = z.enum([
|
|
901
|
+
"EQUAL",
|
|
902
|
+
"NOT_EQUAL",
|
|
903
|
+
"LESS_THAN",
|
|
904
|
+
"LESS_THAN_OR_EQUAL",
|
|
905
|
+
"GREATER_THAN",
|
|
906
|
+
"GREATER_THAN_OR_EQUAL"
|
|
907
|
+
]);
|
|
908
|
+
var HMDocumentFilterSchema = z.lazy(
|
|
909
|
+
() => z.object({
|
|
910
|
+
and: z.object({ filters: z.array(HMDocumentFilterSchema) }).optional(),
|
|
911
|
+
or: z.object({ filters: z.array(HMDocumentFilterSchema) }).optional(),
|
|
912
|
+
not: z.object({ filter: HMDocumentFilterSchema }).optional(),
|
|
913
|
+
comparison: z.object({ key: z.string(), operator: HMDocumentFilterComparisonOperatorSchema, value: HMAttributeValueSchema }).optional(),
|
|
914
|
+
exists: z.object({ key: z.string() }).optional(),
|
|
915
|
+
missing: z.object({ key: z.string() }).optional(),
|
|
916
|
+
stringMatch: z.object({
|
|
917
|
+
key: z.string(),
|
|
918
|
+
value: z.string(),
|
|
919
|
+
caseSensitive: z.boolean().optional(),
|
|
920
|
+
prefix: z.boolean().optional()
|
|
921
|
+
}).optional(),
|
|
922
|
+
urlMatch: z.object({ url: z.string(), prefix: z.boolean().optional() }).optional(),
|
|
923
|
+
spaceMatch: z.object({ space: z.string() }).optional(),
|
|
924
|
+
pathMatch: z.object({ path: z.string(), prefix: z.boolean().optional() }).optional()
|
|
925
|
+
}).strict()
|
|
926
|
+
);
|
|
927
|
+
var HMBuiltinSortAttributeSchema = z.enum([
|
|
928
|
+
"BUILTIN_SORT_ATTRIBUTE_NAME",
|
|
929
|
+
"BUILTIN_SORT_ATTRIBUTE_PATH",
|
|
930
|
+
"BUILTIN_SORT_ATTRIBUTE_CREATE_TIME",
|
|
931
|
+
"BUILTIN_SORT_ATTRIBUTE_UPDATE_TIME",
|
|
932
|
+
"BUILTIN_SORT_ATTRIBUTE_ACTIVITY_TIME",
|
|
933
|
+
"BUILTIN_SORT_ATTRIBUTE_COMMENT_COUNT"
|
|
934
|
+
]);
|
|
935
|
+
var HMDocumentSortSchema = z.object({
|
|
936
|
+
key: z.string().optional(),
|
|
937
|
+
attribute: HMBuiltinSortAttributeSchema.optional(),
|
|
938
|
+
descending: z.boolean().optional()
|
|
939
|
+
}).strict();
|
|
940
|
+
var HMQueryDocumentsInputSchema = z.object({
|
|
941
|
+
filter: HMDocumentFilterSchema.optional(),
|
|
942
|
+
sort: z.array(HMDocumentSortSchema).optional(),
|
|
943
|
+
pageSize: z.number().int().positive().optional(),
|
|
944
|
+
pageToken: z.string().optional()
|
|
945
|
+
}).strict();
|
|
946
|
+
var HMRawDocumentInfoSchema = z.object({
|
|
947
|
+
account: z.string(),
|
|
948
|
+
/** The document path, `/`-prefixed; empty for the space's home document. */
|
|
949
|
+
path: z.string().optional(),
|
|
950
|
+
metadata: z.record(z.unknown()).optional(),
|
|
951
|
+
authors: z.array(z.string()).optional(),
|
|
952
|
+
createTime: z.string().optional(),
|
|
953
|
+
updateTime: z.string().optional(),
|
|
954
|
+
genesis: z.string().optional(),
|
|
955
|
+
version: z.string().optional()
|
|
956
|
+
}).passthrough();
|
|
957
|
+
var HMQueryDocumentsOutputSchema = z.object({
|
|
958
|
+
documents: z.array(HMRawDocumentInfoSchema).optional(),
|
|
959
|
+
nextPageToken: z.string().optional()
|
|
960
|
+
}).passthrough();
|
|
961
|
+
var HMQueryDocumentsRequestSchema = z.object({
|
|
962
|
+
key: z.literal("QueryDocuments"),
|
|
963
|
+
input: HMQueryDocumentsInputSchema,
|
|
964
|
+
output: HMQueryDocumentsOutputSchema
|
|
965
|
+
});
|
|
966
|
+
var HMDocumentAttributeKindSchema = z.enum([
|
|
967
|
+
"DOCUMENT_ATTRIBUTE_KIND_UNSPECIFIED",
|
|
968
|
+
"DOCUMENT_ATTRIBUTE_KIND_OBJECT",
|
|
969
|
+
"DOCUMENT_ATTRIBUTE_KIND_STRING",
|
|
970
|
+
"DOCUMENT_ATTRIBUTE_KIND_INT",
|
|
971
|
+
"DOCUMENT_ATTRIBUTE_KIND_BOOL"
|
|
972
|
+
]);
|
|
973
|
+
var HMListDocumentAttributeNamesInputSchema = z.object({
|
|
974
|
+
/** Space whose attribute names come first; omitted = ordered globally. */
|
|
975
|
+
account: z.string().optional(),
|
|
976
|
+
/** Parent object path; results are its direct children. */
|
|
977
|
+
parentPath: z.array(z.string()).optional(),
|
|
978
|
+
prefix: z.string().optional(),
|
|
979
|
+
pageSize: z.number().int().positive().optional(),
|
|
980
|
+
pageToken: z.string().optional(),
|
|
981
|
+
/** Complete dotted scalar paths instead of direct children. */
|
|
982
|
+
recursive: z.boolean().optional()
|
|
983
|
+
}).strict();
|
|
984
|
+
var HMListDocumentAttributeNamesOutputSchema = z.object({
|
|
985
|
+
names: z.array(
|
|
986
|
+
z.object({
|
|
987
|
+
name: z.string(),
|
|
988
|
+
kinds: z.array(z.object({ kind: HMDocumentAttributeKindSchema.optional() }).passthrough()).optional()
|
|
989
|
+
}).passthrough()
|
|
990
|
+
).optional(),
|
|
991
|
+
nextPageToken: z.string().optional()
|
|
992
|
+
}).passthrough();
|
|
993
|
+
var HMListDocumentAttributeNamesRequestSchema = z.object({
|
|
994
|
+
key: z.literal("ListDocumentAttributeNames"),
|
|
995
|
+
input: HMListDocumentAttributeNamesInputSchema,
|
|
996
|
+
output: HMListDocumentAttributeNamesOutputSchema
|
|
997
|
+
});
|
|
998
|
+
var HMListDocumentAttributeValuesInputSchema = z.object({
|
|
999
|
+
/** Exact nested path of the attribute. */
|
|
1000
|
+
path: z.array(z.string()),
|
|
1001
|
+
kind: HMDocumentAttributeKindSchema,
|
|
1002
|
+
account: z.string().optional(),
|
|
1003
|
+
prefix: z.string().optional(),
|
|
1004
|
+
pageSize: z.number().int().positive().optional(),
|
|
1005
|
+
pageToken: z.string().optional()
|
|
1006
|
+
}).strict();
|
|
1007
|
+
var HMListDocumentAttributeValuesOutputSchema = z.object({
|
|
1008
|
+
values: z.array(z.object({ value: HMAttributeValueSchema.optional() }).passthrough()).optional(),
|
|
1009
|
+
nextPageToken: z.string().optional()
|
|
1010
|
+
}).passthrough();
|
|
1011
|
+
var HMListDocumentAttributeValuesRequestSchema = z.object({
|
|
1012
|
+
key: z.literal("ListDocumentAttributeValues"),
|
|
1013
|
+
input: HMListDocumentAttributeValuesInputSchema,
|
|
1014
|
+
output: HMListDocumentAttributeValuesOutputSchema
|
|
1015
|
+
});
|
|
886
1016
|
var HMMentionCandidateSchema = z.object({
|
|
887
1017
|
id: unpackedHmIdSchema,
|
|
888
1018
|
type: z.enum(["account", "document"]),
|
|
@@ -1332,10 +1462,16 @@ var HMGetRequestSchema = z.discriminatedUnion("key", [
|
|
|
1332
1462
|
]);
|
|
1333
1463
|
var HMActionSchema = z.discriminatedUnion("key", [
|
|
1334
1464
|
HMPublishBlobsRequestSchema,
|
|
1335
|
-
HMPrepareDocumentChangeRequestSchema
|
|
1465
|
+
HMPrepareDocumentChangeRequestSchema,
|
|
1466
|
+
HMQueryDocumentsRequestSchema,
|
|
1467
|
+
HMListDocumentAttributeNamesRequestSchema,
|
|
1468
|
+
HMListDocumentAttributeValuesRequestSchema
|
|
1336
1469
|
]);
|
|
1337
1470
|
var HMRequestSchema = z.discriminatedUnion("key", [
|
|
1338
1471
|
HMResourceRequestSchema,
|
|
1472
|
+
HMQueryDocumentsRequestSchema,
|
|
1473
|
+
HMListDocumentAttributeNamesRequestSchema,
|
|
1474
|
+
HMListDocumentAttributeValuesRequestSchema,
|
|
1339
1475
|
HMResourceMetadataRequestSchema,
|
|
1340
1476
|
HMAccountRequestSchema,
|
|
1341
1477
|
HMCommentRequestSchema,
|
|
@@ -1632,6 +1768,22 @@ export {
|
|
|
1632
1768
|
HMSearchResultItemSchema,
|
|
1633
1769
|
HMSearchPayloadSchema,
|
|
1634
1770
|
HMSearchRequestSchema,
|
|
1771
|
+
HMAttributeValueSchema,
|
|
1772
|
+
HMDocumentFilterComparisonOperatorSchema,
|
|
1773
|
+
HMDocumentFilterSchema,
|
|
1774
|
+
HMBuiltinSortAttributeSchema,
|
|
1775
|
+
HMDocumentSortSchema,
|
|
1776
|
+
HMQueryDocumentsInputSchema,
|
|
1777
|
+
HMRawDocumentInfoSchema,
|
|
1778
|
+
HMQueryDocumentsOutputSchema,
|
|
1779
|
+
HMQueryDocumentsRequestSchema,
|
|
1780
|
+
HMDocumentAttributeKindSchema,
|
|
1781
|
+
HMListDocumentAttributeNamesInputSchema,
|
|
1782
|
+
HMListDocumentAttributeNamesOutputSchema,
|
|
1783
|
+
HMListDocumentAttributeNamesRequestSchema,
|
|
1784
|
+
HMListDocumentAttributeValuesInputSchema,
|
|
1785
|
+
HMListDocumentAttributeValuesOutputSchema,
|
|
1786
|
+
HMListDocumentAttributeValuesRequestSchema,
|
|
1635
1787
|
HMMentionCandidateSchema,
|
|
1636
1788
|
HMMentionCandidatesRequestSchema,
|
|
1637
1789
|
HMQueryRequestSchema,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
HMActionSchema,
|
|
16
16
|
HMRequestSchema,
|
|
17
17
|
packHmId
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-SU2G6KVP.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) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NDQHXVP4.mjs";
|
|
4
4
|
import {
|
|
5
5
|
createSeedClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WQ2GBQWJ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
unpackHmId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SU2G6KVP.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-WQ2GBQWJ.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-SU2G6KVP.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-D5RC44SE.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-SU2G6KVP.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-6GFFLR72.mjs";
|
|
8
|
+
import "./chunk-SU2G6KVP.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-KMRULMJF.mjs";
|
|
5
5
|
import "./chunk-JKKS35IS.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-SU2G6KVP.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;
|