@functional-systems/lambdadb 0.4.3 → 0.5.0-rc.1

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 (209) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/FUNCTIONS.md +7 -2
  3. package/README.md +60 -2
  4. package/RUNTIMES.md +7 -0
  5. package/USAGE.md +20 -0
  6. package/dist/commonjs/client.d.ts +25 -10
  7. package/dist/commonjs/client.d.ts.map +1 -1
  8. package/dist/commonjs/client.js +182 -56
  9. package/dist/commonjs/client.js.map +1 -1
  10. package/dist/commonjs/compat/qdrant/client.d.ts +3 -6
  11. package/dist/commonjs/compat/qdrant/client.d.ts.map +1 -1
  12. package/dist/commonjs/compat/qdrant/client.js +17 -11
  13. package/dist/commonjs/compat/qdrant/client.js.map +1 -1
  14. package/dist/commonjs/funcs/collectionsCreate.js +1 -1
  15. package/dist/commonjs/funcs/collectionsDelete.js +1 -1
  16. package/dist/commonjs/funcs/collectionsDocsGetBulkUpsert.js +4 -0
  17. package/dist/commonjs/funcs/collectionsDocsGetBulkUpsert.js.map +1 -1
  18. package/dist/commonjs/funcs/collectionsDocsListDocs.js +2 -0
  19. package/dist/commonjs/funcs/collectionsDocsListDocs.js.map +1 -1
  20. package/dist/commonjs/index.d.ts +4 -1
  21. package/dist/commonjs/index.d.ts.map +1 -1
  22. package/dist/commonjs/index.js +15 -1
  23. package/dist/commonjs/index.js.map +1 -1
  24. package/dist/commonjs/lib/config.d.ts +2 -2
  25. package/dist/commonjs/lib/config.js +2 -2
  26. package/dist/commonjs/lib/config.js.map +1 -1
  27. package/dist/commonjs/lib/queryInput.d.ts +3 -11
  28. package/dist/commonjs/lib/queryInput.d.ts.map +1 -1
  29. package/dist/commonjs/lib/queryInput.js.map +1 -1
  30. package/dist/commonjs/models/collectionresponse.d.ts +12 -21
  31. package/dist/commonjs/models/collectionresponse.d.ts.map +1 -1
  32. package/dist/commonjs/models/collectionresponse.js +5 -6
  33. package/dist/commonjs/models/collectionresponse.js.map +1 -1
  34. package/dist/commonjs/models/index.d.ts +1 -0
  35. package/dist/commonjs/models/index.d.ts.map +1 -1
  36. package/dist/commonjs/models/index.js +1 -0
  37. package/dist/commonjs/models/index.js.map +1 -1
  38. package/dist/commonjs/models/operations/bulkupsertdocs.d.ts +6 -0
  39. package/dist/commonjs/models/operations/bulkupsertdocs.d.ts.map +1 -1
  40. package/dist/commonjs/models/operations/bulkupsertdocs.js +2 -0
  41. package/dist/commonjs/models/operations/bulkupsertdocs.js.map +1 -1
  42. package/dist/commonjs/models/operations/createcollection.d.ts +20 -13
  43. package/dist/commonjs/models/operations/createcollection.d.ts.map +1 -1
  44. package/dist/commonjs/models/operations/createcollection.js +15 -7
  45. package/dist/commonjs/models/operations/createcollection.js.map +1 -1
  46. package/dist/commonjs/models/operations/deletedocs.d.ts +3 -0
  47. package/dist/commonjs/models/operations/deletedocs.d.ts.map +1 -1
  48. package/dist/commonjs/models/operations/deletedocs.js +1 -0
  49. package/dist/commonjs/models/operations/deletedocs.js.map +1 -1
  50. package/dist/commonjs/models/operations/fetchdocs.d.ts +3 -0
  51. package/dist/commonjs/models/operations/fetchdocs.d.ts.map +1 -1
  52. package/dist/commonjs/models/operations/fetchdocs.js +9 -0
  53. package/dist/commonjs/models/operations/fetchdocs.js.map +1 -1
  54. package/dist/commonjs/models/operations/getbulkupsertdocs.d.ts +5 -0
  55. package/dist/commonjs/models/operations/getbulkupsertdocs.d.ts.map +1 -1
  56. package/dist/commonjs/models/operations/getbulkupsertdocs.js +5 -3
  57. package/dist/commonjs/models/operations/getbulkupsertdocs.js.map +1 -1
  58. package/dist/commonjs/models/operations/listdocs.d.ts +9 -0
  59. package/dist/commonjs/models/operations/listdocs.d.ts.map +1 -1
  60. package/dist/commonjs/models/operations/listdocs.js +11 -0
  61. package/dist/commonjs/models/operations/listdocs.js.map +1 -1
  62. package/dist/commonjs/models/operations/querycollection.d.ts +3 -0
  63. package/dist/commonjs/models/operations/querycollection.d.ts.map +1 -1
  64. package/dist/commonjs/models/operations/querycollection.js +9 -0
  65. package/dist/commonjs/models/operations/querycollection.js.map +1 -1
  66. package/dist/commonjs/models/operations/updatecollection.d.ts +10 -4
  67. package/dist/commonjs/models/operations/updatecollection.d.ts.map +1 -1
  68. package/dist/commonjs/models/operations/updatecollection.js +8 -1
  69. package/dist/commonjs/models/operations/updatecollection.js.map +1 -1
  70. package/dist/commonjs/models/operations/updatedocs.d.ts +3 -0
  71. package/dist/commonjs/models/operations/updatedocs.d.ts.map +1 -1
  72. package/dist/commonjs/models/operations/updatedocs.js +1 -0
  73. package/dist/commonjs/models/operations/updatedocs.js.map +1 -1
  74. package/dist/commonjs/models/operations/upsertdocs.d.ts +3 -0
  75. package/dist/commonjs/models/operations/upsertdocs.d.ts.map +1 -1
  76. package/dist/commonjs/models/operations/upsertdocs.js +1 -0
  77. package/dist/commonjs/models/operations/upsertdocs.js.map +1 -1
  78. package/dist/commonjs/models/versioning.d.ts +100 -0
  79. package/dist/commonjs/models/versioning.d.ts.map +1 -0
  80. package/dist/commonjs/models/versioning.js +93 -0
  81. package/dist/commonjs/models/versioning.js.map +1 -0
  82. package/dist/commonjs/types/public.d.ts +80 -6
  83. package/dist/commonjs/types/public.d.ts.map +1 -1
  84. package/dist/commonjs/types/public.js +30 -7
  85. package/dist/commonjs/types/public.js.map +1 -1
  86. package/dist/commonjs/versioning.d.ts +63 -0
  87. package/dist/commonjs/versioning.d.ts.map +1 -0
  88. package/dist/commonjs/versioning.js +390 -0
  89. package/dist/commonjs/versioning.js.map +1 -0
  90. package/dist/esm/client.d.ts +25 -10
  91. package/dist/esm/client.d.ts.map +1 -1
  92. package/dist/esm/client.js +183 -58
  93. package/dist/esm/client.js.map +1 -1
  94. package/dist/esm/compat/qdrant/client.d.ts +3 -6
  95. package/dist/esm/compat/qdrant/client.d.ts.map +1 -1
  96. package/dist/esm/compat/qdrant/client.js +17 -11
  97. package/dist/esm/compat/qdrant/client.js.map +1 -1
  98. package/dist/esm/funcs/collectionsCreate.js +1 -1
  99. package/dist/esm/funcs/collectionsDelete.js +1 -1
  100. package/dist/esm/funcs/collectionsDocsGetBulkUpsert.js +5 -1
  101. package/dist/esm/funcs/collectionsDocsGetBulkUpsert.js.map +1 -1
  102. package/dist/esm/funcs/collectionsDocsListDocs.js +2 -0
  103. package/dist/esm/funcs/collectionsDocsListDocs.js.map +1 -1
  104. package/dist/esm/index.d.ts +4 -1
  105. package/dist/esm/index.d.ts.map +1 -1
  106. package/dist/esm/index.js +3 -1
  107. package/dist/esm/index.js.map +1 -1
  108. package/dist/esm/lib/config.d.ts +2 -2
  109. package/dist/esm/lib/config.js +2 -2
  110. package/dist/esm/lib/config.js.map +1 -1
  111. package/dist/esm/lib/queryInput.d.ts +3 -11
  112. package/dist/esm/lib/queryInput.d.ts.map +1 -1
  113. package/dist/esm/lib/queryInput.js.map +1 -1
  114. package/dist/esm/models/collectionresponse.d.ts +12 -21
  115. package/dist/esm/models/collectionresponse.d.ts.map +1 -1
  116. package/dist/esm/models/collectionresponse.js +5 -6
  117. package/dist/esm/models/collectionresponse.js.map +1 -1
  118. package/dist/esm/models/index.d.ts +1 -0
  119. package/dist/esm/models/index.d.ts.map +1 -1
  120. package/dist/esm/models/index.js +1 -0
  121. package/dist/esm/models/index.js.map +1 -1
  122. package/dist/esm/models/operations/bulkupsertdocs.d.ts +6 -0
  123. package/dist/esm/models/operations/bulkupsertdocs.d.ts.map +1 -1
  124. package/dist/esm/models/operations/bulkupsertdocs.js +2 -0
  125. package/dist/esm/models/operations/bulkupsertdocs.js.map +1 -1
  126. package/dist/esm/models/operations/createcollection.d.ts +20 -13
  127. package/dist/esm/models/operations/createcollection.d.ts.map +1 -1
  128. package/dist/esm/models/operations/createcollection.js +15 -7
  129. package/dist/esm/models/operations/createcollection.js.map +1 -1
  130. package/dist/esm/models/operations/deletedocs.d.ts +3 -0
  131. package/dist/esm/models/operations/deletedocs.d.ts.map +1 -1
  132. package/dist/esm/models/operations/deletedocs.js +1 -0
  133. package/dist/esm/models/operations/deletedocs.js.map +1 -1
  134. package/dist/esm/models/operations/fetchdocs.d.ts +3 -0
  135. package/dist/esm/models/operations/fetchdocs.d.ts.map +1 -1
  136. package/dist/esm/models/operations/fetchdocs.js +9 -0
  137. package/dist/esm/models/operations/fetchdocs.js.map +1 -1
  138. package/dist/esm/models/operations/getbulkupsertdocs.d.ts +5 -0
  139. package/dist/esm/models/operations/getbulkupsertdocs.d.ts.map +1 -1
  140. package/dist/esm/models/operations/getbulkupsertdocs.js +6 -4
  141. package/dist/esm/models/operations/getbulkupsertdocs.js.map +1 -1
  142. package/dist/esm/models/operations/listdocs.d.ts +9 -0
  143. package/dist/esm/models/operations/listdocs.d.ts.map +1 -1
  144. package/dist/esm/models/operations/listdocs.js +11 -0
  145. package/dist/esm/models/operations/listdocs.js.map +1 -1
  146. package/dist/esm/models/operations/querycollection.d.ts +3 -0
  147. package/dist/esm/models/operations/querycollection.d.ts.map +1 -1
  148. package/dist/esm/models/operations/querycollection.js +9 -0
  149. package/dist/esm/models/operations/querycollection.js.map +1 -1
  150. package/dist/esm/models/operations/updatecollection.d.ts +10 -4
  151. package/dist/esm/models/operations/updatecollection.d.ts.map +1 -1
  152. package/dist/esm/models/operations/updatecollection.js +8 -1
  153. package/dist/esm/models/operations/updatecollection.js.map +1 -1
  154. package/dist/esm/models/operations/updatedocs.d.ts +3 -0
  155. package/dist/esm/models/operations/updatedocs.d.ts.map +1 -1
  156. package/dist/esm/models/operations/updatedocs.js +1 -0
  157. package/dist/esm/models/operations/updatedocs.js.map +1 -1
  158. package/dist/esm/models/operations/upsertdocs.d.ts +3 -0
  159. package/dist/esm/models/operations/upsertdocs.d.ts.map +1 -1
  160. package/dist/esm/models/operations/upsertdocs.js +1 -0
  161. package/dist/esm/models/operations/upsertdocs.js.map +1 -1
  162. package/dist/esm/models/versioning.d.ts +100 -0
  163. package/dist/esm/models/versioning.d.ts.map +1 -0
  164. package/dist/esm/models/versioning.js +57 -0
  165. package/dist/esm/models/versioning.js.map +1 -0
  166. package/dist/esm/types/public.d.ts +80 -6
  167. package/dist/esm/types/public.d.ts.map +1 -1
  168. package/dist/esm/types/public.js +26 -7
  169. package/dist/esm/types/public.js.map +1 -1
  170. package/dist/esm/versioning.d.ts +63 -0
  171. package/dist/esm/versioning.d.ts.map +1 -0
  172. package/dist/esm/versioning.js +344 -0
  173. package/dist/esm/versioning.js.map +1 -0
  174. package/jsr.json +3 -1
  175. package/package.json +14 -2
  176. package/src/client.ts +300 -61
  177. package/src/compat/qdrant/client.ts +28 -16
  178. package/src/funcs/collectionsCreate.ts +1 -1
  179. package/src/funcs/collectionsDelete.ts +1 -1
  180. package/src/funcs/collectionsDocsGetBulkUpsert.ts +6 -1
  181. package/src/funcs/collectionsDocsListDocs.ts +2 -0
  182. package/src/index.ts +17 -0
  183. package/src/lib/config.ts +2 -2
  184. package/src/lib/queryInput.ts +3 -10
  185. package/src/models/collectionresponse.ts +17 -26
  186. package/src/models/index.ts +1 -0
  187. package/src/models/operations/bulkupsertdocs.ts +8 -0
  188. package/src/models/operations/createcollection.ts +39 -18
  189. package/src/models/operations/deletedocs.ts +4 -0
  190. package/src/models/operations/fetchdocs.ts +12 -0
  191. package/src/models/operations/getbulkupsertdocs.ts +11 -4
  192. package/src/models/operations/listdocs.ts +20 -0
  193. package/src/models/operations/querycollection.ts +12 -0
  194. package/src/models/operations/updatecollection.ts +21 -3
  195. package/src/models/operations/updatedocs.ts +4 -0
  196. package/src/models/operations/upsertdocs.ts +4 -0
  197. package/src/models/versioning.ts +118 -0
  198. package/src/types/public.ts +127 -14
  199. package/src/versioning.ts +490 -0
  200. package/examples/collectionScoped.example.ts +0 -38
  201. package/examples/collectionsList.example.ts +0 -25
  202. package/examples/package-lock.json +0 -612
  203. package/examples/package.json +0 -18
  204. package/test/integration/qdrant-compat-external.test.mjs +0 -351
  205. package/test/integration/qdrant-compat-live.test.mjs +0 -122
  206. package/test/null-response.test.mjs +0 -73
  207. package/test/public-api.test.mjs +0 -540
  208. package/test/qdrant-compat.test.mjs +0 -547
  209. package/tsconfig.json +0 -39
@@ -1,6 +1,10 @@
1
1
  import { LambdaDBClient, type LambdaDBClientOptions } from "../../client.js";
2
2
  import { ResourceNotFoundError } from "../../models/errors/index.js";
3
- import type { CreateCollectionInput, ListDocsInput } from "../../types/public.js";
3
+ import type {
4
+ CreateCollectionInput,
5
+ ListDocsInput,
6
+ UpdateCollectionInput,
7
+ } from "../../types/public.js";
4
8
  import {
5
9
  ORIGINAL_ID_FIELD,
6
10
  mergeIndexConfigs,
@@ -28,7 +32,7 @@ type ListDocsBody = ListDocsInput;
28
32
 
29
33
  type CollectionLike = {
30
34
  get(): Promise<{ collection: JsonObject }>;
31
- update(body: { indexConfigs: IndexConfigs }): Promise<unknown>;
35
+ update(body: UpdateCollectionInput): Promise<unknown>;
32
36
  delete(): Promise<unknown>;
33
37
  query(body: JsonObject): Promise<{ docs: unknown[] }>;
34
38
  docs: {
@@ -184,7 +188,7 @@ export class QdrantCompatClient {
184
188
  collectionName,
185
189
  indexConfigs: indexConfigs as CreateCollectionInput["indexConfigs"],
186
190
  });
187
- await this.waitForCollectionActive(collectionName, body.timeout);
191
+ await this.waitForCollectionAvailable(collectionName, body.timeout);
188
192
  return true;
189
193
  }
190
194
 
@@ -255,9 +259,12 @@ export class QdrantCompatClient {
255
259
  }
256
260
 
257
261
  await this.client.collection(collectionName).update({
258
- indexConfigs: mergeIndexConfigs(existingIndexConfigs, payloadIndexConfig),
262
+ indexConfigs: mergeIndexConfigs(
263
+ existingIndexConfigs,
264
+ payloadIndexConfig,
265
+ ) as UpdateCollectionInput["indexConfigs"],
259
266
  });
260
- await this.waitForCollectionActive(collectionName, timeout);
267
+ await this.waitForCollectionAvailable(collectionName, timeout);
261
268
  return true;
262
269
  }
263
270
 
@@ -690,24 +697,25 @@ export class QdrantCompatClient {
690
697
  return response.collection;
691
698
  }
692
699
 
693
- private async waitForCollectionActive(
700
+ private async waitForCollectionAvailable(
694
701
  collectionName: string,
695
702
  timeoutSeconds: unknown,
696
703
  ): Promise<void> {
697
704
  const timeout = typeof timeoutSeconds === "number" ? timeoutSeconds : 60;
698
705
  const deadline = Date.now() + timeout * 1000;
699
- let lastStatus = "unknown";
700
706
  while (true) {
701
- const collection = await this.currentCollection(collectionName);
702
- const status = collection["collectionStatus"];
703
- if (status === undefined || status === "ACTIVE") return;
704
- lastStatus = String(status);
705
- if (Date.now() >= deadline) {
706
- throw new QdrantCompatError(
707
- `Collection ${collectionName} did not become ACTIVE within ${timeout}s; last status=${lastStatus}`,
708
- );
707
+ try {
708
+ await this.currentCollection(collectionName);
709
+ return;
710
+ } catch (error) {
711
+ if (!isNotFoundError(error)) throw error;
712
+ if (Date.now() >= deadline) {
713
+ throw new QdrantCompatError(
714
+ `Collection ${collectionName} was not available within ${timeout}s`,
715
+ );
716
+ }
717
+ await sleep(500);
709
718
  }
710
- await sleep(500);
711
719
  }
712
720
  }
713
721
  }
@@ -737,6 +745,7 @@ function normalizeConstructorOptions(
737
745
  "timeoutMs",
738
746
  "retryConfig",
739
747
  "httpClient",
748
+ "transferClient",
740
749
  "serverURL",
741
750
  "projectHost",
742
751
  "path",
@@ -779,6 +788,9 @@ function normalizeConstructorOptions(
779
788
  if (timeoutMs !== undefined) normalized.timeoutMs = timeoutMs;
780
789
  if (options.retryConfig !== undefined) normalized.retryConfig = options.retryConfig;
781
790
  if (options.httpClient !== undefined) normalized.httpClient = options.httpClient;
791
+ if (options.transferClient !== undefined) {
792
+ normalized.transferClient = options.transferClient;
793
+ }
782
794
  if (options.serverURL !== undefined) normalized.serverURL = options.serverURL;
783
795
  if (options.projectHost !== undefined) normalized.projectHost = options.projectHost;
784
796
  return normalized;
@@ -175,7 +175,7 @@ async function $do(
175
175
  | UnexpectedClientError
176
176
  | SDKValidationError
177
177
  >(
178
- M.json(202, operations.CreateCollectionResponse$inboundSchema),
178
+ M.json(201, operations.CreateCollectionResponse$inboundSchema),
179
179
  M.jsonErr(400, errors.BadRequestError$inboundSchema),
180
180
  M.jsonErr(401, errors.UnauthenticatedError$inboundSchema),
181
181
  M.jsonErr(409, errors.ResourceAlreadyExistsError$inboundSchema),
@@ -179,7 +179,7 @@ async function $do(
179
179
  | UnexpectedClientError
180
180
  | SDKValidationError
181
181
  >(
182
- M.json(202, models.MessageResponse$inboundSchema),
182
+ M.json(200, models.MessageResponse$inboundSchema),
183
183
  M.jsonErr(401, errors.UnauthenticatedError$inboundSchema),
184
184
  M.jsonErr(404, errors.ResourceNotFoundError$inboundSchema),
185
185
  M.jsonErr(429, errors.TooManyRequestsError$inboundSchema),
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import { LambdaDBCore } from "../core.js";
6
- import { encodeSimple } from "../lib/encodings.js";
6
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
7
7
  import * as M from "../lib/matchers.js";
8
8
  import { compactMap } from "../lib/primitives.js";
9
9
  import { safeParse } from "../lib/schemas.js";
@@ -104,6 +104,10 @@ async function $do(
104
104
  pathParams,
105
105
  );
106
106
 
107
+ const query = encodeFormQuery({
108
+ "branch": payload.branch,
109
+ });
110
+
107
111
  const headers = new Headers(compactMap({
108
112
  Accept: "application/json",
109
113
  }));
@@ -142,6 +146,7 @@ async function $do(
142
146
  method: "GET",
143
147
  baseURL: options?.serverURL,
144
148
  path: path,
149
+ query: query,
145
150
  headers: headers,
146
151
  body: body,
147
152
  userAgent: client._options.userAgent,
@@ -105,6 +105,8 @@ async function $do(
105
105
  const query = encodeFormQuery({
106
106
  "includeVectors": payload.includeVectors,
107
107
  "pageToken": payload.pageToken,
108
+ "refKind": payload.refKind,
109
+ "refName": payload.refName,
108
110
  "size": payload.size,
109
111
  });
110
112
 
package/src/index.ts CHANGED
@@ -12,12 +12,29 @@ export * from "./sdk/sdk.js";
12
12
  export {
13
13
  LambdaDBClient,
14
14
  CollectionHandle,
15
+ CollectionDocs,
15
16
  DEFAULT_BASE_URL,
16
17
  DEFAULT_PROJECT_NAME,
17
18
  type RequestOptions as ClientRequestOptions,
18
19
  type LambdaDBClientOptions,
19
20
  } from "./client.js";
20
21
 
22
+ /** Data Versioning lifecycle clients and validated ref/source/target helpers. */
23
+ export {
24
+ CollectionAliases,
25
+ CollectionBranches,
26
+ CollectionTags,
27
+ DATA_VERSIONING_CONTRACT_REVISION,
28
+ aliasRef,
29
+ branchRef,
30
+ branchSource,
31
+ branchTarget,
32
+ tagRef,
33
+ tagSource,
34
+ tagTarget,
35
+ } from "./versioning.js";
36
+ export type { VersioningError } from "./versioning.js";
37
+
21
38
  /** Public API types (inputs and responses for the collection-scoped client). */
22
39
  export type * from "./types/public.js";
23
40
 
package/src/lib/config.ts CHANGED
@@ -73,8 +73,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
73
73
  export const SDK_METADATA = {
74
74
  language: "typescript",
75
75
  openapiDocVersion: "1.1.1",
76
- sdkVersion: "0.4.3",
76
+ sdkVersion: "0.5.0-rc.1",
77
77
  genVersion: "2.798.0",
78
78
  userAgent:
79
- "speakeasy-sdk/typescript 0.4.3 2.798.0 1.1.1 @functional-systems/lambdadb",
79
+ "speakeasy-sdk/typescript 0.5.0-rc.1 2.798.0 1.1.1 @functional-systems/lambdadb",
80
80
  } as const;
@@ -2,20 +2,13 @@
2
2
  * Helper to build QueryCollectionInput for collection.query() / collection.querySafe().
3
3
  */
4
4
 
5
- import type { FieldsSelectorUnion, PartitionFilter } from "../models/index.js";
6
5
  import type { QueryCollectionInput } from "../types/public.js";
7
6
 
8
7
  /**
9
8
  * Options for createQueryInput (all optional except query).
10
9
  */
11
- export type CreateQueryInputOptions = {
12
- size?: number;
13
- consistentRead?: boolean;
14
- includeVectors?: boolean;
15
- sort?: Array<{ [k: string]: unknown }>;
16
- fields?: FieldsSelectorUnion;
17
- partitionFilter?: PartitionFilter;
18
- };
10
+ type WithoutQuery<T> = T extends unknown ? Omit<T, "query"> : never;
11
+ export type CreateQueryInputOptions = WithoutQuery<QueryCollectionInput>;
19
12
 
20
13
  /**
21
14
  * Build a query input object for collection.query() or collection.querySafe().
@@ -29,5 +22,5 @@ export function createQueryInput(
29
22
  query: { [k: string]: unknown },
30
23
  options?: CreateQueryInputOptions,
31
24
  ): QueryCollectionInput {
32
- return { query, ...options };
25
+ return { query, ...options } as QueryCollectionInput;
33
26
  }
@@ -14,7 +14,6 @@ import {
14
14
  PartitionConfig,
15
15
  PartitionConfig$inboundSchema,
16
16
  } from "./partitionconfig.js";
17
- import { Status, Status$inboundSchema } from "./status.js";
18
17
 
19
18
  export type CollectionResponse = {
20
19
  /**
@@ -26,6 +25,10 @@ export type CollectionResponse = {
26
25
  */
27
26
  collectionName: string;
28
27
  indexConfigs: { [k: string]: IndexConfigsUnion };
28
+ /** Collection description. */
29
+ description: string;
30
+ /** Collection metadata tags. */
31
+ tags: Record<string, string>;
29
32
  partitionConfig?: PartitionConfig | undefined;
30
33
  /**
31
34
  * Total number of partitions including the default partition.
@@ -35,34 +38,22 @@ export type CollectionResponse = {
35
38
  * Total number of documents.
36
39
  */
37
40
  numDocs: number;
41
+ /** Default writable Branch. */
42
+ defaultBranchName: "main";
43
+ /** Number of days that committed snapshots are retained. */
44
+ snapshotRetentionInDays: number;
38
45
  /**
39
- * Source project name.
40
- */
41
- sourceProjectName?: string | undefined;
42
- /**
43
- * Source collection name.
44
- */
45
- sourceCollectionName?: string | undefined;
46
- /**
47
- * Source collection version.
48
- */
49
- sourceCollectionVersionId?: string | undefined;
50
- /**
51
- * Status
52
- */
53
- collectionStatus: Status;
54
- /**
55
- * Collection creation time in seconds since the Unix epoch.
46
+ * Collection creation time in milliseconds since the Unix epoch.
56
47
  */
57
48
  createdAt: number;
58
49
  /**
59
- * Collection last update time in seconds since the Unix epoch.
50
+ * Collection last update time in milliseconds since the Unix epoch.
60
51
  */
61
52
  updatedAt: number;
62
53
  /**
63
- * Collection data last update time in seconds since the Unix epoch.
54
+ * Collection data last update time in milliseconds since the Unix epoch.
64
55
  */
65
- dataUpdatedAt: number;
56
+ dataUpdatedAt?: number | undefined;
66
57
  };
67
58
 
68
59
  /** @internal */
@@ -74,16 +65,16 @@ export const CollectionResponse$inboundSchema: z.ZodType<
74
65
  projectName: z.string(),
75
66
  collectionName: z.string(),
76
67
  indexConfigs: z.record(IndexConfigsUnion$inboundSchema),
68
+ description: z.string(),
69
+ tags: z.record(z.string()),
77
70
  partitionConfig: nullToUndefined(PartitionConfig$inboundSchema.optional()),
78
71
  numPartitions: z.number().int(),
79
72
  numDocs: z.number().int(),
80
- sourceProjectName: nullToUndefined(z.string().optional()),
81
- sourceCollectionName: nullToUndefined(z.string().optional()),
82
- sourceCollectionVersionId: nullToUndefined(z.string().optional()),
83
- collectionStatus: Status$inboundSchema,
73
+ defaultBranchName: z.literal("main"),
74
+ snapshotRetentionInDays: z.number().int().min(1).max(31),
84
75
  createdAt: z.number().int(),
85
76
  updatedAt: z.number().int(),
86
- dataUpdatedAt: z.number().int(),
77
+ dataUpdatedAt: nullToUndefined(z.number().int().optional()),
87
78
  });
88
79
 
89
80
  export function collectionResponseFromJSON(
@@ -10,3 +10,4 @@ export * from "./partitionconfig.js";
10
10
  export * from "./partitionfilter.js";
11
11
  export * from "./security.js";
12
12
  export * from "./status.js";
13
+ export * from "./versioning.js";
@@ -10,6 +10,10 @@ export type BulkUpsertDocsRequestBody = {
10
10
  * Object key uploaded based on bulk upsert info.
11
11
  */
12
12
  objectKey: string;
13
+ /** Content type supplied by the bulk-upload info response. */
14
+ type?: "application/json" | undefined;
15
+ /** Write target Branch. Must match the bulk-upload info request. */
16
+ branch?: string | undefined;
13
17
  };
14
18
 
15
19
  export type BulkUpsertDocsRequest = {
@@ -23,6 +27,8 @@ export type BulkUpsertDocsRequest = {
23
27
  /** @internal */
24
28
  export type BulkUpsertDocsRequestBody$Outbound = {
25
29
  objectKey: string;
30
+ type: "application/json";
31
+ branch?: string | undefined;
26
32
  };
27
33
 
28
34
  /** @internal */
@@ -32,6 +38,8 @@ export const BulkUpsertDocsRequestBody$outboundSchema: z.ZodType<
32
38
  BulkUpsertDocsRequestBody
33
39
  > = z.object({
34
40
  objectKey: z.string(),
41
+ type: z.literal("application/json").default("application/json"),
42
+ branch: z.string().regex(/^[a-zA-Z0-9_-]{3,52}$/).optional(),
35
43
  });
36
44
 
37
45
  export function bulkUpsertDocsRequestBodyToJSON(
@@ -13,30 +13,38 @@ export type CreateCollectionRequest = {
13
13
  * Collection name must be unique within a project and the supported maximum length is 52.
14
14
  */
15
15
  collectionName: string;
16
- indexConfigs?: { [k: string]: models.IndexConfigsUnion } | undefined;
16
+ indexConfigs: { [k: string]: models.IndexConfigsUnion };
17
+ description?: string | undefined;
18
+ tags?: Record<string, string> | undefined;
17
19
  partitionConfig?: models.PartitionConfig | undefined;
18
- sourceProjectName?: string | undefined;
19
- sourceCollectionName?: string | undefined;
20
- sourceDatetime?: string | undefined;
21
- sourceProjectApiKey?: string | undefined;
20
+ snapshotRetentionInDays?: number | undefined;
21
+ };
22
+
23
+ export type CreatedCollection = {
24
+ collectionName: string;
25
+ description: string;
26
+ tags: Record<string, string>;
27
+ defaultBranchName: "main";
28
+ snapshotRetentionInDays: number;
29
+ /** Collection creation time as Unix epoch milliseconds. */
30
+ createdAt: number;
22
31
  };
23
32
 
24
33
  /**
25
34
  * Created collection
26
35
  */
27
36
  export type CreateCollectionResponse = {
28
- collection: models.CollectionResponse;
37
+ collection: CreatedCollection;
29
38
  };
30
39
 
31
40
  /** @internal */
32
41
  export type CreateCollectionRequest$Outbound = {
33
42
  collectionName: string;
34
- indexConfigs?: { [k: string]: models.IndexConfigsUnion$Outbound } | undefined;
43
+ indexConfigs: { [k: string]: models.IndexConfigsUnion$Outbound };
44
+ description?: string | undefined;
45
+ tags?: Record<string, string> | undefined;
35
46
  partitionConfig?: models.PartitionConfig$Outbound | undefined;
36
- sourceProjectName?: string | undefined;
37
- sourceCollectionName?: string | undefined;
38
- sourceDatetime?: string | undefined;
39
- sourceProjectApiKey?: string | undefined;
47
+ snapshotRetentionInDays?: number | undefined;
40
48
  };
41
49
 
42
50
  /** @internal */
@@ -45,13 +53,19 @@ export const CreateCollectionRequest$outboundSchema: z.ZodType<
45
53
  z.ZodTypeDef,
46
54
  CreateCollectionRequest
47
55
  > = z.object({
48
- collectionName: z.string(),
49
- indexConfigs: z.record(models.IndexConfigsUnion$outboundSchema).optional(),
56
+ collectionName: z.string().regex(/^[a-zA-Z0-9_-]{3,52}$/),
57
+ indexConfigs: z.record(models.IndexConfigsUnion$outboundSchema),
58
+ description: z.string().max(255).optional(),
59
+ tags: z.record(
60
+ z.string().min(1).max(127).regex(/^[^:#,]+$/),
61
+ ).refine((value) => Object.keys(value).length <= 5, {
62
+ message: "Collection tags support at most five entries",
63
+ }).refine(
64
+ (value) => Object.keys(value).every((key) => /^[A-Za-z0-9_.-]{1,63}$/.test(key)),
65
+ { message: "Invalid collection tag key" },
66
+ ).optional(),
50
67
  partitionConfig: models.PartitionConfig$outboundSchema.optional(),
51
- sourceProjectName: z.string().optional(),
52
- sourceCollectionName: z.string().optional(),
53
- sourceDatetime: z.string().optional(),
54
- sourceProjectApiKey: z.string().optional(),
68
+ snapshotRetentionInDays: z.number().int().min(1).max(31).optional(),
55
69
  });
56
70
 
57
71
  export function createCollectionRequestToJSON(
@@ -68,7 +82,14 @@ export const CreateCollectionResponse$inboundSchema: z.ZodType<
68
82
  z.ZodTypeDef,
69
83
  unknown
70
84
  > = z.object({
71
- collection: models.CollectionResponse$inboundSchema,
85
+ collection: z.object({
86
+ collectionName: z.string(),
87
+ description: z.string(),
88
+ tags: z.record(z.string()),
89
+ defaultBranchName: z.literal("main"),
90
+ snapshotRetentionInDays: z.number().int().min(1).max(31),
91
+ createdAt: z.number().int(),
92
+ }),
72
93
  });
73
94
 
74
95
  export function createCollectionResponseFromJSON(
@@ -16,6 +16,8 @@ export type DeleteDocsRequestBody = {
16
16
  */
17
17
  filter?: { [k: string]: any } | undefined;
18
18
  partitionFilter?: models.PartitionFilter | undefined;
19
+ /** Write target Branch. Omitting it writes to main. */
20
+ branch?: string | undefined;
19
21
  };
20
22
 
21
23
  export type DeleteDocsRequest = {
@@ -31,6 +33,7 @@ export type DeleteDocsRequestBody$Outbound = {
31
33
  ids?: Array<string> | undefined;
32
34
  filter?: { [k: string]: any } | undefined;
33
35
  partitionFilter?: models.PartitionFilter$Outbound | undefined;
36
+ branch?: string | undefined;
34
37
  };
35
38
 
36
39
  /** @internal */
@@ -42,6 +45,7 @@ export const DeleteDocsRequestBody$outboundSchema: z.ZodType<
42
45
  ids: z.array(z.string()).optional(),
43
46
  filter: z.record(z.any()).optional(),
44
47
  partitionFilter: models.PartitionFilter$outboundSchema.optional(),
48
+ branch: z.string().regex(/^[a-zA-Z0-9_-]{3,52}$/).optional(),
45
49
  });
46
50
 
47
51
  export function deleteDocsRequestBodyToJSON(
@@ -27,6 +27,8 @@ export type FetchDocsRequestBody = {
27
27
  */
28
28
  fields?: models.FieldsSelectorUnion | undefined;
29
29
  partitionFilter?: models.PartitionFilter | undefined;
30
+ /** Read target. Omitting it reads from main. */
31
+ ref?: models.ReadRef | undefined;
30
32
  };
31
33
 
32
34
  export type FetchDocsRequest = {
@@ -72,6 +74,7 @@ export type FetchDocsRequestBody$Outbound = {
72
74
  includeVectors: boolean;
73
75
  fields?: models.FieldsSelectorUnion$Outbound | undefined;
74
76
  partitionFilter?: models.PartitionFilter$Outbound | undefined;
77
+ ref?: models.ReadRef | undefined;
75
78
  };
76
79
 
77
80
  /** @internal */
@@ -85,6 +88,15 @@ export const FetchDocsRequestBody$outboundSchema: z.ZodType<
85
88
  includeVectors: z.boolean().default(false),
86
89
  fields: models.FieldsSelectorUnion$outboundSchema.optional(),
87
90
  partitionFilter: models.PartitionFilter$outboundSchema.optional(),
91
+ ref: models.ReadRef$schema.optional(),
92
+ }).superRefine((value, context) => {
93
+ if (value.consistentRead && value.ref != null && value.ref.kind !== "branch") {
94
+ context.addIssue({
95
+ code: z.ZodIssueCode.custom,
96
+ message: "consistentRead is supported only for direct Branch reads",
97
+ path: ["consistentRead"],
98
+ });
99
+ }
88
100
  });
89
101
 
90
102
  export function fetchDocsRequestBodyToJSON(
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod/v3";
6
- import { nullToUndefined, safeParse } from "../../lib/schemas.js";
6
+ import { safeParse } from "../../lib/schemas.js";
7
7
  import { ClosedEnum } from "../../types/enums.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
9
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
@@ -13,6 +13,8 @@ export type GetBulkUpsertDocsRequest = {
13
13
  * Collection name.
14
14
  */
15
15
  collectionName: string;
16
+ /** Write target Branch. Omitting it writes to main. */
17
+ branch?: string | undefined;
16
18
  };
17
19
 
18
20
  /**
@@ -61,11 +63,14 @@ export type GetBulkUpsertDocsResponse = {
61
63
  * Object size limit in bytes.
62
64
  */
63
65
  sizeLimitBytes: number;
66
+ /** Signed headers to forward unchanged to the presigned upload URL. */
67
+ headers: Record<string, string>;
64
68
  };
65
69
 
66
70
  /** @internal */
67
71
  export type GetBulkUpsertDocsRequest$Outbound = {
68
72
  collectionName: string;
73
+ branch?: string | undefined;
69
74
  };
70
75
 
71
76
  /** @internal */
@@ -75,6 +80,7 @@ export const GetBulkUpsertDocsRequest$outboundSchema: z.ZodType<
75
80
  GetBulkUpsertDocsRequest
76
81
  > = z.object({
77
82
  collectionName: z.string(),
83
+ branch: z.string().regex(/^[a-zA-Z0-9_-]{3,52}$/).optional(),
78
84
  });
79
85
 
80
86
  export function getBulkUpsertDocsRequestToJSON(
@@ -101,10 +107,11 @@ export const GetBulkUpsertDocsResponse$inboundSchema: z.ZodType<
101
107
  unknown
102
108
  > = z.object({
103
109
  url: z.string(),
104
- type: nullToUndefined(Type$inboundSchema.default("application/json")),
105
- httpMethod: nullToUndefined(HttpMethod$inboundSchema.default("PUT")),
110
+ type: Type$inboundSchema,
111
+ httpMethod: HttpMethod$inboundSchema,
106
112
  objectKey: z.string(),
107
- sizeLimitBytes: nullToUndefined(z.number().int().default(209715200)),
113
+ sizeLimitBytes: z.number().int(),
114
+ headers: z.record(z.string()),
108
115
  });
109
116
 
110
117
  export function getBulkUpsertDocsResponseFromJSON(
@@ -26,6 +26,10 @@ export type ListDocsRequest = {
26
26
  * Set to true to include vector values in the response. Defaults to false.
27
27
  */
28
28
  includeVectors?: boolean | undefined;
29
+ /** Read ref kind. Must be supplied together with refName. */
30
+ refKind?: models.ReadRef["kind"] | undefined;
31
+ /** Read ref name. Must be supplied together with refKind. */
32
+ refName?: string | undefined;
29
33
  };
30
34
 
31
35
  export type ListDocsDoc = {
@@ -59,6 +63,8 @@ export type ListDocsRequest$Outbound = {
59
63
  size?: number | undefined;
60
64
  pageToken?: string | undefined;
61
65
  includeVectors: boolean;
66
+ refKind?: models.ReadRef["kind"] | undefined;
67
+ refName?: string | undefined;
62
68
  };
63
69
 
64
70
  /** @internal */
@@ -71,6 +77,16 @@ export const ListDocsRequest$outboundSchema: z.ZodType<
71
77
  size: z.number().int().optional(),
72
78
  pageToken: z.string().optional(),
73
79
  includeVectors: z.boolean().default(false),
80
+ refKind: z.enum(["branch", "tag", "alias"]).optional(),
81
+ refName: z.string().regex(/^[a-zA-Z0-9_-]{3,52}$/).optional(),
82
+ }).superRefine((value, context) => {
83
+ if ((value.refKind == null) !== (value.refName == null)) {
84
+ context.addIssue({
85
+ code: z.ZodIssueCode.custom,
86
+ message: "refKind and refName must be supplied together",
87
+ path: [value.refKind == null ? "refKind" : "refName"],
88
+ });
89
+ }
74
90
  });
75
91
 
76
92
  export function listDocsRequestToJSON(
@@ -101,6 +117,8 @@ export type ListDocsExtendedRequestBody = {
101
117
  * Set to true to include vector values in the response. Defaults to false.
102
118
  */
103
119
  includeVectors?: boolean | undefined;
120
+ /** Read target. Omitting it reads from main. */
121
+ ref?: models.ReadRef | undefined;
104
122
  };
105
123
 
106
124
  export type ListDocsExtendedRequest = {
@@ -119,6 +137,7 @@ export type ListDocsExtendedRequestBody$Outbound = {
119
137
  partitionFilter?: models.PartitionFilter$Outbound | undefined;
120
138
  fields?: models.FieldsSelectorUnion$Outbound | undefined;
121
139
  includeVectors: boolean;
140
+ ref?: models.ReadRef | undefined;
122
141
  };
123
142
 
124
143
  /** @internal */
@@ -133,6 +152,7 @@ export const ListDocsExtendedRequestBody$outboundSchema: z.ZodType<
133
152
  partitionFilter: models.PartitionFilter$outboundSchema.optional(),
134
153
  fields: models.FieldsSelectorUnion$outboundSchema.optional(),
135
154
  includeVectors: z.boolean().default(false),
155
+ ref: models.ReadRef$schema.optional(),
136
156
  });
137
157
 
138
158
  export function listDocsExtendedRequestBodyToJSON(
@@ -35,6 +35,8 @@ export type QueryCollectionRequestBody = {
35
35
  */
36
36
  fields?: models.FieldsSelectorUnion | undefined;
37
37
  partitionFilter?: models.PartitionFilter | undefined;
38
+ /** Read target. Omitting it reads from main. */
39
+ ref?: models.ReadRef | undefined;
38
40
  };
39
41
 
40
42
  export type QueryCollectionRequest = {
@@ -96,6 +98,7 @@ export type QueryCollectionRequestBody$Outbound = {
96
98
  sort?: Array<{ [k: string]: any }> | undefined;
97
99
  fields?: models.FieldsSelectorUnion$Outbound | undefined;
98
100
  partitionFilter?: models.PartitionFilter$Outbound | undefined;
101
+ ref?: models.ReadRef | undefined;
99
102
  };
100
103
 
101
104
  /** @internal */
@@ -111,6 +114,15 @@ export const QueryCollectionRequestBody$outboundSchema: z.ZodType<
111
114
  sort: z.array(z.record(z.any())).optional(),
112
115
  fields: models.FieldsSelectorUnion$outboundSchema.optional(),
113
116
  partitionFilter: models.PartitionFilter$outboundSchema.optional(),
117
+ ref: models.ReadRef$schema.optional(),
118
+ }).superRefine((value, context) => {
119
+ if (value.consistentRead && value.ref != null && value.ref.kind !== "branch") {
120
+ context.addIssue({
121
+ code: z.ZodIssueCode.custom,
122
+ message: "consistentRead is supported only for direct Branch reads",
123
+ path: ["consistentRead"],
124
+ });
125
+ }
114
126
  });
115
127
 
116
128
  export function queryCollectionRequestBodyToJSON(