Skip to content

Commit 817fe2d

Browse files
authored
Merge pull request #624 from kuzzleio/7.6.0-proposal
# [7.6.0](https://github.com/kuzzleio/sdk-javascript/releases/tag/7.6.0) (2021-04-06) #### Bug fixes - [ [#622](#622) ] Pick first route when multiple non-GET routes of the same size are available ([scottinet](https://github.com/scottinet)) #### New features - [ [#621](#621) ] Secure WebSocket connection with cookie authentication ([Shiranuit](https://github.com/Shiranuit)) - [ [#613](#613) ] Implement index:stats ([Leodau](https://github.com/Leodau)) - [ [#612](#612) ] Implement security:getUserStrategies ([Leodau](https://github.com/Leodau)) #### Enhancements - [ [#620](#620) ] Add kuzzleStack property to KuzzleError ([Aschen](https://github.com/Aschen)) - [ [#617](#617) ] Add suggest to search result ([Aschen](https://github.com/Aschen)) - [ [#614](#614) ] Print deprecation warning from Kuzzle ([MathieuVeber](https://github.com/MathieuVeber)) - [ [#606](#606) ] Add _source property to user objects ([Aschen](https://github.com/Aschen)) ---
2 parents 99fd623 + 8beec6a commit 817fe2d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2384
-1166
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ src/core/searchResult/Profile.js
2727
src/core/searchResult/Role.js
2828
src/core/searchResult/Specifications.js
2929
src/core/searchResult/User.js
30+
src/utils/Deprecation.js
31+
src/utils/interfaces.js

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,5 @@ src/core/searchResult/Profile.js
5555
src/core/searchResult/Role.js
5656
src/core/searchResult/Specifications.js
5757
src/core/searchResult/User.js
58+
src/utils/Deprecation.js
59+
src/utils/interfaces.js
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
code: true
3+
type: page
4+
title: stats
5+
description: Gets detailed storage statistics
6+
---
7+
8+
# stats
9+
10+
<SinceBadge version="Kuzzle 2.10.0"/>
11+
<SinceBadge version="7.6.0"/>
12+
13+
Gets detailed storage usage statistics.
14+
15+
<br/>
16+
17+
```js
18+
stats([options]);
19+
```
20+
21+
<br/>
22+
23+
| Arguments | Type | Description |
24+
| --------- | ----------------- | ------------- |
25+
| `options` | <pre>object</pre> | Query options |
26+
27+
### options
28+
29+
Additional query options
30+
31+
| Property | Type<br/>(default) | Description |
32+
| ---------- | ------------------------------- | ---------------------------------------------------------------------------- |
33+
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
34+
35+
## Resolves
36+
37+
Returns detailed storage usage statistics: overall index/collection sizes and the number of documents per collection.
38+
39+
## Usage
40+
41+
<<< ./snippets/stats.js
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const stats = await kuzzle.index.stats();
2+
3+
console.log(JSON.stringify(stats));
4+
/*
5+
{
6+
"indexes":[
7+
{
8+
"name":"nyc-open-data",
9+
"size":42,
10+
"collections":[
11+
{
12+
"name":"yellow-taxi",
13+
"documentCount":42,
14+
"size":42
15+
}
16+
]
17+
}
18+
],
19+
"size":42
20+
}
21+
*/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: index#stats
3+
description: Gets detailed storage statistics
4+
hooks:
5+
before: |
6+
curl -X POST kuzzle:7512/nyc-open-data/_create
7+
curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi
8+
after: curl -X DELETE kuzzle:7512/nyc-open-data
9+
template: catch
10+
expected: ["documentCount":0]

doc/7/controllers/security/create-user/snippets/create-user.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ template: default
66
expected:
77
- "User {"
88
- "_id: 'jdoe',"
9-
- "content: {"
9+
- "_source: {"
1010
- "profileIds: \\[ \\'default\\' \\],"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
code: true
3+
type: page
4+
title: getUserStrategies
5+
description: Gets all the available authentication strategies of a user
6+
---
7+
8+
# getUserStrategies
9+
10+
<SinceBadge version="Kuzzle 2.9.0"/>
11+
<SinceBadge version="7.6.0"/>
12+
13+
Gets all the available authentication strategies of a user.
14+
15+
<br />
16+
17+
```js
18+
getUserStrategies(kuid, [options]);
19+
```
20+
21+
<br />
22+
23+
| Property | Type | Description |
24+
|--- |--- |--- |
25+
| `kuid` | <pre>string</pre> | User [kuid](/core/2/guides/main-concepts/authentication#kuzzle-user-identifier-kuid) |
26+
| `options` | <pre>object</pre> | Query options |
27+
28+
### options
29+
30+
| Property | Type<br />(default) | Description |
31+
| --- | --- | --- |
32+
| `queuable` | <pre>boolean</pre><br />(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
33+
34+
## Resolves
35+
36+
Resolves to an array of strings containing all the authentication strategies available for the requested user.
37+
38+
## Usage
39+
40+
<<< ./snippets/get-user-strategies.js
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const strategies = await kuzzle.security.getUserStrategies('john.doe');
2+
3+
console.log(strategies);
4+
// [ 'local' ]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: security#getUserStrategies
2+
description: get user strategies
3+
hooks:
4+
before: >
5+
curl --fail -H "Content-type: application/json" -d '{
6+
"content": {
7+
"profileIds": [ "default" ],
8+
"fullName": "John Doe"
9+
},
10+
"credentials": {
11+
"local": {
12+
"username": "jdoe",
13+
"password": "password"
14+
}
15+
}
16+
}' kuzzle:7512/users/john.doe/_create
17+
after: curl -XDELETE kuzzle:7512/users/john.doe
18+
template: catch
19+
expected:
20+
- "[ 'local' ]"

doc/7/core-classes/kuzzle-error/properties/index.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ order: 10
99

1010
# Properties
1111

12-
| Property name | Type | Description |
13-
| -------------------- | -------- | --------------------------------------- |
14-
| `message` | <pre>string</pre> | Error message |
15-
| `status` | <pre>number</pre> | Error status code |
16-
| `stack` | <pre>string</pre> | Error stacktrace (only in development mode) |
17-
| `id` | <pre>string</pre> | Error unique identifier |
18-
| `code` | <pre>string</pre> | Error unique code |
12+
| Property name | Type | Description |
13+
|---------------|-------------------|---------------------------------------------------------------------|
14+
| `kuzzleStack` | <pre>string</pre> | Kuzzle stacktrace (only in development mode) |
15+
| `message` | <pre>string</pre> | Error message |
16+
| `status` | <pre>number</pre> | Error status code |
17+
| `stack` | <pre>string</pre> | Complete error stacktrace (Kuzzle + SDK) (only in development mode) |
18+
| `id` | <pre>string</pre> | Error unique identifier |
19+
| `code` | <pre>string</pre> | Error unique code |
1920

0 commit comments

Comments
 (0)