@functional-systems/lambdadb 0.5.0 → 0.6.0
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/CHANGELOG.md +49 -0
- package/README.md +31 -1
- package/dist/commonjs/client.d.ts.map +1 -1
- package/dist/commonjs/client.js +5 -4
- package/dist/commonjs/client.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/indexconfigsunion.d.ts +16 -2
- package/dist/commonjs/models/indexconfigsunion.d.ts.map +1 -1
- package/dist/commonjs/models/indexconfigsunion.js +16 -2
- package/dist/commonjs/models/indexconfigsunion.js.map +1 -1
- package/dist/commonjs/models/operations/querycollection.d.ts +18 -4
- package/dist/commonjs/models/operations/querycollection.d.ts.map +1 -1
- package/dist/commonjs/models/operations/querycollection.js +16 -1
- package/dist/commonjs/models/operations/querycollection.js.map +1 -1
- package/dist/commonjs/types/public.d.ts +1 -0
- package/dist/commonjs/types/public.d.ts.map +1 -1
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +5 -4
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/indexconfigsunion.d.ts +16 -2
- package/dist/esm/models/indexconfigsunion.d.ts.map +1 -1
- package/dist/esm/models/indexconfigsunion.js +16 -2
- package/dist/esm/models/indexconfigsunion.js.map +1 -1
- package/dist/esm/models/operations/querycollection.d.ts +18 -4
- package/dist/esm/models/operations/querycollection.d.ts.map +1 -1
- package/dist/esm/models/operations/querycollection.js +16 -1
- package/dist/esm/models/operations/querycollection.js.map +1 -1
- package/dist/esm/types/public.d.ts +1 -0
- package/dist/esm/types/public.d.ts.map +1 -1
- package/jsr.json +1 -1
- package/package.json +2 -1
- package/src/client.ts +5 -4
- package/src/lib/config.ts +2 -2
- package/src/models/indexconfigsunion.ts +19 -3
- package/src/models/operations/querycollection.ts +28 -3
- package/src/types/public.ts +2 -0
|
@@ -9,6 +9,13 @@ import { Result as SafeParseResult } from "../../types/fp.js";
|
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
10
|
import * as models from "../index.js";
|
|
11
11
|
|
|
12
|
+
export type FacetRequest = {
|
|
13
|
+
/** Maximum buckets to return (1–100). Omitted or null uses the server default of 10. */
|
|
14
|
+
size?: number | null | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type FacetBucket = { value: string; count: number };
|
|
17
|
+
export type FacetResult = { buckets: Array<FacetBucket> };
|
|
18
|
+
|
|
12
19
|
export type QueryCollectionRequestBody = {
|
|
13
20
|
/**
|
|
14
21
|
* Number of documents to return. Note that the maximum number of documents is 100.
|
|
@@ -17,7 +24,8 @@ export type QueryCollectionRequestBody = {
|
|
|
17
24
|
/**
|
|
18
25
|
* Query object. For managed embedding vector fields, use knn.queryText. For unmanaged vector fields, use knn.queryVector.
|
|
19
26
|
*/
|
|
20
|
-
query
|
|
27
|
+
query?: { [k: string]: any } | undefined;
|
|
28
|
+
facets?: Record<string, FacetRequest> | undefined;
|
|
21
29
|
/**
|
|
22
30
|
* Overlay eligible pending writes on a directly selected Branch. Tag and Alias reads reject true, pending bulk imports are excluded, and an oversized pending overlay can return HTTP 429.
|
|
23
31
|
*/
|
|
@@ -63,6 +71,7 @@ export type QueryCollectionDoc = {
|
|
|
63
71
|
* Documents selected by query.
|
|
64
72
|
*/
|
|
65
73
|
export type QueryCollectionResponse = {
|
|
74
|
+
facets?: Record<string, FacetResult> | undefined;
|
|
66
75
|
/**
|
|
67
76
|
* Elapsed time in milliseconds.
|
|
68
77
|
*/
|
|
@@ -92,7 +101,8 @@ export type QueryCollectionResponse = {
|
|
|
92
101
|
/** @internal */
|
|
93
102
|
export type QueryCollectionRequestBody$Outbound = {
|
|
94
103
|
size?: number | undefined;
|
|
95
|
-
query
|
|
104
|
+
query?: { [k: string]: any } | undefined;
|
|
105
|
+
facets?: Record<string, FacetRequest> | undefined;
|
|
96
106
|
consistentRead: boolean;
|
|
97
107
|
includeVectors: boolean;
|
|
98
108
|
sort?: Array<{ [k: string]: any }> | undefined;
|
|
@@ -108,7 +118,12 @@ export const QueryCollectionRequestBody$outboundSchema: z.ZodType<
|
|
|
108
118
|
QueryCollectionRequestBody
|
|
109
119
|
> = z.object({
|
|
110
120
|
size: z.number().int().optional(),
|
|
111
|
-
query: z.record(z.any()),
|
|
121
|
+
query: z.record(z.any()).optional(),
|
|
122
|
+
facets: z.record(z.object({
|
|
123
|
+
size: z.number().int().min(1).max(100).nullable().optional(),
|
|
124
|
+
}).strict()).refine((facets) => Object.keys(facets).length <= 5, {
|
|
125
|
+
message: "At most five facet fields may be requested",
|
|
126
|
+
}).optional(),
|
|
112
127
|
consistentRead: z.boolean().default(false),
|
|
113
128
|
includeVectors: z.boolean().default(false),
|
|
114
129
|
sort: z.array(z.record(z.any())).optional(),
|
|
@@ -116,6 +131,13 @@ export const QueryCollectionRequestBody$outboundSchema: z.ZodType<
|
|
|
116
131
|
partitionFilter: models.PartitionFilter$outboundSchema.optional(),
|
|
117
132
|
ref: models.ReadRef$schema.optional(),
|
|
118
133
|
}).strict().superRefine((value, context) => {
|
|
134
|
+
if (value.size === 0 && Object.keys(value.facets ?? {}).length === 0) {
|
|
135
|
+
context.addIssue({
|
|
136
|
+
code: z.ZodIssueCode.custom,
|
|
137
|
+
message: "size: 0 requires at least one facet",
|
|
138
|
+
path: ["facets"],
|
|
139
|
+
});
|
|
140
|
+
}
|
|
119
141
|
if (value.consistentRead && value.ref != null && value.ref.kind !== "branch") {
|
|
120
142
|
context.addIssue({
|
|
121
143
|
code: z.ZodIssueCode.custom,
|
|
@@ -194,6 +216,9 @@ export const QueryCollectionResponse$inboundSchema: z.ZodType<
|
|
|
194
216
|
docs: z.array(z.lazy(() => QueryCollectionDoc$inboundSchema)),
|
|
195
217
|
isDocsInline: z.boolean(),
|
|
196
218
|
docsUrl: nullToUndefined(z.string().optional()),
|
|
219
|
+
facets: nullToUndefined(z.record(z.object({
|
|
220
|
+
buckets: z.array(z.object({ value: z.string(), count: z.number().int() })),
|
|
221
|
+
})).optional()),
|
|
197
222
|
});
|
|
198
223
|
|
|
199
224
|
export function queryCollectionResponseFromJSON(
|
package/src/types/public.ts
CHANGED
|
@@ -273,3 +273,5 @@ export function tagDetailsWithDates(details: TagDetailsModel): TagDetails {
|
|
|
273
273
|
export function aliasDetailsWithDate(details: AliasDetailsModel): AliasDetails {
|
|
274
274
|
return { ...details, createdAt: new Date(details.createdAt) };
|
|
275
275
|
}
|
|
276
|
+
|
|
277
|
+
export type { FacetRequest, FacetBucket, FacetResult } from "../models/operations/querycollection.js";
|