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
56 changes: 28 additions & 28 deletions .ci/doc/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
version: '3'

services:
# kuzzle:
# image: kuzzleio/kuzzle:2
# ports:
# - '7512:7512'
# cap_add:
# - SYS_PTRACE
# depends_on:
# - redis
# - elasticsearch
# environment:
# - kuzzle_services__storageEngine__client__node=http://elasticsearch:9200
# - kuzzle_services__internalCache__node__host=redis
# - kuzzle_services__memoryStorage__node__host=redis
# - kuzzle_services__storageEngine__commonMapping__dynamic=true
# - kuzzle_services__storageEngine__internalIndex__collections__users__dynamic=true
# - NODE_ENV=production
kuzzle:
image: kuzzleio/kuzzle:2
ports:
- '7512:7512'
cap_add:
- SYS_PTRACE
depends_on:
- redis
- elasticsearch
environment:
- kuzzle_services__storageEngine__client__node=http://elasticsearch:9200
- kuzzle_services__internalCache__node__host=redis
- kuzzle_services__memoryStorage__node__host=redis
- kuzzle_services__storageEngine__commonMapping__dynamic=true
- kuzzle_services__storageEngine__internalIndex__collections__users__dynamic=true
- NODE_ENV=development

# redis:
# image: redis:5
redis:
image: redis:5

# elasticsearch:
# image: kuzzleio/elasticsearch:7.3.0
# ulimits:
# nofile: 65536
# environment:
# - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
# - node.name=alyx
# - cluster.name=kuzzle
# - discovery.type=single-node
elasticsearch:
image: kuzzleio/elasticsearch:7.3.0
ulimits:
nofile: 65536
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- node.name=alyx
- cluster.name=kuzzle
- discovery.type=single-node

doc-tests:
image: kuzzleio/snippets-tests
privileged: true
ports:
- '9229:9229'
depends_on:
# - kuzzle
- kuzzle
- doc-runner-node
- doc-runner-web
- doc-runner-webpack
Expand Down
7 changes: 2 additions & 5 deletions .ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
kuzzle:
image: kuzzleio/kuzzle
image: kuzzleio/kuzzle:2
ports:
- "7512:7512"
cap_add:
Expand All @@ -28,7 +28,4 @@ services:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- node.name=alyx
- cluster.name=kuzzle
- discovery.type=single-node

volumes:
snippets:
- discovery.type=single-node
33 changes: 33 additions & 0 deletions .ci/test-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -e

here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$here"

docker-compose -f ./doc/docker-compose.yml pull
docker-compose -f ./doc/docker-compose.yml run doc-tests node index
EXIT=$?
docker-compose -f ./doc/docker-compose.yml down

docker-compose -f ./doc/docker-compose.yml up -d kuzzle

until $(curl --output /dev/null --silent --head --fail http://localhost:7512); do
printf '.'
sleep 5
done

cd ${here}/../doc/7/getting-started/.react
yarn install
SKIP_PREFLIGHT_CHECK=true yarn start &
npm run test

cd ${here}/../doc/7/getting-started/.vuejs
npm ci
npm run serve-standalone &
npm run test

cd ${here}
docker-compose -f ./doc/docker-compose.yml down

exit $EXIT
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ examples/node_modules/
coverage/

doc/framework
dead_links.json
dead_links.json

# Cypress debug
doc/6/getting-started/.react/cypress/screenshots
doc/6/getting-started/.react/cypress/videos
doc/6/getting-started/.vuejs/cypress/screenshots
doc/6/getting-started/.vuejs/cypress/videos
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Unit Tests
if: type = pull_request OR type = push AND branch =~ /^master|[0-9]+-(dev|stable)$/ OR type = cron
language: node_js
node_js: 6
node_js: 10

env:
# Codecov token
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
name: Integration Tests
if: type = pull_request OR type = push AND branch =~ /^master|[0-9]+-(dev|stable)$/ OR type = cron
language: node_js
node_js: 6
node_js: 10

addons:
apt:
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
if: tag IS present AND type != cron
sudo: false
language: node_js
node_js: 6
node_js: 10

addons:
apt:
Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
if: type = push && branch =~ /^[0-9]+-dev$/
sudo: false
language: node_js
node_js: 6
node_js: 10

addons:
apt:
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ Our teams will be able to meet your needs in terms of expertise and multi-techno

## Usage

## Compatibility matrice

| Kuzzle Version | SDK Version |
| -------------- | -------------- |
| 1.x.x | 5.x.x |
| 1.x.x | 6.x.x |
| 2.x.x | 7.x.x |

### Installation

This SDK can be used either in NodeJS or in a browser.
Expand Down Expand Up @@ -140,4 +148,3 @@ try {
console.error(error);
}
```

4 changes: 1 addition & 3 deletions doc/7/controllers/document/m-create-or-replace/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ description: Create or replace documents

Creates or replaces multiple documents.

Throws a partial error (error code 206) if one or more document creations/replacements fail.

<br/>

```js
Expand All @@ -21,7 +19,7 @@ mCreateOrReplace(index, collection, documents, [options]);
| ------------ | --------------- | ---------------------------- |
| `index` | <pre>string</pre> | Index name |
| `collection` | <pre>string</pre> | Collection name |
| `documents` | <pre>array<object></pre> | Array of documents to create |
| `documents` | <pre>object[]</pre> | Array of documents to create |
| `options` | <pre>object</pre> | Query options |

### Options
Expand Down
3 changes: 1 addition & 2 deletions doc/7/controllers/document/m-create/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mCreate(index, collection, documents, [options]);
| ------------ | --------------- | ---------------------------- |
| `index` | <pre>string</pre> | Index name |
| `collection` | <pre>string</pre> | Collection name |
| `documents` | <pre>array<object></pre> | Array of documents to create |
| `documents` | <pre>object[]</pre> | Array of documents to create |
| `options` | <pre>object</pre> | Query options |

### Options
Expand Down Expand Up @@ -51,7 +51,6 @@ Each errored document is an object of the `errors` array with the following prop
| `status` | <pre>number</pre> | HTTP error status |
| `reason` | <pre>string</pre> | Human readable reason |


## Usage

<<< ./snippets/m-create.js
8 changes: 3 additions & 5 deletions doc/7/controllers/document/m-delete/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ description: Delete documents

Deletes multiple documents.

Throws a partial error (error code 206) if one or more document deletions fail.

The optional parameter `refresh` can be used with the value `wait_for` in order to wait for the document indexation (indexed documents are available for `search`).

<br/>
Expand All @@ -23,7 +21,7 @@ mDelete(index, collection, ids, [options]);
| ------------ | --------------- | ------------------------------ |
| `index` | <pre>string</pre> | Index name |
| `collection` | <pre>string</pre> | Collection name |
| `ids` | <pre>array<string></pre> | IDs of the documents to delete |
| `ids` | <pre>string[]</pre> | IDs of the documents to delete |
| `options` | <pre>object</pre> | Query options |

### Options
Expand All @@ -37,9 +35,9 @@ Additional query options

## Resolves

Returns an object containing 2 arrays: `deleted` and `errors`
Returns an object containing 2 arrays: `successes` and `errors`

The `deleted` array contain the successfuly deleted document IDs.
The `successes` array contain the successfuly deleted document IDs.

Each deletion error is an object of the `errors` array with the following properties:

Expand Down
2 changes: 1 addition & 1 deletion doc/7/controllers/document/m-delete/snippets/m-delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ try {
['some-id', 'some-other-id']
);

console.log(`Successfully deleted ${response.deleted.length} documents`);
console.log(`Successfully deleted ${response.successes.length} documents`);
} catch (error) {
console.error(error.message);
}
15 changes: 6 additions & 9 deletions doc/7/controllers/document/m-get/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ description: Get multiple documents

Gets multiple documents.

Throws a partial error (error code 206) if one or more document can not be retrieved.

<br/>

```js
Expand All @@ -21,7 +19,7 @@ mGet(index, collection, ids, [options]);
| ------------ | --------------- | --------------- |
| `index` | <pre>string</pre> | Index name |
| `collection` | <pre>string</pre> | Collection name |
| `ids` | <pre>array<string></pre> | Document ids |
| `ids` | <pre>string[]</pre> | Document ids |
| `options` | <pre>object</pre> | Query options |

### Options
Expand All @@ -34,21 +32,20 @@ Additional query options

## Resolves

Resolves to an object containing the retrieved documents.
Returns an object containing 2 arrays: `successes` and `errors`

| Property | Type | Description |
| -------- | --------------- | ------------------------- |
| `hits` | <pre>array<object></pre> | Retrieved documents |
| `total` | <pre>number</pre> | Total retrieved documents |
The `successes` array contain the list of retrieved documents.

Each document of the `hits` array have with the following properties:
Each document have with following properties:

| Name | Type | Description |
| --------- | ----------------- | ------------------------------------------------------ |
| `_id` | <pre>string</pre> | Document ID |
| `_version` | <pre>number</pre> | Version of the document in the persistent data storage |
| `_source` | <pre>object</pre> | Document content |

The `errors` array contain the IDs of not found documents.

## Usage

<<< ./snippets/m-get.js
6 changes: 3 additions & 3 deletions doc/7/controllers/document/m-get/snippets/m-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ try {
console.log(response);
/*
{
"hits": [
"successes": [
{ "_id": "some-id",
"_version": 1,
"found": true,
Expand Down Expand Up @@ -42,10 +42,10 @@ try {
}
}
],
"total": 2
"errors": []
}
*/
console.log(`Successfully get ${response.total} documents`);
console.log(`Successfully get ${response.successes.length} documents`);
} catch (error) {
console.error(error.message);
}
4 changes: 1 addition & 3 deletions doc/7/controllers/document/m-replace/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ description: Replace documents

Replaces multiple documents.

Throws a partial error (error code 206) if one or more documents can not be replaced.

<br/>

```js
Expand All @@ -21,7 +19,7 @@ mReplace(index, collection, documents, [options]);
| ------------ | --------------- | ---------------------------- |
| `index` | <pre>string</pre> | Index name |
| `collection` | <pre>string</pre> | Collection name |
| `documents` | <pre>array<object></pre> | Array of documents to update |
| `documents` | <pre>object[]</pre> | Array of documents to update |
| `options` | <pre>object</pre> | Query options |

### Options
Expand Down
4 changes: 1 addition & 3 deletions doc/7/controllers/document/m-update/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ description: Update documents

Updates multiple documents.

Returns a partial error (error code 206) if one or more documents can not be updated.

Conflicts may occur if the same document gets updated multiple times within a short timespan in a database cluster.

You can set the `retryOnConflict` optional argument (with a retry count), to tell Kuzzle to retry the failing updates the specified amount of times before rejecting the request with an error.
Expand All @@ -25,7 +23,7 @@ mUpdate(index, collection, documents, [options]);
| ------------ | --------------- | ---------------------------- |
| `index` | <pre>string</pre> | Index name |
| `collection` | <pre>string</pre> | Collection name |
| `documents` | <pre>array<object></pre> | Array of documents to update |
| `documents` | <pre>object[]</pre> | Array of documents to update |
| `options` | <pre>object</pre> | Query options |

### Options
Expand Down
5 changes: 4 additions & 1 deletion doc/7/controllers/security/create-user/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ createUser(kuid, body, [options]);
| `body` | <pre>object</pre> | User content &amp; credentials |
| `options` | <pre>object</pre> | Query options |

::: info
If the `kuid` is `null`, Kuzzle will generate an ID.
:::

### body

The `body` property must contain two objects:
Expand Down Expand Up @@ -67,4 +71,3 @@ A [`User`](sdk/js/6/core-classes/user/introduction) object containing informatio
## Usage

<<< ./snippets/create-user.js

Loading