Skip to content
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
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ This is the official Javascript SDK for the free and open-source backend Kuzzle.

#### Multiprotocols

Currently, the SDK provides 3 protocols: __Http, WebSocket and SocketIO.__
WebSocket and Socket.IO protocols implement the whole Kuzzle API, while the HTTP protocol does not implement realtime features (rooms and subscriptions).
While Socket.IO offers better compatibility with older web browsers, our raw WebSocket implementation is about 20% faster.
Currently, the SDK provides 2 protocols: __Http and WebSocket.__
WebSocket protocol implement the whole Kuzzle API, while the HTTP protocol does not implement realtime features (rooms and subscriptions).

#### Promises based

Expand All @@ -35,7 +34,7 @@ For example, for the action create of the controller collection (_collection:cre
Any error must be caught either at the end of the `Promise` chain, or by using `async/await` and a `try...catch`.

<p align="center">
:books: <b><a href="https://docs-v2.kuzzle.io/sdk-reference/js/6/">Documentation</a></b>
:books: <b><a href="https://docs.kuzzle.io/sdk-reference/js/7">Documentation</a></b>
</p>

### Kuzzle
Expand All @@ -45,7 +44,7 @@ an administration console and a set of plugins that provide advanced functionali

* :octocat: __[Github](https://github.com/kuzzleio/kuzzle)__
* :earth_africa: __[Website](https://kuzzle.io)__
* :books: __[Documentation](https://docs-v2.kuzzle.io)__
* :books: __[Documentation](https://docs.kuzzle.io)__
* :email: __[Gitter](https://gitter.im/kuzzleio/kuzzle)__


Expand Down Expand Up @@ -113,13 +112,6 @@ Then the Kuzzle SDK will be available under the `KuzzleSDK` variable:
</script>
```

If you want to support older browser versions, you may load `socket.io` before Kuzzle, making the SDK compatible with browsers without websocket support:

```html
<!-- Don't forget to include socketio before Kuzzle SDK -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.3/socket.io.slim.js"></script>
```

#### Browser with Webpack

If you use Webpack, you'll likely use the NPM-packaged version of the SDK (like in Node)
Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/auth/get-current-user/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Additional query options

## Resolves

A [User](/sdk/js/6/core-classes/user) representing the current user logged with the SDK.
A [User](/sdk/js/7/core-classes/user) representing the current user logged with the SDK.

## Usage

Expand Down
10 changes: 5 additions & 5 deletions doc/7/controllers/auth/login/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ description: Authenticate a user

Authenticates a user.

If this action is successful, then the [jwt](/sdk/js/6/core-classes/kuzzle/properties) property of this class instance is set to the new authentication token.
If this action is successful, then the [jwt](/sdk/js/7/core-classes/kuzzle/properties) property of this class instance is set to the new authentication token.

All further requests emitted by this SDK instance will be on behalf of the authenticated user, until either the authenticated token expires, the [logout](/sdk/js/6/controllers/auth/logout) action is called, or the `jwt` property is manually set to another value.
All further requests emitted by this SDK instance will be on behalf of the authenticated user, until either the authenticated token expires, the [logout](/sdk/js/7/controllers/auth/logout) action is called, or the `jwt` property is manually set to another value.

## Arguments

Expand All @@ -29,16 +29,16 @@ login(strategy, [credentials], [expiresIn]);

### strategy

The name of the [authentication strategy](/core/1/guides/kuzzle-depth/authentication) used to log the user in.
The name of the [authentication strategy](/core/2/guides/kuzzle-depth/authentication) used to log the user in.

Depending on the chosen authentication strategy, additional credential arguments may be required.
The API request example in this page provides the necessary arguments for the [`local` authentication plugin](https://github.com/kuzzleio/kuzzle-plugin-auth-passport-local).

Check the appropriate [authentication plugin](/core/1/plugins/guides/strategies/overview) documentation to get the list of additional arguments to provide.
Check the appropriate [authentication plugin](/core/2/plugins/guides/strategies/overview) documentation to get the list of additional arguments to provide.

### expiresIn

The default value for the `expiresIn` option is defined at server level, in Kuzzle's [configuration file](/core/1/guides/essentials/configuration).
The default value for the `expiresIn` option is defined at server level, in Kuzzle's [configuration file](/core/2/guides/essentials/configuration).

## Resolves

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/auth/logout/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Revokes the current authentication token.

If there were any, real-time subscriptions are cancelled.

If this action is successful, then the [jwt](/sdk/js/6/core-classes/kuzzle/properties) property of this class instance is unset.
If this action is successful, then the [jwt](/sdk/js/7/core-classes/kuzzle/properties) property of this class instance is unset.

<br/>

Expand Down
8 changes: 4 additions & 4 deletions doc/7/controllers/auth/refresh-token/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ description: Refresh an authentication token

Refreshes a valid, non-expired authentication token.

If this action is successful, then the [jwt](/sdk/js/6/core-classes/kuzzle/properties) property of this class instance is set to the new authentication token.
If this action is successful, then the [jwt](/sdk/js/7/core-classes/kuzzle/properties) property of this class instance is set to the new authentication token.

All further requests emitted by this SDK instance will be on behalf of the authenticated user, until either the authenticated token expires, the [logout](/sdk/js/6/controllers/auth/logout) action is called, or the `jwt` property is manually set to another value.
All further requests emitted by this SDK instance will be on behalf of the authenticated user, until either the authenticated token expires, the [logout](/sdk/js/7/controllers/auth/logout) action is called, or the `jwt` property is manually set to another value.


## Arguments
Expand All @@ -40,15 +40,15 @@ Additional query options

### expiresIn

The default value for the `expiresIn` option is defined at server level, in Kuzzle's [configuration file](/core/1/guides/essentials/configuration).
The default value for the `expiresIn` option is defined at server level, in Kuzzle's [configuration file](/core/2/guides/essentials/configuration).

## Resolves

The `refreshToken` action resolves to a token object with the following properties:

| Property | Type | Description |
|--------------|---------|-------------|
| `_id` | <pre>string</pre> | User unique identifier ([kuid](/core/1/guides/essentials/user-authentication#kuzzle-user-identifier-kuid)) |
| `_id` | <pre>string</pre> | User unique identifier ([kuid](/core/2/guides/essentials/user-authentication#kuzzle-user-identifier-kuid)) |
| `expiresAt` | <pre>number</pre> | Expiration timestamp in Epoch-millis format (UTC) |
| `jwt` | <pre>string</pre> | Authentication token |
| `ttl` | <pre>number</pre> | Time to live of the authentication token, in milliseconds |
Expand Down
4 changes: 2 additions & 2 deletions doc/7/controllers/auth/update-self/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: Updates the current user object in Kuzzle.

Updates the currently logged in user content.

This route cannot update the list of associated security profiles. To change a user's security profiles, the route [security:updateUser](/core/1/api/controllers/security/update-user) must be used instead.
This route cannot update the list of associated security profiles. To change a user's security profiles, the route [security:updateUser](/core/2/api/controllers/security/update-user) must be used instead.

<br/>

Expand All @@ -34,7 +34,7 @@ Additional query options

## Resolves

A [User](/sdk/js/6/core-classes/user) representing the current user logged with the SDK.
A [User](/sdk/js/7/core-classes/user) representing the current user logged with the SDK.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/bulk/import/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: Performs a bulk import on a collection

Create, update or delete large amount of documents as fast as possible.

This route is faster than the `document:m*` routes family (e.g. [document:mCreate](/sdk/js/6/controllers/document/m-create)), but no real-time notifications will be generated, even if some of the documents in the import match subscription filters.
This route is faster than the `document:m*` routes family (e.g. [document:mCreate](/sdk/js/7/controllers/document/m-create)), but no real-time notifications will be generated, even if some of the documents in the import match subscription filters.

<br/>

Expand Down
6 changes: 3 additions & 3 deletions doc/7/controllers/bulk/mWrite/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ description: Creates or replaces multiple documents directly into the storage en
Creates or replaces multiple documents directly into the storage engine.

This is a low level route intended to bypass Kuzzle actions on document creation, notably:
- check [document validity](/core/1/guides/essentials/data-validation),
- add [kuzzle metadata](/core/1/guides/essentials/document-metadata),
- trigger [realtime notifications](/core/1/guides/essentials/real-time) (unless asked otherwise)
- check [document validity](/core/2/guides/essentials/data-validation),
- add [kuzzle metadata](/core/2/guides/essentials/document-metadata),
- trigger [realtime notifications](/core/2/guides/essentials/real-time) (unless asked otherwise)

<br/>

Expand Down
6 changes: 3 additions & 3 deletions doc/7/controllers/bulk/write/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ description: Creates or replaces a document directly into the storage engine.
Creates or replaces a document directly into the storage engine.

This is a low level route intended to bypass Kuzzle actions on document creation, notably:
- check [document validity](/core/1/guides/essentials/data-validation),
- add [kuzzle metadata](/core/1/guides/essentials/document-metadata),
- trigger [realtime notifications](/core/1/guides/essentials/real-time) (unless asked otherwise).
- check [document validity](/core/2/guides/essentials/data-validation),
- add [kuzzle metadata](/core/2/guides/essentials/document-metadata),
- trigger [realtime notifications](/core/2/guides/essentials/real-time) (unless asked otherwise).

<br/>

Expand Down
4 changes: 2 additions & 2 deletions doc/7/controllers/collection/create/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Create a new collection

# create

Creates a new [collection](/core/1/guides/essentials/store-access-data) in Kuzzle via the persistence engine, in the provided index.
Creates a new [collection](/core/2/guides/essentials/store-access-data) in Kuzzle via the persistence engine, in the provided index.

You can also provide an optional data mapping that allow you to exploit the full capabilities of our
persistent data storage layer, [ElasticSearch](https://www.elastic.co/products/elasticsearch) (check here the [mapping capabilities of ElasticSearch](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/mapping.html)).
Expand Down Expand Up @@ -48,7 +48,7 @@ const mapping = {
};
```

More informations about database mappings [here](/core/1/guides/essentials/database-mappings).
More informations about database mappings [here](/core/2/guides/essentials/database-mappings).

### options

Expand Down
4 changes: 2 additions & 2 deletions doc/7/controllers/collection/search-specifications/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ There is a limit to how many items can be returned by a single search query.
That limit is by default set at 10000, and you can't get over it even with the from and size pagination options.

:::info
When processing a large number of items (i.e. more than 1000), it is advised to paginate the results using [SearchResult.next](/sdk/js/6/core-classes/search-result/next) rather than increasing the size parameter.
When processing a large number of items (i.e. more than 1000), it is advised to paginate the results using [SearchResult.next](/sdk/js/7/core-classes/search-result/next) rather than increasing the size parameter.
:::

<br/>
Expand Down Expand Up @@ -63,7 +63,7 @@ const body = {

## Resolves

Resolve to a [SpecificationsSearchResult](/sdk/js/6/core-classes/search-result).
Resolve to a [SpecificationsSearchResult](/sdk/js/7/core-classes/search-result).

## Usage

Expand Down
6 changes: 3 additions & 3 deletions doc/7/controllers/collection/update-mapping/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ description: Update the collection mapping

<SinceBadge version="1.7.1" />

You can define the collection [dynamic mapping policy](/core/1/guides/essentials/database-mappings#dynamic-mapping-policy) by setting the `dynamic` field to the desired value.
You can define the collection [dynamic mapping policy](/core/2/guides/essentials/database-mappings#dynamic-mapping-policy) by setting the `dynamic` field to the desired value.

You can define [collection additional metadata](/core/1/guides/essentials/database-mappings#collection-metadata) within the `_meta` root field.
You can define [collection additional metadata](/core/2/guides/essentials/database-mappings#collection-metadata) within the `_meta` root field.

<br/>

Expand Down Expand Up @@ -47,7 +47,7 @@ const mapping = {
};
```

More informations about database mappings [here](/core/1/guides/essentials/database-mappings).
More informations about database mappings [here](/core/2/guides/essentials/database-mappings).

### options

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ updateSpecifications(index, collection, specifications, [options]);

An object representing the specifications.

This object must follow the [Specification Structure](/core/1/guides/essentials/data-validation):
This object must follow the [Specification Structure](/core/2/guides/essentials/data-validation):

```js
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ validateSpecifications(index, collection, specifications, [options]);

An object representing the specifications.

This object must follow the [Specification Structure](/core/1/guides/cookbooks/datavalidation):
This object must follow the [Specification Structure](/core/2/guides/cookbooks/datavalidation):

```js
{
Expand Down
4 changes: 2 additions & 2 deletions doc/7/controllers/document/search/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ There is a limit to how many documents can be returned by a single search query.
That limit is by default set at 10000 documents, and you can't get over it even with the from and size pagination options.

:::info
When processing a large number of documents (i.e. more than 1000), it is advised to paginate the results using [SearchResult.next](/sdk/js/6/core-classes/search-result/next) rather than increasing the size parameter.
When processing a large number of documents (i.e. more than 1000), it is advised to paginate the results using [SearchResult.next](/sdk/js/7/core-classes/search-result/next) rather than increasing the size parameter.
:::

<br/>
Expand Down Expand Up @@ -52,7 +52,7 @@ An empty body matches all documents in the queried collection.

## Resolves

Resolves to a [SearchResult](/sdk/js/6/core-classes/search-result) object.
Resolves to a [SearchResult](/sdk/js/7/core-classes/search-result) object.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/ms/geodist/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: geodist

# geodist

Returns the distance between two geospatial members of a key (see [geoadd](/sdk/js/6/controllers/ms/geoadd)).
Returns the distance between two geospatial members of a key (see [geoadd](/sdk/js/7/controllers/ms/geoadd)).

The returned distance is expressed in meters by default.

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/ms/geohash/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: geohash

# geohash

Converts a key's geopoints (see [geoadd](/sdk/js/6/controllers/ms/geoadd)) into [geohashes](https://en.wikipedia.org/wiki/Geohash).
Converts a key's geopoints (see [geoadd](/sdk/js/7/controllers/ms/geoadd)) into [geohashes](https://en.wikipedia.org/wiki/Geohash).

[[_Redis documentation_]](https://redis.io/commands/geohash)

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/ms/geopos/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: geopos

# geopos

Returns the positions of the provided key's members (see [geoadd](/sdk/js/6/controllers/ms/geoadd)).
Returns the positions of the provided key's members (see [geoadd](/sdk/js/7/controllers/ms/geoadd)).

[[_Redis documentation_]](https://redis.io/commands/geopos)

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/ms/georadius/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: georadius

# georadius

Returns the members (added with [geoadd](/sdk/js/6/controllers/ms/geoadd)) of a given key inside the provided geospatial radius.
Returns the members (added with [geoadd](/sdk/js/7/controllers/ms/geoadd)) of a given key inside the provided geospatial radius.

[[_Redis documentation_]](https://redis.io/commands/georadius)

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/ms/georadiusbymember/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: georadiusbymember

# georadiusbymember

Returns the members (added with [geoadd](/sdk/js/6/controllers/ms/geoadd)) of a given key inside the provided geospatial radius, centered around one of a key's member.
Returns the members (added with [geoadd](/sdk/js/7/controllers/ms/geoadd)) of a given key inside the provided geospatial radius, centered around one of a key's member.

[[_Redis documentation_]](https://redis.io/commands/georadiusbymember)

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/ms/pfcount/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: pfcount

# pfcount

Returns the probabilistic cardinality of a [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog) data structure, or of the merged HyperLogLog structures if more than 1 is provided (see [pfadd](/sdk/js/6/controllers/ms/pfadd)).
Returns the probabilistic cardinality of a [HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog) data structure, or of the merged HyperLogLog structures if more than 1 is provided (see [pfadd](/sdk/js/7/controllers/ms/pfadd)).

[[_Redis documentation_]](https://redis.io/commands/pfcount)

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/ms/zrevrange/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: zrevrange

# zrevrange

Identical to [zrange](/sdk/js/6/controllers/ms/zrange), except that the sorted set is traversed in descending order.
Identical to [zrange](/sdk/js/7/controllers/ms/zrange), except that the sorted set is traversed in descending order.

[[_Redis documentation_]](https://redis.io/commands/zrevrange)

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/ms/zrevrangebylex/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: zrevrangebylex

# zrevrangebylex

Identical to [zrangebylex](/core/1/api/controllers/memory-storage/zrangebylex) except that the sorted set is traversed in descending order.
Identical to [zrangebylex](/core/2/api/controllers/memory-storage/zrangebylex) except that the sorted set is traversed in descending order.

[[_Redis documentation_]](https://redis.io/commands/zrevrangebylex)

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/ms/zrevrangebyscore/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: zrevrangebyscore

# zrevrangebyscore

Identical to [zrangebyscore](/core/1/api/controllers/memory-storage/zrangebyscore), except that the sorted set is traversed in descending order.
Identical to [zrangebyscore](/core/2/api/controllers/memory-storage/zrangebyscore), except that the sorted set is traversed in descending order.

[[_Redis documentation_]](https://redis.io/commands/zrevrangebyscore)

Expand Down
Loading