@functional-systems/lambdadb 0.3.0 → 0.3.2
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/FUNCTIONS.md +1 -1
- package/README.md +22 -7
- package/dist/commonjs/client.d.ts +28 -9
- package/dist/commonjs/client.d.ts.map +1 -1
- package/dist/commonjs/client.js +71 -12
- package/dist/commonjs/client.js.map +1 -1
- package/dist/commonjs/funcs/collectionsList.d.ts +1 -1
- package/dist/commonjs/funcs/collectionsList.d.ts.map +1 -1
- package/dist/commonjs/funcs/collectionsList.js +9 -3
- package/dist/commonjs/funcs/collectionsList.js.map +1 -1
- package/dist/commonjs/models/collectionresponse.d.ts +12 -0
- package/dist/commonjs/models/collectionresponse.d.ts.map +1 -1
- package/dist/commonjs/models/collectionresponse.js +3 -0
- package/dist/commonjs/models/collectionresponse.js.map +1 -1
- package/dist/commonjs/models/operations/listcollections.d.ts +19 -0
- package/dist/commonjs/models/operations/listcollections.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listcollections.js +7 -1
- package/dist/commonjs/models/operations/listcollections.js.map +1 -1
- package/dist/commonjs/models/operations/listdocs.d.ts +17 -3
- package/dist/commonjs/models/operations/listdocs.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listdocs.js +9 -2
- package/dist/commonjs/models/operations/listdocs.js.map +1 -1
- package/dist/commonjs/sdk/collections.d.ts +1 -1
- package/dist/commonjs/sdk/collections.d.ts.map +1 -1
- package/dist/commonjs/sdk/collections.js +2 -2
- package/dist/commonjs/sdk/collections.js.map +1 -1
- package/dist/commonjs/types/public.d.ts +38 -1
- package/dist/commonjs/types/public.d.ts.map +1 -1
- package/dist/commonjs/types/public.js +30 -0
- package/dist/commonjs/types/public.js.map +1 -1
- package/dist/esm/client.d.ts +28 -9
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +71 -12
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/funcs/collectionsList.d.ts +1 -1
- package/dist/esm/funcs/collectionsList.d.ts.map +1 -1
- package/dist/esm/funcs/collectionsList.js +9 -3
- package/dist/esm/funcs/collectionsList.js.map +1 -1
- package/dist/esm/models/collectionresponse.d.ts +12 -0
- package/dist/esm/models/collectionresponse.d.ts.map +1 -1
- package/dist/esm/models/collectionresponse.js +3 -0
- package/dist/esm/models/collectionresponse.js.map +1 -1
- package/dist/esm/models/operations/listcollections.d.ts +19 -0
- package/dist/esm/models/operations/listcollections.d.ts.map +1 -1
- package/dist/esm/models/operations/listcollections.js +6 -0
- package/dist/esm/models/operations/listcollections.js.map +1 -1
- package/dist/esm/models/operations/listdocs.d.ts +17 -3
- package/dist/esm/models/operations/listdocs.d.ts.map +1 -1
- package/dist/esm/models/operations/listdocs.js +8 -1
- package/dist/esm/models/operations/listdocs.js.map +1 -1
- package/dist/esm/sdk/collections.d.ts +1 -1
- package/dist/esm/sdk/collections.d.ts.map +1 -1
- package/dist/esm/sdk/collections.js +2 -2
- package/dist/esm/sdk/collections.js.map +1 -1
- package/dist/esm/types/public.d.ts +38 -1
- package/dist/esm/types/public.d.ts.map +1 -1
- package/dist/esm/types/public.js +27 -1
- package/dist/esm/types/public.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +100 -24
- package/src/funcs/collectionsList.ts +10 -0
- package/src/models/collectionresponse.ts +15 -0
- package/src/models/operations/listcollections.ts +29 -0
- package/src/models/operations/listdocs.ts +27 -2
- package/src/sdk/collections.ts +2 -0
- package/src/types/public.ts +74 -1
|
@@ -2,11 +2,30 @@ import * as z from "zod/v3";
|
|
|
2
2
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
3
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
4
|
import * as models from "../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Request parameters for listing collections (pagination).
|
|
7
|
+
*/
|
|
8
|
+
export type ListCollectionsRequest = {
|
|
9
|
+
/**
|
|
10
|
+
* Max number of collections to return at once.
|
|
11
|
+
*/
|
|
12
|
+
size?: number | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Next page token.
|
|
15
|
+
*/
|
|
16
|
+
pageToken?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const ListCollectionsRequest$outboundSchema: z.ZodType<ListCollectionsRequest, z.ZodTypeDef, ListCollectionsRequest>;
|
|
5
20
|
/**
|
|
6
21
|
* A list of collections matched with a projectName.
|
|
7
22
|
*/
|
|
8
23
|
export type ListCollectionsResponse = {
|
|
9
24
|
collections: Array<models.CollectionResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Next page token.
|
|
27
|
+
*/
|
|
28
|
+
nextPageToken?: string | undefined;
|
|
10
29
|
};
|
|
11
30
|
/** @internal */
|
|
12
31
|
export declare const ListCollectionsResponse$inboundSchema: z.ZodType<ListCollectionsResponse, z.ZodTypeDef, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listcollections.d.ts","sourceRoot":"","sources":["../../../../src/models/operations/listcollections.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"listcollections.d.ts","sourceRoot":"","sources":["../../../../src/models/operations/listcollections.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,qCAAqC,EAAE,CAAC,CAAC,OAAO,CAC3D,sBAAsB,EACtB,CAAC,CAAC,UAAU,EACZ,sBAAsB,CAItB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAC9C;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,qCAAqC,EAAE,CAAC,CAAC,OAAO,CAC3D,uBAAuB,EACvB,CAAC,CAAC,UAAU,EACZ,OAAO,CAIP,CAAC;AAEH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,CAM9D"}
|
|
@@ -5,8 +5,14 @@ import * as z from "zod/v3";
|
|
|
5
5
|
import { safeParse } from "../../lib/schemas.js";
|
|
6
6
|
import * as models from "../index.js";
|
|
7
7
|
/** @internal */
|
|
8
|
+
export const ListCollectionsRequest$outboundSchema = z.object({
|
|
9
|
+
size: z.number().int().min(1).max(100).optional(),
|
|
10
|
+
pageToken: z.string().optional(),
|
|
11
|
+
});
|
|
12
|
+
/** @internal */
|
|
8
13
|
export const ListCollectionsResponse$inboundSchema = z.object({
|
|
9
14
|
collections: z.array(models.CollectionResponse$inboundSchema),
|
|
15
|
+
nextPageToken: z.string().optional(),
|
|
10
16
|
});
|
|
11
17
|
export function listCollectionsResponseFromJSON(jsonString) {
|
|
12
18
|
return safeParse(jsonString, (x) => ListCollectionsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListCollectionsResponse' from JSON`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listcollections.js","sourceRoot":"","sources":["../../../../src/models/operations/listcollections.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"listcollections.js","sourceRoot":"","sources":["../../../../src/models/operations/listcollections.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAgBtC,gBAAgB;AAChB,MAAM,CAAC,MAAM,qCAAqC,GAI9C,CAAC,CAAC,MAAM,CAAC;IACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACjD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAaH,gBAAgB;AAChB,MAAM,CAAC,MAAM,qCAAqC,GAI9C,CAAC,CAAC,MAAM,CAAC;IACX,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,gCAAgC,CAAC;IAC7D,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAEH,MAAM,UAAU,+BAA+B,CAC7C,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,qCAAqC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACjE,qDAAqD,CACtD,CAAC;AACJ,CAAC"}
|
|
@@ -15,6 +15,12 @@ export type ListDocsRequest = {
|
|
|
15
15
|
*/
|
|
16
16
|
pageToken?: string | undefined;
|
|
17
17
|
};
|
|
18
|
+
export type ListDocsDoc = {
|
|
19
|
+
collection: string;
|
|
20
|
+
doc: {
|
|
21
|
+
[k: string]: any;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
18
24
|
/**
|
|
19
25
|
* Documents list.
|
|
20
26
|
*/
|
|
@@ -23,10 +29,16 @@ export type ListDocsResponse = {
|
|
|
23
29
|
/**
|
|
24
30
|
* A list of documents.
|
|
25
31
|
*/
|
|
26
|
-
docs: Array<
|
|
27
|
-
[k: string]: any;
|
|
28
|
-
}>;
|
|
32
|
+
docs: Array<ListDocsDoc>;
|
|
29
33
|
nextPageToken?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the list of documents is included.
|
|
36
|
+
*/
|
|
37
|
+
isDocsInline: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Download URL for the list of documents.
|
|
40
|
+
*/
|
|
41
|
+
docsUrl?: string | undefined;
|
|
30
42
|
};
|
|
31
43
|
/** @internal */
|
|
32
44
|
export type ListDocsRequest$Outbound = {
|
|
@@ -38,6 +50,8 @@ export type ListDocsRequest$Outbound = {
|
|
|
38
50
|
export declare const ListDocsRequest$outboundSchema: z.ZodType<ListDocsRequest$Outbound, z.ZodTypeDef, ListDocsRequest>;
|
|
39
51
|
export declare function listDocsRequestToJSON(listDocsRequest: ListDocsRequest): string;
|
|
40
52
|
/** @internal */
|
|
53
|
+
export declare const ListDocsDoc$inboundSchema: z.ZodType<ListDocsDoc, z.ZodTypeDef, unknown>;
|
|
54
|
+
/** @internal */
|
|
41
55
|
export declare const ListDocsResponse$inboundSchema: z.ZodType<ListDocsResponse, z.ZodTypeDef, unknown>;
|
|
42
56
|
export declare function listDocsResponseFromJSON(jsonString: string): SafeParseResult<ListDocsResponse, SDKValidationError>;
|
|
43
57
|
//# sourceMappingURL=listdocs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listdocs.d.ts","sourceRoot":"","sources":["../../../../src/models/operations/listdocs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC
|
|
1
|
+
{"version":3,"file":"listdocs.d.ts","sourceRoot":"","sources":["../../../../src/models/operations/listdocs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF,gBAAgB;AAChB,MAAM,MAAM,wBAAwB,GAAG;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,8BAA8B,EAAE,CAAC,CAAC,OAAO,CACpD,wBAAwB,EACxB,CAAC,CAAC,UAAU,EACZ,eAAe,CAKf,CAAC;AAEH,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,eAAe,GAC/B,MAAM,CAER;AAED,gBAAgB;AAChB,eAAO,MAAM,yBAAyB,EAAE,CAAC,CAAC,OAAO,CAC/C,WAAW,EACX,CAAC,CAAC,UAAU,EACZ,OAAO,CAIP,CAAC;AAEH,gBAAgB;AAChB,eAAO,MAAM,8BAA8B,EAAE,CAAC,CAAC,OAAO,CACpD,gBAAgB,EAChB,CAAC,CAAC,UAAU,EACZ,OAAO,CAOP,CAAC;AAEH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAMvD"}
|
|
@@ -13,10 +13,17 @@ export function listDocsRequestToJSON(listDocsRequest) {
|
|
|
13
13
|
return JSON.stringify(ListDocsRequest$outboundSchema.parse(listDocsRequest));
|
|
14
14
|
}
|
|
15
15
|
/** @internal */
|
|
16
|
+
export const ListDocsDoc$inboundSchema = z.object({
|
|
17
|
+
collection: z.string(),
|
|
18
|
+
doc: z.record(z.any()),
|
|
19
|
+
});
|
|
20
|
+
/** @internal */
|
|
16
21
|
export const ListDocsResponse$inboundSchema = z.object({
|
|
17
22
|
total: z.number().int(),
|
|
18
|
-
docs: z.array(
|
|
23
|
+
docs: z.array(ListDocsDoc$inboundSchema),
|
|
19
24
|
nextPageToken: z.string().optional(),
|
|
25
|
+
isDocsInline: z.boolean(),
|
|
26
|
+
docsUrl: z.string().optional(),
|
|
20
27
|
});
|
|
21
28
|
export function listDocsResponseFromJSON(jsonString) {
|
|
22
29
|
return safeParse(jsonString, (x) => ListDocsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDocsResponse' from JSON`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listdocs.js","sourceRoot":"","sources":["../../../../src/models/operations/listdocs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"listdocs.js","sourceRoot":"","sources":["../../../../src/models/operations/listdocs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAmDjD,gBAAgB;AAChB,MAAM,CAAC,MAAM,8BAA8B,GAIvC,CAAC,CAAC,MAAM,CAAC;IACX,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAEH,MAAM,UAAU,qBAAqB,CACnC,eAAgC;IAEhC,OAAO,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAIlC,CAAC,CAAC,MAAM,CAAC;IACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;CACvB,CAAC,CAAC;AAEH,gBAAgB;AAChB,MAAM,CAAC,MAAM,8BAA8B,GAIvC,CAAC,CAAC,MAAM,CAAC;IACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACvB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,yBAAyB,CAAC;IACxC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,UAAU,wBAAwB,CACtC,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,8BAA8B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAC1D,8CAA8C,CAC/C,CAAC;AACJ,CAAC"}
|
|
@@ -11,7 +11,7 @@ export declare class Collections extends ClientSDK {
|
|
|
11
11
|
/**
|
|
12
12
|
* List all collections in an existing project.
|
|
13
13
|
*/
|
|
14
|
-
list(options?: RequestOptions): Promise<operations.ListCollectionsResponse>;
|
|
14
|
+
list(request?: operations.ListCollectionsRequest, options?: RequestOptions): Promise<operations.ListCollectionsResponse>;
|
|
15
15
|
/**
|
|
16
16
|
* Create a collection.
|
|
17
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/sdk/collections.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,qBAAa,WAAY,SAAQ,SAAS;IACxC,OAAO,CAAC,KAAK,CAAC,CAAO;IACrB,IAAI,IAAI,IAAI,IAAI,CAEf;IAED;;OAEG;IACG,IAAI,CACR,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/sdk/collections.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,qBAAa,WAAY,SAAQ,SAAS;IACxC,OAAO,CAAC,KAAK,CAAC,CAAO;IACrB,IAAI,IAAI,IAAI,IAAI,CAEf;IAED;;OAEG;IACG,IAAI,CACR,OAAO,CAAC,EAAE,UAAU,CAAC,sBAAsB,EAC3C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,uBAAuB,CAAC;IAQ9C;;OAEG;IACG,MAAM,CACV,OAAO,EAAE,UAAU,CAAC,uBAAuB,EAC3C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,wBAAwB,CAAC;IAQ/C;;OAEG;IACG,MAAM,CACV,OAAO,EAAE,UAAU,CAAC,uBAAuB,EAC3C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC;IAQlC;;OAEG;IACG,GAAG,CACP,OAAO,EAAE,UAAU,CAAC,oBAAoB,EACxC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC;IAQ5C;;OAEG;IACG,MAAM,CACV,OAAO,EAAE,UAAU,CAAC,uBAAuB,EAC3C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,wBAAwB,CAAC;IAQ/C;;OAEG;IACG,KAAK,CACT,OAAO,EAAE,UAAU,CAAC,sBAAsB,EAC1C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,uBAAuB,CAAC;CAO/C"}
|
|
@@ -20,8 +20,8 @@ export class Collections extends ClientSDK {
|
|
|
20
20
|
/**
|
|
21
21
|
* List all collections in an existing project.
|
|
22
22
|
*/
|
|
23
|
-
async list(options) {
|
|
24
|
-
return unwrapAsync(collectionsList(this, options));
|
|
23
|
+
async list(request, options) {
|
|
24
|
+
return unwrapAsync(collectionsList(this, request, options));
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Create a collection.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../../src/sdk/collections.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAA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AwC,EACxC,OAAwB;QAExB,OAAO,WAAW,CAAC,cAAc,CAC/B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,OAA2C,EAC3C,OAAwB;QAExB,OAAO,WAAW,CAAC,iBAAiB,CAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK,CACT,OAA0C,EAC1C,OAAwB;QAExB,OAAO,WAAW,CAAC,gBAAgB,CACjC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -11,16 +11,53 @@ export type { DeleteDocsRequestBody as DeleteDocsInput } from "../models/operati
|
|
|
11
11
|
export type { FetchDocsRequestBody as FetchDocsInput } from "../models/operations/fetchdocs.js";
|
|
12
12
|
export type { BulkUpsertDocsRequestBody as BulkUpsertInput } from "../models/operations/bulkupsertdocs.js";
|
|
13
13
|
import type { ListDocsRequest } from "../models/operations/listdocs.js";
|
|
14
|
+
import type { ListCollectionsRequest } from "../models/operations/listcollections.js";
|
|
14
15
|
/** Parameters for listing documents (size, pageToken). */
|
|
15
16
|
export type ListDocsInput = Pick<ListDocsRequest, "size" | "pageToken">;
|
|
17
|
+
/** Parameters for listing collections (size, pageToken). */
|
|
18
|
+
export type ListCollectionsInput = Pick<ListCollectionsRequest, "size" | "pageToken">;
|
|
16
19
|
export type { ListCollectionsResponse } from "../models/operations/listcollections.js";
|
|
17
20
|
export type { CreateCollectionResponse } from "../models/operations/createcollection.js";
|
|
18
21
|
export type { GetCollectionResponse } from "../models/operations/getcollection.js";
|
|
19
22
|
export type { UpdateCollectionResponse } from "../models/operations/updatecollection.js";
|
|
20
23
|
export type { QueryCollectionResponse, QueryCollectionDoc, } from "../models/operations/querycollection.js";
|
|
21
|
-
export type { ListDocsResponse } from "../models/operations/listdocs.js";
|
|
24
|
+
export type { ListDocsResponse, ListDocsDoc, } from "../models/operations/listdocs.js";
|
|
22
25
|
export type { MessageResponse } from "../models/index.js";
|
|
23
26
|
export type { FetchDocsResponse, FetchDocsDoc, } from "../models/operations/fetchdocs.js";
|
|
24
27
|
export type { GetBulkUpsertDocsResponse } from "../models/operations/getbulkupsertdocs.js";
|
|
25
28
|
export type { IndexConfigsUnion, PartitionConfig, PartitionFilter, FieldsSelectorUnion, CollectionResponse, } from "../models/index.js";
|
|
29
|
+
import type { CollectionResponse as CollectionResponseModel } from "../models/index.js";
|
|
30
|
+
/**
|
|
31
|
+
* Collection response with timestamp fields as Date (for better DX).
|
|
32
|
+
* Use {@link collectionResponseWithDates} to convert API response.
|
|
33
|
+
*/
|
|
34
|
+
export type CollectionResponseWithDates = Omit<CollectionResponseModel, "createdAt" | "updatedAt" | "dataUpdatedAt"> & {
|
|
35
|
+
createdAt?: Date | undefined;
|
|
36
|
+
updatedAt?: Date | undefined;
|
|
37
|
+
dataUpdatedAt?: Date | undefined;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* List collections response with timestamp fields as Date.
|
|
41
|
+
*/
|
|
42
|
+
export type ListCollectionsResponseWithDates = {
|
|
43
|
+
collections: CollectionResponseWithDates[];
|
|
44
|
+
nextPageToken?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Converts Unix-second timestamp fields to Date. Safe to call on partial responses.
|
|
48
|
+
*/
|
|
49
|
+
export declare function collectionResponseWithDates(c: CollectionResponseModel): CollectionResponseWithDates;
|
|
50
|
+
/** Converts ListCollectionsResponse to use Date for timestamp fields. */
|
|
51
|
+
export declare function listCollectionsResponseWithDates(res: {
|
|
52
|
+
collections: CollectionResponseModel[];
|
|
53
|
+
nextPageToken?: string | undefined;
|
|
54
|
+
}): ListCollectionsResponseWithDates;
|
|
55
|
+
/** Get collection response with timestamp fields as Date. */
|
|
56
|
+
export type GetCollectionResponseWithDates = {
|
|
57
|
+
collection: CollectionResponseWithDates;
|
|
58
|
+
};
|
|
59
|
+
/** Converts GetCollectionResponse to use Date for timestamp fields. */
|
|
60
|
+
export declare function getCollectionResponseWithDates(res: {
|
|
61
|
+
collection: CollectionResponseModel;
|
|
62
|
+
}): GetCollectionResponseWithDates;
|
|
26
63
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +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;
|
|
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,EA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O,KAAK,EAAE,kBAAkB,IAAI,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAExF;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,uBAAuB,EACvB,WAAW,GAAG,WAAW,GAAG,eAAe,CAC5C,GAAG;IACF,SAAS,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC7B,aAAa,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,WAAW,EAAE,2BAA2B,EAAE,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,CAAC,EAAE,uBAAuB,GACzB,2BAA2B,CAQ7B;AAED,yEAAyE;AACzE,wBAAgB,gCAAgC,CAAC,GAAG,EAAE;IACpD,WAAW,EAAE,uBAAuB,EAAE,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,GAAG,gCAAgC,CAMnC;AAED,6DAA6D;AAC7D,MAAM,MAAM,8BAA8B,GAAG;IAC3C,UAAU,EAAE,2BAA2B,CAAC;CACzC,CAAC;AAEF,uEAAuE;AACvE,wBAAgB,8BAA8B,CAAC,GAAG,EAAE;IAClD,UAAU,EAAE,uBAAuB,CAAC;CACrC,GAAG,8BAA8B,CAEjC"}
|
package/dist/esm/types/public.js
CHANGED
|
@@ -2,5 +2,31 @@
|
|
|
2
2
|
* Public API types for the collection-scoped client.
|
|
3
3
|
* Only request-body–level inputs and method return types are exposed.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Converts Unix-second timestamp fields to Date. Safe to call on partial responses.
|
|
7
|
+
*/
|
|
8
|
+
export function collectionResponseWithDates(c) {
|
|
9
|
+
const { createdAt, updatedAt, dataUpdatedAt, ...rest } = c;
|
|
10
|
+
const out = { ...rest };
|
|
11
|
+
if (createdAt != null)
|
|
12
|
+
out.createdAt = new Date(createdAt * 1000);
|
|
13
|
+
if (updatedAt != null)
|
|
14
|
+
out.updatedAt = new Date(updatedAt * 1000);
|
|
15
|
+
if (dataUpdatedAt != null)
|
|
16
|
+
out.dataUpdatedAt = new Date(dataUpdatedAt * 1000);
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
/** Converts ListCollectionsResponse to use Date for timestamp fields. */
|
|
20
|
+
export function listCollectionsResponseWithDates(res) {
|
|
21
|
+
const out = {
|
|
22
|
+
collections: res.collections.map(collectionResponseWithDates),
|
|
23
|
+
};
|
|
24
|
+
if (res.nextPageToken !== undefined)
|
|
25
|
+
out.nextPageToken = res.nextPageToken;
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
/** Converts GetCollectionResponse to use Date for timestamp fields. */
|
|
29
|
+
export function getCollectionResponseWithDates(res) {
|
|
30
|
+
return { collection: collectionResponseWithDates(res.collection) };
|
|
31
|
+
}
|
|
6
32
|
//# sourceMappingURL=public.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/types/public.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/types/public.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6EH;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,CAA0B;IAE1B,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3D,MAAM,GAAG,GAAgC,EAAE,GAAG,IAAI,EAAE,CAAC;IACrD,IAAI,SAAS,IAAI,IAAI;QAAE,GAAG,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAClE,IAAI,SAAS,IAAI,IAAI;QAAE,GAAG,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAClE,IAAI,aAAa,IAAI,IAAI;QACvB,GAAG,CAAC,aAAa,GAAG,IAAI,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACrD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,gCAAgC,CAAC,GAGhD;IACC,MAAM,GAAG,GAAqC;QAC5C,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,2BAA2B,CAAC;KAC9D,CAAC;IACF,IAAI,GAAG,CAAC,aAAa,KAAK,SAAS;QAAE,GAAG,CAAC,aAAa,GAAG,GAAG,CAAC,aAAa,CAAC;IAC3E,OAAO,GAAG,CAAC;AACb,CAAC;AAOD,uEAAuE;AACvE,MAAM,UAAU,8BAA8B,CAAC,GAE9C;IACC,OAAO,EAAE,UAAU,EAAE,2BAA2B,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;AACrE,CAAC"}
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -30,14 +30,20 @@ import { unwrapAsync, OK, ERR } from "./types/fp.js";
|
|
|
30
30
|
import type { Result } from "./types/fp.js";
|
|
31
31
|
import type * as operations from "./models/operations/index.js";
|
|
32
32
|
import type * as models from "./models/index.js";
|
|
33
|
-
import
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
import {
|
|
34
|
+
listCollectionsResponseWithDates,
|
|
35
|
+
getCollectionResponseWithDates,
|
|
36
|
+
type CreateCollectionInput,
|
|
37
|
+
type UpdateCollectionInput,
|
|
38
|
+
type QueryCollectionInput,
|
|
39
|
+
type QueryCollectionResponse,
|
|
40
|
+
type QueryCollectionDoc,
|
|
41
|
+
type ListDocsInput,
|
|
42
|
+
type ListDocsResponse,
|
|
43
|
+
type ListDocsDoc,
|
|
44
|
+
type ListCollectionsInput,
|
|
45
|
+
type ListCollectionsResponseWithDates,
|
|
46
|
+
type GetCollectionResponseWithDates,
|
|
41
47
|
UpsertDocsInput,
|
|
42
48
|
UpdateDocsInput,
|
|
43
49
|
DeleteDocsInput,
|
|
@@ -46,9 +52,7 @@ import type {
|
|
|
46
52
|
FetchDocsDoc,
|
|
47
53
|
BulkUpsertInput,
|
|
48
54
|
MessageResponse,
|
|
49
|
-
ListCollectionsResponse,
|
|
50
55
|
CreateCollectionResponse,
|
|
51
|
-
GetCollectionResponse,
|
|
52
56
|
UpdateCollectionResponse,
|
|
53
57
|
GetBulkUpsertDocsResponse,
|
|
54
58
|
} from "./types/public.js";
|
|
@@ -155,19 +159,66 @@ export class LambdaDBClient extends LambdaDBCore {
|
|
|
155
159
|
}
|
|
156
160
|
|
|
157
161
|
/**
|
|
158
|
-
* List
|
|
162
|
+
* List collections in the project (with optional pagination). Timestamp fields are returned as Date.
|
|
159
163
|
*/
|
|
160
|
-
async listCollections(
|
|
161
|
-
|
|
164
|
+
async listCollections(
|
|
165
|
+
params?: ListCollectionsInput,
|
|
166
|
+
options?: RequestOptions,
|
|
167
|
+
): Promise<ListCollectionsResponseWithDates> {
|
|
168
|
+
const res = await unwrapAsync(collectionsList(this, params, options));
|
|
169
|
+
return listCollectionsResponseWithDates(res);
|
|
162
170
|
}
|
|
163
171
|
|
|
164
172
|
/**
|
|
165
|
-
* List
|
|
173
|
+
* List collections (Safe: returns Result instead of throwing). Timestamp fields are Date.
|
|
166
174
|
*/
|
|
167
175
|
async listCollectionsSafe(
|
|
176
|
+
params?: ListCollectionsInput,
|
|
177
|
+
options?: RequestOptions,
|
|
178
|
+
): Promise<Result<ListCollectionsResponseWithDates, ListCollectionsError>> {
|
|
179
|
+
const result = await collectionsList(this, params, options);
|
|
180
|
+
if (!result.ok) return result;
|
|
181
|
+
return OK(listCollectionsResponseWithDates(result.value));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Iterate over all pages of collections. Yields one page per API response.
|
|
186
|
+
* Use this to process many collections without loading everything into memory.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* for await (const page of client.listCollectionsPages({ size: 20 })) {
|
|
190
|
+
* console.log(page.collections.length, page.nextPageToken ?? "last page");
|
|
191
|
+
* }
|
|
192
|
+
*/
|
|
193
|
+
async *listCollectionsPages(
|
|
194
|
+
params?: ListCollectionsInput,
|
|
195
|
+
options?: RequestOptions,
|
|
196
|
+
): AsyncGenerator<ListCollectionsResponseWithDates> {
|
|
197
|
+
let pageToken: string | undefined = params?.pageToken;
|
|
198
|
+
const baseParams: ListCollectionsInput = { size: params?.size, pageToken };
|
|
199
|
+
while (true) {
|
|
200
|
+
const page = await this.listCollections(
|
|
201
|
+
{ ...baseParams, pageToken } as ListCollectionsInput,
|
|
202
|
+
options,
|
|
203
|
+
);
|
|
204
|
+
yield page;
|
|
205
|
+
pageToken = page.nextPageToken;
|
|
206
|
+
if (pageToken == null || pageToken === "") break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Fetch all collections across pages and return a single list. Uses listCollectionsPages internally.
|
|
212
|
+
*/
|
|
213
|
+
async listAllCollections(
|
|
214
|
+
params?: ListCollectionsInput,
|
|
168
215
|
options?: RequestOptions,
|
|
169
|
-
): Promise<
|
|
170
|
-
|
|
216
|
+
): Promise<{ collections: ListCollectionsResponseWithDates["collections"] }> {
|
|
217
|
+
const collections: ListCollectionsResponseWithDates["collections"] = [];
|
|
218
|
+
for await (const page of this.listCollectionsPages(params, options)) {
|
|
219
|
+
collections.push(...page.collections);
|
|
220
|
+
}
|
|
221
|
+
return { collections };
|
|
171
222
|
}
|
|
172
223
|
|
|
173
224
|
/**
|
|
@@ -201,21 +252,28 @@ export class CollectionHandle {
|
|
|
201
252
|
) {}
|
|
202
253
|
|
|
203
254
|
/**
|
|
204
|
-
* Get metadata of this collection.
|
|
255
|
+
* Get metadata of this collection. Timestamp fields are returned as Date.
|
|
205
256
|
*/
|
|
206
|
-
async get(options?: RequestOptions) {
|
|
207
|
-
|
|
257
|
+
async get(options?: RequestOptions): Promise<GetCollectionResponseWithDates> {
|
|
258
|
+
const res = await unwrapAsync(
|
|
208
259
|
collectionsGet(this.client, { collectionName: this.collectionName }, options),
|
|
209
260
|
);
|
|
261
|
+
return getCollectionResponseWithDates(res);
|
|
210
262
|
}
|
|
211
263
|
|
|
212
264
|
/**
|
|
213
|
-
* Get metadata of this collection (Safe: returns Result instead of throwing).
|
|
265
|
+
* Get metadata of this collection (Safe: returns Result instead of throwing). Timestamp fields are Date.
|
|
214
266
|
*/
|
|
215
267
|
async getSafe(
|
|
216
268
|
options?: RequestOptions,
|
|
217
|
-
): Promise<Result<
|
|
218
|
-
|
|
269
|
+
): Promise<Result<GetCollectionResponseWithDates, GetCollectionError>> {
|
|
270
|
+
const result = await collectionsGet(
|
|
271
|
+
this.client,
|
|
272
|
+
{ collectionName: this.collectionName },
|
|
273
|
+
options,
|
|
274
|
+
);
|
|
275
|
+
if (!result.ok) return result;
|
|
276
|
+
return OK(getCollectionResponseWithDates(result.value));
|
|
219
277
|
}
|
|
220
278
|
|
|
221
279
|
/**
|
|
@@ -344,32 +402,50 @@ class CollectionDocs {
|
|
|
344
402
|
|
|
345
403
|
/**
|
|
346
404
|
* List documents in the collection.
|
|
405
|
+
* When the API returns docs via docsUrl (isDocsInline false), documents are
|
|
406
|
+
* fetched from the presigned URL automatically so the response always has docs.
|
|
347
407
|
*/
|
|
348
408
|
async list(
|
|
349
409
|
params?: ListDocsInput,
|
|
350
410
|
options?: RequestOptions,
|
|
351
411
|
) {
|
|
352
|
-
|
|
412
|
+
const result = await unwrapAsync(
|
|
353
413
|
collectionsDocsListDocs(
|
|
354
414
|
this.client,
|
|
355
415
|
{ collectionName: this.collectionName, ...params },
|
|
356
416
|
options,
|
|
357
417
|
),
|
|
358
418
|
);
|
|
419
|
+
if (!result.isDocsInline && result.docsUrl) {
|
|
420
|
+
const docs = await fetchDocsFromUrl<ListDocsDoc>(result.docsUrl);
|
|
421
|
+
return { ...result, docs, isDocsInline: true };
|
|
422
|
+
}
|
|
423
|
+
return result;
|
|
359
424
|
}
|
|
360
425
|
|
|
361
426
|
/**
|
|
362
427
|
* List documents in the collection (Safe: returns Result instead of throwing).
|
|
428
|
+
* When the API returns docs via docsUrl, documents are fetched from the presigned URL automatically.
|
|
363
429
|
*/
|
|
364
430
|
async listSafe(
|
|
365
431
|
params?: ListDocsInput,
|
|
366
432
|
options?: RequestOptions,
|
|
367
433
|
): Promise<Result<ListDocsResponse, ListDocsError>> {
|
|
368
|
-
|
|
434
|
+
const result = await collectionsDocsListDocs(
|
|
369
435
|
this.client,
|
|
370
436
|
{ collectionName: this.collectionName, ...params },
|
|
371
437
|
options,
|
|
372
438
|
);
|
|
439
|
+
if (!result.ok) return result;
|
|
440
|
+
if (!result.value.isDocsInline && result.value.docsUrl) {
|
|
441
|
+
try {
|
|
442
|
+
const docs = await fetchDocsFromUrl<ListDocsDoc>(result.value.docsUrl);
|
|
443
|
+
return OK({ ...result.value, docs, isDocsInline: true });
|
|
444
|
+
} catch (e) {
|
|
445
|
+
return ERR(e as ListDocsError);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return result;
|
|
373
449
|
}
|
|
374
450
|
|
|
375
451
|
/**
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { LambdaDBCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
6
7
|
import * as M from "../lib/matchers.js";
|
|
7
8
|
import { compactMap } from "../lib/primitives.js";
|
|
8
9
|
import { RequestOptions } from "../lib/sdks.js";
|
|
@@ -28,6 +29,7 @@ import { Result } from "../types/fp.js";
|
|
|
28
29
|
*/
|
|
29
30
|
export function collectionsList(
|
|
30
31
|
client: LambdaDBCore,
|
|
32
|
+
request?: operations.ListCollectionsRequest,
|
|
31
33
|
options?: RequestOptions,
|
|
32
34
|
): APIPromise<
|
|
33
35
|
Result<
|
|
@@ -48,12 +50,14 @@ export function collectionsList(
|
|
|
48
50
|
> {
|
|
49
51
|
return new APIPromise($do(
|
|
50
52
|
client,
|
|
53
|
+
request,
|
|
51
54
|
options,
|
|
52
55
|
));
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
async function $do(
|
|
56
59
|
client: LambdaDBCore,
|
|
60
|
+
request?: operations.ListCollectionsRequest,
|
|
57
61
|
options?: RequestOptions,
|
|
58
62
|
): Promise<
|
|
59
63
|
[
|
|
@@ -77,6 +81,11 @@ async function $do(
|
|
|
77
81
|
> {
|
|
78
82
|
const path = pathToFunc("/collections")();
|
|
79
83
|
|
|
84
|
+
const query = encodeFormQuery({
|
|
85
|
+
"pageToken": request?.pageToken,
|
|
86
|
+
"size": request?.size,
|
|
87
|
+
});
|
|
88
|
+
|
|
80
89
|
const headers = new Headers(compactMap({
|
|
81
90
|
Accept: "application/json",
|
|
82
91
|
}));
|
|
@@ -116,6 +125,7 @@ async function $do(
|
|
|
116
125
|
baseURL: options?.serverURL,
|
|
117
126
|
path: path,
|
|
118
127
|
headers: headers,
|
|
128
|
+
query: query,
|
|
119
129
|
userAgent: client._options.userAgent,
|
|
120
130
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
121
131
|
}, options);
|
|
@@ -51,6 +51,18 @@ export type CollectionResponse = {
|
|
|
51
51
|
* Status
|
|
52
52
|
*/
|
|
53
53
|
collectionStatus: Status;
|
|
54
|
+
/**
|
|
55
|
+
* Collection creation time in seconds since the Unix epoch.
|
|
56
|
+
*/
|
|
57
|
+
createdAt: number;
|
|
58
|
+
/**
|
|
59
|
+
* Collection last update time in seconds since the Unix epoch.
|
|
60
|
+
*/
|
|
61
|
+
updatedAt: number;
|
|
62
|
+
/**
|
|
63
|
+
* Collection data last update time in seconds since the Unix epoch.
|
|
64
|
+
*/
|
|
65
|
+
dataUpdatedAt: number;
|
|
54
66
|
};
|
|
55
67
|
|
|
56
68
|
/** @internal */
|
|
@@ -69,6 +81,9 @@ export const CollectionResponse$inboundSchema: z.ZodType<
|
|
|
69
81
|
sourceCollectionName: z.string().optional(),
|
|
70
82
|
sourceCollectionVersionId: z.string().optional(),
|
|
71
83
|
collectionStatus: Status$inboundSchema,
|
|
84
|
+
createdAt: z.number().int(),
|
|
85
|
+
updatedAt: z.number().int(),
|
|
86
|
+
dataUpdatedAt: z.number().int(),
|
|
72
87
|
});
|
|
73
88
|
|
|
74
89
|
export function collectionResponseFromJSON(
|
|
@@ -8,11 +8,39 @@ import { Result as SafeParseResult } from "../../types/fp.js";
|
|
|
8
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
9
|
import * as models from "../index.js";
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Request parameters for listing collections (pagination).
|
|
13
|
+
*/
|
|
14
|
+
export type ListCollectionsRequest = {
|
|
15
|
+
/**
|
|
16
|
+
* Max number of collections to return at once.
|
|
17
|
+
*/
|
|
18
|
+
size?: number | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Next page token.
|
|
21
|
+
*/
|
|
22
|
+
pageToken?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const ListCollectionsRequest$outboundSchema: z.ZodType<
|
|
27
|
+
ListCollectionsRequest,
|
|
28
|
+
z.ZodTypeDef,
|
|
29
|
+
ListCollectionsRequest
|
|
30
|
+
> = z.object({
|
|
31
|
+
size: z.number().int().min(1).max(100).optional(),
|
|
32
|
+
pageToken: z.string().optional(),
|
|
33
|
+
});
|
|
34
|
+
|
|
11
35
|
/**
|
|
12
36
|
* A list of collections matched with a projectName.
|
|
13
37
|
*/
|
|
14
38
|
export type ListCollectionsResponse = {
|
|
15
39
|
collections: Array<models.CollectionResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Next page token.
|
|
42
|
+
*/
|
|
43
|
+
nextPageToken?: string | undefined;
|
|
16
44
|
};
|
|
17
45
|
|
|
18
46
|
/** @internal */
|
|
@@ -22,6 +50,7 @@ export const ListCollectionsResponse$inboundSchema: z.ZodType<
|
|
|
22
50
|
unknown
|
|
23
51
|
> = z.object({
|
|
24
52
|
collections: z.array(models.CollectionResponse$inboundSchema),
|
|
53
|
+
nextPageToken: z.string().optional(),
|
|
25
54
|
});
|
|
26
55
|
|
|
27
56
|
export function listCollectionsResponseFromJSON(
|