Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexApi.replace() seems to have wrong signature #4

Open
Choppel opened this issue Jan 4, 2024 · 1 comment
Open

IndexApi.replace() seems to have wrong signature #4

Choppel opened this issue Jan 4, 2024 · 1 comment

Comments

@Choppel
Copy link

Choppel commented Jan 4, 2024

1.) Wrong type definition

The autocomplete from my IDE (PHPStorm) suggests the following:

grafik

However, the data returned looks like this:

{
  _index: 'db',
  _id: 8865561979561969000,
  created: false,
  result: 'updated',
  status: 200
}

The attribute found from the type definition is not present in the data and the attribute status from the data is not present in the type definition.

2.) Missing type definition
When the query does not succeed the returned data is something like this:

{
  error: {
    type: "table 'main' absent, or does not support INSERT",
    index: 'main'
  },
  status: 409
}

The return type of the type definition does not mention this. AFAICT the method need to return Promise<SuccessResponse | ErrorResponse> and not only Promise<SuccessResponse>.

This may occur on more than just this method. At least IndexApi.insert() seems to have the same problem.

@Choppel
Copy link
Author

Choppel commented Jan 4, 2024

It goes even further. When I execute a query where I set attribute id to an invalid value like 'Lorem Ipsum' I get this:
grafik

Here the Response is an array of objects which do not seem to have anything in common with SuccessResponse | ErrorResponse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant