From 512794da21f48805d37817cb44f5526c975dcbaa Mon Sep 17 00:00:00 2001 From: Luis Merino Date: Sat, 22 Apr 2023 22:09:01 +0200 Subject: [PATCH 1/2] fix: move exports default condition to last --- .changeset/slimy-cycles-repeat.md | 6 ++++++ packages/js-client-rest/package.json | 4 ++-- packages/qdrant-js/package.json | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/slimy-cycles-repeat.md diff --git a/.changeset/slimy-cycles-repeat.md b/.changeset/slimy-cycles-repeat.md new file mode 100644 index 0000000..430365b --- /dev/null +++ b/.changeset/slimy-cycles-repeat.md @@ -0,0 +1,6 @@ +--- +'@qdrant/js-client-rest': patch +'@qdrant/qdrant-js': patch +--- + +Fixes issue on Webpack and potentially other bundles to target ESM files when bundling. diff --git a/packages/js-client-rest/package.json b/packages/js-client-rest/package.json index b072459..b9869d9 100644 --- a/packages/js-client-rest/package.json +++ b/packages/js-client-rest/package.json @@ -22,9 +22,9 @@ "exports": { ".": { "require": "./dist/cjs/index.js", - "default": "./dist/esm/index.js", "browser": "./dist/browser/index.js", - "types": "./dist/types/index.d.ts" + "types": "./dist/types/index.d.ts", + "default": "./dist/esm/index.js" } }, "files": [ diff --git a/packages/qdrant-js/package.json b/packages/qdrant-js/package.json index b4b460f..9187568 100644 --- a/packages/qdrant-js/package.json +++ b/packages/qdrant-js/package.json @@ -21,9 +21,9 @@ "exports": { ".": { "require": "./dist/cjs/index.js", - "default": "./dist/esm/index.js", "browser": "./dist/browser/index.js", - "types": "./dist/types/index.d.ts" + "types": "./dist/types/index.d.ts", + "default": "./dist/esm/index.js" } }, "files": [ From 4a74872ebb408ee8688693c35ab181c76238498c Mon Sep 17 00:00:00 2001 From: Luis Merino Date: Sun, 23 Apr 2023 23:36:21 +0200 Subject: [PATCH 2/2] fix default 'host' as localhost resolving to ipv6 since Node 17 --- .changeset/slimy-cycles-repeat.md | 3 ++- packages/js-client-rest/README.md | 4 ++-- packages/js-client-rest/src/qdrant-client.ts | 2 +- packages/js-client-rest/tests/integration-tests.sh | 2 +- packages/js-client-rest/tests/unit/qdrant-client.test.ts | 6 +++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.changeset/slimy-cycles-repeat.md b/.changeset/slimy-cycles-repeat.md index 430365b..8ba9e82 100644 --- a/.changeset/slimy-cycles-repeat.md +++ b/.changeset/slimy-cycles-repeat.md @@ -3,4 +3,5 @@ '@qdrant/qdrant-js': patch --- -Fixes issue on Webpack and potentially other bundles to target ESM files when bundling. +- Fixes issue on Webpack and potentially other bundles to target ESM files when bundling. +- Fixes default parameter host=localhost resolving to ipv6 ::1 since Node 17 by using 127.0.0.1 instead. diff --git a/packages/js-client-rest/README.md b/packages/js-client-rest/README.md index c1cec66..f7c5a56 100644 --- a/packages/js-client-rest/README.md +++ b/packages/js-client-rest/README.md @@ -25,9 +25,9 @@ docker run -p 6333:6333 qdrant/qdrant ```ts import {QdrantClient} from '@qdrant/js-client-rest'; -const client = new QdrantClient({host: 'localhost', port: 6333}); +const client = new QdrantClient({host: '127.0.0.1', port: 6333}); // or -const client = new QdrantClient({url: 'http://localhost:6333'}); +const client = new QdrantClient({url: 'http://127.0.0.1:6333'}); ``` ## Make requests diff --git a/packages/js-client-rest/src/qdrant-client.ts b/packages/js-client-rest/src/qdrant-client.ts index f60d227..2edcd6e 100644 --- a/packages/js-client-rest/src/qdrant-client.ts +++ b/packages/js-client-rest/src/qdrant-client.ts @@ -61,7 +61,7 @@ export class QdrantClient { } } else { this._port = port; - this._host = host ?? 'localhost'; + this._host = host ?? '127.0.0.1'; } const headers = new Headers(); diff --git a/packages/js-client-rest/tests/integration-tests.sh b/packages/js-client-rest/tests/integration-tests.sh index 286dd37..2bf8b3a 100755 --- a/packages/js-client-rest/tests/integration-tests.sh +++ b/packages/js-client-rest/tests/integration-tests.sh @@ -11,7 +11,7 @@ function stop_docker() QDRANT_LATEST="v1.1.1" QDRANT_VERSION=${QDRANT_VERSION:-"$QDRANT_LATEST"} -QDRANT_HOST='localhost:6333' +QDRANT_HOST='127.0.0.1:6333' docker run -d --rm \ -p 6333:6333 \ diff --git a/packages/js-client-rest/tests/unit/qdrant-client.test.ts b/packages/js-client-rest/tests/unit/qdrant-client.test.ts index 71248d1..7fd993e 100644 --- a/packages/js-client-rest/tests/unit/qdrant-client.test.ts +++ b/packages/js-client-rest/tests/unit/qdrant-client.test.ts @@ -5,15 +5,15 @@ import {QdrantClientConfigError} from '../../src/errors.js'; test('QdrantClient()', () => { let client = new QdrantClient(); // @ts-expect-error ts(2341) - expect(client._restUri).toBe('http://localhost:6333'); + expect(client._restUri).toBe('http://127.0.0.1:6333'); client = new QdrantClient({https: true}); // @ts-expect-error ts(2341) - expect(client._restUri).toBe('https://localhost:6333'); + expect(client._restUri).toBe('https://127.0.0.1:6333'); client = new QdrantClient({https: true, port: 7333}); // @ts-expect-error ts(2341) - expect(client._restUri).toBe('https://localhost:7333'); + expect(client._restUri).toBe('https://127.0.0.1:7333'); expect(() => new QdrantClient({host: 'localhost:6333'})).toThrow(QdrantClientConfigError);