From 71492ba4f16861762410746f96cf3c4f72b74997 Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Tue, 7 Nov 2023 13:36:24 -0500 Subject: [PATCH] Update pinecone-generated-ts-fetch code along with associated types and unit tests (#153) ## Problem We need to update the generated client code (`pinecone-generated-ts-fetch`) to align with upcoming API changes. ## Solution - Regenerate and replace the contents of `/pinecone-generated-ts-fetch`. - Update relevant types and unit tests, primarily `createIndex` and `listIndexes`. - Add new unit tests to the `createIndex.validation` suite focused on new required fields in `CreateIndexOptions`. - **Bonus:** Fix for `vectorOperationsProvider` - TS wasn't properly inferring types within `buildVectorOperationsConfig`, and we were passing `undefined` to `indexConfigurationParameters.basePath`. ## Type of Change - [X] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [X] This change requires a documentation update --- src/control/__tests__/configureIndex.test.ts | 3 +- .../__tests__/createCollection.test.ts | 7 +- src/control/__tests__/createIndex.test.ts | 17 +- .../__tests__/createIndex.validation.test.ts | 189 +++++++++++++++++- src/control/__tests__/listIndexes.test.ts | 69 ++++++- src/control/createIndex.ts | 24 +++ src/control/index.ts | 2 +- src/control/listIndexes.ts | 35 ++-- src/control/types.ts | 7 + src/data/types.ts | 2 +- src/data/vectorOperationsProvider.ts | 6 +- src/index.ts | 2 +- .../control/configureIndex.test.ts | 3 + src/integration/control/createIndex.test.ts | 24 +++ src/integration/control/describeIndex.test.ts | 3 + src/integration/control/listIndexes.test.ts | 7 +- src/integration/data/deleteMany.test.ts | 3 + src/integration/data/query.test.ts | 3 + .../.openapi-generator/FILES | 3 +- .../apis/IndexOperationsApi.ts | 29 ++- .../models/CollectionMeta.ts | 29 +-- .../models/CreateCollectionRequest.ts | 2 +- .../models/CreateRequest.ts | 39 ++++ .../models/IndexListMeta.ts | 102 ++++++++++ .../models/IndexMeta.ts | 10 +- .../models/IndexMetaDatabase.ts | 24 ++- .../models/IndexMetaStatus.ts | 20 +- .../models/InlineResponse200.ts | 64 ++++++ .../models/ListIndexes200Response.ts | 72 +++++++ .../models/index.ts | 2 + 30 files changed, 714 insertions(+), 88 deletions(-) create mode 100644 src/pinecone-generated-ts-fetch/models/IndexListMeta.ts create mode 100644 src/pinecone-generated-ts-fetch/models/InlineResponse200.ts create mode 100644 src/pinecone-generated-ts-fetch/models/ListIndexes200Response.ts diff --git a/src/control/__tests__/configureIndex.test.ts b/src/control/__tests__/configureIndex.test.ts index 148ff3c6..e95098c6 100644 --- a/src/control/__tests__/configureIndex.test.ts +++ b/src/control/__tests__/configureIndex.test.ts @@ -1,10 +1,11 @@ import { configureIndex } from '../configureIndex'; import { IndexOperationsApi } from '../../pinecone-generated-ts-fetch'; import type { ConfigureIndexRequest } from '../../pinecone-generated-ts-fetch'; +import type { IndexMeta } from '../../index'; describe('configureIndex', () => { test('calls the openapi configure endpoint', async () => { - const fakeConfigure: (req: ConfigureIndexRequest) => Promise = + const fakeConfigure: (req: ConfigureIndexRequest) => Promise = jest.fn(); const IOA = { configureIndex: fakeConfigure } as IndexOperationsApi; diff --git a/src/control/__tests__/createCollection.test.ts b/src/control/__tests__/createCollection.test.ts index f0b58528..39258c41 100644 --- a/src/control/__tests__/createCollection.test.ts +++ b/src/control/__tests__/createCollection.test.ts @@ -1,13 +1,16 @@ import { createCollection } from '../createCollection'; import { PineconeArgumentError } from '../../errors'; import { IndexOperationsApi } from '../../pinecone-generated-ts-fetch'; -import type { CreateCollectionOperationRequest as CCOR } from '../../pinecone-generated-ts-fetch'; +import type { + CreateCollectionOperationRequest as CCOR, + ListIndexes200Response, +} from '../../pinecone-generated-ts-fetch'; const setOpenAPIResponse = (fakeCreateCollectionResponse) => { const fakeCreateCollection: (req: CCOR) => Promise = jest .fn() .mockImplementation(fakeCreateCollectionResponse); - const fakeListIndexes: () => Promise = jest + const fakeListIndexes: () => Promise = jest .fn() .mockImplementation(() => Promise.resolve(['foo', 'bar'])); const IOA = { diff --git a/src/control/__tests__/createIndex.test.ts b/src/control/__tests__/createIndex.test.ts index e30fbe06..1d0a4d81 100644 --- a/src/control/__tests__/createIndex.test.ts +++ b/src/control/__tests__/createIndex.test.ts @@ -13,7 +13,7 @@ const setupCreateIndexResponse = ( isCreateIndexSuccess = true, isDescribeIndexSuccess = true ) => { - const fakeCreateIndex: (req: CreateIndexRequest) => Promise = jest + const fakeCreateIndex: (req: CreateIndexRequest) => Promise = jest .fn() .mockImplementation(() => isCreateIndexSuccess @@ -52,6 +52,9 @@ describe('createIndex', () => { const returned = await createIndex(IOA)({ name: 'index-name', dimension: 10, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', }); expect(returned).toBe(void 0); @@ -59,6 +62,9 @@ describe('createIndex', () => { createRequest: { name: 'index-name', dimension: 10, + capacityMode: 'pod', + cloud: 'gcp', + region: 'us-east1', }, }); }); @@ -81,6 +87,9 @@ describe('createIndex', () => { const returned = await createIndex(IOA)({ name: 'index-name', dimension: 10, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', waitUntilReady: true, }); @@ -89,6 +98,9 @@ describe('createIndex', () => { createRequest: { name: 'index-name', dimension: 10, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', waitUntilReady: true, }, }); @@ -116,6 +128,9 @@ describe('createIndex', () => { const returned = createIndex(IOA)({ name: 'index-name', dimension: 10, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', waitUntilReady: true, }); diff --git a/src/control/__tests__/createIndex.validation.test.ts b/src/control/__tests__/createIndex.validation.test.ts index 8b211d40..7d397fdd 100644 --- a/src/control/__tests__/createIndex.validation.test.ts +++ b/src/control/__tests__/createIndex.validation.test.ts @@ -29,7 +29,13 @@ describe('createIndex argument validations', () => { test('should throw if index name is not a string', async () => { const toThrow = async () => - await createIndex(IOA)({ name: 12, dimension: 10 }); + await createIndex(IOA)({ + name: 12, + dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', + }); expect(toThrow).rejects.toThrowError(PineconeArgumentError); expect(toThrow).rejects.toThrowError( @@ -39,7 +45,13 @@ describe('createIndex argument validations', () => { test('should throw if index name is empty string', async () => { const toThrow = async () => - await createIndex(IOA)({ name: '', dimension: 10 }); + await createIndex(IOA)({ + name: '', + dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', + }); expect(toThrow).rejects.toThrowError(PineconeArgumentError); expect(toThrow).rejects.toThrowError( @@ -49,7 +61,12 @@ describe('createIndex argument validations', () => { test('should throw if dimension is not provided', async () => { const toThrow = async () => - await createIndex(IOA)({ name: 'index-name' }); + await createIndex(IOA)({ + name: 'index-name', + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', + }); expect(toThrow).rejects.toThrowError(PineconeArgumentError); expect(toThrow).rejects.toThrowError( @@ -59,7 +76,13 @@ describe('createIndex argument validations', () => { test('should throw if dimension is not a number', async () => { const toThrow = async () => - await createIndex(IOA)({ name: 'index-name', dimension: '10' }); + await createIndex(IOA)({ + name: 'index-name', + dimension: '10', + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', + }); expect(toThrow).rejects.toThrowError(PineconeArgumentError); expect(toThrow).rejects.toThrowError( @@ -69,7 +92,13 @@ describe('createIndex argument validations', () => { test('should throw if dimension is float', async () => { const toThrow = async () => - await createIndex(IOA)({ name: 'index-name', dimension: 10.5 }); + await createIndex(IOA)({ + name: 'index-name', + dimension: 10.5, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', + }); expect(toThrow).rejects.toThrowError(PineconeArgumentError); expect(toThrow).rejects.toThrowError( @@ -79,13 +108,128 @@ describe('createIndex argument validations', () => { test('should throw if dimension is not a positive integer', async () => { const toThrow = async () => - await createIndex(IOA)({ name: 'index-name', dimension: -10 }); + await createIndex(IOA)({ + name: 'index-name', + dimension: -10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', + }); expect(toThrow).rejects.toThrowError(PineconeArgumentError); expect(toThrow).rejects.toThrowError( "The argument to createIndex had validation errors: property 'dimension' must be >= 1." ); }); + + test('should throw if region is not provided', () => { + const toThrow = async () => + await createIndex(IOA)({ + name: 'index-name', + dimension: 10, + cloud: 'gcp', + capacityMode: 'pod', + }); + + expect(toThrow).rejects.toThrowError(PineconeArgumentError); + expect(toThrow).rejects.toThrowError( + 'The argument to createIndex must have required property: region.' + ); + }); + + test('should throw if region is not a string', () => { + const toThrow = async () => + await createIndex(IOA)({ + name: 'index-name', + dimension: 10, + region: 111, + cloud: 'gcp', + capacityMode: 'pod', + }); + + expect(toThrow).rejects.toThrowError(PineconeArgumentError); + expect(toThrow).rejects.toThrowError( + "The argument to createIndex had type errors: property 'region' must be string." + ); + }); + + test('should throw if cloud is not provided', () => { + const toThrow = async () => + await createIndex(IOA)({ + name: 'index-name', + dimension: 10, + region: 'us-east3', + capacityMode: 'pod', + }); + + expect(toThrow).rejects.toThrowError(PineconeArgumentError); + expect(toThrow).rejects.toThrowError( + 'The argument to createIndex must have required property: cloud.' + ); + }); + + test('should throw if cloud is not a string', () => { + const toThrow = async () => + await createIndex(IOA)({ + name: 'index-name', + dimension: 10, + region: 'us-east3', + cloud: 123, + capacityMode: 'pod', + }); + + expect(toThrow).rejects.toThrowError(PineconeArgumentError); + expect(toThrow).rejects.toThrowError( + 'The argument to createIndex accepts multiple types. Either 1) 2) 3)' + ); + }); + + test('should throw if cloud is not one of the expected strings', () => { + const toThrow = async () => + await createIndex(IOA)({ + name: 'index-name', + dimension: 10, + region: 'us-east3', + cloud: 'pcg', + capacityMode: 'pod', + }); + + expect(toThrow).rejects.toThrowError(PineconeArgumentError); + expect(toThrow).rejects.toThrowError( + 'The argument to createIndex accepts multiple types. Either 1) 2) 3)' + ); + }); + + test('should throw if capacityMode is not provided', () => { + const toThrow = async () => + await createIndex(IOA)({ + name: 'index-name', + dimension: 10, + region: 'us-east3', + cloud: 'gcp', + }); + + expect(toThrow).rejects.toThrowError(PineconeArgumentError); + expect(toThrow).rejects.toThrowError( + 'The argument to createIndex must have required property: capacityMode.' + ); + }); + + test('should throw if capacityMode is not a string', () => { + const toThrow = async () => + await createIndex(IOA)({ + name: 'index-name', + dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 321, + }); + + expect(toThrow).rejects.toThrowError(PineconeArgumentError); + expect(toThrow).rejects.toThrowError( + "The argument to createIndex had type errors: property 'capacityMode' must be string." + ); + }); }); describe('optional configurations', () => { @@ -94,6 +238,9 @@ describe('createIndex argument validations', () => { await createIndex(IOA)({ name: 'index-name', dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', metric: 10, }); @@ -108,6 +255,9 @@ describe('createIndex argument validations', () => { await createIndex(IOA)({ name: 'index-name', dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', metric: '', }); @@ -122,6 +272,9 @@ describe('createIndex argument validations', () => { await createIndex(IOA)({ name: 'index-name', dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', replicas: '10', }); @@ -136,6 +289,9 @@ describe('createIndex argument validations', () => { await createIndex(IOA)({ name: 'index-name', dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', replicas: -10, }); @@ -150,6 +306,9 @@ describe('createIndex argument validations', () => { await createIndex(IOA)({ name: 'index-name', dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', podType: 10, }); @@ -164,6 +323,9 @@ describe('createIndex argument validations', () => { await createIndex(IOA)({ name: 'index-name', dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', podType: '', }); @@ -178,6 +340,9 @@ describe('createIndex argument validations', () => { await createIndex(IOA)({ name: 'index-name', dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', pods: '10', }); @@ -192,6 +357,9 @@ describe('createIndex argument validations', () => { await createIndex(IOA)({ name: 'index-name', dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', pods: -10, }); @@ -206,6 +374,9 @@ describe('createIndex argument validations', () => { await createIndex(IOA)({ name: 'index-name', dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', metadataConfig: '{}', }); @@ -220,6 +391,9 @@ describe('createIndex argument validations', () => { await createIndex(IOA)({ name: 'index-name', dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', sourceCollection: 10, }); @@ -234,6 +408,9 @@ describe('createIndex argument validations', () => { await createIndex(IOA)({ name: 'index-name', dimension: 10, + region: 'us-east3', + cloud: 'gcp', + capacityMode: 'pod', sourceCollection: '', }); diff --git a/src/control/__tests__/listIndexes.test.ts b/src/control/__tests__/listIndexes.test.ts index 5fc05ffb..5873db5e 100644 --- a/src/control/__tests__/listIndexes.test.ts +++ b/src/control/__tests__/listIndexes.test.ts @@ -3,19 +3,74 @@ import { listIndexes } from '../listIndexes'; describe('listIndexes', () => { test('should return a list of index objects', async () => { const IndexOperationsApi = { - listIndexes: jest - .fn() - .mockImplementation(() => - Promise.resolve(['index-name', 'index-name-2']) - ), + listIndexes: jest.fn().mockImplementation(() => + Promise.resolve({ + databases: [ + { + database: { + name: 'index-name', + dimension: 5, + capacityMode: 'pod', + metric: 'cosine', + }, + status: { + ready: true, + state: 'Ready', + host: '789-123-foo.svc.efgh.pinecone.io', + port: 443, + }, + }, + { + database: { + name: 'index-name-2', + dimension: 5, + capacityMode: 'pod', + metric: 'cosine', + }, + status: { + ready: true, + state: 'Ready', + host: '123-456-foo.svc.abcd.pinecone.io', + port: 443, + }, + }, + ], + }) + ), }; // @ts-ignore const returned = await listIndexes(IndexOperationsApi)(); expect(returned).toEqual([ - { name: 'index-name' }, - { name: 'index-name-2' }, + { + database: { + name: 'index-name', + dimension: 5, + capacityMode: 'pod', + metric: 'cosine', + }, + status: { + ready: true, + state: 'Ready', + host: '789-123-foo.svc.efgh.pinecone.io', + port: 443, + }, + }, + { + database: { + name: 'index-name-2', + dimension: 5, + capacityMode: 'pod', + metric: 'cosine', + }, + status: { + ready: true, + state: 'Ready', + host: '123-456-foo.svc.abcd.pinecone.io', + port: 443, + }, + }, ]); }); }); diff --git a/src/control/createIndex.ts b/src/control/createIndex.ts index 326bc83b..9a548b3d 100644 --- a/src/control/createIndex.ts +++ b/src/control/createIndex.ts @@ -5,9 +5,12 @@ import { handleApiError } from '../errors'; import { Type } from '@sinclair/typebox'; import { IndexNameSchema, + CapacityModeSchema, + CloudSchema, DimensionSchema, MetricSchema, PodsSchema, + RegionSchema, ReplicasSchema, PodTypeSchema, MetadataConfigSchema, @@ -25,6 +28,21 @@ export type CreateIndexOptions = { /** The dimension of the index. Must be a positive integer. The dimension of your index should match the output dimension of your embedding model. For example, if you are using a model that outputs 128-dimensional vectors, you should set the dimension to 128. */ dimension: number; + /** + * The region where you would like your index to be created + */ + region: string; + + /** + * The public cloud where you would like your index hosted + */ + cloud: 'gcp' | 'aws' | 'azure'; + + /** + * The capacity mode for the index. + */ + capacityMode: string; + /** * The metric specifies how similarity is calculated in the index when querying. The default metric is `'cosine'`. Supported metrics include `'cosine'`, `'dotproduct'`, and `'euclidean'`. To learn more about these options, see [Distance metrics](https://docs.pinecone.io/docs/indexes#distance-metrics) * @@ -39,6 +57,9 @@ export type CreateIndexOptions = { /** The number of replicas in the index. The default number of replicas is 1. */ replicas?: number; + /** The number of shards to be used in the index. */ + shards?: number; + /** * The type of pod in the index. This string should combine a base pod type (`s1`, `p1`, or `p2`) with a size (`x1`, `x2`, `x4`, or `x8`) into a string such as `p1.x1` or `s1.x4`. The default pod type is `p1.x1`. For more information on these, see this guide on [pod types and sizes](https://docs.pinecone.io/docs/indexes#pods-pod-types-and-pod-sizes). * @@ -70,6 +91,9 @@ const CreateIndexOptionsSchema = Type.Object( { name: IndexNameSchema, dimension: DimensionSchema, + region: RegionSchema, + cloud: CloudSchema, + capacityMode: CapacityModeSchema, metric: Type.Optional(MetricSchema), pods: Type.Optional(PodsSchema), replicas: Type.Optional(ReplicasSchema), diff --git a/src/control/index.ts b/src/control/index.ts index 95b9e697..6ad30b90 100644 --- a/src/control/index.ts +++ b/src/control/index.ts @@ -10,7 +10,7 @@ export type { DeleteIndexOptions } from './deleteIndex'; export { describeIndex } from './describeIndex'; export type { DescribeIndexOptions, IndexDescription } from './describeIndex'; export { listIndexes } from './listIndexes'; -export type { IndexList, PartialIndexDescription } from './listIndexes'; +export type { IndexList, IndexListDescription } from './listIndexes'; // Collection Operations export type { CollectionName } from './types'; diff --git a/src/control/listIndexes.ts b/src/control/listIndexes.ts index 63d42935..f861daec 100644 --- a/src/control/listIndexes.ts +++ b/src/control/listIndexes.ts @@ -1,28 +1,35 @@ import { IndexOperationsApi } from '../pinecone-generated-ts-fetch'; +import type { IndexListMeta } from '../pinecone-generated-ts-fetch'; /** - * A partial description of indexes in your project. + * A description of indexes in your project. * - * For full information about each index, see - * { @link Pinecone.describeIndex } + * For full information about each index, see { @link Pinecone.describeIndex } */ -export type PartialIndexDescription = { +export type IndexListDescription = { /** The name of the index */ name: string; + + /** The distance metric of the index */ + metric: string; + + /** The dimension of the index */ + dimension: number; + + /** The capacityMode of the index */ + capacityMode: string; + + /** The host address of the index */ + host: string; }; /** The list of indexes in your project */ -export type IndexList = Array; +export type IndexList = Array; export const listIndexes = (api: IndexOperationsApi) => { - return async (): Promise => { - const names = await api.listIndexes(); - - // We know in a future version of the API that listing - // indexes should return more information than just the - // index names. Mapping these results into an object - // will allow us us to add more information in the future - // in a non-breaking way. - return names.map((n) => ({ name: n })); + return async (): Promise> => { + const response = await api.listIndexes(); + + return response.databases || []; }; }; diff --git a/src/control/types.ts b/src/control/types.ts index e1ce7c44..d2ebaa97 100644 --- a/src/control/types.ts +++ b/src/control/types.ts @@ -26,6 +26,13 @@ export const ReplicasSchema = positiveInteger; export const PodsSchema = positiveInteger; export const MetricSchema = nonemptyString; export const DimensionSchema = positiveInteger; +export const RegionSchema = nonemptyString; +export const CloudSchema = Type.Union([ + Type.Literal('gcp'), + Type.Literal('aws'), + Type.Literal('azure'), +]); +export const CapacityModeSchema = nonemptyString; export const MetadataConfigSchema = Type.Object( { indexed: Type.Array(nonemptyString), diff --git a/src/data/types.ts b/src/data/types.ts index 56aa6d98..23edb5ea 100644 --- a/src/data/types.ts +++ b/src/data/types.ts @@ -41,7 +41,7 @@ export type IndexConfiguration = PineconeConfiguration & { /** * The host URL for the Index. */ - indexHostUrl?: string; + hostUrl?: string; }; export const RecordIdSchema = Type.String({ minLength: 1 }); diff --git a/src/data/vectorOperationsProvider.ts b/src/data/vectorOperationsProvider.ts index 75b3c515..0f69de6b 100644 --- a/src/data/vectorOperationsProvider.ts +++ b/src/data/vectorOperationsProvider.ts @@ -23,10 +23,10 @@ export class VectorOperationsProvider { return this.vectorOperations; } - if (this.config.indexHostUrl) { + if (this.config.hostUrl) { this.vectorOperations = this.buildVectorOperationsConfig(this.config); } else { - this.config.indexHostUrl = await IndexHostSingleton.getHostUrl( + this.config.hostUrl = await IndexHostSingleton.getHostUrl( this.config, this.indexName ); @@ -37,7 +37,7 @@ export class VectorOperationsProvider { return this.vectorOperations; } - buildVectorOperationsConfig(config) { + buildVectorOperationsConfig(config: IndexConfiguration) { const indexConfigurationParameters: ConfigurationParameters = { basePath: config.hostUrl, apiKey: config.apiKey, diff --git a/src/index.ts b/src/index.ts index 0e5d2af4..37baabb1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,8 +17,8 @@ export type { DescribeIndexOptions, IndexDescription, IndexList, + IndexListDescription, IndexName, - PartialIndexDescription, PartialCollectionDescription, PodType, } from './control'; diff --git a/src/integration/control/configureIndex.test.ts b/src/integration/control/configureIndex.test.ts index cd05f618..94f044d5 100644 --- a/src/integration/control/configureIndex.test.ts +++ b/src/integration/control/configureIndex.test.ts @@ -16,6 +16,9 @@ describe('configure index', () => { waitUntilReady: true, podType: 'p1.x1', replicas: 2, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', }); }); diff --git a/src/integration/control/createIndex.test.ts b/src/integration/control/createIndex.test.ts index 7975815b..e7bd5498 100644 --- a/src/integration/control/createIndex.test.ts +++ b/src/integration/control/createIndex.test.ts @@ -20,6 +20,9 @@ describe('create index', () => { await pinecone.createIndex({ name: indexName, dimension: 5, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', }); const description = await pinecone.describeIndex(indexName); expect(description.database?.name).toEqual(indexName); @@ -38,6 +41,9 @@ describe('create index', () => { metric: 'euclidean', replicas: 2, podType: 'p1.x2', + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', }); const description = await pinecone.describeIndex(indexName); @@ -54,6 +60,9 @@ describe('create index', () => { await pinecone.createIndex({ name: indexName, dimension: 5, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', waitUntilReady: true, }); @@ -66,10 +75,16 @@ describe('create index', () => { await pinecone.createIndex({ name: indexName, dimension: 5, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', }); await pinecone.createIndex({ name: indexName, dimension: 5, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', suppressConflicts: true, }); @@ -84,6 +99,9 @@ describe('create index', () => { await pinecone.createIndex({ name: indexName + '-', dimension: 5, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', }); } catch (e) { const err = e as PineconeNotFoundError; @@ -98,6 +116,9 @@ describe('create index', () => { name: indexName, dimension: 5, replicas: 20, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', }); } catch (e) { const err = e as PineconeNotFoundError; @@ -112,6 +133,9 @@ describe('create index', () => { name: indexName, dimension: 5, sourceCollection: 'non-existent-collection', + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', }); } catch (e) { const err = e as PineconeNotFoundError; diff --git a/src/integration/control/describeIndex.test.ts b/src/integration/control/describeIndex.test.ts index b799610f..360877ab 100644 --- a/src/integration/control/describeIndex.test.ts +++ b/src/integration/control/describeIndex.test.ts @@ -13,6 +13,9 @@ describe('describe index', () => { await pinecone.createIndex({ name: indexName, dimension: 5, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', }); }); diff --git a/src/integration/control/listIndexes.test.ts b/src/integration/control/listIndexes.test.ts index 183c6a43..d2b51a6f 100644 --- a/src/integration/control/listIndexes.test.ts +++ b/src/integration/control/listIndexes.test.ts @@ -12,6 +12,9 @@ describe('list indexes', () => { await pinecone.createIndex({ name: indexName, dimension: 5, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', }); }); @@ -22,8 +25,8 @@ describe('list indexes', () => { test('list indexes', async () => { const indexes = await pinecone.listIndexes(); expect(indexes).toBeDefined(); - expect(indexes.length).toBeGreaterThan(0); + expect(indexes?.length).toBeGreaterThan(0); - expect(indexes.map((i) => i.name)).toContain(indexName); + expect(indexes?.map((i) => i.name)).toContain(indexName); }); }); diff --git a/src/integration/data/deleteMany.test.ts b/src/integration/data/deleteMany.test.ts index 50f490ec..34288132 100644 --- a/src/integration/data/deleteMany.test.ts +++ b/src/integration/data/deleteMany.test.ts @@ -11,6 +11,9 @@ describe('deleteMany', () => { await pinecone.createIndex({ name: INDEX_NAME, dimension: 5, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', waitUntilReady: true, suppressConflicts: true, }); diff --git a/src/integration/data/query.test.ts b/src/integration/data/query.test.ts index 2791fbe4..a597c831 100644 --- a/src/integration/data/query.test.ts +++ b/src/integration/data/query.test.ts @@ -11,6 +11,9 @@ describe('query', () => { await pinecone.createIndex({ name: INDEX_NAME, dimension: 5, + cloud: 'gcp', + region: 'us-east1', + capacityMode: 'pod', waitUntilReady: true, suppressConflicts: true, }); diff --git a/src/pinecone-generated-ts-fetch/.openapi-generator/FILES b/src/pinecone-generated-ts-fetch/.openapi-generator/FILES index 74952e8e..86b46a39 100644 --- a/src/pinecone-generated-ts-fetch/.openapi-generator/FILES +++ b/src/pinecone-generated-ts-fetch/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore apis/IndexOperationsApi.ts apis/VectorOperationsApi.ts apis/index.ts @@ -13,10 +12,12 @@ models/DescribeIndexStatsRequest.ts models/DescribeIndexStatsResponse.ts models/FetchResponse.ts models/HnswConfig.ts +models/IndexListMeta.ts models/IndexMeta.ts models/IndexMetaDatabase.ts models/IndexMetaDatabaseIndexConfig.ts models/IndexMetaStatus.ts +models/ListIndexes200Response.ts models/NamespaceSummary.ts models/PatchRequest.ts models/ProtobufAny.ts diff --git a/src/pinecone-generated-ts-fetch/apis/IndexOperationsApi.ts b/src/pinecone-generated-ts-fetch/apis/IndexOperationsApi.ts index b2e9c53d..8132d312 100644 --- a/src/pinecone-generated-ts-fetch/apis/IndexOperationsApi.ts +++ b/src/pinecone-generated-ts-fetch/apis/IndexOperationsApi.ts @@ -19,6 +19,7 @@ import type { CreateCollectionRequest, CreateRequest, IndexMeta, + ListIndexes200Response, PatchRequest, } from '../models/index'; import { @@ -30,6 +31,8 @@ import { CreateRequestToJSON, IndexMetaFromJSON, IndexMetaToJSON, + ListIndexes200ResponseFromJSON, + ListIndexes200ResponseToJSON, PatchRequestFromJSON, PatchRequestToJSON, } from '../models/index'; @@ -71,7 +74,7 @@ export class IndexOperationsApi extends runtime.BaseAPI { /** * This operation specifies the pod type and number of replicas for an index. */ - async configureIndexRaw(requestParameters: ConfigureIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async configureIndexRaw(requestParameters: ConfigureIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.indexName === null || requestParameters.indexName === undefined) { throw new runtime.RequiredError('indexName','Required parameter requestParameters.indexName was null or undefined when calling configureIndex.'); } @@ -94,17 +97,13 @@ export class IndexOperationsApi extends runtime.BaseAPI { body: PatchRequestToJSON(requestParameters.patchRequest), }, initOverrides); - if (this.isJsonMime(response.headers.get('content-type'))) { - return new runtime.JSONApiResponse(response); - } else { - return new runtime.TextApiResponse(response) as any; - } + return new runtime.JSONApiResponse(response, (jsonValue) => IndexMetaFromJSON(jsonValue)); } /** * This operation specifies the pod type and number of replicas for an index. */ - async configureIndex(requestParameters: ConfigureIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async configureIndex(requestParameters: ConfigureIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.configureIndexRaw(requestParameters, initOverrides); return await response.value(); } @@ -149,7 +148,7 @@ export class IndexOperationsApi extends runtime.BaseAPI { /** * This operation creates a Pinecone index. You can use it to specify the measure of similarity, the dimension of vectors to be stored in the index, the numbers of shards and replicas to use, and more. */ - async createIndexRaw(requestParameters: CreateIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createIndexRaw(requestParameters: CreateIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -168,17 +167,13 @@ export class IndexOperationsApi extends runtime.BaseAPI { body: CreateRequestToJSON(requestParameters.createRequest), }, initOverrides); - if (this.isJsonMime(response.headers.get('content-type'))) { - return new runtime.JSONApiResponse(response); - } else { - return new runtime.TextApiResponse(response) as any; - } + return new runtime.JSONApiResponse(response, (jsonValue) => IndexMetaFromJSON(jsonValue)); } /** * This operation creates a Pinecone index. You can use it to specify the measure of similarity, the dimension of vectors to be stored in the index, the numbers of shards and replicas to use, and more. */ - async createIndex(requestParameters: CreateIndexRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async createIndex(requestParameters: CreateIndexRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createIndexRaw(requestParameters, initOverrides); return await response.value(); } @@ -360,7 +355,7 @@ export class IndexOperationsApi extends runtime.BaseAPI { /** * This operation returns a list of your Pinecone indexes. */ - async listIndexesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + async listIndexesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -376,13 +371,13 @@ export class IndexOperationsApi extends runtime.BaseAPI { query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response); + return new runtime.JSONApiResponse(response, (jsonValue) => ListIndexes200ResponseFromJSON(jsonValue)); } /** * This operation returns a list of your Pinecone indexes. */ - async listIndexes(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async listIndexes(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.listIndexesRaw(initOverrides); return await response.value(); } diff --git a/src/pinecone-generated-ts-fetch/models/CollectionMeta.ts b/src/pinecone-generated-ts-fetch/models/CollectionMeta.ts index 33749af3..99d6bd2f 100644 --- a/src/pinecone-generated-ts-fetch/models/CollectionMeta.ts +++ b/src/pinecone-generated-ts-fetch/models/CollectionMeta.ts @@ -24,31 +24,31 @@ export interface CollectionMeta { * @type {string} * @memberof CollectionMeta */ - name?: string; + name: string; /** * The size of the collection in bytes. * @type {number} * @memberof CollectionMeta */ - size?: number; + size: number; /** * The status of the collection. * @type {string} * @memberof CollectionMeta */ - status?: string; + status: string; /** - * + * The dimension of the records stored in the collection * @type {number} * @memberof CollectionMeta */ - dimension?: number; + dimension: number; /** - * + * The number of records stored in the collection * @type {number} * @memberof CollectionMeta */ - vectorCount?: number; + vectorCount: number; } /** @@ -56,6 +56,11 @@ export interface CollectionMeta { */ export function instanceOfCollectionMeta(value: object): boolean { let isInstance = true; + isInstance = isInstance && "name" in value; + isInstance = isInstance && "size" in value; + isInstance = isInstance && "status" in value; + isInstance = isInstance && "dimension" in value; + isInstance = isInstance && "vectorCount" in value; return isInstance; } @@ -70,11 +75,11 @@ export function CollectionMetaFromJSONTyped(json: any, ignoreDiscriminator: bool } return { - 'name': !exists(json, 'name') ? undefined : json['name'], - 'size': !exists(json, 'size') ? undefined : json['size'], - 'status': !exists(json, 'status') ? undefined : json['status'], - 'dimension': !exists(json, 'dimension') ? undefined : json['dimension'], - 'vectorCount': !exists(json, 'vector_count') ? undefined : json['vector_count'], + 'name': json['name'], + 'size': json['size'], + 'status': json['status'], + 'dimension': json['dimension'], + 'vectorCount': json['vector_count'], }; } diff --git a/src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts b/src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts index 05516573..542fc199 100644 --- a/src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts +++ b/src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts @@ -26,7 +26,7 @@ export interface CreateCollectionRequest { */ name: string; /** - * The name of the source index to be used as the source for the collection. + * The name of the index to be used as the source for the collection. * @type {string} * @memberof CreateCollectionRequest */ diff --git a/src/pinecone-generated-ts-fetch/models/CreateRequest.ts b/src/pinecone-generated-ts-fetch/models/CreateRequest.ts index 93cfd32e..0ba8401f 100644 --- a/src/pinecone-generated-ts-fetch/models/CreateRequest.ts +++ b/src/pinecone-generated-ts-fetch/models/CreateRequest.ts @@ -38,6 +38,24 @@ export interface CreateRequest { * @memberof CreateRequest */ dimension: number; + /** + * The region where you would like your index to be created + * @type {string} + * @memberof CreateRequest + */ + region: string; + /** + * The public cloud where you would like your index hosted + * @type {string} + * @memberof CreateRequest + */ + cloud: CreateRequestCloudEnum; + /** + * The capacity mode for the index. + * @type {string} + * @memberof CreateRequest + */ + capacityMode: string; /** * The type of vector index. Pinecone supports 'approximated'. * @type {string} @@ -99,6 +117,18 @@ export interface CreateRequest { sourceCollection?: string; } + +/** + * @export + */ +export const CreateRequestCloudEnum = { + Gcp: 'gcp', + Aws: 'aws', + Azure: 'azure' +} as const; +export type CreateRequestCloudEnum = typeof CreateRequestCloudEnum[keyof typeof CreateRequestCloudEnum]; + + /** * Check if a given object implements the CreateRequest interface. */ @@ -106,6 +136,9 @@ export function instanceOfCreateRequest(value: object): boolean { let isInstance = true; isInstance = isInstance && "name" in value; isInstance = isInstance && "dimension" in value; + isInstance = isInstance && "region" in value; + isInstance = isInstance && "cloud" in value; + isInstance = isInstance && "capacityMode" in value; return isInstance; } @@ -122,6 +155,9 @@ export function CreateRequestFromJSONTyped(json: any, ignoreDiscriminator: boole 'name': json['name'], 'dimension': json['dimension'], + 'region': json['region'], + 'cloud': json['cloud'], + 'capacityMode': json['capacity_mode'], 'indexType': !exists(json, 'index_type') ? undefined : json['index_type'], 'metric': !exists(json, 'metric') ? undefined : json['metric'], 'pods': !exists(json, 'pods') ? undefined : json['pods'], @@ -145,6 +181,9 @@ export function CreateRequestToJSON(value?: CreateRequest | null): any { 'name': value.name, 'dimension': value.dimension, + 'region': value.region, + 'cloud': value.cloud, + 'capacity_mode': value.capacityMode, 'index_type': value.indexType, 'metric': value.metric, 'pods': value.pods, diff --git a/src/pinecone-generated-ts-fetch/models/IndexListMeta.ts b/src/pinecone-generated-ts-fetch/models/IndexListMeta.ts new file mode 100644 index 00000000..29072839 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/models/IndexListMeta.ts @@ -0,0 +1,102 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface IndexListMeta + */ +export interface IndexListMeta { + /** + * + * @type {string} + * @memberof IndexListMeta + */ + name: string; + /** + * + * @type {string} + * @memberof IndexListMeta + */ + metric: string; + /** + * + * @type {number} + * @memberof IndexListMeta + */ + dimension: number; + /** + * + * @type {string} + * @memberof IndexListMeta + */ + capacityMode: string; + /** + * + * @type {string} + * @memberof IndexListMeta + */ + host: string; +} + +/** + * Check if a given object implements the IndexListMeta interface. + */ +export function instanceOfIndexListMeta(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "name" in value; + isInstance = isInstance && "metric" in value; + isInstance = isInstance && "dimension" in value; + isInstance = isInstance && "capacityMode" in value; + isInstance = isInstance && "host" in value; + + return isInstance; +} + +export function IndexListMetaFromJSON(json: any): IndexListMeta { + return IndexListMetaFromJSONTyped(json, false); +} + +export function IndexListMetaFromJSONTyped(json: any, ignoreDiscriminator: boolean): IndexListMeta { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'name': json['name'], + 'metric': json['metric'], + 'dimension': json['dimension'], + 'capacityMode': json['capacity_mode'], + 'host': json['host'], + }; +} + +export function IndexListMetaToJSON(value?: IndexListMeta | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'name': value.name, + 'metric': value.metric, + 'dimension': value.dimension, + 'capacity_mode': value.capacityMode, + 'host': value.host, + }; +} + diff --git a/src/pinecone-generated-ts-fetch/models/IndexMeta.ts b/src/pinecone-generated-ts-fetch/models/IndexMeta.ts index 5753ce48..31ebf69b 100644 --- a/src/pinecone-generated-ts-fetch/models/IndexMeta.ts +++ b/src/pinecone-generated-ts-fetch/models/IndexMeta.ts @@ -37,13 +37,13 @@ export interface IndexMeta { * @type {IndexMetaDatabase} * @memberof IndexMeta */ - database?: IndexMetaDatabase; + database: IndexMetaDatabase; /** * * @type {IndexMetaStatus} * @memberof IndexMeta */ - status?: IndexMetaStatus; + status: IndexMetaStatus; } /** @@ -51,6 +51,8 @@ export interface IndexMeta { */ export function instanceOfIndexMeta(value: object): boolean { let isInstance = true; + isInstance = isInstance && "database" in value; + isInstance = isInstance && "status" in value; return isInstance; } @@ -65,8 +67,8 @@ export function IndexMetaFromJSONTyped(json: any, ignoreDiscriminator: boolean): } return { - 'database': !exists(json, 'database') ? undefined : IndexMetaDatabaseFromJSON(json['database']), - 'status': !exists(json, 'status') ? undefined : IndexMetaStatusFromJSON(json['status']), + 'database': IndexMetaDatabaseFromJSON(json['database']), + 'status': IndexMetaStatusFromJSON(json['status']), }; } diff --git a/src/pinecone-generated-ts-fetch/models/IndexMetaDatabase.ts b/src/pinecone-generated-ts-fetch/models/IndexMetaDatabase.ts index 918e6e7c..50c344bf 100644 --- a/src/pinecone-generated-ts-fetch/models/IndexMetaDatabase.ts +++ b/src/pinecone-generated-ts-fetch/models/IndexMetaDatabase.ts @@ -31,13 +31,19 @@ export interface IndexMetaDatabase { * @type {string} * @memberof IndexMetaDatabase */ - name?: string; + name: string; + /** + * + * @type {number} + * @memberof IndexMetaDatabase + */ + dimension: number; /** * * @type {string} * @memberof IndexMetaDatabase */ - dimension?: string; + capacityMode: string; /** * * @type {string} @@ -50,7 +56,7 @@ export interface IndexMetaDatabase { * @type {string} * @memberof IndexMetaDatabase */ - metric?: string; + metric: string; /** * * @type {number} @@ -94,6 +100,10 @@ export interface IndexMetaDatabase { */ export function instanceOfIndexMetaDatabase(value: object): boolean { let isInstance = true; + isInstance = isInstance && "name" in value; + isInstance = isInstance && "dimension" in value; + isInstance = isInstance && "capacityMode" in value; + isInstance = isInstance && "metric" in value; return isInstance; } @@ -108,10 +118,11 @@ export function IndexMetaDatabaseFromJSONTyped(json: any, ignoreDiscriminator: b } return { - 'name': !exists(json, 'name') ? undefined : json['name'], - 'dimension': !exists(json, 'dimension') ? undefined : json['dimension'], + 'name': json['name'], + 'dimension': json['dimension'], + 'capacityMode': json['capacity_mode'], 'indexType': !exists(json, 'index_type') ? undefined : json['index_type'], - 'metric': !exists(json, 'metric') ? undefined : json['metric'], + 'metric': json['metric'], 'pods': !exists(json, 'pods') ? undefined : json['pods'], 'replicas': !exists(json, 'replicas') ? undefined : json['replicas'], 'shards': !exists(json, 'shards') ? undefined : json['shards'], @@ -132,6 +143,7 @@ export function IndexMetaDatabaseToJSON(value?: IndexMetaDatabase | null): any { 'name': value.name, 'dimension': value.dimension, + 'capacity_mode': value.capacityMode, 'index_type': value.indexType, 'metric': value.metric, 'pods': value.pods, diff --git a/src/pinecone-generated-ts-fetch/models/IndexMetaStatus.ts b/src/pinecone-generated-ts-fetch/models/IndexMetaStatus.ts index 7022fe9d..bc80c346 100644 --- a/src/pinecone-generated-ts-fetch/models/IndexMetaStatus.ts +++ b/src/pinecone-generated-ts-fetch/models/IndexMetaStatus.ts @@ -24,25 +24,25 @@ export interface IndexMetaStatus { * @type {boolean} * @memberof IndexMetaStatus */ - ready?: boolean; + ready: boolean; /** * * @type {string} * @memberof IndexMetaStatus */ - state?: IndexMetaStatusStateEnum; + state: IndexMetaStatusStateEnum; /** * * @type {string} * @memberof IndexMetaStatus */ - host?: string; + host: string; /** * * @type {number} * @memberof IndexMetaStatus */ - port?: number; + port: number; } @@ -67,6 +67,10 @@ export type IndexMetaStatusStateEnum = typeof IndexMetaStatusStateEnum[keyof typ */ export function instanceOfIndexMetaStatus(value: object): boolean { let isInstance = true; + isInstance = isInstance && "ready" in value; + isInstance = isInstance && "state" in value; + isInstance = isInstance && "host" in value; + isInstance = isInstance && "port" in value; return isInstance; } @@ -81,10 +85,10 @@ export function IndexMetaStatusFromJSONTyped(json: any, ignoreDiscriminator: boo } return { - 'ready': !exists(json, 'ready') ? undefined : json['ready'], - 'state': !exists(json, 'state') ? undefined : json['state'], - 'host': !exists(json, 'host') ? undefined : json['host'], - 'port': !exists(json, 'port') ? undefined : json['port'], + 'ready': json['ready'], + 'state': json['state'], + 'host': json['host'], + 'port': json['port'], }; } diff --git a/src/pinecone-generated-ts-fetch/models/InlineResponse200.ts b/src/pinecone-generated-ts-fetch/models/InlineResponse200.ts new file mode 100644 index 00000000..2da0e9ca --- /dev/null +++ b/src/pinecone-generated-ts-fetch/models/InlineResponse200.ts @@ -0,0 +1,64 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import { + IndexMeta, + IndexMetaFromJSON, + IndexMetaFromJSONTyped, + IndexMetaToJSON, +} from './'; + +/** + * + * @export + * @interface InlineResponse200 + */ +export interface InlineResponse200 { + /** + * + * @type {Array} + * @memberof InlineResponse200 + */ + databases?: Array; +} + +export function InlineResponse200FromJSON(json: any): InlineResponse200 { + return InlineResponse200FromJSONTyped(json, false); +} + +export function InlineResponse200FromJSONTyped(json: any, ignoreDiscriminator: boolean): InlineResponse200 { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'databases': !exists(json, 'databases') ? undefined : ((json['databases'] as Array).map(IndexMetaFromJSON)), + }; +} + +export function InlineResponse200ToJSON(value?: InlineResponse200 | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'databases': value.databases === undefined ? undefined : ((value.databases as Array).map(IndexMetaToJSON)), + }; +} + + diff --git a/src/pinecone-generated-ts-fetch/models/ListIndexes200Response.ts b/src/pinecone-generated-ts-fetch/models/ListIndexes200Response.ts new file mode 100644 index 00000000..93e69113 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/models/ListIndexes200Response.ts @@ -0,0 +1,72 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { IndexListMeta } from './IndexListMeta'; +import { + IndexListMetaFromJSON, + IndexListMetaFromJSONTyped, + IndexListMetaToJSON, +} from './IndexListMeta'; + +/** + * + * @export + * @interface ListIndexes200Response + */ +export interface ListIndexes200Response { + /** + * + * @type {Array} + * @memberof ListIndexes200Response + */ + databases?: Array; +} + +/** + * Check if a given object implements the ListIndexes200Response interface. + */ +export function instanceOfListIndexes200Response(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function ListIndexes200ResponseFromJSON(json: any): ListIndexes200Response { + return ListIndexes200ResponseFromJSONTyped(json, false); +} + +export function ListIndexes200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ListIndexes200Response { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'databases': !exists(json, 'databases') ? undefined : ((json['databases'] as Array).map(IndexListMetaFromJSON)), + }; +} + +export function ListIndexes200ResponseToJSON(value?: ListIndexes200Response | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'databases': value.databases === undefined ? undefined : ((value.databases as Array).map(IndexListMetaToJSON)), + }; +} + diff --git a/src/pinecone-generated-ts-fetch/models/index.ts b/src/pinecone-generated-ts-fetch/models/index.ts index 8752fda7..a9012ac0 100644 --- a/src/pinecone-generated-ts-fetch/models/index.ts +++ b/src/pinecone-generated-ts-fetch/models/index.ts @@ -10,10 +10,12 @@ export * from './DescribeIndexStatsRequest'; export * from './DescribeIndexStatsResponse'; export * from './FetchResponse'; export * from './HnswConfig'; +export * from './IndexListMeta'; export * from './IndexMeta'; export * from './IndexMetaDatabase'; export * from './IndexMetaDatabaseIndexConfig'; export * from './IndexMetaStatus'; +export * from './ListIndexes200Response'; export * from './NamespaceSummary'; export * from './PatchRequest'; export * from './ProtobufAny';