@toa.io/extensions.exposition 0.7.2 → 0.8.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/.manifest/schema.yaml +1 -1
- package/src/remote.js +1 -1
- package/src/tree.js +2 -0
- package/test/manifest.validate.test.js +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/extensions.exposition",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-dev.1",
|
|
4
4
|
"description": "Toa Resources Exposition",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"@types/express": "4.17.13"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@toa.io/bindings.amqp": "0.7.
|
|
25
|
+
"@toa.io/bindings.amqp": "0.7.3-dev.0",
|
|
26
26
|
"@toa.io/console": "0.6.0",
|
|
27
27
|
"@toa.io/core": "0.8.0",
|
|
28
28
|
"@toa.io/generic": "0.8.0",
|
|
29
|
-
"@toa.io/schema": "0.7.
|
|
29
|
+
"@toa.io/schema": "0.7.3-dev.0",
|
|
30
30
|
"@toa.io/yaml": "0.7.2",
|
|
31
31
|
"cors": "2.8.5",
|
|
32
32
|
"express": "4.18.1",
|
|
33
33
|
"path-to-regexp": "6.2.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "cec62c1e23f4f16baff9baf6e71935ecccf786e5"
|
|
36
36
|
}
|
|
@@ -41,7 +41,7 @@ definitions:
|
|
|
41
41
|
operation:
|
|
42
42
|
$ref: definitions#/definitions/token
|
|
43
43
|
type:
|
|
44
|
-
enum: [transition, observation, assignment]
|
|
44
|
+
enum: [transition, observation, assignment, computation, effect]
|
|
45
45
|
scope:
|
|
46
46
|
type: string
|
|
47
47
|
enum: [object, objects, changeset, none]
|
package/src/remote.js
CHANGED
|
@@ -24,7 +24,7 @@ class Remote extends Connector {
|
|
|
24
24
|
super()
|
|
25
25
|
|
|
26
26
|
const { namespace, name } = remote.locator
|
|
27
|
-
const route = '/' + (namespace ===
|
|
27
|
+
const route = '/' + (namespace === 'default' ? '' : namespace + '/') + name + '*'
|
|
28
28
|
|
|
29
29
|
server.route(route, (req, res) => this.#reply(req, res))
|
|
30
30
|
|
package/src/tree.js
CHANGED
|
@@ -102,6 +102,8 @@ const method = (operation) => {
|
|
|
102
102
|
|
|
103
103
|
if (operation.type === 'observation') return 'GET'
|
|
104
104
|
if (operation.type === 'assignment') return 'PATCH'
|
|
105
|
+
if (operation.type === 'computation') return 'GET'
|
|
106
|
+
if (operation.type === 'effect') return 'POST'
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
exports.Tree = Tree
|
|
@@ -23,3 +23,18 @@ it('should validate', () => {
|
|
|
23
23
|
|
|
24
24
|
expect(() => validate(resources)).not.toThrow()
|
|
25
25
|
})
|
|
26
|
+
|
|
27
|
+
it.each(['computation', 'effect'])('should allow %s operation', async (type) => {
|
|
28
|
+
const resources = {
|
|
29
|
+
'/path/to': {
|
|
30
|
+
operations: [
|
|
31
|
+
{
|
|
32
|
+
operation: 'foo',
|
|
33
|
+
type
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
expect(() => validate(resources)).not.toThrow()
|
|
40
|
+
})
|