Skip to content

Commit 47c232b

Browse files
committed
Merge branch 'dev/1.30' of https://github.com/weaviate/typescript-client into 1.30/support-for-runtime-generate
2 parents 1a11acd + e970d8f commit 47c232b

File tree

16 files changed

+54
-51
lines changed

16 files changed

+54
-51
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "weaviate-client",
3-
"version": "3.4.0",
3+
"version": "3.4.1",
44
"description": "JS/TS client for Weaviate",
55
"main": "dist/node/cjs/index.js",
66
"type": "module",

src/collections/aggregate/integration.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('Testing of the collection.aggregate methods', () => {
3939

4040
beforeAll(async () => {
4141
client = await weaviate.connectToLocal();
42-
collection = client.collections.get(collectionName);
42+
collection = client.collections.use(collectionName);
4343
return client.collections
4444
.create({
4545
name: collectionName,
@@ -168,7 +168,7 @@ describe('Testing of the collection.aggregate methods', () => {
168168
});
169169

170170
it('should aggregate data without a search and one non-generic property metric', async () => {
171-
const result = await (await client).collections.get(collectionName).aggregate.overAll({
171+
const result = await (await client).collections.use(collectionName).aggregate.overAll({
172172
returnMetrics: collection.metrics
173173
.aggregate('text')
174174
.text(['count', 'topOccurrencesOccurs', 'topOccurrencesValue']),
@@ -307,7 +307,7 @@ describe('Testing of the collection.aggregate methods with named vectors', () =>
307307

308308
beforeAll(async () => {
309309
client = await weaviate.connectToLocal();
310-
collection = client.collections.get(collectionName);
310+
collection = client.collections.use(collectionName);
311311
const query = () =>
312312
client.collections.create<TestCollectionAggregateVectors>({
313313
name: collectionName,
@@ -355,7 +355,7 @@ describe('Testing of collection.aggregate.overAll with a multi-tenancy collectio
355355

356356
beforeAll(async () => {
357357
client = await weaviate.connectToLocal();
358-
collection = client.collections.get(collectionName);
358+
collection = client.collections.use(collectionName);
359359
return client.collections
360360
.create({
361361
name: collectionName,
@@ -407,7 +407,7 @@ describe('Testing of collection.aggregate search methods', () => {
407407

408408
beforeAll(async () => {
409409
client = await weaviate.connectToLocal();
410-
collection = client.collections.get(collectionName);
410+
collection = client.collections.use(collectionName);
411411
return client.collections
412412
.create({
413413
name: collectionName,

src/collections/backup/integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('Integration testing of backups', () => {
1111
grpcPort: 50061,
1212
});
1313

14-
const getCollection = (client: WeaviateClient) => client.collections.get('TestBackupCollection');
14+
const getCollection = (client: WeaviateClient) => client.collections.use('TestBackupCollection');
1515

1616
beforeAll(() =>
1717
clientPromise.then((client) =>

src/collections/config/integration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ describe('Testing of the collection.config namespace', () => {
580580
vectorizer: 'none',
581581
})
582582
.do();
583-
const collection = client.collections.get(collectionName);
583+
const collection = client.collections.use(collectionName);
584584
const config = await collection.config
585585
.update({
586586
vectorizers: weaviate.reconfigure.vectorizer.update({
@@ -631,7 +631,7 @@ describe('Testing of the collection.config namespace', () => {
631631
return;
632632
}
633633
const collectionName = 'TestCollectionConfigUpdateGenerative';
634-
const collection = client.collections.get(collectionName);
634+
const collection = client.collections.use(collectionName);
635635
await client.collections.create({
636636
name: collectionName,
637637
vectorizers: weaviate.configure.vectorizer.none(),

src/collections/data/integration.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Testing of the collection.data methods with a single target reference'
4040

4141
beforeAll(async () => {
4242
client = await weaviate.connectToLocal();
43-
collection = client.collections.get(collectionName);
43+
collection = client.collections.use(collectionName);
4444
await client.collections
4545
.create<TestCollectionData>({
4646
name: collectionName,
@@ -500,8 +500,8 @@ describe('Testing of the collection.data methods with a multi target reference',
500500

501501
beforeAll(async () => {
502502
client = await weaviate.connectToLocal();
503-
collectionOne = client.collections.get(classNameOne);
504-
collectionTwo = client.collections.get(classNameTwo);
503+
collectionOne = client.collections.use(classNameOne);
504+
collectionTwo = client.collections.use(classNameTwo);
505505
oneId = await client.collections
506506
.create({
507507
name: classNameOne,
@@ -1019,7 +1019,7 @@ describe('Testing of BYOV insertion with legacy vectorizer', () => {
10191019

10201020
it('should insert and retrieve many vectors using the new client', async () => {
10211021
const client = await weaviate.connectToLocal();
1022-
const collection = client.collections.get(collectionName);
1022+
const collection = client.collections.use(collectionName);
10231023
const { uuids, hasErrors } = await collection.data.insertMany([
10241024
{ vectors: [1, 2, 3] },
10251025
{ vectors: [4, 5, 6] },
@@ -1035,7 +1035,7 @@ describe('Testing of BYOV insertion with legacy vectorizer', () => {
10351035

10361036
it('should insert and retrieve single vectors using the new client', async () => {
10371037
const client = await weaviate.connectToLocal();
1038-
const collection = client.collections.get(collectionName);
1038+
const collection = client.collections.use(collectionName);
10391039
const id = await collection.data.insert({ vectors: [7, 8, 9] });
10401040
const object = await collection.query.fetchObjectById(id, { includeVector: true });
10411041
expect(object?.vectors.default).toEqual([7, 8, 9]);

src/collections/filters/integration.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('Testing of the filter class with a simple collection', () => {
3232

3333
beforeAll(async () => {
3434
client = await weaviate.connectToLocal();
35-
collection = client.collections.get(collectionName);
35+
collection = client.collections.use(collectionName);
3636
ids = await client.collections
3737
.create({
3838
name: collectionName,
@@ -111,8 +111,8 @@ describe('Testing of the filter class with a simple collection', () => {
111111
});
112112

113113
it('should filter a fetch objects query with a single filter and non-generic collection', async () => {
114-
const res = await client.collections.get(collectionName).query.fetchObjects({
115-
filters: client.collections.get(collectionName).filter.byProperty('text').equal('two'),
114+
const res = await client.collections.use(collectionName).query.fetchObjects({
115+
filters: client.collections.use(collectionName).filter.byProperty('text').equal('two'),
116116
});
117117
expect(res.objects.length).toEqual(1);
118118
const obj = res.objects[0];
@@ -295,7 +295,7 @@ describe('Testing of the filter class with complex data types', () => {
295295

296296
beforeAll(async () => {
297297
client = await weaviate.connectToLocal();
298-
collection = client.collections.get(collectionName);
298+
collection = client.collections.use(collectionName);
299299
await client.collections
300300
.create<TestCollectionFilterComplex>({
301301
name: collectionName,

src/collections/generate/integration.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ maybe('Testing of the collection.generate methods with a simple collection', ()
4242

4343
beforeAll(async () => {
4444
client = await makeOpenAIClient();
45-
collection = client.collections.get(collectionName);
45+
collection = client.collections.use(collectionName);
4646
id = await client.collections
4747
.create({
4848
name: collectionName,
@@ -70,7 +70,7 @@ maybe('Testing of the collection.generate methods with a simple collection', ()
7070

7171
describe('using a non-generic collection', () => {
7272
it('should generate without search', async () => {
73-
const ret = await client.collections.get(collectionName).generate.fetchObjects({
73+
const ret = await client.collections.use(collectionName).generate.fetchObjects({
7474
singlePrompt: 'Write a haiku about ducks for {testProp}',
7575
groupedTask: 'What is the value of testProp here?',
7676
groupedProperties: ['testProp'],
@@ -183,7 +183,7 @@ maybe('Testing of the groupBy collection.generate methods with a simple collecti
183183

184184
beforeAll(async () => {
185185
client = await makeOpenAIClient();
186-
collection = client.collections.get(collectionName);
186+
collection = client.collections.use(collectionName);
187187
id = await client.collections
188188
.create({
189189
name: collectionName,
@@ -331,7 +331,7 @@ maybe('Testing of the collection.generate methods with a multi vector collection
331331

332332
beforeAll(async () => {
333333
client = await makeOpenAIClient();
334-
collection = client.collections.get(collectionName);
334+
collection = client.collections.use(collectionName);
335335
const query = () =>
336336
client.collections
337337
.create({

src/collections/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ const collections = (connection: Connection, dbVersionSupport: DbVersionSupport)
276276
get: <TProperties extends Properties | undefined = undefined, TName extends string = string>(
277277
name: TName
278278
) => collection<TProperties, TName>(connection, name, dbVersionSupport),
279+
use: <TProperties extends Properties | undefined = undefined, TName extends string = string>(
280+
name: TName
281+
) => collection<TProperties, TName>(connection, name, dbVersionSupport),
279282
};
280283
};
281284

@@ -292,9 +295,9 @@ export interface Collections {
292295
name: TName
293296
): Collection<TProperties, TName>;
294297
listAll(): Promise<CollectionConfig[]>;
295-
// use<TProperties extends Properties | undefined = undefined, TName extends string = string>(
296-
// name: TName
297-
// ): Collection<TProperties, TName>;
298+
use<TProperties extends Properties | undefined = undefined, TName extends string = string>(
299+
name: TName
300+
): Collection<TProperties, TName>;
298301
}
299302

300303
export default collections;

src/collections/integration.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('Testing of the collections.create method', () => {
7777
},
7878
],
7979
})
80-
.then(() => contextionary.collections.get(collectionName).config.get());
80+
.then(() => contextionary.collections.use(collectionName).config.get());
8181
expect(response.name).toEqual(collectionName);
8282
expect(response.properties?.length).toEqual(1);
8383
expect(response.properties[0].name).toEqual('testProp');
@@ -166,7 +166,7 @@ describe('Testing of the collections.create method', () => {
166166
.create({
167167
name: collectionName,
168168
})
169-
.then(() => contextionary.collections.get(collectionName).config.get());
169+
.then(() => contextionary.collections.use(collectionName).config.get());
170170
expect(response.name).toEqual(collectionName);
171171
expect(response.properties?.length).toEqual(0);
172172
expect(response.vectorizers.default.indexConfig).toBeDefined();
@@ -188,7 +188,7 @@ describe('Testing of the collections.create method', () => {
188188
const response = await contextionary.collections
189189
.create(schema)
190190
.then(async (collection) => expect(await collection.exists()).toEqual(true))
191-
.then(() => contextionary.collections.get(collectionName).config.get());
191+
.then(() => contextionary.collections.use(collectionName).config.get());
192192
expect(response.name).toEqual(collectionName);
193193
expect(response.properties?.length).toEqual(1);
194194
expect(response.properties[0].name).toEqual('testProp');
@@ -525,7 +525,7 @@ describe('Testing of the collections.create method', () => {
525525
}),
526526
})
527527
.then(async (collection) => expect(await collection.exists()).toEqual(true))
528-
.then(() => cluster.collections.get(collectionName).config.get());
528+
.then(() => cluster.collections.use(collectionName).config.get());
529529

530530
expect(response.name).toEqual(collectionName);
531531
expect(response.description).toEqual('A test collection');
@@ -628,7 +628,7 @@ describe('Testing of the collections.create method', () => {
628628
vectorizers: weaviate.configure.vectorizer.text2VecContextionary(),
629629
})
630630
.then(async (collection) => expect(await collection.exists()).toEqual(true))
631-
.then(() => contextionary.collections.get(collectionName).config.get());
631+
.then(() => contextionary.collections.use(collectionName).config.get());
632632
expect(response.name).toEqual(collectionName);
633633
expect(response.properties?.length).toEqual(1);
634634
expect(response.properties?.[0].name).toEqual('testProp');
@@ -656,7 +656,7 @@ describe('Testing of the collections.create method', () => {
656656
vectorizers: weaviate.configure.vectorizer.text2VecOpenAI(),
657657
})
658658
.then(async (collection) => expect(await collection.exists()).toEqual(true))
659-
.then(() => openai.collections.get(collectionName).config.get());
659+
.then(() => openai.collections.use(collectionName).config.get());
660660
expect(response.name).toEqual(collectionName);
661661
expect(response.properties?.length).toEqual(1);
662662
expect(response.properties?.[0].name).toEqual('testProp');
@@ -684,7 +684,7 @@ describe('Testing of the collections.create method', () => {
684684
generative: weaviate.configure.generative.openAI(),
685685
})
686686
.then(async (collection) => expect(await collection.exists()).toEqual(true))
687-
.then(() => openai.collections.get(collectionName).config.get());
687+
.then(() => openai.collections.use(collectionName).config.get());
688688
expect(response.name).toEqual(collectionName);
689689
expect(response.properties?.length).toEqual(1);
690690
expect(response.properties?.[0].name).toEqual('testProp');

0 commit comments

Comments
 (0)