From 74e94925085eb7394805f6ca0cdf0495b8c6b1fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Coss=C3=ADo?= Date: Fri, 21 Nov 2025 11:51:33 -0300 Subject: [PATCH 1/2] update from latest schema --- .../src/openapi/generated_schema.ts | 60 +++++++++++++++---- packages/js-client-rest/src/qdrant-client.ts | 3 + 2 files changed, 52 insertions(+), 11 deletions(-) diff --git a/packages/js-client-rest/src/openapi/generated_schema.ts b/packages/js-client-rest/src/openapi/generated_schema.ts index 50e939a..8b9b80d 100644 --- a/packages/js-client-rest/src/openapi/generated_schema.ts +++ b/packages/js-client-rest/src/openapi/generated_schema.ts @@ -2319,7 +2319,7 @@ export interface components { * @description State of the single shard within a replica set. * @enum {string} */ - ReplicaState: "Active" | "Dead" | "Partial" | "Initializing" | "Listener" | "PartialSnapshot" | "Recovery" | "Resharding" | "ReshardingScaleDown"; + ReplicaState: "Active" | "Dead" | "Partial" | "Initializing" | "Listener" | "PartialSnapshot" | "Recovery" | "Resharding" | "ReshardingScaleDown" | "ActiveRead"; RemoteShardInfo: { /** * Format: uint32 @@ -2361,7 +2361,18 @@ export interface components { /** @description A human-readable report of the transfer progress. Available only on the source peer. */ comment?: string | null; }; - /** @description Methods for transferring a shard from one node to another. */ + /** + * @description Methods for transferring a shard from one node to another. + * + * - `stream_records` - Stream all shard records in batches until the whole shard is transferred. + * + * - `snapshot` - Snapshot the shard, transfer and restore it on the receiver. + * + * - `wal_delta` - Attempt to transfer shard difference by WAL delta. + * + * - `resharding_stream_records` - Shard transfer for resharding: stream all records in batches until all points are transferred. + * @enum {string} + */ ShardTransferMethod: "stream_records" | "snapshot" | "wal_delta" | "resharding_stream_records"; ReshardingInfo: { direction: components["schemas"]["ReshardingDirection"]; @@ -2371,7 +2382,14 @@ export interface components { peer_id: number; shard_key?: components["schemas"]["ShardKey"] | (Record | null); }; - /** @description Resharding direction, scale up or down in number of shards */ + /** + * @description Resharding direction, scale up or down in number of shards + * + * - `up` - Scale up, add a new shard + * + * - `down` - Scale down, remove a shard + * @enum {string} + */ ReshardingDirection: "up" | "down"; TelemetryData: { id: string; @@ -2447,25 +2465,33 @@ export interface components { */ migrate_rocksdb_id_tracker?: boolean; /** - * @description Migrate RocksDB based vector storages into new format on start. - * @default false + * @description Migrate RocksDB based vector storages into new format on start. + * + * Enabled by default in Qdrant 1.16.1. + * @default true */ migrate_rocksdb_vector_storage?: boolean; /** - * @description Migrate RocksDB based payload storages into new format on start. - * @default false + * @description Migrate RocksDB based payload storages into new format on start. + * + * Enabled by default in Qdrant 1.16.1. + * @default true */ migrate_rocksdb_payload_storage?: boolean; /** * @description Migrate RocksDB based payload indices into new format on start. * - * Rebuilds a new payload index from scratch. - * @default false + * Rebuilds a new payload index from scratch. + * + * Enabled by default in Qdrant 1.16.1. + * @default true */ migrate_rocksdb_payload_indices?: boolean; /** - * @description Use appendable quantization in appendable plain segments. - * @default false + * @description Use appendable quantization in appendable plain segments. + * + * Enabled by default in Qdrant 1.16.0. + * @default true */ appendable_quantization?: boolean; }; @@ -2502,6 +2528,7 @@ export interface components { /** Format: uint */ max_collections?: number | null; collections?: (components["schemas"]["CollectionTelemetryEnum"])[] | null; + snapshots?: (components["schemas"]["CollectionSnapshotTelemetry"])[] | null; }; CollectionTelemetryEnum: components["schemas"]["CollectionTelemetry"] | components["schemas"]["CollectionsAggregatedTelemetry"]; CollectionTelemetry: { @@ -2840,6 +2867,15 @@ export interface components { optimizers_status: components["schemas"]["OptimizersStatus"]; params: components["schemas"]["CollectionParams"]; }; + CollectionSnapshotTelemetry: { + id: string; + /** Format: uint */ + running_snapshots?: number | null; + /** Format: uint */ + running_snapshot_recovery?: number | null; + /** Format: uint */ + total_snapshot_creations?: number | null; + }; ClusterTelemetry: { enabled: boolean; status?: components["schemas"]["ClusterStatusTelemetry"] | (Record | null); @@ -3021,6 +3057,8 @@ export interface components { replication_factor?: number | null; /** @description Placement of shards for this key List of peer ids, that can be used to place shards for this key If not specified, will be randomly placed among all peers */ placement?: (number)[] | null; + /** @description Initial state of the shards for this key If not specified, will be `Initializing` first and then `Active` Warning: do not change this unless you know what you are doing */ + initial_state?: components["schemas"]["ReplicaState"] | (Record | null); }; DropShardingKeyOperation: { drop_sharding_key: components["schemas"]["DropShardingKey"]; diff --git a/packages/js-client-rest/src/qdrant-client.ts b/packages/js-client-rest/src/qdrant-client.ts index 6aaabec..af8b369 100644 --- a/packages/js-client-rest/src/qdrant-client.ts +++ b/packages/js-client-rest/src/qdrant-client.ts @@ -1657,6 +1657,7 @@ export class QdrantClient { * - shards_number: How many shards to create for this key If not specified, will use the default value from config * - replication_factor: How many replicas to create for each shard If not specified, will use the default value from config * - placement: Placement of shards for this key List of peer ids, that can be used to place shards for this key If not specified, will be randomly placed among all peers + * - initial_state: Initial state of the shards for this key If not specified, will be `Initializing` first and then `Active` Warning: do not change this unless you know what you are doing. * - timeout: If set, overrides global timeout setting for this request. Unit is seconds. * @returns Operation result */ @@ -1667,6 +1668,7 @@ export class QdrantClient { shards_number, replication_factor, placement, + initial_state, timeout, }: {timeout?: number} & SchemaFor<'CreateShardingKey'>, ): Promise { @@ -1676,6 +1678,7 @@ export class QdrantClient { shards_number, replication_factor, placement, + initial_state, timeout, }); return response.data.result ?? noResultError(); From 809fa15c99bcba9248ecff79715ac28c814adc79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Coss=C3=ADo?= Date: Fri, 21 Nov 2025 12:06:55 -0300 Subject: [PATCH 2/2] use direct `Schemas["MySchema"]` in arg types for better navigability --- packages/js-client-rest/src/qdrant-client.ts | 91 ++++++++++---------- packages/js-client-rest/src/types.ts | 2 - 2 files changed, 45 insertions(+), 48 deletions(-) diff --git a/packages/js-client-rest/src/qdrant-client.ts b/packages/js-client-rest/src/qdrant-client.ts index af8b369..ea4c929 100644 --- a/packages/js-client-rest/src/qdrant-client.ts +++ b/packages/js-client-rest/src/qdrant-client.ts @@ -1,6 +1,6 @@ import {OpenApiClient, createApis} from './api-client.js'; import {QdrantClientConfigError} from './errors.js'; -import {RestArgs, SchemaFor, Schemas} from './types.js'; +import {RestArgs, Schemas} from './types.js'; import {PACKAGE_VERSION, ClientVersion} from './client-version.js'; import {ClientApi} from './openapi/generated_client_type.js'; @@ -167,7 +167,7 @@ export class QdrantClient { searches, consistency, timeout, - }: Pick, 'searches'> & {consistency?: SchemaFor<'ReadConsistency'>} & { + }: Pick & {consistency?: Schemas['ReadConsistency']} & { timeout?: number; }, ): Promise { @@ -257,9 +257,9 @@ export class QdrantClient { score_threshold, consistency, timeout, - }: Partial, 'limit'>> & - Omit, 'limit'> & { - consistency?: SchemaFor<'ReadConsistency'>; + }: Partial> & + Omit & { + consistency?: Schemas['ReadConsistency']; } & {timeout?: number}, ): Promise { const response = await this._openApiClient.searchPoints({ @@ -300,7 +300,7 @@ export class QdrantClient { searches, consistency, timeout, - }: SchemaFor<'RecommendRequestBatch'> & {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number}, + }: Schemas['RecommendRequestBatch'] & {consistency?: Schemas['ReadConsistency']} & {timeout?: number}, ): Promise { const response = await this._openApiClient.recommendBatchPoints({ collection_name, @@ -320,7 +320,7 @@ export class QdrantClient { searches, consistency, timeout, - }: SchemaFor<'RecommendRequestBatch'> & {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number}, + }: Schemas['RecommendRequestBatch'] & {consistency?: Schemas['ReadConsistency']} & {timeout?: number}, ): Promise { const response = await this._openApiClient.recommendBatchPoints({ collection_name, @@ -412,8 +412,8 @@ export class QdrantClient { lookup_from, consistency, timeout, - }: Omit, 'limit'> & - Partial, 'limit'>> & {consistency?: SchemaFor<'ReadConsistency'>} & { + }: Omit & + Partial> & {consistency?: Schemas['ReadConsistency']} & { timeout?: number; }, ): Promise { @@ -483,7 +483,7 @@ export class QdrantClient { with_payload = true, with_vector = false, order_by, - }: SchemaFor<'ScrollRequest'> & {timeout?: number} & {consistency?: SchemaFor<'ReadConsistency'>} = {}, + }: Schemas['ScrollRequest'] & {timeout?: number} & {consistency?: Schemas['ReadConsistency']} = {}, ): Promise { const response = await this._openApiClient.scrollPoints({ collection_name, @@ -515,7 +515,7 @@ export class QdrantClient { */ async count( collection_name: string, - {shard_key, filter, exact = true, timeout}: SchemaFor<'CountRequest'> & {timeout?: number} = {}, + {shard_key, filter, exact = true, timeout}: Schemas['CountRequest'] & {timeout?: number} = {}, ): Promise { const response = await this._openApiClient.countPoints({ collection_name, @@ -556,7 +556,7 @@ export class QdrantClient { */ async updateCollectionCluster( collection_name: string, - {timeout, ...operation}: {timeout?: number} & SchemaFor<'ClusterOperations'>, + {timeout, ...operation}: {timeout?: number} & Schemas['ClusterOperations'], ): Promise { const response = await this._openApiClient.updateCollectionCluster({ collection_name, @@ -591,7 +591,7 @@ export class QdrantClient { ordering, points, shard_key, - }: {wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>} & SchemaFor<'UpdateVectors'>, + }: {wait?: boolean; ordering?: Schemas['WriteOrdering']} & Schemas['UpdateVectors'], ): Promise { const response = await this._openApiClient.updateVectors({ collection_name, @@ -632,7 +632,7 @@ export class QdrantClient { filter, vector, shard_key, - }: {wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>} & SchemaFor<'DeleteVectors'>, + }: {wait?: boolean; ordering?: Schemas['WriteOrdering']} & Schemas['DeleteVectors'], ): Promise { const response = await this._openApiClient.deleteVectors({ collection_name, @@ -684,7 +684,7 @@ export class QdrantClient { group_by, group_size, limit, - }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'SearchGroupsRequest'>, + }: {consistency?: Schemas['ReadConsistency']} & {timeout?: number} & Schemas['SearchGroupsRequest'], ): Promise { const response = await this._openApiClient.searchPointGroups({ collection_name, @@ -750,7 +750,7 @@ export class QdrantClient { group_by, group_size, limit, - }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'RecommendGroupsRequest'>, + }: {consistency?: Schemas['ReadConsistency']} & {timeout?: number} & Schemas['RecommendGroupsRequest'], ): Promise { const response = await this._openApiClient.recommendPointGroups({ collection_name, @@ -797,7 +797,7 @@ export class QdrantClient { wait = true, ordering, ...points_or_batch - }: {wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>} & SchemaFor<'PointInsertOperations'>, + }: {wait?: boolean; ordering?: Schemas['WriteOrdering']} & Schemas['PointInsertOperations'], ): Promise { const response = await this._openApiClient.upsertPoints({ collection_name, @@ -811,7 +811,7 @@ export class QdrantClient { /** * Retrieve stored points by IDs * @param collection_name - * @param {object} args + * @param {object} args - * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * - ids: list of IDs to lookup * - with_payload: @@ -844,7 +844,7 @@ export class QdrantClient { with_vector, consistency, timeout, - }: SchemaFor<'PointRequest'> & {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number}, + }: Schemas['PointRequest'] & {consistency?: Schemas['ReadConsistency']} & {timeout?: number}, ): Promise { const response = await this._openApiClient.getPoints({ collection_name, @@ -861,7 +861,7 @@ export class QdrantClient { /** * Deletes selected points from collection * @param collection_name Name of the collection - * @param {object} args + * @param {object} args - * - wait: Await for the results to be processed. * - If `true`, result will be returned only when all changes are applied * - If `false`, result will be returned immediately after the confirmation of receiving. @@ -894,7 +894,7 @@ export class QdrantClient { wait, ordering, ...points_selector - }: {wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>} & SchemaFor<'PointsSelector'>, + }: {wait?: boolean; ordering?: Schemas['WriteOrdering']} & Schemas['PointsSelector'], ): Promise { const response = await this._openApiClient.deletePoints({ collection_name, @@ -908,7 +908,7 @@ export class QdrantClient { /** * Sets payload values for specified points. * @param collection_name Name of the collection - * @param {object} args + * @param {object} args - * - wait: Await for the results to be processed. * - If `true`, result will be returned only when all changes are applied * - If `false`, result will be returned immediately after the confirmation of receiving. @@ -948,7 +948,7 @@ export class QdrantClient { key, ordering, wait = true, - }: {wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>} & SchemaFor<'SetPayload'>, + }: {wait?: boolean; ordering?: Schemas['WriteOrdering']} & Schemas['SetPayload'], ): Promise { const response = await this._openApiClient.setPayload({ collection_name, @@ -1008,7 +1008,7 @@ export class QdrantClient { shard_key, key, wait = true, - }: {wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>} & SchemaFor<'SetPayload'>, + }: {wait?: boolean; ordering?: Schemas['WriteOrdering']} & Schemas['SetPayload'], ): Promise { const response = await this._openApiClient.overwritePayload({ collection_name, @@ -1064,8 +1064,7 @@ export class QdrantClient { filter, shard_key, wait = true, - }: {wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>} & SchemaFor<'PointsSelector'> & - SchemaFor<'DeletePayload'>, + }: {wait?: boolean; ordering?: Schemas['WriteOrdering']} & Schemas['PointsSelector'] & Schemas['DeletePayload'], ): Promise { const response = await this._openApiClient.deletePayload({ collection_name, @@ -1115,7 +1114,7 @@ export class QdrantClient { ordering, wait = true, ...points_selector - }: {wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>} & SchemaFor<'PointsSelector'>, + }: {wait?: boolean; ordering?: Schemas['WriteOrdering']} & Schemas['PointsSelector'], ): Promise { const response = await this._openApiClient.clearPayload({ collection_name, @@ -1137,7 +1136,7 @@ export class QdrantClient { async updateCollectionAliases({ actions, timeout, - }: {timeout?: number} & SchemaFor<'ChangeAliasesOperation'>): Promise { + }: {timeout?: number} & Schemas['ChangeAliasesOperation']): Promise { const response = await this._openApiClient.updateAliases({actions, timeout}); return response.data.result ?? noResultError(); } @@ -1193,7 +1192,7 @@ export class QdrantClient { */ async updateCollection( collection_name: string, - args?: SchemaFor<'UpdateCollection'> & {timeout?: number}, + args?: Schemas['UpdateCollection'] & {timeout?: number}, ): Promise { const response = await this._openApiClient.updateCollection({ collection_name, @@ -1270,7 +1269,7 @@ export class QdrantClient { write_consistency_factor, sparse_vectors, strict_mode_config, - }: {timeout?: number} & SchemaFor<'CreateCollection'>, + }: {timeout?: number} & Schemas['CreateCollection'], ): Promise { const response = await this._openApiClient.createCollection({ collection_name, @@ -1346,7 +1345,7 @@ export class QdrantClient { write_consistency_factor, sparse_vectors, strict_mode_config, - }: {timeout?: number} & SchemaFor<'CreateCollection'>, + }: {timeout?: number} & Schemas['CreateCollection'], ): Promise { const deleteResponse = await this._openApiClient.deleteCollection({ collection_name, @@ -1403,7 +1402,7 @@ export class QdrantClient { ordering, field_name, field_schema, - }: {wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>} & SchemaFor<'CreateFieldIndex'>, + }: {wait?: boolean; ordering?: Schemas['WriteOrdering']} & Schemas['CreateFieldIndex'], ): Promise { const response = await this._openApiClient.createFieldIndex({ collection_name, @@ -1435,7 +1434,7 @@ export class QdrantClient { async deletePayloadIndex( collection_name: string, field_name: string, - {wait = true, ordering}: {wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>} = {}, + {wait = true, ordering}: {wait?: boolean; ordering?: Schemas['WriteOrdering']} = {}, ): Promise { const response = await this._openApiClient.deleteFieldIndex({ collection_name, @@ -1528,7 +1527,7 @@ export class QdrantClient { */ async recoverSnapshot( collection_name: string, - {location, priority, checksum, api_key}: SchemaFor<'SnapshotRecover'>, + {location, priority, checksum, api_key}: Schemas['SnapshotRecover'], ): Promise { const response = await this._openApiClient.recoverFromSnapshot({ collection_name, @@ -1563,7 +1562,7 @@ export class QdrantClient { wait = true, ordering, ...operations - }: {wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>} & SchemaFor<'UpdateOperations'>, + }: {wait?: boolean; ordering?: Schemas['WriteOrdering']} & Schemas['UpdateOperations'], ): Promise { const response = await this._openApiClient.batchUpdate({ collection_name, @@ -1583,7 +1582,7 @@ export class QdrantClient { async recoverShardFromSnapshot( collection_name: string, shard_id: number, - {wait = true, ...shard_snapshot_recover}: {wait?: boolean} & SchemaFor<'ShardSnapshotRecover'>, + {wait = true, ...shard_snapshot_recover}: {wait?: boolean} & Schemas['ShardSnapshotRecover'], ): Promise { const response = await this._openApiClient.recoverShardFromSnapshot({ collection_name, @@ -1670,7 +1669,7 @@ export class QdrantClient { placement, initial_state, timeout, - }: {timeout?: number} & SchemaFor<'CreateShardingKey'>, + }: {timeout?: number} & Schemas['CreateShardingKey'], ): Promise { const response = await this._openApiClient.createShardKey({ collection_name, @@ -1694,7 +1693,7 @@ export class QdrantClient { */ async deleteShardKey( collection_name: string, - {shard_key, timeout}: {timeout?: number} & SchemaFor<'DropShardingKey'>, + {shard_key, timeout}: {timeout?: number} & Schemas['DropShardingKey'], ): Promise { const response = await this._openApiClient.deleteShardKey({ collection_name, @@ -1747,7 +1746,7 @@ export class QdrantClient { with_vector, using, lookup_from, - }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'DiscoverRequest'>, + }: {consistency?: Schemas['ReadConsistency']} & {timeout?: number} & Schemas['DiscoverRequest'], ): Promise { const response = await this._openApiClient.discoverPoints({ collection_name, @@ -1788,7 +1787,7 @@ export class QdrantClient { consistency, timeout, searches, - }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'DiscoverRequestBatch'>, + }: {consistency?: Schemas['ReadConsistency']} & {timeout?: number} & Schemas['DiscoverRequestBatch'], ): Promise { const response = await this._openApiClient.discoverBatchPoints({ collection_name, @@ -1863,7 +1862,7 @@ export class QdrantClient { with_vector, with_payload, lookup_from, - }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'QueryRequest'>, + }: {consistency?: Schemas['ReadConsistency']} & {timeout?: number} & Schemas['QueryRequest'], ): Promise { const response = await this._openApiClient.queryPoints({ collection_name, @@ -1906,7 +1905,7 @@ export class QdrantClient { consistency, timeout, searches, - }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'QueryRequestBatch'>, + }: {consistency?: Schemas['ReadConsistency']} & {timeout?: number} & Schemas['QueryRequestBatch'], ): Promise { const response = await this._openApiClient.queryBatchPoints({ collection_name, @@ -1962,7 +1961,7 @@ export class QdrantClient { group_size, limit, with_lookup, - }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'QueryGroupsRequest'>, + }: {consistency?: Schemas['ReadConsistency']} & {timeout?: number} & Schemas['QueryGroupsRequest'], ): Promise { const response = await this._openApiClient.queryPointsGroups({ collection_name, @@ -2014,7 +2013,7 @@ export class QdrantClient { limit, filter, exact, - }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'FacetRequest'>, + }: {consistency?: Schemas['ReadConsistency']} & {timeout?: number} & Schemas['FacetRequest'], ): Promise { const response = await this._openApiClient.facet({ collection_name, @@ -2058,7 +2057,7 @@ export class QdrantClient { sample, limit, using, - }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'SearchMatrixRequest'>, + }: {consistency?: Schemas['ReadConsistency']} & {timeout?: number} & Schemas['SearchMatrixRequest'], ): Promise { const response = await this._openApiClient.searchMatrixPairs({ collection_name, @@ -2102,7 +2101,7 @@ export class QdrantClient { sample, limit, using, - }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'SearchMatrixRequest'>, + }: {consistency?: Schemas['ReadConsistency']} & {timeout?: number} & Schemas['SearchMatrixRequest'], ): Promise { const response = await this._openApiClient.searchMatrixOffsets({ collection_name, diff --git a/packages/js-client-rest/src/types.ts b/packages/js-client-rest/src/types.ts index 1d57791..3af7a79 100644 --- a/packages/js-client-rest/src/types.ts +++ b/packages/js-client-rest/src/types.ts @@ -6,7 +6,5 @@ export interface RestArgs { connections?: number; } -export type SchemaFor = T[K]; - // Definitions (in OpenAPI 2.0) or Schemas (in OpenAPI 3.0) – Data models that describe your API inputs and outputs. export type Schemas = components['schemas'];