@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.
- package/CHANGELOG.md +71 -0
- package/FUNCTIONS.md +7 -2
- package/README.md +60 -2
- package/RUNTIMES.md +7 -0
- package/USAGE.md +20 -0
- package/dist/commonjs/client.d.ts +25 -10
- package/dist/commonjs/client.d.ts.map +1 -1
- package/dist/commonjs/client.js +182 -56
- package/dist/commonjs/client.js.map +1 -1
- package/dist/commonjs/compat/qdrant/client.d.ts +3 -6
- package/dist/commonjs/compat/qdrant/client.d.ts.map +1 -1
- package/dist/commonjs/compat/qdrant/client.js +17 -11
- package/dist/commonjs/compat/qdrant/client.js.map +1 -1
- package/dist/commonjs/funcs/collectionsCreate.js +1 -1
- package/dist/commonjs/funcs/collectionsDelete.js +1 -1
- package/dist/commonjs/funcs/collectionsDocsGetBulkUpsert.js +4 -0
- package/dist/commonjs/funcs/collectionsDocsGetBulkUpsert.js.map +1 -1
- package/dist/commonjs/funcs/collectionsDocsListDocs.js +2 -0
- package/dist/commonjs/funcs/collectionsDocsListDocs.js.map +1 -1
- package/dist/commonjs/index.d.ts +4 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +15 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/lib/queryInput.d.ts +3 -11
- package/dist/commonjs/lib/queryInput.d.ts.map +1 -1
- package/dist/commonjs/lib/queryInput.js.map +1 -1
- package/dist/commonjs/models/collectionresponse.d.ts +12 -21
- package/dist/commonjs/models/collectionresponse.d.ts.map +1 -1
- package/dist/commonjs/models/collectionresponse.js +5 -6
- package/dist/commonjs/models/collectionresponse.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +1 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +1 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/operations/bulkupsertdocs.d.ts +6 -0
- package/dist/commonjs/models/operations/bulkupsertdocs.d.ts.map +1 -1
- package/dist/commonjs/models/operations/bulkupsertdocs.js +2 -0
- package/dist/commonjs/models/operations/bulkupsertdocs.js.map +1 -1
- package/dist/commonjs/models/operations/createcollection.d.ts +20 -13
- package/dist/commonjs/models/operations/createcollection.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createcollection.js +15 -7
- package/dist/commonjs/models/operations/createcollection.js.map +1 -1
- package/dist/commonjs/models/operations/deletedocs.d.ts +3 -0
- package/dist/commonjs/models/operations/deletedocs.d.ts.map +1 -1
- package/dist/commonjs/models/operations/deletedocs.js +1 -0
- package/dist/commonjs/models/operations/deletedocs.js.map +1 -1
- package/dist/commonjs/models/operations/fetchdocs.d.ts +3 -0
- package/dist/commonjs/models/operations/fetchdocs.d.ts.map +1 -1
- package/dist/commonjs/models/operations/fetchdocs.js +9 -0
- package/dist/commonjs/models/operations/fetchdocs.js.map +1 -1
- package/dist/commonjs/models/operations/getbulkupsertdocs.d.ts +5 -0
- package/dist/commonjs/models/operations/getbulkupsertdocs.d.ts.map +1 -1
- package/dist/commonjs/models/operations/getbulkupsertdocs.js +5 -3
- package/dist/commonjs/models/operations/getbulkupsertdocs.js.map +1 -1
- package/dist/commonjs/models/operations/listdocs.d.ts +9 -0
- package/dist/commonjs/models/operations/listdocs.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listdocs.js +11 -0
- package/dist/commonjs/models/operations/listdocs.js.map +1 -1
- package/dist/commonjs/models/operations/querycollection.d.ts +3 -0
- package/dist/commonjs/models/operations/querycollection.d.ts.map +1 -1
- package/dist/commonjs/models/operations/querycollection.js +9 -0
- package/dist/commonjs/models/operations/querycollection.js.map +1 -1
- package/dist/commonjs/models/operations/updatecollection.d.ts +10 -4
- package/dist/commonjs/models/operations/updatecollection.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updatecollection.js +8 -1
- package/dist/commonjs/models/operations/updatecollection.js.map +1 -1
- package/dist/commonjs/models/operations/updatedocs.d.ts +3 -0
- package/dist/commonjs/models/operations/updatedocs.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updatedocs.js +1 -0
- package/dist/commonjs/models/operations/updatedocs.js.map +1 -1
- package/dist/commonjs/models/operations/upsertdocs.d.ts +3 -0
- package/dist/commonjs/models/operations/upsertdocs.d.ts.map +1 -1
- package/dist/commonjs/models/operations/upsertdocs.js +1 -0
- package/dist/commonjs/models/operations/upsertdocs.js.map +1 -1
- package/dist/commonjs/models/versioning.d.ts +100 -0
- package/dist/commonjs/models/versioning.d.ts.map +1 -0
- package/dist/commonjs/models/versioning.js +93 -0
- package/dist/commonjs/models/versioning.js.map +1 -0
- package/dist/commonjs/types/public.d.ts +80 -6
- package/dist/commonjs/types/public.d.ts.map +1 -1
- package/dist/commonjs/types/public.js +30 -7
- package/dist/commonjs/types/public.js.map +1 -1
- package/dist/commonjs/versioning.d.ts +63 -0
- package/dist/commonjs/versioning.d.ts.map +1 -0
- package/dist/commonjs/versioning.js +390 -0
- package/dist/commonjs/versioning.js.map +1 -0
- package/dist/esm/client.d.ts +25 -10
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +183 -58
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/compat/qdrant/client.d.ts +3 -6
- package/dist/esm/compat/qdrant/client.d.ts.map +1 -1
- package/dist/esm/compat/qdrant/client.js +17 -11
- package/dist/esm/compat/qdrant/client.js.map +1 -1
- package/dist/esm/funcs/collectionsCreate.js +1 -1
- package/dist/esm/funcs/collectionsDelete.js +1 -1
- package/dist/esm/funcs/collectionsDocsGetBulkUpsert.js +5 -1
- package/dist/esm/funcs/collectionsDocsGetBulkUpsert.js.map +1 -1
- package/dist/esm/funcs/collectionsDocsListDocs.js +2 -0
- package/dist/esm/funcs/collectionsDocsListDocs.js.map +1 -1
- package/dist/esm/index.d.ts +4 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/lib/queryInput.d.ts +3 -11
- package/dist/esm/lib/queryInput.d.ts.map +1 -1
- package/dist/esm/lib/queryInput.js.map +1 -1
- package/dist/esm/models/collectionresponse.d.ts +12 -21
- package/dist/esm/models/collectionresponse.d.ts.map +1 -1
- package/dist/esm/models/collectionresponse.js +5 -6
- package/dist/esm/models/collectionresponse.js.map +1 -1
- package/dist/esm/models/index.d.ts +1 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +1 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/operations/bulkupsertdocs.d.ts +6 -0
- package/dist/esm/models/operations/bulkupsertdocs.d.ts.map +1 -1
- package/dist/esm/models/operations/bulkupsertdocs.js +2 -0
- package/dist/esm/models/operations/bulkupsertdocs.js.map +1 -1
- package/dist/esm/models/operations/createcollection.d.ts +20 -13
- package/dist/esm/models/operations/createcollection.d.ts.map +1 -1
- package/dist/esm/models/operations/createcollection.js +15 -7
- package/dist/esm/models/operations/createcollection.js.map +1 -1
- package/dist/esm/models/operations/deletedocs.d.ts +3 -0
- package/dist/esm/models/operations/deletedocs.d.ts.map +1 -1
- package/dist/esm/models/operations/deletedocs.js +1 -0
- package/dist/esm/models/operations/deletedocs.js.map +1 -1
- package/dist/esm/models/operations/fetchdocs.d.ts +3 -0
- package/dist/esm/models/operations/fetchdocs.d.ts.map +1 -1
- package/dist/esm/models/operations/fetchdocs.js +9 -0
- package/dist/esm/models/operations/fetchdocs.js.map +1 -1
- package/dist/esm/models/operations/getbulkupsertdocs.d.ts +5 -0
- package/dist/esm/models/operations/getbulkupsertdocs.d.ts.map +1 -1
- package/dist/esm/models/operations/getbulkupsertdocs.js +6 -4
- package/dist/esm/models/operations/getbulkupsertdocs.js.map +1 -1
- package/dist/esm/models/operations/listdocs.d.ts +9 -0
- package/dist/esm/models/operations/listdocs.d.ts.map +1 -1
- package/dist/esm/models/operations/listdocs.js +11 -0
- package/dist/esm/models/operations/listdocs.js.map +1 -1
- package/dist/esm/models/operations/querycollection.d.ts +3 -0
- package/dist/esm/models/operations/querycollection.d.ts.map +1 -1
- package/dist/esm/models/operations/querycollection.js +9 -0
- package/dist/esm/models/operations/querycollection.js.map +1 -1
- package/dist/esm/models/operations/updatecollection.d.ts +10 -4
- package/dist/esm/models/operations/updatecollection.d.ts.map +1 -1
- package/dist/esm/models/operations/updatecollection.js +8 -1
- package/dist/esm/models/operations/updatecollection.js.map +1 -1
- package/dist/esm/models/operations/updatedocs.d.ts +3 -0
- package/dist/esm/models/operations/updatedocs.d.ts.map +1 -1
- package/dist/esm/models/operations/updatedocs.js +1 -0
- package/dist/esm/models/operations/updatedocs.js.map +1 -1
- package/dist/esm/models/operations/upsertdocs.d.ts +3 -0
- package/dist/esm/models/operations/upsertdocs.d.ts.map +1 -1
- package/dist/esm/models/operations/upsertdocs.js +1 -0
- package/dist/esm/models/operations/upsertdocs.js.map +1 -1
- package/dist/esm/models/versioning.d.ts +100 -0
- package/dist/esm/models/versioning.d.ts.map +1 -0
- package/dist/esm/models/versioning.js +57 -0
- package/dist/esm/models/versioning.js.map +1 -0
- package/dist/esm/types/public.d.ts +80 -6
- package/dist/esm/types/public.d.ts.map +1 -1
- package/dist/esm/types/public.js +26 -7
- package/dist/esm/types/public.js.map +1 -1
- package/dist/esm/versioning.d.ts +63 -0
- package/dist/esm/versioning.d.ts.map +1 -0
- package/dist/esm/versioning.js +344 -0
- package/dist/esm/versioning.js.map +1 -0
- package/jsr.json +3 -1
- package/package.json +14 -2
- package/src/client.ts +300 -61
- package/src/compat/qdrant/client.ts +28 -16
- package/src/funcs/collectionsCreate.ts +1 -1
- package/src/funcs/collectionsDelete.ts +1 -1
- package/src/funcs/collectionsDocsGetBulkUpsert.ts +6 -1
- package/src/funcs/collectionsDocsListDocs.ts +2 -0
- package/src/index.ts +17 -0
- package/src/lib/config.ts +2 -2
- package/src/lib/queryInput.ts +3 -10
- package/src/models/collectionresponse.ts +17 -26
- package/src/models/index.ts +1 -0
- package/src/models/operations/bulkupsertdocs.ts +8 -0
- package/src/models/operations/createcollection.ts +39 -18
- package/src/models/operations/deletedocs.ts +4 -0
- package/src/models/operations/fetchdocs.ts +12 -0
- package/src/models/operations/getbulkupsertdocs.ts +11 -4
- package/src/models/operations/listdocs.ts +20 -0
- package/src/models/operations/querycollection.ts +12 -0
- package/src/models/operations/updatecollection.ts +21 -3
- package/src/models/operations/updatedocs.ts +4 -0
- package/src/models/operations/upsertdocs.ts +4 -0
- package/src/models/versioning.ts +118 -0
- package/src/types/public.ts +127 -14
- package/src/versioning.ts +490 -0
- package/examples/collectionScoped.example.ts +0 -38
- package/examples/collectionsList.example.ts +0 -25
- package/examples/package-lock.json +0 -612
- package/examples/package.json +0 -18
- package/test/integration/qdrant-compat-external.test.mjs +0 -351
- package/test/integration/qdrant-compat-live.test.mjs +0 -122
- package/test/null-response.test.mjs +0 -73
- package/test/public-api.test.mjs +0 -540
- package/test/qdrant-compat.test.mjs +0 -547
- package/tsconfig.json +0 -39
|
@@ -10,7 +10,10 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
10
10
|
import * as models from "../index.js";
|
|
11
11
|
|
|
12
12
|
export type UpdateCollectionRequestBody = {
|
|
13
|
-
indexConfigs
|
|
13
|
+
indexConfigs?: { [k: string]: models.IndexConfigsUnion } | undefined;
|
|
14
|
+
description?: string | undefined;
|
|
15
|
+
tags?: Record<string, string> | undefined;
|
|
16
|
+
snapshotRetentionInDays?: number | undefined;
|
|
14
17
|
};
|
|
15
18
|
|
|
16
19
|
export type UpdateCollectionRequest = {
|
|
@@ -30,7 +33,10 @@ export type UpdateCollectionResponse = {
|
|
|
30
33
|
|
|
31
34
|
/** @internal */
|
|
32
35
|
export type UpdateCollectionRequestBody$Outbound = {
|
|
33
|
-
indexConfigs
|
|
36
|
+
indexConfigs?: { [k: string]: models.IndexConfigsUnion$Outbound } | undefined;
|
|
37
|
+
description?: string | undefined;
|
|
38
|
+
tags?: Record<string, string> | undefined;
|
|
39
|
+
snapshotRetentionInDays?: number | undefined;
|
|
34
40
|
};
|
|
35
41
|
|
|
36
42
|
/** @internal */
|
|
@@ -39,7 +45,19 @@ export const UpdateCollectionRequestBody$outboundSchema: z.ZodType<
|
|
|
39
45
|
z.ZodTypeDef,
|
|
40
46
|
UpdateCollectionRequestBody
|
|
41
47
|
> = z.object({
|
|
42
|
-
indexConfigs: z.record(models.IndexConfigsUnion$outboundSchema),
|
|
48
|
+
indexConfigs: z.record(models.IndexConfigsUnion$outboundSchema).optional(),
|
|
49
|
+
description: z.string().max(255).optional(),
|
|
50
|
+
tags: z.record(
|
|
51
|
+
z.string().min(1).max(127).regex(/^[^:#,]+$/),
|
|
52
|
+
).refine((value) => Object.keys(value).length <= 5, {
|
|
53
|
+
message: "Collection tags support at most five entries",
|
|
54
|
+
}).refine(
|
|
55
|
+
(value) => Object.keys(value).every((key) => /^[A-Za-z0-9_.-]{1,63}$/.test(key)),
|
|
56
|
+
{ message: "Invalid collection tag key" },
|
|
57
|
+
).optional(),
|
|
58
|
+
snapshotRetentionInDays: z.number().int().min(1).max(31).optional(),
|
|
59
|
+
}).refine((value) => Object.values(value).some((item) => item !== undefined), {
|
|
60
|
+
message: "At least one collection field must be provided",
|
|
43
61
|
});
|
|
44
62
|
|
|
45
63
|
export function updateCollectionRequestBodyToJSON(
|
|
@@ -10,6 +10,8 @@ export type UpdateDocsRequestBody = {
|
|
|
10
10
|
* A list of documents to update. Each document must contain 'id' field to be updated. For managed embedding vector fields, omit the managed vector field and update only the configured source text field.
|
|
11
11
|
*/
|
|
12
12
|
docs: Array<{ [k: string]: any }>;
|
|
13
|
+
/** Write target Branch. Omitting it writes to main. */
|
|
14
|
+
branch?: string | undefined;
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export type UpdateDocsRequest = {
|
|
@@ -23,6 +25,7 @@ export type UpdateDocsRequest = {
|
|
|
23
25
|
/** @internal */
|
|
24
26
|
export type UpdateDocsRequestBody$Outbound = {
|
|
25
27
|
docs: Array<{ [k: string]: any }>;
|
|
28
|
+
branch?: string | undefined;
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
/** @internal */
|
|
@@ -32,6 +35,7 @@ export const UpdateDocsRequestBody$outboundSchema: z.ZodType<
|
|
|
32
35
|
UpdateDocsRequestBody
|
|
33
36
|
> = z.object({
|
|
34
37
|
docs: z.array(z.record(z.any())),
|
|
38
|
+
branch: z.string().regex(/^[a-zA-Z0-9_-]{3,52}$/).optional(),
|
|
35
39
|
});
|
|
36
40
|
|
|
37
41
|
export function updateDocsRequestBodyToJSON(
|
|
@@ -10,6 +10,8 @@ export type UpsertDocsRequestBody = {
|
|
|
10
10
|
* A list of documents to upsert. For managed embedding vector fields, omit the managed vector field and provide only the configured source text field.
|
|
11
11
|
*/
|
|
12
12
|
docs: Array<{ [k: string]: any }>;
|
|
13
|
+
/** Write target Branch. Omitting it writes to main. */
|
|
14
|
+
branch?: string | undefined;
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export type UpsertDocsRequest = {
|
|
@@ -23,6 +25,7 @@ export type UpsertDocsRequest = {
|
|
|
23
25
|
/** @internal */
|
|
24
26
|
export type UpsertDocsRequestBody$Outbound = {
|
|
25
27
|
docs: Array<{ [k: string]: any }>;
|
|
28
|
+
branch?: string | undefined;
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
/** @internal */
|
|
@@ -32,6 +35,7 @@ export const UpsertDocsRequestBody$outboundSchema: z.ZodType<
|
|
|
32
35
|
UpsertDocsRequestBody
|
|
33
36
|
> = z.object({
|
|
34
37
|
docs: z.array(z.record(z.any())),
|
|
38
|
+
branch: z.string().regex(/^[a-zA-Z0-9_-]{3,52}$/).optional(),
|
|
35
39
|
});
|
|
36
40
|
|
|
37
41
|
export function upsertDocsRequestBodyToJSON(
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import * as z from "zod/v3";
|
|
2
|
+
|
|
3
|
+
const refNameSchema = z.string().regex(/^[a-zA-Z0-9_-]{3,52}$/);
|
|
4
|
+
|
|
5
|
+
export type BranchRef = {
|
|
6
|
+
kind: "branch";
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type TagRef = {
|
|
11
|
+
kind: "tag";
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type AliasRef = {
|
|
16
|
+
kind: "alias";
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** A Branch, Tag, or Alias used to select document reads. */
|
|
21
|
+
export type ReadRef = BranchRef | TagRef | AliasRef;
|
|
22
|
+
|
|
23
|
+
export type BranchSource = BranchRef & {
|
|
24
|
+
/** Latest committed snapshot cutoff as Unix epoch milliseconds. */
|
|
25
|
+
asOf?: number | undefined;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type TagSource = TagRef;
|
|
29
|
+
|
|
30
|
+
/** A Branch or Tag used as the source of a new Branch or Tag. */
|
|
31
|
+
export type RefSource = BranchSource | TagSource;
|
|
32
|
+
|
|
33
|
+
/** A Branch or Tag used as the target of an Alias. */
|
|
34
|
+
export type AliasTarget = BranchRef | TagRef;
|
|
35
|
+
|
|
36
|
+
export type RefDetails = {
|
|
37
|
+
name: string;
|
|
38
|
+
snapshotId: string | null;
|
|
39
|
+
/** Ref creation time as Unix epoch milliseconds. */
|
|
40
|
+
createdAt: number;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type AliasTargetKind = "BRANCH" | "TAG";
|
|
44
|
+
|
|
45
|
+
export type AliasDetails = {
|
|
46
|
+
aliasId: string;
|
|
47
|
+
aliasName: string;
|
|
48
|
+
targetKind: AliasTargetKind;
|
|
49
|
+
targetName: string;
|
|
50
|
+
targetId: string;
|
|
51
|
+
aliasRevision: number;
|
|
52
|
+
dangling: boolean;
|
|
53
|
+
/** Alias creation time as Unix epoch milliseconds. */
|
|
54
|
+
createdAt: number;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** @internal */
|
|
58
|
+
export const BranchRef$schema = z.object({
|
|
59
|
+
kind: z.literal("branch"),
|
|
60
|
+
name: refNameSchema,
|
|
61
|
+
}).strict();
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
export const TagRef$schema = z.object({
|
|
65
|
+
kind: z.literal("tag"),
|
|
66
|
+
name: refNameSchema,
|
|
67
|
+
}).strict();
|
|
68
|
+
|
|
69
|
+
/** @internal */
|
|
70
|
+
export const AliasRef$schema = z.object({
|
|
71
|
+
kind: z.literal("alias"),
|
|
72
|
+
name: refNameSchema,
|
|
73
|
+
}).strict();
|
|
74
|
+
|
|
75
|
+
/** @internal */
|
|
76
|
+
export const ReadRef$schema: z.ZodType<ReadRef> = z.discriminatedUnion("kind", [
|
|
77
|
+
BranchRef$schema,
|
|
78
|
+
TagRef$schema,
|
|
79
|
+
AliasRef$schema,
|
|
80
|
+
]);
|
|
81
|
+
|
|
82
|
+
/** @internal */
|
|
83
|
+
export const BranchSource$schema = z.object({
|
|
84
|
+
kind: z.literal("branch"),
|
|
85
|
+
name: refNameSchema,
|
|
86
|
+
asOf: z.number().int().optional(),
|
|
87
|
+
}).strict();
|
|
88
|
+
|
|
89
|
+
/** @internal */
|
|
90
|
+
export const RefSource$schema: z.ZodType<RefSource> = z.union([
|
|
91
|
+
BranchSource$schema,
|
|
92
|
+
TagRef$schema,
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
/** @internal */
|
|
96
|
+
export const AliasTarget$schema: z.ZodType<AliasTarget> = z.union([
|
|
97
|
+
BranchRef$schema,
|
|
98
|
+
TagRef$schema,
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
/** @internal */
|
|
102
|
+
export const RefDetails$inboundSchema: z.ZodType<RefDetails> = z.object({
|
|
103
|
+
name: z.string(),
|
|
104
|
+
snapshotId: z.string().nullable(),
|
|
105
|
+
createdAt: z.number().int(),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
/** @internal */
|
|
109
|
+
export const AliasDetails$inboundSchema: z.ZodType<AliasDetails> = z.object({
|
|
110
|
+
aliasId: z.string(),
|
|
111
|
+
aliasName: z.string(),
|
|
112
|
+
targetKind: z.enum(["BRANCH", "TAG"]),
|
|
113
|
+
targetName: z.string(),
|
|
114
|
+
targetId: z.string(),
|
|
115
|
+
aliasRevision: z.number().int().nonnegative(),
|
|
116
|
+
dangling: z.boolean(),
|
|
117
|
+
createdAt: z.number().int(),
|
|
118
|
+
});
|
package/src/types/public.ts
CHANGED
|
@@ -6,15 +6,39 @@
|
|
|
6
6
|
// ---- Input types (RequestBody / Request aliased as XxxInput) ----
|
|
7
7
|
export type { CreateCollectionRequest as CreateCollectionInput } from "../models/operations/createcollection.js";
|
|
8
8
|
export type { UpdateCollectionRequestBody as UpdateCollectionInput } from "../models/operations/updatecollection.js";
|
|
9
|
-
export type { QueryCollectionRequestBody as QueryCollectionInput } from "../models/operations/querycollection.js";
|
|
10
9
|
export type { UpsertDocsRequestBody as UpsertDocsInput } from "../models/operations/upsertdocs.js";
|
|
11
10
|
export type { UpdateDocsRequestBody as UpdateDocsInput } from "../models/operations/updatedocs.js";
|
|
12
11
|
export type { DeleteDocsRequestBody as DeleteDocsInput } from "../models/operations/deletedocs.js";
|
|
13
|
-
export type { FetchDocsRequestBody as FetchDocsInput } from "../models/operations/fetchdocs.js";
|
|
14
12
|
export type { BulkUpsertDocsRequestBody as BulkUpsertInput } from "../models/operations/bulkupsertdocs.js";
|
|
15
13
|
|
|
16
14
|
import type { ListDocsRequest } from "../models/operations/listdocs.js";
|
|
17
15
|
import type { ListCollectionsRequest } from "../models/operations/listcollections.js";
|
|
16
|
+
import type { QueryCollectionRequestBody } from "../models/operations/querycollection.js";
|
|
17
|
+
import type { FetchDocsRequestBody } from "../models/operations/fetchdocs.js";
|
|
18
|
+
import type {
|
|
19
|
+
AliasDetails as AliasDetailsModel,
|
|
20
|
+
AliasRef,
|
|
21
|
+
BranchRef,
|
|
22
|
+
ReadRef,
|
|
23
|
+
RefDetails as RefDetailsModel,
|
|
24
|
+
TagRef,
|
|
25
|
+
} from "../models/versioning.js";
|
|
26
|
+
|
|
27
|
+
type ConsistentReadForRef =
|
|
28
|
+
| { ref?: BranchRef | undefined; consistentRead?: boolean | undefined }
|
|
29
|
+
| { ref: TagRef | AliasRef; consistentRead?: false | undefined };
|
|
30
|
+
|
|
31
|
+
/** Query input with consistent reads restricted to direct Branch refs. */
|
|
32
|
+
export type QueryCollectionInput = Omit<
|
|
33
|
+
QueryCollectionRequestBody,
|
|
34
|
+
"ref" | "consistentRead"
|
|
35
|
+
> & ConsistentReadForRef;
|
|
36
|
+
|
|
37
|
+
/** Fetch input with consistent reads restricted to direct Branch refs. */
|
|
38
|
+
export type FetchDocsInput = Omit<
|
|
39
|
+
FetchDocsRequestBody,
|
|
40
|
+
"ref" | "consistentRead"
|
|
41
|
+
> & ConsistentReadForRef;
|
|
18
42
|
|
|
19
43
|
/** Parameters for listing documents, including extended list options. */
|
|
20
44
|
export type ListDocsInput = Pick<
|
|
@@ -24,6 +48,8 @@ export type ListDocsInput = Pick<
|
|
|
24
48
|
filter?: Record<string, unknown> | undefined;
|
|
25
49
|
partitionFilter?: import("../models/index.js").PartitionFilter | undefined;
|
|
26
50
|
fields?: import("../models/index.js").FieldsSelectorUnion | undefined;
|
|
51
|
+
/** Read target. Omitting it reads from main. */
|
|
52
|
+
ref?: ReadRef | undefined;
|
|
27
53
|
};
|
|
28
54
|
|
|
29
55
|
/** Parameters for listing collections (size, pageToken). */
|
|
@@ -46,12 +72,57 @@ export type {
|
|
|
46
72
|
ListDocsDoc,
|
|
47
73
|
} from "../models/operations/listdocs.js";
|
|
48
74
|
export type { MessageResponse } from "../models/index.js";
|
|
49
|
-
export type {
|
|
50
|
-
FetchDocsResponse,
|
|
51
|
-
FetchDocsDoc,
|
|
52
|
-
} from "../models/operations/fetchdocs.js";
|
|
75
|
+
export type { FetchDocsResponse, FetchDocsDoc } from "../models/operations/fetchdocs.js";
|
|
53
76
|
export type { GetBulkUpsertDocsResponse } from "../models/operations/getbulkupsertdocs.js";
|
|
54
77
|
|
|
78
|
+
export type {
|
|
79
|
+
AliasRef,
|
|
80
|
+
AliasTarget,
|
|
81
|
+
BranchRef,
|
|
82
|
+
BranchSource,
|
|
83
|
+
ReadRef,
|
|
84
|
+
RefSource,
|
|
85
|
+
TagRef,
|
|
86
|
+
TagSource,
|
|
87
|
+
} from "../models/versioning.js";
|
|
88
|
+
|
|
89
|
+
export type RefDetails = Omit<RefDetailsModel, "createdAt"> & {
|
|
90
|
+
createdAt: Date;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type AliasDetails = Omit<AliasDetailsModel, "createdAt"> & {
|
|
94
|
+
createdAt: Date;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export type CreateBranchInput = {
|
|
98
|
+
branchName: string;
|
|
99
|
+
source?: import("../models/versioning.js").RefSource | undefined;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type CreateBranchResponse = { branch: RefDetails };
|
|
103
|
+
export type ListBranchesResponse = { branches: RefDetails[] };
|
|
104
|
+
|
|
105
|
+
export type CreateTagInput = {
|
|
106
|
+
tagName: string;
|
|
107
|
+
source?: import("../models/versioning.js").RefSource | undefined;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type CreateTagResponse = { tag: RefDetails };
|
|
111
|
+
export type ListTagsResponse = { tags: RefDetails[] };
|
|
112
|
+
|
|
113
|
+
export type CreateAliasInput = {
|
|
114
|
+
aliasName: string;
|
|
115
|
+
target: import("../models/versioning.js").AliasTarget;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type RetargetAliasInput = {
|
|
119
|
+
target: import("../models/versioning.js").AliasTarget;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export type AliasResponse = { alias: AliasDetails };
|
|
123
|
+
export type ListAliasesResponse = { aliases: AliasDetails[] };
|
|
124
|
+
export type GetBulkUpsertInput = { branch?: string | undefined };
|
|
125
|
+
|
|
55
126
|
// ---- Models referenced by request/response bodies ----
|
|
56
127
|
export type {
|
|
57
128
|
IndexConfigsUnion,
|
|
@@ -64,8 +135,11 @@ export type {
|
|
|
64
135
|
CollectionResponse,
|
|
65
136
|
} from "../models/index.js";
|
|
66
137
|
|
|
67
|
-
// ---- Timestamp helpers (Unix
|
|
138
|
+
// ---- Timestamp helpers (Unix epoch milliseconds → Date) ----
|
|
68
139
|
import type { CollectionResponse as CollectionResponseModel } from "../models/index.js";
|
|
140
|
+
import type {
|
|
141
|
+
CreateCollectionResponse as CreateCollectionResponseModel,
|
|
142
|
+
} from "../models/operations/createcollection.js";
|
|
69
143
|
|
|
70
144
|
/**
|
|
71
145
|
* Collection response with timestamp fields as Date (for better DX).
|
|
@@ -75,8 +149,8 @@ export type CollectionResponseWithDates = Omit<
|
|
|
75
149
|
CollectionResponseModel,
|
|
76
150
|
"createdAt" | "updatedAt" | "dataUpdatedAt"
|
|
77
151
|
> & {
|
|
78
|
-
createdAt
|
|
79
|
-
updatedAt
|
|
152
|
+
createdAt: Date;
|
|
153
|
+
updatedAt: Date;
|
|
80
154
|
dataUpdatedAt?: Date | undefined;
|
|
81
155
|
};
|
|
82
156
|
|
|
@@ -89,17 +163,19 @@ export type ListCollectionsResponseWithDates = {
|
|
|
89
163
|
};
|
|
90
164
|
|
|
91
165
|
/**
|
|
92
|
-
* Converts Unix-
|
|
166
|
+
* Converts Unix-millisecond timestamp fields to Date. Safe to call on partial responses.
|
|
93
167
|
*/
|
|
94
168
|
export function collectionResponseWithDates(
|
|
95
169
|
c: CollectionResponseModel,
|
|
96
170
|
): CollectionResponseWithDates {
|
|
97
171
|
const { createdAt, updatedAt, dataUpdatedAt, ...rest } = c;
|
|
98
|
-
const out: CollectionResponseWithDates = {
|
|
99
|
-
|
|
100
|
-
|
|
172
|
+
const out: CollectionResponseWithDates = {
|
|
173
|
+
...rest,
|
|
174
|
+
createdAt: new Date(createdAt),
|
|
175
|
+
updatedAt: new Date(updatedAt),
|
|
176
|
+
};
|
|
101
177
|
if (dataUpdatedAt != null)
|
|
102
|
-
out.dataUpdatedAt = new Date(dataUpdatedAt
|
|
178
|
+
out.dataUpdatedAt = new Date(dataUpdatedAt);
|
|
103
179
|
return out;
|
|
104
180
|
}
|
|
105
181
|
|
|
@@ -126,3 +202,40 @@ export function getCollectionResponseWithDates(res: {
|
|
|
126
202
|
}): GetCollectionResponseWithDates {
|
|
127
203
|
return { collection: collectionResponseWithDates(res.collection) };
|
|
128
204
|
}
|
|
205
|
+
|
|
206
|
+
/** Update response with timestamp fields converted to Date. */
|
|
207
|
+
export type UpdateCollectionResponseWithDates = GetCollectionResponseWithDates;
|
|
208
|
+
|
|
209
|
+
export function updateCollectionResponseWithDates(res: {
|
|
210
|
+
collection: CollectionResponseModel;
|
|
211
|
+
}): UpdateCollectionResponseWithDates {
|
|
212
|
+
return getCollectionResponseWithDates(res);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Create response with its Unix-millisecond timestamp converted to Date. */
|
|
216
|
+
export type CreateCollectionResponseWithDates = {
|
|
217
|
+
collection: Omit<CreateCollectionResponseModel["collection"], "createdAt"> & {
|
|
218
|
+
createdAt: Date;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export function createCollectionResponseWithDates(
|
|
223
|
+
response: CreateCollectionResponseModel,
|
|
224
|
+
): CreateCollectionResponseWithDates {
|
|
225
|
+
return {
|
|
226
|
+
collection: {
|
|
227
|
+
...response.collection,
|
|
228
|
+
createdAt: new Date(response.collection.createdAt),
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** @internal */
|
|
234
|
+
export function refDetailsWithDate(details: RefDetailsModel): RefDetails {
|
|
235
|
+
return { ...details, createdAt: new Date(details.createdAt) };
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** @internal */
|
|
239
|
+
export function aliasDetailsWithDate(details: AliasDetailsModel): AliasDetails {
|
|
240
|
+
return { ...details, createdAt: new Date(details.createdAt) };
|
|
241
|
+
}
|