@functional-systems/lambdadb 0.3.0-dev.2 → 0.3.0-dev.3

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 (49) hide show
  1. package/README.md +129 -13
  2. package/dist/commonjs/client.d.ts +108 -18
  3. package/dist/commonjs/client.d.ts.map +1 -1
  4. package/dist/commonjs/client.js +220 -2
  5. package/dist/commonjs/client.js.map +1 -1
  6. package/dist/commonjs/index.d.ts +16 -1
  7. package/dist/commonjs/index.d.ts.map +1 -1
  8. package/dist/commonjs/index.js +10 -2
  9. package/dist/commonjs/index.js.map +1 -1
  10. package/dist/commonjs/lib/queryInput.d.ts +30 -0
  11. package/dist/commonjs/lib/queryInput.d.ts.map +1 -0
  12. package/dist/commonjs/lib/queryInput.js +18 -0
  13. package/dist/commonjs/lib/queryInput.js.map +1 -0
  14. package/dist/commonjs/types/errors.d.ts +34 -0
  15. package/dist/commonjs/types/errors.d.ts.map +1 -0
  16. package/dist/commonjs/types/errors.js +27 -0
  17. package/dist/commonjs/types/errors.js.map +1 -0
  18. package/dist/commonjs/types/public.d.ts +26 -0
  19. package/dist/commonjs/types/public.d.ts.map +1 -0
  20. package/dist/commonjs/types/public.js +7 -0
  21. package/dist/commonjs/types/public.js.map +1 -0
  22. package/dist/esm/client.d.ts +108 -18
  23. package/dist/esm/client.d.ts.map +1 -1
  24. package/dist/esm/client.js +221 -3
  25. package/dist/esm/client.js.map +1 -1
  26. package/dist/esm/index.d.ts +16 -1
  27. package/dist/esm/index.d.ts.map +1 -1
  28. package/dist/esm/index.js +6 -1
  29. package/dist/esm/index.js.map +1 -1
  30. package/dist/esm/lib/queryInput.d.ts +30 -0
  31. package/dist/esm/lib/queryInput.d.ts.map +1 -0
  32. package/dist/esm/lib/queryInput.js +15 -0
  33. package/dist/esm/lib/queryInput.js.map +1 -0
  34. package/dist/esm/types/errors.d.ts +34 -0
  35. package/dist/esm/types/errors.d.ts.map +1 -0
  36. package/dist/esm/types/errors.js +8 -0
  37. package/dist/esm/types/errors.js.map +1 -0
  38. package/dist/esm/types/public.d.ts +26 -0
  39. package/dist/esm/types/public.d.ts.map +1 -0
  40. package/dist/esm/types/public.js +6 -0
  41. package/dist/esm/types/public.js.map +1 -0
  42. package/examples/collectionScoped.example.ts +9 -3
  43. package/examples/collectionsList.example.ts +5 -2
  44. package/package.json +1 -1
  45. package/src/client.ts +410 -19
  46. package/src/index.ts +25 -1
  47. package/src/lib/queryInput.ts +33 -0
  48. package/src/types/errors.ts +97 -0
  49. package/src/types/public.ts +45 -0
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Helper to build QueryCollectionInput for collection.query() / collection.querySafe().
3
+ */
4
+ /**
5
+ * Build a query input object for collection.query() or collection.querySafe().
6
+ * Pass the required query object (e.g. text search or vector search params) and optional options.
7
+ *
8
+ * @example
9
+ * const input = createQueryInput({ text: "hello" }, { size: 10 });
10
+ * const result = await collection.query(input);
11
+ */
12
+ export function createQueryInput(query, options) {
13
+ return { query, ...options };
14
+ }
15
+ //# sourceMappingURL=queryInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryInput.js","sourceRoot":"","sources":["../../../src/lib/queryInput.ts"],"names":[],"mappings":"AAAA;;GAEG;AAiBH;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAA+B,EAC/B,OAAiC;IAEjC,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Public API error types for the collection-scoped client.
3
+ * Re-exports error classes and defines per-operation error unions for Safe methods.
4
+ */
5
+ import type * as errors from "../models/errors/index.js";
6
+ import type { LambdaDBError } from "../models/errors/lambdadberror.js";
7
+ import type { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
8
+ import type { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
9
+ import type { ConnectionError, RequestAbortedError, RequestTimeoutError, InvalidRequestError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
10
+ export { BadRequestError, UnauthenticatedError, ResourceNotFoundError, ResourceAlreadyExistsError, TooManyRequestsError, InternalServerError, LambdaDBError, LambdaDBDefaultError, ResponseValidationError, SDKValidationError, } from "../models/errors/index.js";
11
+ export { HTTPClientError, ConnectionError, RequestAbortedError, RequestTimeoutError, InvalidRequestError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js";
12
+ export type LambdaDBClientError = LambdaDBError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError;
13
+ /** Errors that can occur when listing collections, getting a collection, deleting a collection, or getting bulk upsert info. */
14
+ export type ListCollectionsError = errors.UnauthenticatedError | errors.ResourceNotFoundError | errors.TooManyRequestsError | errors.InternalServerError | LambdaDBClientError;
15
+ /** Errors that can occur when creating a collection. */
16
+ export type CreateCollectionError = errors.BadRequestError | errors.UnauthenticatedError | errors.ResourceAlreadyExistsError | errors.TooManyRequestsError | errors.InternalServerError | LambdaDBClientError;
17
+ /** Errors that can occur when getting a collection. */
18
+ export type GetCollectionError = ListCollectionsError;
19
+ /** Errors that can occur when updating a collection. */
20
+ export type UpdateCollectionError = errors.BadRequestError | errors.UnauthenticatedError | errors.ResourceNotFoundError | errors.TooManyRequestsError | errors.InternalServerError | LambdaDBClientError;
21
+ /** Errors that can occur when deleting a collection. */
22
+ export type DeleteCollectionError = ListCollectionsError;
23
+ /** Errors that can occur when querying a collection. */
24
+ export type QueryCollectionError = UpdateCollectionError;
25
+ /** Errors that can occur when listing, upserting, updating, deleting, or fetching docs, or when calling bulkUpsert. */
26
+ export type ListDocsError = UpdateCollectionError;
27
+ export type UpsertDocsError = UpdateCollectionError;
28
+ export type UpdateDocsError = UpdateCollectionError;
29
+ export type DeleteDocsError = UpdateCollectionError;
30
+ export type FetchDocsError = UpdateCollectionError;
31
+ export type BulkUpsertDocsError = UpdateCollectionError;
32
+ /** Errors that can occur when getting bulk upsert docs info. */
33
+ export type GetBulkUpsertDocsError = ListCollectionsError;
34
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sCAAsC,CAAC;AAG9C,MAAM,MAAM,mBAAmB,GAC3B,aAAa,GACb,uBAAuB,GACvB,eAAe,GACf,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,CAAC;AAIvB,gIAAgI;AAChI,MAAM,MAAM,oBAAoB,GAC5B,MAAM,CAAC,oBAAoB,GAC3B,MAAM,CAAC,qBAAqB,GAC5B,MAAM,CAAC,oBAAoB,GAC3B,MAAM,CAAC,mBAAmB,GAC1B,mBAAmB,CAAC;AAExB,wDAAwD;AACxD,MAAM,MAAM,qBAAqB,GAC7B,MAAM,CAAC,eAAe,GACtB,MAAM,CAAC,oBAAoB,GAC3B,MAAM,CAAC,0BAA0B,GACjC,MAAM,CAAC,oBAAoB,GAC3B,MAAM,CAAC,mBAAmB,GAC1B,mBAAmB,CAAC;AAExB,uDAAuD;AACvD,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEtD,wDAAwD;AACxD,MAAM,MAAM,qBAAqB,GAC7B,MAAM,CAAC,eAAe,GACtB,MAAM,CAAC,oBAAoB,GAC3B,MAAM,CAAC,qBAAqB,GAC5B,MAAM,CAAC,oBAAoB,GAC3B,MAAM,CAAC,mBAAmB,GAC1B,mBAAmB,CAAC;AAExB,wDAAwD;AACxD,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAEzD,wDAAwD;AACxD,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAEzD,uHAAuH;AACvH,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAClD,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AACpD,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AACpD,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AACpD,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC;AACnD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,gEAAgE;AAChE,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Public API error types for the collection-scoped client.
3
+ * Re-exports error classes and defines per-operation error unions for Safe methods.
4
+ */
5
+ // ---- Re-export error classes for instanceof checks and typing ----
6
+ export { BadRequestError, UnauthenticatedError, ResourceNotFoundError, ResourceAlreadyExistsError, TooManyRequestsError, InternalServerError, LambdaDBError, LambdaDBDefaultError, ResponseValidationError, SDKValidationError, } from "../models/errors/index.js";
7
+ export { HTTPClientError, ConnectionError, RequestAbortedError, RequestTimeoutError, InvalidRequestError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js";
8
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,qEAAqE;AACrE,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sCAAsC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Public API types for the collection-scoped client.
3
+ * Only request-body–level inputs and method return types are exposed.
4
+ */
5
+ export type { CreateCollectionRequest as CreateCollectionInput } from "../models/operations/createcollection.js";
6
+ export type { UpdateCollectionRequestBody as UpdateCollectionInput } from "../models/operations/updatecollection.js";
7
+ export type { QueryCollectionRequestBody as QueryCollectionInput } from "../models/operations/querycollection.js";
8
+ export type { UpsertDocsRequestBody as UpsertDocsInput } from "../models/operations/upsertdocs.js";
9
+ export type { UpdateDocsRequestBody as UpdateDocsInput } from "../models/operations/updatedocs.js";
10
+ export type { DeleteDocsRequestBody as DeleteDocsInput } from "../models/operations/deletedocs.js";
11
+ export type { FetchDocsRequestBody as FetchDocsInput } from "../models/operations/fetchdocs.js";
12
+ export type { BulkUpsertDocsRequestBody as BulkUpsertInput } from "../models/operations/bulkupsertdocs.js";
13
+ import type { ListDocsRequest } from "../models/operations/listdocs.js";
14
+ /** Parameters for listing documents (size, pageToken). */
15
+ export type ListDocsInput = Pick<ListDocsRequest, "size" | "pageToken">;
16
+ export type { ListCollectionsResponse } from "../models/operations/listcollections.js";
17
+ export type { CreateCollectionResponse } from "../models/operations/createcollection.js";
18
+ export type { GetCollectionResponse } from "../models/operations/getcollection.js";
19
+ export type { UpdateCollectionResponse } from "../models/operations/updatecollection.js";
20
+ export type { QueryCollectionResponse, QueryCollectionDoc, } from "../models/operations/querycollection.js";
21
+ export type { ListDocsResponse } from "../models/operations/listdocs.js";
22
+ export type { MessageResponse } from "../models/index.js";
23
+ export type { FetchDocsResponse, FetchDocsDoc, } from "../models/operations/fetchdocs.js";
24
+ export type { GetBulkUpsertDocsResponse } from "../models/operations/getbulkupsertdocs.js";
25
+ export type { IndexConfigsUnion, PartitionConfig, PartitionFilter, FieldsSelectorUnion, CollectionResponse, } from "../models/index.js";
26
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/types/public.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,uBAAuB,IAAI,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjH,YAAY,EAAE,2BAA2B,IAAI,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACrH,YAAY,EAAE,0BAA0B,IAAI,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAClH,YAAY,EAAE,qBAAqB,IAAI,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACnG,YAAY,EAAE,qBAAqB,IAAI,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACnG,YAAY,EAAE,qBAAqB,IAAI,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACnG,YAAY,EAAE,oBAAoB,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAChG,YAAY,EAAE,yBAAyB,IAAI,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAE3G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,0DAA0D;AAC1D,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC;AAGxE,YAAY,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AACvF,YAAY,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACzF,YAAY,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AACnF,YAAY,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACzF,YAAY,EACV,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,yCAAyC,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,YAAY,EACV,iBAAiB,EACjB,YAAY,GACb,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAG3F,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Public API types for the collection-scoped client.
3
+ * Only request-body–level inputs and method return types are exposed.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/types/public.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -9,7 +9,11 @@ dotenv.config();
9
9
  * npm run build && npx tsx collectionScoped.example.ts
10
10
  */
11
11
 
12
- import { LambdaDBClient } from "@functional-systems/lambdadb";
12
+ import {
13
+ LambdaDBClient,
14
+ type ListDocsInput,
15
+ type ListDocsResponse,
16
+ } from "@functional-systems/lambdadb";
13
17
 
14
18
  const client = new LambdaDBClient({
15
19
  projectApiKey: process.env.LAMBDADB_PROJECT_API_KEY ?? "<YOUR_PROJECT_API_KEY>",
@@ -24,8 +28,10 @@ async function main() {
24
28
  const meta = await collection.get();
25
29
  console.log("Collection:", meta);
26
30
 
27
- // List documents (no collectionName in the call)
28
- const { docs, total, nextPageToken } = await collection.docs.list({ size: 10 });
31
+ // List documents (no collectionName in the call); use public types for params and result
32
+ const listParams: ListDocsInput = { size: 10 };
33
+ const listResult: ListDocsResponse = await collection.docs.list(listParams);
34
+ const { docs, total, nextPageToken } = listResult;
29
35
  console.log(`Documents: ${docs.length} of ${total}`, nextPageToken ? "(has more)" : "");
30
36
  }
31
37
 
@@ -8,14 +8,17 @@ dotenv.config();
8
8
  * npm run build && npx tsx collectionsList.example.ts
9
9
  */
10
10
 
11
- import { LambdaDBClient } from "@functional-systems/lambdadb";
11
+ import {
12
+ LambdaDBClient,
13
+ type ListCollectionsResponse,
14
+ } from "@functional-systems/lambdadb";
12
15
 
13
16
  const client = new LambdaDBClient({
14
17
  projectApiKey: process.env.LAMBDADB_PROJECT_API_KEY ?? "<YOUR_PROJECT_API_KEY>",
15
18
  });
16
19
 
17
20
  async function main() {
18
- const result = await client.listCollections();
21
+ const result: ListCollectionsResponse = await client.listCollections();
19
22
  console.log(result);
20
23
  }
21
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functional-systems/lambdadb",
3
- "version": "0.3.0-dev.2",
3
+ "version": "0.3.0-dev.3",
4
4
  "author": "Functional Systems, Inc.",
5
5
  "homepage": "https://github.com/lambdadb/lambdadb-typescript-client#readme",
6
6
  "license": "Apache-2.0",