Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2b84bb2
add default timeout to requests
Shiranuit Apr 2, 2021
d8bdbfd
add tests for _timeoutRequest
Shiranuit Apr 6, 2021
9583fce
update tests of the offlineQueue
Shiranuit Apr 6, 2021
e03a4ba
change default timeout to -1
Shiranuit Apr 21, 2021
f6d0281
add timeout option to actions
Shiranuit Apr 21, 2021
05d560c
add timeout option to Bulk actions
Shiranuit Apr 21, 2021
9a21ec5
add timeout option to Collection actions
Shiranuit Apr 21, 2021
ed83551
add timeout option to Document actions
Shiranuit Apr 21, 2021
ac8192d
add timeout option to Index actions
Shiranuit Apr 21, 2021
e1f4d9c
add timeout option to Realtime actions
Shiranuit Apr 21, 2021
a56fecb
add doc for Auth
Shiranuit Apr 21, 2021
e34355f
add doc for bulk controller
Shiranuit Apr 21, 2021
ae86899
add doc for collection controller
Shiranuit Apr 21, 2021
e98fb40
add document doc for timeout option
Shiranuit Apr 22, 2021
65456d3
add index doc for timeout option
Shiranuit Apr 22, 2021
2d8e7c6
add realtime doc for timeout option
Shiranuit Apr 22, 2021
7cf2ba0
add doc for kuzzle constructor option
Shiranuit Apr 22, 2021
b98b947
update Auth.ts function signature and formatting
Shiranuit Apr 22, 2021
1ef0452
update Bulk.ts function signature and formatting
Shiranuit Apr 22, 2021
b964228
update Collection.ts function signature and formatting
Shiranuit Apr 22, 2021
50c722f
update Document.ts function signature and formatting
Shiranuit Apr 22, 2021
0c59083
update Index.ts function signature and formatting
Shiranuit Apr 22, 2021
b6d57ef
update Realtime.ts function signature and formatting
Shiranuit Apr 22, 2021
db4920e
update option
Shiranuit Apr 22, 2021
1d886c8
update tests
Shiranuit Apr 22, 2021
aa6b40b
fix lint Kuzzle.ts
Shiranuit Apr 22, 2021
8390f55
fix lint Auth.ts
Shiranuit Apr 22, 2021
6d2dabd
Merge branch '7-dev' into feature/597-request-timeout
Shiranuit Apr 22, 2021
4af1816
add test for getter/setter
Shiranuit Apr 22, 2021
b29c1ae
add JSDoc and proper error class
Shiranuit May 19, 2021
3fee54c
add proper RequestTimeoutError class
Shiranuit May 19, 2021
736e46c
fix query tests
Shiranuit May 19, 2021
068b761
fix queue tests
Shiranuit May 19, 2021
9a44654
update documentation on the timeout option
Shiranuit May 20, 2021
747a1c8
use the proper type
Shiranuit May 21, 2021
1c828ac
coding standard nitpick
Shiranuit May 21, 2021
ea885ed
Merge branch '7-dev' into feature/597-request-timeout
Shiranuit May 27, 2021
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
7 changes: 4 additions & 3 deletions doc/7/controllers/auth/check-rights/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ Checks if the provided API request can be executed by the current logged user.
checkRights(requestPayload)
```

| Property | Type | Description |
|--- |--- |--- |
| `requestPayload` | <pre>object</pre> | Contains a [RequestPayload](/core/2/api/payloads/request) |
| Property | Type | Description |
| ---------------- | ---------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `requestPayload` | <pre>object</pre> | Contains a [RequestPayload](/core/2/api/payloads/request) |
| `timeout` | <pre>number</pre> | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

## `requestPayload`

Expand Down
8 changes: 8 additions & 0 deletions doc/7/controllers/auth/check-token/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ checkToken([token]);
| -------- | ----------------- | ----------- |
| `token` | <pre>string</pre> | Optional authentication token |

### options

Additional query options

| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `timeout` | <pre>number</pre> | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

## Resolves

An `object` representing the token validity status
Expand Down
39 changes: 20 additions & 19 deletions doc/7/controllers/auth/create-api-key/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ createApiKey(description, [options]);

<br />

| Property | Type | Description |
| --- | --- | --- |
| Property | Type | Description |
| ------------- | ----------------- | ------------------- |
| `description` | <pre>string</pre> | API key description |
| `options` | <pre>object</pre> | Additional options |
| `options` | <pre>object</pre> | Additional options |

### options

Additional query options

| Property | Type<br />(default) | Description |
| --- | --- | --- |
| `expiresIn` | <pre>string/number</pre><br />(`-1`) | Expiration duration |
| `_id` | <pre>string</pre><br />(`null`) | API key unique ID |
| `refresh` | <pre>boolean</pre><br />(`false`) | If set to `wait_for`, Kuzzle will not respond until the API key is indexed |
| Property | Type<br />(default) | Description |
| ----------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
| `expiresIn` | <pre>string/number</pre><br />(`-1`) | Expiration duration |
| `_id` | <pre>string</pre><br />(`null`) | API key unique ID |
| `refresh` | <pre>boolean</pre><br />(`false`) | If set to `wait_for`, Kuzzle will not respond until the API key is indexed |
| `timeout` | <pre>number</pre><br/>(`-1`) | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

**Notes**:
- `expiresIn`:
Expand All @@ -46,20 +47,20 @@ Additional query options

An object containing the newly created API key:

| Name | Type | Description |
| --------- | ----------------- | ---------------- |
| `_id` | <pre>string</pre> | ID of the newly created API key |
| `_source` | <pre>object</pre> | API key content |
| Name | Type | Description |
| --------- | ----------------- | ------------------------------- |
| `_id` | <pre>string</pre> | ID of the newly created API key |
| `_source` | <pre>object</pre> | API key content |

The API key content has the following properties:

| Name | Type | Description |
| --------- | ----------------- | ---------------- |
| `userId` | <pre>string</pre> | User kuid |
| `expiresAt` | <pre>number</pre> | Expiration date in Epoch-millis format (`-1` if the token never expires) |
| `ttl` | <pre>number</pre> | Original TTL |
| `description` | <pre>string</pre> | API key description |
| `token` | <pre>string</pre> | Authentication token associated with this API key |
| Name | Type | Description |
| ------------- | ----------------- | ------------------------------------------------------------------------ |
| `userId` | <pre>string</pre> | User kuid |
| `expiresAt` | <pre>number</pre> | Expiration date in Epoch-millis format (`-1` if the token never expires) |
| `ttl` | <pre>number</pre> | Original TTL |
| `description` | <pre>string</pre> | API key description |
| `token` | <pre>string</pre> | Authentication token associated with this API key |

::: warning
The authentication token `token` will never be returned by Kuzzle again. If you lose it, you'll have to delete the API key and recreate a new one.
Expand Down
7 changes: 4 additions & 3 deletions doc/7/controllers/auth/create-my-credentials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ createMyCredentials(strategy, credentials, [options]);

Additional query options

| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | ---------------------------------------------------------------------------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| `timeout` | <pre>number</pre> | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |
Copy link
Contributor

@Leodau Leodau Apr 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So at this action, the timeout has no default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a default timeout but IDK how to explain that the default timeout is the global timeout configured in the Kuzzle constructor if it has been configured or -1 otherwise, meaning that there is no timeout


## Resolves

Expand Down
7 changes: 4 additions & 3 deletions doc/7/controllers/auth/credentials-exist/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ credentialsExist(strategy, [options]);

Additional query options

| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | ---------------------------------------------------------------------------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| `timeout` | <pre>number</pre> | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

## Resolves

Expand Down
13 changes: 7 additions & 6 deletions doc/7/controllers/auth/delete-api-key/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ deleteApiKey(id, [options]);

<br />

| Property | Type | Description |
| --- | --- | --- |
| `id` | <pre>string</pre> | API key unique ID |
| Property | Type | Description |
| --------- | ----------------- | ------------------ |
| `id` | <pre>string</pre> | API key unique ID |
| `options` | <pre>object</pre> | Additional options |

### options

Additional query options

| Property | Type<br />(default) | Description |
| --- | --- | --- |
| `refresh` | <pre>boolean</pre><br />(`false`) | If set to `wait_for`, Kuzzle will not respond until the API key is indexed |
| Property | Type<br />(default) | Description |
| --------- | --------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `refresh` | <pre>boolean</pre><br />(`false`) | If set to `wait_for`, Kuzzle will not respond until the API key is indexed |
| `timeout` | <pre>number</pre><br/>(`-1`) | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

## Resolves

Expand Down
7 changes: 4 additions & 3 deletions doc/7/controllers/auth/delete-my-credentials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ deleteMyCredentials(strategy, [options]);

Additional query options

| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | ---------------------------------------------------------------------------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| `timeout` | <pre>number</pre> | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

## Resolves

Expand Down
7 changes: 4 additions & 3 deletions doc/7/controllers/auth/get-current-user/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ getCurrentUser([options]);

Additional query options

| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | ---------------------------------------------------------------------------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| `timeout` | <pre>number</pre> | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

## Resolves

Expand Down
7 changes: 4 additions & 3 deletions doc/7/controllers/auth/get-my-credentials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ getMyCredentials(strategy, [options]);

Additional query options

| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | ---------------------------------------------------------------------------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| `timeout` | <pre>number</pre> | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

## Resolves

Expand Down
1 change: 1 addition & 0 deletions doc/7/controllers/auth/get-my-rights/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Additional query options
| Property | Type<br/>(default) | Description |
| ---------- | ------------------------------- | --------------------------------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | Make this request queuable or not |
| `timeout` | <pre>number</pre> | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

## Resolves

Expand Down
7 changes: 4 additions & 3 deletions doc/7/controllers/auth/get-strategies/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ getStrategies([options]);

Additional query options

| Property | Type | Description | Default |
| ---------- | ------------------------------- | --------------------------------- | ------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | Make this request queuable or not |
| Property | Type | Description | Default |
| ---------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------- |
| `queuable` | <pre>boolean</pre><br/>(`true`) | Make this request queuable or not |
| `timeout` | <pre>number</pre> | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

## Resolves

Expand Down
9 changes: 5 additions & 4 deletions doc/7/controllers/auth/refresh-token/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ refreshToken ([options])

Additional query options

| Property | Type<br/>(default) | Description |
| ----------- | ------------------------------- | ------------------------------------------------------------------------------------- |
| `expiresIn` | <pre>string</pre> | Expiration time in [ms library](https://www.npmjs.com/package/ms) format. (e.g. `2h`) |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| Property | Type<br/>(default) | Description |
| ----------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `expiresIn` | <pre>string</pre> | Expiration time in [ms library](https://www.npmjs.com/package/ms) format. (e.g. `2h`) |
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
| `timeout` | <pre>number</pre><br/>(`-1`) | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

### expiresIn

Expand Down
33 changes: 17 additions & 16 deletions doc/7/controllers/auth/search-api-keys/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ searchApiKeys([query], [options]);

<br />

| Property | Type | Description |
| --- | --- | --- |
| `query` | <pre>object</pre> | Search query |
| Property | Type | Description |
| --------- | ----------------- | ------------------ |
| `query` | <pre>object</pre> | Search query |
| `options` | <pre>object</pre> | Additional options |

### query
Expand All @@ -45,27 +45,28 @@ If left empty, the result will return all available API keys of the currently lo

Additional query options

| Property | Type<br/>(default) | Description |
| ---------- | ------------------ | ------------ |
| `from` | <pre>number</pre><br/>(`0`) | Offset of the first document to fetch |
| `size` | <pre>number</pre><br/>(`10`) | Maximum number of documents to retrieve per page |
| `lang` | <pre>string</pre> | Specify the query language to use. By default, it's `elasticsearch` but `koncorde` can also be used. <SinceBadge version="7.4.8"/> |
| Property | Type<br/>(default) | Description |
| --------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `from` | <pre>number</pre><br/>(`0`) | Offset of the first document to fetch |
| `size` | <pre>number</pre><br/>(`10`) | Maximum number of documents to retrieve per page |
| `lang` | <pre>string</pre> | Specify the query language to use. By default, it's `elasticsearch` but `koncorde` can also be used. <SinceBadge version="7.4.8"/> |
| `timeout` | <pre>number</pre><br/>(`-1`) | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |

## Resolves

Resolves an object with the following properties:

| Name | Type | Description |
| --------- | ----------------- | ---------------- |
| `hits` | <pre>object[]</pre> | Array of objects representing found API keys |
| `total` | <pre>number</pre> | Total number of API keys found. Depending on pagination options, this can be greater than the actual number of API keys in a single result page |
| Name | Type | Description |
| ------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `hits` | <pre>object[]</pre> | Array of objects representing found API keys |
| `total` | <pre>number</pre> | Total number of API keys found. Depending on pagination options, this can be greater than the actual number of API keys in a single result page |

Each object of the `hits` array has the following properties:

| Name | Type | Description |
| --------- | ----------------- | ---------------- |
| `_id_` | <pre>string</pre> | API key unique ID |
| `_source` | <pre>object</pre> | API key definition without the `token` field |
| Name | Type | Description |
| --------- | ----------------- | -------------------------------------------- |
| `_id_` | <pre>string</pre> | API key unique ID |
| `_source` | <pre>object</pre> | API key definition without the `token` field |


## Usage
Expand Down
Loading