-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gRPC client + project setup overhaul (#24)
- Generated gRPC client based on plugins from @bufbuild - REST client accepts maxConnections now using undici.js agent for fetch - Updated OAS definitions and improved generated types - Improved NPM dependency management in monorepo - Improved linting and tooling setup - Added CI check to avoid bumping a version of clients too early
- Loading branch information
Showing
137 changed files
with
19,218 additions
and
1,181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@qdrant/js-client-grpc': patch | ||
'@qdrant/js-client-rest': patch | ||
'@qdrant/qdrant-js': patch | ||
--- | ||
|
||
Added gRPC client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"root": true, | ||
"env": { | ||
"node": true | ||
}, | ||
"ignorePatterns": ["**/node_modules/**", "scripts/*"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": ["./tsconfig.base.json"] | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"plugin:@typescript-eslint/strict" | ||
], | ||
"rules": { | ||
"object-shorthand": "warn", | ||
"arrow-body-style": "warn", | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
"args": "all", | ||
"argsIgnorePattern": "^_", | ||
"ignoreRestSiblings": true | ||
} | ||
], | ||
"@typescript-eslint/consistent-type-definitions": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
**/node_modules/ | ||
**/dist/ | ||
**/src/openapi/ | ||
**/src/proto/ | ||
**/pnpm-lock.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"eslint.workingDirectories": ["packages/js-client-rest", "packages/js-client-grpc"] | ||
"eslint.workingDirectories": ["packages/qdrant-js", "packages/js-client-rest", "packages/js-client-grpc"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,21 +8,38 @@ | |
}, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"prepare": "node ./prepare.cjs && pnpm -r build", | ||
"prepare": "node scripts/prepare.cjs && pnpm -r build", | ||
"ci:version": "pnpm changeset version && pnpm install --no-frozen-lockfile && git add .", | ||
"ci:release": "pnpm changeset publish" | ||
"ci:release": "node scripts/prepublish.mjs && pnpm changeset publish" | ||
}, | ||
"lint-staged": { | ||
"*.ts": [ | ||
"prettier --list-different", | ||
"eslint" | ||
], | ||
"*.{md,yaml}": "prettier --list-different" | ||
}, | ||
"devDependencies": { | ||
"@changesets/changelog-github": "0.4.8", | ||
"@changesets/cli": "2.26.1", | ||
"husky": "8.0.3", | ||
"is-ci": "3.0.1", | ||
"prettier": "2.8.7", | ||
"typescript": "5.0.4" | ||
"@changesets/changelog-github": "^0.4.8", | ||
"@changesets/cli": "^2.26.1", | ||
"@rollup/plugin-node-resolve": "^15.0.2", | ||
"@rollup/plugin-terser": "^0.4.1", | ||
"@types/node": "^20.1.3", | ||
"@typescript-eslint/eslint-plugin": "^5.59.5", | ||
"@typescript-eslint/parser": "^5.59.5", | ||
"eslint": "^8.41.0", | ||
"husky": "^8.0.3", | ||
"is-ci": "^3.0.1", | ||
"lint-staged": "^13.2.2", | ||
"prettier": "^2.8.8", | ||
"rimraf": "^5.0.0", | ||
"rollup": "^3.21.6", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.4" | ||
}, | ||
"pnpm": { | ||
"overrides": { | ||
"[email protected] || 2.x": "^2.2.2" | ||
"@bufbuild/protobuf@^1.2.0": "file:./packages/js-client-grpc/includes/bufbuild-protobuf-1.2.1.tgz" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"ignorePatterns": ["dist/*", "src/proto/*", "scripts/post-build.js"], | ||
"parserOptions": { | ||
"project": ["./tsconfig.json"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
**/node_modules/ | ||
**/dist/ | ||
**/src/proto/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# JavaScript Qdrant gRPC Client | ||
|
||
This repository contains the gRPC client for the [Qdrant](https://github.com/qdrant/qdrant) vector search engine. | ||
|
||
## Installation | ||
|
||
```shell | ||
npm install @qdrant/js-client-grpc | ||
# or | ||
yarn add @qdrant/js-client-grpc | ||
# or | ||
pnpm i @qdrant/js-client-grpc | ||
``` | ||
|
||
## Usage | ||
|
||
Run the Qdrant Docker container: | ||
|
||
```shell | ||
docker run -p 6334:6334 qdrant/qdrant | ||
``` | ||
|
||
## Instantiate a client | ||
|
||
```ts | ||
import {QdrantClient} from '@qdrant/js-client-grpc'; | ||
|
||
const client = new QdrantClient({host: '127.0.0.1', port: 6334}); | ||
// or | ||
const client = new QdrantClient({url: 'http://127.0.0.1:6334'}); | ||
``` | ||
|
||
## Make requests | ||
|
||
Use an endpoint from `collections` API: | ||
|
||
```ts | ||
try { | ||
const result = await client.api('collections').list({}); | ||
console.log('List of collections:', result.collections); | ||
} catch (err) { | ||
console.error('Could not get collections:', err); | ||
} | ||
``` | ||
|
||
## Support | ||
|
||
The gRPC implementation relies on the native node module `node:https`. For the time being, no JavaScript runtime other than Node / Deno are supported (though support for web may be added). Both Deno and Node support full-duplex, HTTP trailers and all the necessary bits for gRPC. Under the hood, the client uses [`connect-es`](https://github.com/bufbuild/connect-es/) to communicate with the server. | ||
|
||
## Releases | ||
|
||
Major and minor versions align with Qdrant's engine releases, whilst patch are reserved for fixes regarding the current minor release. Check out [RELEASE.md](../../RELEASE.md) for more info on release guidelines. | ||
|
||
## Contributing | ||
|
||
These are the most relevant scripts for development: | ||
|
||
- `pnpm build`: builds and bundles from TypeScript sources | ||
- `pnpm pre-check`: type-checks sources | ||
- `pnpm pre-commit`: same as pre-check, but for git hooks (husky) | ||
- `pnpm test`: run unit tests | ||
- `pnpm test:integration`: runs integration tests against a locally running Qdrant docker container | ||
- `pnpm codegen:openapi-typescript`: updates generated TS schema from the latest openapi.json remote |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.