You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JS SDK: document class properties independently to the "introduction" pages (#277)
* [JS SDK] separate class properties from the "introduction" page
* [JS SDK] document what the auth actions do to the jwt class property
* Apply @xbill82's suggestions
Co-Authored-By: scottinet <[email protected]>
Copy file name to clipboardExpand all lines: src/sdk-reference/js/6/auth/login/index.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,9 @@ description: Authenticate a user
8
8
9
9
Authenticates a user.
10
10
11
-
If this action is successful, all further requests emitted by this SDK instance will be in the name of the authenticated user, until either the authenticated token expires, the [logout]({{ site_base_path }}sdk-reference/js/6/auth/logout) action is called, or the [jwt]({{ site_base_path }}sdk-reference/js/6/kuzzle/introduction/#properties) property is manually unset.
11
+
If this action is successful, then the [jwt]({{ site_base_path }}sdk-reference/js/6/kuzzle/properties) property of this class instance is set to the new authentication token.
12
+
13
+
All further requests emitted by this SDK instance will be on behalf of the authenticated user, until either the authenticated token expires, the [logout]({{ site_base_path }}sdk-reference/js/6/auth/logout) action is called, or the `jwt` property is manually set to another value.
Copy file name to clipboardExpand all lines: src/sdk-reference/js/6/auth/refresh-token/index.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,10 @@ description: Refresh an authentication token
10
10
11
11
Refreshes a valid, non-expired authentication token.
12
12
13
-
If this action is successful, all further requests emitted by this SDK instance will use the refreshed authentication token.
13
+
If this action is successful, then the [jwt]({{ site_base_path }}sdk-reference/js/6/kuzzle/properties) property of this class instance is set to the new authentication token.
14
+
15
+
All further requests emitted by this SDK instance will be on behalf of the authenticated user, until either the authenticated token expires, the [logout]({{ site_base_path }}sdk-reference/js/6/auth/logout) action is called, or the `jwt` property is manually set to another value.
Copy file name to clipboardExpand all lines: src/sdk-reference/js/6/kuzzle/introduction/index.md
-67Lines changed: 0 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,70 +32,3 @@ The following protocols are available in the SDK JS 6:
32
32
You can tell the Kuzzle SDK to attach a set of "volatile" data to each request. You can set it as an object contained in the `volatile` field of the Kuzzle constructor. The response to a request containing volatile data will contain the same data in its `volatile` field. This can be useful, for example, in real-time notifications for [user join/leave notifications]({{site_base_path}}api/1/essentials/volatile-data/) to provide additional informations about the client who sent the request.
33
33
34
34
Note that you can also set volatile data on a per-request basis (on requests that accept a `volatile` field in their `options` argument). In this case, per-request volatile data will be merged with the global `volatile` object set in the constructor. Per-request fields will override global ones.
35
-
36
-
## Properties
37
-
38
-
Available properties.
39
-
40
-
| Property name | Type | Description | Writable? |
|`autoQueue`| <pre>boolean</pre> | Automatically queue all requests during offline mode | Yes |
43
-
|`autoReplay`| <pre>boolean</pre> | Automatically replay queued requests on a `reconnected` event | Yes |
44
-
|`autoResubscribe`| <pre>boolean</pre> | Automatically renew all subscriptions on a `reconnected` event | Yes |
45
-
|`jwt`| <pre>string</pre> | Token used in requests for authentication | Yes |
46
-
|`offlineQueue`| <pre>object[]</pre> | Contains the queued requests during offline mode | No |
47
-
|`offlineQueueLoader`| <pre>function</pre> | Called before dequeuing requests after exiting offline mode,</br> to add items at the beginning of the offline queue | Yes |
48
-
|`protocol`| <pre>Protocol</pre> | Protocol used by the SDK | No |
49
-
|`queueFilter`| <pre>function</pre> | Called during offline mode. </br>Takes a request object as arguments and returns a boolean, indicating if a request can be queued | Yes |
50
-
|`queueMaxSize`| <pre>number</pre> | Number of maximum requests kept during offline mode| Yes |
51
-
|`queueTTL`| <pre>number</pre> | Time a queued request is kept during offline mode, in milliseconds | Yes |
52
-
|`replayInterval`| <pre>number</pre> | Delay between each replayed requests | Yes |
53
-
|`volatile`| <pre>object</pre> | Common volatile data, will be sent to all future requests | Yes |
54
-
55
-
### offlineQueueLoader
56
-
57
-
The `offlineQueueLoader` property must be set with a function of one of the following formats:
58
-
59
-
```js
60
-
Object[] offlineQueueLoader()
61
-
62
-
Promise<Object[]>offlineQueueLoader()
63
-
```
64
-
65
-
The returned (or resolved) array must contain objects, each with the following properties:
66
-
67
-
| Property | Type | Description |
68
-
|---|---|---|
69
-
|`query`| <pre>object</pre> | Object representing the request that is about to be sent to Kuzzle, following the [Kuzzle API]({{ site_base_path }}api/1/essentials/query-syntax) format |
70
-
|`reject`| <pre>function</pre> | A [Promise.reject](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject) function |
71
-
|`resolve`| <pre>function</pre> | A [Promise.resolve](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve) function |
72
-
73
-
### queueFilter
74
-
75
-
The `queueFilter` property must be set with a function of the following form:
76
-
77
-
```js
78
-
boolean queueFilter(request)
79
-
```
80
-
81
-
The `request` argument is an object representing the request that is about to be sent to Kuzzle, following the [Kuzzle API]({{ site_base_path }}api/1/essentials/query-syntax) format.
82
-
83
-
### queueMaxSize
84
-
85
-
This property defines the size of the offline buffer, which is a first-in first-out (FIFO) queue.
86
-
87
-
This means that if the `queueMaxSize` limit is reached, older requests are discarded to make room for newer requests.
88
-
89
-
If `queueMaxSize` is set to a number lower than, or equal to `0`, then an unlimited number of requests is kept in the offline buffer.
90
-
Note that doing so may lead to a crash due to memory saturation, if there are too many requests held in memory.
91
-
92
-
### queueTTL
93
-
94
-
If the `queueTTL` property is set to a number lower than, or equal to `0`, then requests never expire and are kept indefinitely.
95
-
96
-
### volatile
97
-
98
-
Multiple methods allow passing specific `volatile` data.
99
-
100
-
These `volatile` data will be merged with the global Kuzzle `volatile` object when sending the request, with the request specific `volatile` taking priority over the global ones.
|`offlineQueueLoader`| <pre>function</pre> | Called before dequeuing requests after exiting offline mode, to add items at the beginning of the offline queue |
24
+
|`queueFilter`| <pre>function</pre> | Custom function called during offline mode to filter queued requests on-the-fly |
25
+
|`queueMaxSize`| <pre>number</pre> | Number of maximum requests kept during offline mode|
26
+
|`queueTTL`| <pre>number</pre> | Time a queued request is kept during offline mode, in milliseconds |
27
+
|`replayInterval`| <pre>number</pre> | Delay between each replayed requests |
28
+
|`volatile`| <pre>object</pre> | Common volatile data, will be sent to all future requests |
29
+
30
+
### offlineQueueLoader
31
+
32
+
The `offlineQueueLoader` property must be set with a function of one of the following formats:
33
+
34
+
```js
35
+
Object[] offlineQueueLoader()
36
+
37
+
Promise<Object[]>offlineQueueLoader()
38
+
```
39
+
40
+
The returned (or resolved) array must contain objects, each with the following properties:
41
+
42
+
| Property | Type | Description |
43
+
|---|---|---|
44
+
|`query`| <pre>object</pre> | Object representing the request that is about to be sent to Kuzzle, following the [Kuzzle API]({{ site_base_path }}api/1/essentials/query-syntax) format |
45
+
|`reject`| <pre>function</pre> | A [Promise.reject](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject) function |
46
+
|`resolve`| <pre>function</pre> | A [Promise.resolve](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve) function |
47
+
48
+
### queueFilter
49
+
50
+
The `queueFilter` property must be set with a function of the following form:
51
+
52
+
```js
53
+
boolean queueFilter(request)
54
+
```
55
+
56
+
The `request` argument is an object representing the request that is about to be sent to Kuzzle, following the [Kuzzle API]({{ site_base_path }}api/1/essentials/query-syntax) format.
57
+
58
+
### queueMaxSize
59
+
60
+
This property defines the size of the offline buffer, which is a first-in first-out (FIFO) queue.
61
+
62
+
This means that if the `queueMaxSize` limit is reached, older requests are discarded to make room for newer requests.
63
+
64
+
If `queueMaxSize` is set to a number lower than, or equal to `0`, then an unlimited number of requests is kept in the offline buffer.
65
+
Note that doing so may lead to a crash due to memory saturation, if there are too many requests held in memory.
66
+
67
+
### queueTTL
68
+
69
+
If the `queueTTL` property is set to a number lower than, or equal to `0`, then requests never expire and are kept indefinitely.
70
+
71
+
### volatile
72
+
73
+
Multiple methods allow passing specific `volatile` data.
74
+
75
+
These `volatile` data will be merged with the global Kuzzle `volatile` object when sending the request, with the request specific `volatile` taking priority over the global ones.
Copy file name to clipboardExpand all lines: src/sdk-reference/js/6/offline-tools/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ during its lifespan.
14
14
15
15
These properties can be set in the `options` object when [instantiating a new SDK]({{ site_base_path }}sdk-reference/js/6/kuzzle/constructor/#arguments).
16
16
17
-
Some of them are also [writable properties]({{ site_base_path }}sdk-reference/js/6/kuzzle/introduction/#properties) available after SDK instantiation.
17
+
Some of them are also [writable properties]({{ site_base_path }}sdk-reference/js/6/kuzzle/properties) available after SDK instantiation.
0 commit comments