Skip to content

Commit

Permalink
[spruce] Remove v0 code paths and references (#181)
Browse files Browse the repository at this point in the history
## Problem
When we launched the node v1.0.0 client, we left in code paths, exports,
and the generated core for the original v0 client. This was to
facilitate ease of migration alongside a migration guide:
`v1-migration.md`.

As we move to release v2.0.0 we'd like to fully deprecate the v0 client.

## Solution

- Remove everything under `/src/v0/` which includes the v0 client code
and generated core.
- Delete `README.v0.md` and `v1-migration.md`.
- Remove references to v0 from `README.md`.
- Remove v0 exports from `src/index.ts`.
- Remove v0 environment requirements and code exports from
`replInit.ts`.
- Remove `isLegacy` from `buildUserAgent`.
- Remove v0 paths and references from config files.

## 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

## Test Plan
Verify CI and tests pass as expected. There should no longer be v0
exports present in the `Pinecone` package.

Run the repl and make sure you're not seeing the legacy export:

```
$ npm run repl

> @pinecone-database/[email protected] repl
> npm run build && node utils/replInit.ts


> @pinecone-database/[email protected] build
> rm -rf dist/ && tsc

INFO Found environment variable PINECONE_API_KEY in .env file
> SUCCESS Pinecone module exports (Pinecone, etc) automatically imported to this repl session.

Run "await init()" to setup client instance using environment variable configs.
```
  • Loading branch information
austin-denoble authored Jan 11, 2024
1 parent f820668 commit 1acb597
Show file tree
Hide file tree
Showing 53 changed files with 12 additions and 4,542 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"es2021": true,
"node": true
},
"ignorePatterns": ["dist", "src/pinecone-generated-ts-fetch", "src/v0"],
"ignorePatterns": ["dist", "src/pinecone-generated-ts-fetch"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
Expand Down
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
dist
node_modules
src/pinecone-generated-ts-fetch
src/v0
src/pinecone-generated-ts-fetch
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,3 @@ If you do not specify a namespace, the records in the default namespace `''` wil
If you are ready to take a JavaScript application to production where raw performance is the overriding concern, you can set the environment variable `PINECONE_DISABLE_RUNTIME_VALIDATIONS="true"` to disable runtime argument validation in the Pinecone client. Runtime validations are used to provide feedback when incorrect method options are provided, for example if you attempt to create an index without specifying a required dimension property.

These runtime validations are most helpful for users who are not developing with Typescript or who are experimenting in a REPL or notebook-type setting. But once you've tested an application and have gained confidence things are working as expected, you can disable these checks to gain a small improvement in performance. This will have the most impact if your workload is upserting very large amounts of data.

## Legacy exports

For information about the legacy `PineconeClient` export, see the [old README](https://github.com/pinecone-io/pinecone-ts-client/blob/main/README.v0.md).
276 changes: 0 additions & 276 deletions README.v0.md

This file was deleted.

1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module.exports = {
collectCoverageFrom: [
'<rootDir>/src/**/*.ts',
'!**/src/pinecone-generated-ts-fetch/**',
'!**/src/v0/**',
'!**/node_modules/**',
'!**/vendor/**',
],
Expand Down
2 changes: 1 addition & 1 deletion src/control/indexOperationsBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const indexOperationsBuilder = (
apiKey,
queryParamsStringify,
headers: {
'User-Agent': buildUserAgent(false),
'User-Agent': buildUserAgent(),
...headers,
},
fetchApi: getFetch(config),
Expand Down
2 changes: 1 addition & 1 deletion src/data/vectorOperationsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class VectorOperationsProvider {
apiKey: this.config.apiKey,
queryParamsStringify,
headers: {
'User-Agent': buildUserAgent(false),
'User-Agent': buildUserAgent(),
},
fetchApi: getFetch(this.config),
middleware,
Expand Down
16 changes: 0 additions & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,3 @@ export type {
IndexList,
IndexModel,
} from './pinecone-generated-ts-fetch';

// Legacy exports for backwards compatibility
export { PineconeClient } from './v0';
export { utils } from './v0/utils';
export {
CreateCollectionRequest as CreateCollectionRequestV0,
CreateRequest,
DeleteRequest,
PatchRequest,
QueryRequest,
QueryVector,
ScoredVector,
UpdateRequest,
UpsertRequest,
Vector,
} from './v0/pinecone-generated-ts-fetch';
6 changes: 1 addition & 5 deletions src/utils/user-agent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isEdge } from './environment';
import * as packageInfo from '../version.json';

export const buildUserAgent = (isLegacy: boolean) => {
export const buildUserAgent = () => {
// We always want to include the package name and version
// along with the langauge name to help distinguish these
// requests from those emitted by other clients
Expand All @@ -24,9 +24,5 @@ export const buildUserAgent = (isLegacy: boolean) => {
userAgentParts.push(`node ${process.version}`);
}

// Use this flag to identify whether they are using the v0 legacy
// client export called PineconeClient
userAgentParts.push(`legacyExport=${isLegacy}`);

return userAgentParts.join('; ');
};
Loading

0 comments on commit 1acb597

Please sign in to comment.