Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 ci/docker-compose-azure-cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- --scheme
- http
- --write-timeout=600s
image: semitechnologies/weaviate:1.18.0-alpha.0-be532d2
image: semitechnologies/weaviate:1.18.0-alpha.1-41f7cb9
ports:
- 8081:8081
restart: on-failure:0
Expand Down
2 changes: 1 addition & 1 deletion 2 ci/docker-compose-okta-cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- --scheme
- http
- --write-timeout=600s
image: semitechnologies/weaviate:1.18.0-alpha.0-be532d2
image: semitechnologies/weaviate:1.18.0-alpha.1-41f7cb9
ports:
- 8082:8082
restart: on-failure:0
Expand Down
2 changes: 1 addition & 1 deletion 2 ci/docker-compose-okta-users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- --scheme
- http
- --write-timeout=600s
image: semitechnologies/weaviate:1.18.0-alpha.0-be532d2
image: semitechnologies/weaviate:1.18.0-alpha.1-41f7cb9
ports:
- 8083:8083
restart: on-failure:0
Expand Down
2 changes: 1 addition & 1 deletion 2 ci/docker-compose-wcs-noscope.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- --scheme
- http
- --write-timeout=600s
image: semitechnologies/weaviate:1.18.0-alpha.0-be532d2
image: semitechnologies/weaviate:1.18.0-alpha.1-41f7cb9
ports:
- 8086:8086
restart: on-failure:0
Expand Down
2 changes: 1 addition & 1 deletion 2 ci/docker-compose-wcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- --scheme
- http
- --write-timeout=600s
image: semitechnologies/weaviate:1.18.0-alpha.0-be532d2
image: semitechnologies/weaviate:1.18.0-alpha.1-41f7cb9
ports:
- 8085:8085
restart: on-failure:0
Expand Down
2 changes: 1 addition & 1 deletion 2 ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version: '3.4'
services:
weaviate:
image: semitechnologies/weaviate:1.18.0-alpha.0-be532d2
image: semitechnologies/weaviate:1.18.0-alpha.1-41f7cb9
restart: on-failure:0
ports:
- "8080:8080"
Expand Down
4 changes: 2 additions & 2 deletions 4 cluster/journey.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const weaviate = require("../index");
const { createTestFoodSchemaAndData, cleanupTestFood, PIZZA_CLASS_NAME, SOUP_CLASS_NAME } = require("../utils/testData");

const EXPECTED_WEAVIATE_VERSION = "1.18.0-alpha.0"
const EXPECTED_WEAVIATE_GIT_HASH = "be532d2"
const EXPECTED_WEAVIATE_VERSION = "1.18.0-alpha.1"
const EXPECTED_WEAVIATE_GIT_HASH = "41f7cb9"

describe("cluster nodes endpoint", () => {
const client = weaviate.client({
Expand Down
8 changes: 7 additions & 1 deletion 8 data/getter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export default class Getter {
return this;
};

withAfter = (id) => {
this.after = id;
return this;
};

withLimit = (limit) => {
this.limit = limit;
return this;
Expand All @@ -32,7 +37,8 @@ export default class Getter {
);
}

return this.objectsPath.buildGet(this.className, this.limit, this.additionals)
return this.objectsPath.buildGet(this.className, this.limit,
this.additionals, this.after)
.then(this.client.get);
};
}
65 changes: 45 additions & 20 deletions 65 data/journey.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ describe("data", () => {

it("creates a new thing object with an explicit id", () => {
const properties = { stringProp: "with-id" };
const id = "1565c06c-463f-466c-9092-5930dbac3887";
// explicitly make this an all-zero UUID. This way we can be sure that it's
// the first to come up when using the cursor API. Since this test suite
// also contains dynamicaly generated IDs, this is the only way to make
// sure that this ID is first. This way the tests returning objects after
// this ID won't be flaky.
const id = "00000000-0000-0000-0000-000000000000";

return client.data
.creator()
Expand Down Expand Up @@ -128,7 +133,7 @@ describe("data", () => {
expect(res.objects).toEqual(
expect.arrayContaining([
expect.objectContaining({
id: "1565c06c-463f-466c-9092-5930dbac3887",
id: "00000000-0000-0000-0000-000000000000",
properties: { stringProp: "with-id" },
}),
expect.objectContaining({
Expand All @@ -150,7 +155,7 @@ describe("data", () => {
expect(res.objects).toEqual(
expect.arrayContaining([
expect.objectContaining({
id: "1565c06c-463f-466c-9092-5930dbac3887",
id: "00000000-0000-0000-0000-000000000000",
properties: { stringProp: "with-id" },
}),
expect.objectContaining({
Expand All @@ -162,6 +167,26 @@ describe("data", () => {
.catch((e) => fail("it should not have errord: " + e));
});

it("gets all classes after a specfic object (Cursor API)", () => {
return client.data
.getter()
.withClassName(thingClassName)
.withLimit(100)
.withAfter("00000000-0000-0000-0000-000000000000")
.do()
.then((res) => {
expect(res.objects).toHaveLength(1);
expect(res.objects).toEqual(
expect.arrayContaining([
expect.objectContaining({
properties: { stringProp: "without-id" },
}),
])
);
})
.catch((e) => fail("it should not have errord: " + e));
});

it("gets all things with all optional _additional params", () => {
return client.data
.getter()
Expand Down Expand Up @@ -207,12 +232,12 @@ describe("data", () => {
it("gets one thing by id only", () => {
return client.data
.getterById()
.withId("1565c06c-463f-466c-9092-5930dbac3887")
.withId("00000000-0000-0000-0000-000000000000")
.do()
.then((res) => {
expect(res).toEqual(
expect.objectContaining({
id: "1565c06c-463f-466c-9092-5930dbac3887",
id: "00000000-0000-0000-0000-000000000000",
properties: { stringProp: "with-id" },
})
);
Expand All @@ -224,12 +249,12 @@ describe("data", () => {
return client.data
.getterById()
.withClassName(thingClassName)
.withId("1565c06c-463f-466c-9092-5930dbac3887")
.withId("00000000-0000-0000-0000-000000000000")
.do()
.then((res) => {
expect(res).toEqual(
expect.objectContaining({
id: "1565c06c-463f-466c-9092-5930dbac3887",
id: "00000000-0000-0000-0000-000000000000",
properties: { stringProp: "with-id" },
})
);
Expand All @@ -241,7 +266,7 @@ describe("data", () => {
return client.data
.getterById()
.withClassName("DoesNotExist")
.withId("1565c06c-463f-466c-9092-5930dbac3887")
.withId("00000000-0000-0000-0000-000000000000")
.do()
.catch(err =>
expect(err).toEqual("usage error (404): ")
Expand All @@ -251,7 +276,7 @@ describe("data", () => {
it("gets one thing by id with all optional additional props", () => {
return client.data
.getterById()
.withId("1565c06c-463f-466c-9092-5930dbac3887")
.withId("00000000-0000-0000-0000-000000000000")
.withAdditional("classification")
.withAdditional("interpretation")
.withAdditional("nearestNeighbors")
Expand Down Expand Up @@ -282,7 +307,7 @@ describe("data", () => {
});

it("updates a thing by id only", () => {
const id = "1565c06c-463f-466c-9092-5930dbac3887";
const id = "00000000-0000-0000-0000-000000000000";
return client.data
.getterById()
.withId(id)
Expand All @@ -307,7 +332,7 @@ describe("data", () => {
});

it("updates a thing by id and class name", () => {
const id = "1565c06c-463f-466c-9092-5930dbac3887";
const id = "00000000-0000-0000-0000-000000000000";
return client.data
.getterById()
.withId(id)
Expand All @@ -332,7 +357,7 @@ describe("data", () => {
});

it("merges a thing", () => {
const id = "1565c06c-463f-466c-9092-5930dbac3887";
const id = "00000000-0000-0000-0000-000000000000";
return client.data
.getterById()
.withId(id)
Expand All @@ -353,7 +378,7 @@ describe("data", () => {

it("adds a reference to a thing by id only", () => {
const sourceId = "599a0c64-5ed5-4d30-978b-6c9c45516db1";
const targetId = "1565c06c-463f-466c-9092-5930dbac3887";
const targetId = "00000000-0000-0000-0000-000000000000";

return client.data
.referenceCreator()
Expand Down Expand Up @@ -398,7 +423,7 @@ describe("data", () => {

it("adds a reference to a thing by id and class name", () => {
const sourceId = "599a0c64-5ed5-4d30-978b-6c9c45516db1";
const targetId = "1565c06c-463f-466c-9092-5930dbac3887";
const targetId = "00000000-0000-0000-0000-000000000000";

return client.data
.referenceCreator()
Expand Down Expand Up @@ -447,7 +472,7 @@ describe("data", () => {
it("checks that object exists by id only", () => {
return client.data
.checker()
.withId("1565c06c-463f-466c-9092-5930dbac3887")
.withId("00000000-0000-0000-0000-000000000000")
.do()
.then((exists) => {
if (!exists) {
Expand All @@ -460,7 +485,7 @@ describe("data", () => {
it("checks that object exists by id and class name", () => {
return client.data
.checker()
.withId("1565c06c-463f-466c-9092-5930dbac3887")
.withId("00000000-0000-0000-0000-000000000000")
.withClassName(thingClassName)
.do()
.then((exists) => {
Expand All @@ -474,15 +499,15 @@ describe("data", () => {
it("deletes a thing by id only", () => {
return client.data
.deleter()
.withId("1565c06c-463f-466c-9092-5930dbac3887")
.withId("00000000-0000-0000-0000-000000000000")
.do()
.catch((e) => fail("it should not have errord: " + e));
});

it("checks that object doesn't exist anymore with delete by id only", () => {
return client.data
.checker()
.withId("1565c06c-463f-466c-9092-5930dbac3887")
.withId("00000000-0000-0000-0000-000000000000")
.do()
.then((exists) => {
if (exists) {
Expand Down Expand Up @@ -585,7 +610,7 @@ describe("data", () => {
});

it("forms a get by id query with node_name set", () => {
const id = "1565c06c-463f-466c-9092-5930dbac3887";
const id = "00000000-0000-0000-0000-000000000000";

return client.data
.getterById()
Expand All @@ -602,7 +627,7 @@ describe("data", () => {
})

it("forms a get by id query with consistency_level set", () => {
const id = "1565c06c-463f-466c-9092-5930dbac3887";
const id = "00000000-0000-0000-0000-000000000000";

return client.data
.getterById()
Expand Down
7 changes: 5 additions & 2 deletions 7 data/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export class ObjectsPath {
return this.build({id, className, additionals, consistencyLevel, nodeName},
[this.addClassNameDeprecatedNotSupportedCheck, this.addId, this.addQueryParams]);
}
buildGet(className, limit, additionals) {
return this.build({className, limit, additionals}, [this.addQueryParamsForGet]);
buildGet(className, limit, additionals, after) {
return this.build({className, limit, additionals, after}, [this.addQueryParamsForGet]);
}
buildUpdate(id, className, consistencyLevel) {
return this.build({id, className, consistencyLevel},
Expand Down Expand Up @@ -103,6 +103,9 @@ export class ObjectsPath {
support.warns.notSupportedClassParameterInEndpointsForObjects();
}
}
if (isValidStringProperty(params.after)) {
queryParams.push(`after=${params.after}`)
}
if (queryParams.length > 0) {
return `${path}?${queryParams.join("&")}`;
}
Expand Down
12 changes: 11 additions & 1 deletion 12 graphql/getter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export default class Getter {
return this;
};

withAfter = (id) => {
this.after = id;
return this;
};

withGroup = (groupObj) => {
try {
this.groupString = new Group(groupObj).toString();
Expand Down Expand Up @@ -202,7 +207,8 @@ export default class Getter {
this.limit ||
this.offset ||
this.groupString ||
this.sortString
this.sortString ||
this.after
) {
let args = [];

Expand Down Expand Up @@ -254,6 +260,10 @@ export default class Getter {
args = [...args, `sort:[${this.sortString}]`];
}

if (this.after) {
args = [...args, `after:"${this.after}"`];
}

params = `(${args.join(",")})`;
}

Expand Down
17 changes: 17 additions & 0 deletions 17 graphql/getter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ test("a simple query with a limit and offset", () => {
expect(mockClient.query).toHaveBeenCalledWith(expectedQuery);
});

test("a simple query with a limit and after", () => {
const mockClient = {
query: jest.fn(),
};

const expectedQuery = `{Get{Person(limit:7,after:"c6f379dd-94b7-4017-acd3-df769a320c92"){name}}}`;

new Getter(mockClient)
.withClassName("Person")
.withFields("name")
.withAfter("c6f379dd-94b7-4017-acd3-df769a320c92")
.withLimit(7)
.do();

expect(mockClient.query).toHaveBeenCalledWith(expectedQuery);
});

test("a simple query with a group", () => {
const mockClient = {
query: jest.fn(),
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.