Skip to content

Commit cea8c93

Browse files
authored
Merge pull request #491 from kuzzleio/7.1.0-proposal
Release 7.1.0
2 parents b89a61d + 1775adb commit cea8c93

File tree

83 files changed

+36245
-1400
lines changed

Some content is hidden

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

83 files changed

+36245
-1400
lines changed

.ci/doc/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
image: redis:5
2323

2424
elasticsearch:
25-
image: kuzzleio/elasticsearch:7.4.0
25+
image: kuzzleio/elasticsearch:7
2626
ulimits:
2727
nofile: 65536
2828

.ci/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ services:
2121
image: redis:5
2222

2323
elasticsearch:
24-
image: kuzzleio/elasticsearch:7.4.0
24+
image: kuzzleio/elasticsearch:7
2525
ulimits:
2626
nofile: 65536

.ci/test-docs.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ until $(curl --output /dev/null --silent --head --fail http://localhost:7512); d
1818
done
1919

2020
cd ${here}/../doc/7/getting-started/.react
21-
npm install
21+
npm ci
2222
SKIP_PREFLIGHT_CHECK=true npm run start &
2323
until $(curl --output /dev/null --silent --head --fail http://localhost:3000); do
2424
printf '.'
@@ -35,6 +35,16 @@ until $(curl --output /dev/null --silent --head --fail http://localhost:8080); d
3535
done
3636
npm run test
3737

38+
cd ${here}/../doc/7/getting-started/.react-native
39+
# Here we use install instead of ci because expo-cli cannot be installed with ci
40+
npm install
41+
npm run web &
42+
until $(curl --output /dev/null --silent --head --fail http://localhost:19006); do
43+
printf '.'
44+
sleep 5
45+
done
46+
npm run test
47+
3848
cd ${here}
3949
docker-compose -f ./doc/docker-compose.yml down
4050

.travis.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020

2121
addons:
2222
apt:
23+
update: true
2324
sources:
2425
- ubuntu-toolchain-r-test
2526
packages:
@@ -47,6 +48,7 @@ jobs:
4748

4849
addons:
4950
apt:
51+
update: true
5052
sources:
5153
- ubuntu-toolchain-r-test
5254
packages:
@@ -78,34 +80,41 @@ jobs:
7880

7981
- stage: Tests
8082
name: Dead link check
83+
language: node_js
84+
node_js: 12
8185
if: type = pull_request OR type = push AND branch =~ /^master|[0-9]+-(dev|stable|beta)$/ OR type = cron
8286

8387
before_script:
88+
- npm ci
8489
- npm run doc-prepare
85-
- npm run --prefix doc/framework repositories -- clone
90+
- $(npm bin)/kuzdoc iterate-repos:install --repos_path doc/framework/.repos/
91+
- $(npm bin)/kuzdoc framework:link -d /sdk/js/7/ -v 7
8692
script:
8793
- gem install typhoeus
88-
- HYDRA_MAX_CONCURRENCY=20 npm run --prefix doc/framework dead-links
94+
- cd doc/framework/ && HYDRA_MAX_CONCURRENCY=20 ruby .ci/dead-links.rb -p src/sdk/js/7/
8995

9096
- stage: Deployment Doc Dev
9197
name: Deploy next-docs.kuzzle.io
9298
if: type = push AND branch =~ /^[0-9]+-dev$/
9399
language: node_js
94100
node_js: 10
95101
env:
102+
- BRANCH=dev
96103
- NODE_ENV=production
97104
- S3_BUCKET=docs-next.kuzzle.io
98105
- CLOUDFRONT_DISTRIBUTION_ID=E2ZCCEK9GRB49U
99106
- AWS_DEFAULT_REGION=us-west-2
100107

101108
addons:
102109
apt:
110+
update: true
103111
packages:
104112
- python
105113
- python-pip
106114

107115
install:
108116
- pip install awscli --upgrade --user
117+
- npm ci
109118

110119
script:
111120
- npm run doc-prepare
@@ -116,6 +125,8 @@ jobs:
116125
script:
117126
- npm run doc-upload
118127
skip_cleanup: true
128+
on:
129+
all_branches: true
119130

120131
after_deploy:
121132
- npm run doc-cloudfront
@@ -133,12 +144,14 @@ jobs:
133144

134145
addons:
135146
apt:
147+
update: true
136148
packages:
137149
- python
138150
- python-pip
139151

140152
install:
141153
- pip install awscli --upgrade --user
154+
- npm ci
142155

143156
script:
144157
- npm run doc-prepare
@@ -149,6 +162,8 @@ jobs:
149162
script:
150163
- npm run doc-upload
151164
skip_cleanup: true
165+
on:
166+
all_branches: true
152167

153168
after_deploy:
154169
- npm run doc-cloudfront
@@ -195,6 +210,7 @@ jobs:
195210

196211
addons:
197212
apt:
213+
update: true
198214
sources:
199215
- ubuntu-toolchain-r-test
200216
packages:
@@ -228,6 +244,7 @@ jobs:
228244

229245
addons:
230246
apt:
247+
update: true
231248
sources:
232249
- ubuntu-toolchain-r-test
233250
packages:
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
code: true
3+
type: page
4+
title: createApiKey
5+
description: Creates a new API key for the currently loggued user.
6+
---
7+
8+
# createApiKey
9+
10+
<SinceBadge version="7.1.0" />
11+
12+
<SinceBadge version="Kuzzle 2.1.0" />
13+
14+
Creates a new API key for the currently loggued user.
15+
16+
<br />
17+
18+
```js
19+
createApiKey(description, [options]);
20+
```
21+
22+
<br />
23+
24+
| Property | Type | Description |
25+
| --- | --- | --- |
26+
| `description` | <pre>string</pre> | API key description |
27+
| `options` | <pre>object</pre> | Additional options |
28+
29+
### options
30+
31+
Additional query options
32+
33+
| Property | Type<br />(default) | Description |
34+
| --- | --- | --- |
35+
| `expiresIn` | <pre>string/number</pre><br />(`-1`) | Expiration duration |
36+
| `_id` | <pre>string</pre><br />(`null`) | API key unique ID |
37+
| `refresh` | <pre>boolean</pre><br />(`false`) | If set to `wait_for`, Kuzzle will not respond until the API key is indexed |
38+
39+
**Notes**:
40+
- `expiresIn`:
41+
- if a raw number is provided (not enclosed between quotes), then the expiration delay is in milliseconds. Example: `86400000`
42+
- if this value is a string, then its content is parsed by the [ms](https://www.npmjs.com/package/ms) library. Examples: `"6d"`, `"10h"`
43+
- if `-1` is provided, the token will never expire
44+
45+
## Resolves
46+
47+
An object containing the newly created API key:
48+
49+
| Name | Type | Description |
50+
| --------- | ----------------- | ---------------- |
51+
| `_id` | <pre>string</pre> | ID of the newly created API key |
52+
| `_source` | <pre>object</pre> | API key content |
53+
54+
The API key content has the following properties:
55+
56+
| Name | Type | Description |
57+
| --------- | ----------------- | ---------------- |
58+
| `userId` | <pre>string</pre> | User kuid |
59+
| `expiresAt` | <pre>number</pre> | Aexpiration date in UNIX micro-timestamp format (`-1` if the token never expires) |
60+
| `ttl` | <pre>number</pre> | Original TTL |
61+
| `description` | <pre>string</pre> | API key description |
62+
| `token` | <pre>string</pre> | Authentication token associated with this API key |
63+
64+
::: warning
65+
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.
66+
:::
67+
68+
## Usage
69+
70+
<<< ./snippets/create-api-key.js
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
try {
2+
await kuzzle.auth.login('local', { username: 'john.doe', password: 'password' });
3+
4+
const apiKey = await kuzzle.auth.createApiKey('Sigfox API key');
5+
6+
console.log(apiKey);
7+
/*
8+
{
9+
_id: '-fQRa28BsidO6V_wmOcL',
10+
_source: {
11+
description: 'Sigfox API key',
12+
userId: 'john.doe',
13+
expiresAt: -1,
14+
ttl: -1,
15+
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJqb2huLmRvZSIsImlhdCI6MTU3ODA0OTMxMn0.XO_keW6EtsCGmPzxVJCChU9VREakEECDGg-N5lhCfF8'
16+
}
17+
}
18+
*/
19+
20+
console.log('API key successfully created');
21+
} catch (e) {
22+
console.error(e);
23+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: auth#createApiKey
2+
description: Creates a new API key for the currently loggued user.
3+
hooks:
4+
before: >
5+
curl -H "Content-type: application/json" -d '{
6+
"content": {
7+
"profileIds": ["default"]
8+
},
9+
"credentials": {
10+
"local": {
11+
"username": "john.doe",
12+
"password": "password"
13+
}
14+
}
15+
}' "kuzzle:7512/users/john.doe/_create?refresh=wait_for"
16+
after:
17+
curl -XDELETE kuzzle:7512/users/john.doe
18+
template: default
19+
expected:
20+
- "description: 'Sigfox API key'"
21+
- "userId: 'john.doe'"
22+
- API key successfully created
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
code: true
3+
type: page
4+
title: deleteApiKey
5+
description: Deletes an API key for the currently loggued user.
6+
---
7+
8+
# deleteApiKey
9+
10+
<SinceBadge version="7.1.0" />
11+
12+
<SinceBadge version="Kuzzle 2.1.0" />
13+
14+
Deletes an API key for the currently loggued user.
15+
16+
<br />
17+
18+
```js
19+
deleteApiKey(id, [options]);
20+
```
21+
22+
<br />
23+
24+
| Property | Type | Description |
25+
| --- | --- | --- |
26+
| `id` | <pre>string</pre> | API key unique ID |
27+
| `options` | <pre>object</pre> | Additional options |
28+
29+
### options
30+
31+
Additional query options
32+
33+
| Property | Type<br />(default) | Description |
34+
| --- | --- | --- |
35+
| `refresh` | <pre>boolean</pre><br />(`false`) | If set to `wait_for`, Kuzzle will not respond until the API key is indexed |
36+
37+
## Resolves
38+
39+
Resolves if the API key is successfully deleted.
40+
41+
## Usage
42+
43+
<<< ./snippets/delete-api-key.js
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
try {
2+
await kuzzle.auth.login('local', { username: 'john.doe', password: 'password' });
3+
4+
await kuzzle.auth.deleteApiKey('fQRa28BsidO6V_wmOcL');
5+
6+
console.log('API key successfully deleted');
7+
} catch (e) {
8+
console.error(e);
9+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: auth#deleteApiKey
2+
description: Deletes an API key for the currently loggued user
3+
hooks:
4+
before: >
5+
curl -H "Content-type: application/json" -d '{
6+
"content": {
7+
"profileIds": ["default"]
8+
},
9+
"credentials": {
10+
"local": {
11+
"username": "john.doe",
12+
"password": "password"
13+
}
14+
}
15+
}' "kuzzle:7512/users/john.doe/_create?refresh=wait_for"
16+
&&
17+
curl -XPOST -H "Content-type: application/json" -d '{
18+
"description": "Sigfox API key"
19+
}' "kuzzle:7512/users/john.doe/api-keys/_create?_id=fQRa28BsidO6V_wmOcL&refresh=wait_for"
20+
after:
21+
curl -XDELETE kuzzle:7512/users/john.doe
22+
template: default
23+
expected:
24+
- API key successfully deleted

0 commit comments

Comments
 (0)