Skip to content

Commit dd01842

Browse files
author
Adrien Maret
authored
Merge pull request #205 from kuzzleio/2.0.0-rc4-proposal
Release 2.0.0 rc4 proposal
2 parents 9f1ad4d + cd38c8b commit dd01842

File tree

97 files changed

+15907
-3465
lines changed

Some content is hidden

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

97 files changed

+15907
-3465
lines changed

.eslintrc.json

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,29 @@
44
"rules": {
55
"@typescript-eslint/ban-ts-comment": "off",
66
"@typescript-eslint/ban-ts-ignore": "off",
7+
"@typescript-eslint/no-shadow": "error",
8+
"@typescript-eslint/no-unused-vars": ["error"],
9+
"brace-style": ["error", "stroustrup"],
10+
"comma-spacing": 2,
711
"consistent-return": 0,
812
"curly": 2,
913
"dot-notation": 2,
1014
"eqeqeq": 2,
1115
"func-names": ["error", "always"],
1216
"guard-for-in": 2,
1317
"indent": [2, 2, {"SwitchCase": 1}],
18+
"key-spacing": ["error", { "afterColon": true }],
19+
"keyword-spacing": ["error", { "before": true, "after": true }],
1420
"linebreak-style": [2, "unix"],
1521
"new-cap": 1,
1622
"no-caller": 2,
1723
"no-catch-shadow": 2,
1824
"no-console": 2,
1925
"no-else-return": 2,
26+
"no-empty": ["error", { "allowEmptyCatch": true }],
27+
"no-eval": 2,
2028
"no-extend-native": 2,
2129
"no-extra-bind": 2,
22-
"no-eval": 2,
2330
"no-implicit-coercion": 2,
2431
"no-implied-eval": 2,
2532
"no-invalid-this": 2,
@@ -39,31 +46,28 @@
3946
"no-return-assign": 2,
4047
"no-self-compare": 2,
4148
"no-sequences": 2,
42-
"no-shadow": 2,
49+
"no-shadow": "off",
4350
"no-shadow-restricted-names": 2,
4451
"no-throw-literal": 2,
4552
"no-undef": 2,
4653
"no-undef-init": 1,
4754
"no-unreachable": 2,
4855
"no-unused-expressions": [2, {"allowShortCircuit": true}],
56+
"no-unused-vars": "off",
4957
"no-useless-call": 2,
5058
"no-with": 2,
59+
"object-curly-spacing": ["error", "always"],
60+
"object-shorthand": ["error", "always"],
5161
"quotes": [2, "single"],
5262
"require-atomic-updates": 0,
5363
"semi": [2, "always"],
54-
"space-before-blocks": 2,
55-
"strict": [2, "global"],
56-
"vars-on-top": 2,
57-
"yoda": [2, "never"],
5864
"sort-keys": ["error", "asc"],
59-
"keyword-spacing": ["error", { "before": true, "after": true }],
60-
"object-curly-spacing": ["error", "always"],
65+
"space-before-blocks": 2,
6166
"space-before-function-paren": ["error", "always"],
62-
"comma-spacing": 2,
63-
"brace-style": ["error", "stroustrup"],
6467
"space-infix-ops": 2,
6568
"space-unary-ops": [2, { "words": true, "nonwords": false, "overrides": { "!": true } }],
66-
"key-spacing": ["error", { "afterColon": true }]
69+
"strict": [2, "global"],
70+
"vars-on-top": 2
6771
},
6872
"overrides": [
6973
{

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ lib/**/*.js
2020
features/fixtures/application/**/*.d.ts
2121
features/fixtures/application/**/*.js
2222
features/fixtures/application/**/*.js.map
23+
24+
features/fakeclasses/**/*.d.ts
25+
features/fakeclasses/**/*.js
26+
features/fakeclasses/**/*.js.map
27+
28+
2329
index.d.ts
2430
index.js
2531
index.js.map
@@ -28,4 +34,4 @@ index.js.map
2834
doc/framework
2935
frontmatter-errors.json
3036

31-
.vscode
37+
.vscode
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
code: true
3+
type: page
4+
title: RelationalController
5+
description: Kuzzle IoT - RelationalController class
6+
---
7+
8+
# RelationalController
9+
10+
RelationalController is an abstract class that can be extend to create controller for entity that can be linked with other entities.
11+
It present different method to create, update and remove the relations, and to automatically update document that contain a copy of another document.
12+
The relation can be "embedded" or "nested".
13+
14+
# Nested relation
15+
16+
An embedded relation is a relation that is symbolised by a string that contain the id of the linked document.
17+
There is no invert relation : the linked document do not know which document link it.
18+
The link will be automatically removed when the object is removed calling genericDelete.
19+
20+
# Embedded relation
21+
22+
An embedded relation is a relation when an object contain a copy of the other object.
23+
The embedded object contain a link to the container object.
24+
Link are represented in the embedded document as FieldPath : A fieldPath contain the index, the collection, the id of the document and the field that contain the copy.
25+
Link are necessary to do edition propagation : When we edit an embedded object, each object that contain a copy must have its copy updated. When we remove an embedded object, each copy will be removed to.
26+
27+
# Dead link and lazy deleting
28+
When we remove a container object, we do not have informations about where does the embbedded document come from (index, collection, field) so we cannot remove the fieldPath that represent the link in the embedded document.
29+
That should be ok, because fieldPath are designed for internal use in RelationalController.
30+
But if a custom code should exploit information in FieldPath, it must take dead link into consideration.
31+
FieldPath will be removed when we try to propagate an edition : if the FieldPath is a dead link (referenced object is deleted), it will be deleted.
32+
33+
34+
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
code: true
3+
type: page
4+
title: create
5+
description: Creates a new asset-category
6+
---
7+
8+
# create
9+
10+
Creates a new asset-category inside a tenant index.
11+
12+
Returns an error if the document already exists.
13+
14+
See also the [document:create](/core/2/api/controllers/document/create) API action.
15+
16+
---
17+
18+
## Query Syntax
19+
20+
### HTTP
21+
22+
```http
23+
URL: http://kuzzle:7512/_/device-manager/:engineId/assetCategory[?refresh=wait_for]
24+
Method: POST
25+
Body:
26+
```
27+
28+
```js
29+
{
30+
// asset content
31+
//Exemple :
32+
{"name" : "myAsset"}
33+
}
34+
```
35+
36+
### Other protocols
37+
38+
```js
39+
{
40+
"engineId": "<index>",
41+
"controller": "device-manager/assetCategory",
42+
"action": "create",
43+
"body": {
44+
// asset content
45+
}
46+
}
47+
```
48+
49+
### Kourou
50+
51+
```bash
52+
kourou device-manager/assetCategory:create <engineId> --body '{
53+
name: "<asset category name>"
54+
}'
55+
```
56+
57+
---
58+
59+
## Arguments
60+
61+
- `engineId`: engine id
62+
63+
### Optional:
64+
65+
- `refresh`: if set to `wait_for`, Kuzzle will not respond until the newly created document is indexed
66+
---
67+
68+
## Body properties
69+
70+
Asset content to create.
71+
72+
Assets must contains at least the following properties:
73+
- `name`: Asset category name.
74+
75+
---
76+
77+
## Response
78+
79+
Returns an object with the following properties:
80+
81+
- `_id`: created document unique identifier
82+
- `_source`: document content
83+
- `_version`: version of the created document (should be `1`)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
code: true
3+
type: page
4+
title: delete
5+
description: Deletes an asset-category
6+
---
7+
8+
# delete
9+
10+
Deletes an asset-category.
11+
12+
See also the [document:delete](/core/2/api/controllers/document/delete) API action.
13+
14+
---
15+
16+
## Query Syntax
17+
18+
### HTTP
19+
20+
```http
21+
URL: http://kuzzle:7512/_/device-manager/:engineId/assetCategory/:_id[?refresh=wait_for][&source]
22+
Method: DELETE
23+
```
24+
25+
### Other protocols
26+
27+
```js
28+
{
29+
"engineId": "<engineId>",
30+
"controller": "device-manager/assetCategory",
31+
"action": "delete",
32+
"_id": "<assetCategoryId>"
33+
}
34+
```
35+
36+
### Kourou
37+
38+
```bash
39+
kourou device-manager/assetCategory:delete <engineId> --id <assetCategoryId>
40+
```
41+
42+
---
43+
44+
## Arguments
45+
46+
- `engineId`: engine id
47+
- `_id`: id of element to delete
48+
49+
### Optional:
50+
51+
- `refresh`: if set to `wait_for`, Kuzzle will not respond until the delete is indexed
52+
- `source`: if set to `true` Kuzzle will return the entire deleted document body in the response.
53+
54+
---
55+
56+
## Response
57+
58+
Returns information about the deleted assetCategory:
59+
60+
- `_id`: assetCategory unique identifier
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
code: true
3+
type: page
4+
title: delete
5+
description: Deletes an asset-category
6+
---
7+
8+
# get
9+
10+
Get an asset-category.
11+
12+
You can also use [document:get](/core/2/api/controllers/document/get) API action if you have proper rights, but if you use this specific controller, the data is preprocessed and easier to use.
13+
14+
---
15+
16+
## Query Syntax
17+
18+
### HTTP
19+
20+
```http
21+
URL: http://kuzzle:7512/_/device-manager/:engineId/assetCategory/:_id
22+
Method: GET
23+
```
24+
25+
### Other protocols
26+
27+
```js
28+
{
29+
"engineId": "<engineId>",
30+
"controller": "device-manager/assetCategory",
31+
"action": "get",
32+
"_id": "<assetCategoryId>"
33+
}
34+
```
35+
36+
### Kourou
37+
38+
```bash
39+
kourou device-manager/assetCategory:get <engineId> --id <assetCategoryId>
40+
```
41+
42+
---
43+
44+
- `engineId`: engine id
45+
46+
---
47+
48+
## Response
49+
50+
```js
51+
{
52+
"action": "get",
53+
"controller": "device-manager/assetCategory",
54+
"error": null,
55+
"headers": {},
56+
"node": "knode-accessible-orwell-15416",
57+
"requestId": "8fd1b8b5-1dfd-4fba-a12f-4b570622980e",
58+
"result": {
59+
"name": "myCategory",
60+
"assetMetadata": [
61+
{
62+
"mandatory": true,
63+
"name": "myMetadata",
64+
"valueType": "string"
65+
},
66+
{
67+
"mandatory": true,
68+
"name": "myOtherMetadata",
69+
"valueType": "string"
70+
}
71+
],
72+
"metadataValues": {
73+
"myMetadata": "myValue"
74+
}
75+
},
76+
"status": 200,
77+
"volatile": null
78+
}
79+
```
80+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
code: true
3+
type: branch
4+
title: asset-category
5+
description: Kuzzle IoT - Device Manager AssetCategory Controller
6+
---

0 commit comments

Comments
 (0)