@superhero/core 1.8.4 → 4.0.0-beta.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/README.md +108 -739
- package/index.js +654 -54
- package/index.test.js +94 -0
- package/package.json +17 -34
- package/worker.js +12 -0
- package/LICENCE +0 -20
- package/bootstrap/config.js +0 -7
- package/bootstrap/index.js +0 -19
- package/bootstrap/locator.js +0 -16
- package/cli/config.js +0 -7
- package/cli/index.js +0 -49
- package/cli/locator.js +0 -17
- package/composer/bootstrap/error/schema-not-resolvable.js +0 -10
- package/composer/bootstrap/index.js +0 -62
- package/composer/bootstrap/locator.js +0 -20
- package/composer/config.js +0 -49
- package/composer/error/filter-is-not-honering-contract.js +0 -13
- package/composer/error/invalid-attribute.js +0 -13
- package/composer/error/invalid-collection.js +0 -13
- package/composer/error/invalid-schema.js +0 -13
- package/composer/error/schema-not-found.js +0 -13
- package/composer/error/validator-is-not-honering-contract.js +0 -13
- package/composer/error/validator-not-found.js +0 -13
- package/composer/filter/boolean/index.js +0 -44
- package/composer/filter/boolean/locator.js +0 -11
- package/composer/filter/decimal/index.js +0 -38
- package/composer/filter/decimal/locator.js +0 -11
- package/composer/filter/index.js +0 -10
- package/composer/filter/integer/index.js +0 -38
- package/composer/filter/integer/locator.js +0 -11
- package/composer/filter/json/index.js +0 -23
- package/composer/filter/json/locator.js +0 -11
- package/composer/filter/schema/error/missing-schema-definition.js +0 -13
- package/composer/filter/schema/index.js +0 -49
- package/composer/filter/schema/locator.js +0 -17
- package/composer/filter/string/index.js +0 -50
- package/composer/filter/string/locator.js +0 -11
- package/composer/filter/timestamp/index.js +0 -45
- package/composer/filter/timestamp/locator.js +0 -11
- package/composer/index.js +0 -180
- package/composer/locator.js +0 -17
- package/composer/validator/boolean/error/invalid.js +0 -13
- package/composer/validator/boolean/index.js +0 -17
- package/composer/validator/boolean/locator.js +0 -11
- package/composer/validator/decimal/error/invalid.js +0 -13
- package/composer/validator/decimal/index.js +0 -59
- package/composer/validator/decimal/locator.js +0 -11
- package/composer/validator/index.js +0 -10
- package/composer/validator/integer/error/invalid.js +0 -13
- package/composer/validator/integer/index.js +0 -65
- package/composer/validator/integer/locator.js +0 -11
- package/composer/validator/json/error/invalid.js +0 -13
- package/composer/validator/json/index.js +0 -23
- package/composer/validator/json/locator.js +0 -11
- package/composer/validator/schema/error/invalid.js +0 -13
- package/composer/validator/schema/index.js +0 -13
- package/composer/validator/schema/locator.js +0 -11
- package/composer/validator/string/error/invalid.js +0 -13
- package/composer/validator/string/index.js +0 -59
- package/composer/validator/string/locator.js +0 -11
- package/composer/validator/timestamp/error/invalid.js +0 -13
- package/composer/validator/timestamp/index.js +0 -54
- package/composer/validator/timestamp/locator.js +0 -11
- package/configuration/config.js +0 -7
- package/configuration/index.js +0 -23
- package/configuration/locator.js +0 -22
- package/console/config.js +0 -15
- package/console/index.js +0 -23
- package/console/locator.js +0 -21
- package/console/observer/error/config.js +0 -7
- package/console/observer/error/index.js +0 -14
- package/console/observer/error/locator.js +0 -17
- package/console/observer/info/config.js +0 -7
- package/console/observer/info/index.js +0 -14
- package/console/observer/info/locator.js +0 -17
- package/console/observer/warning/config.js +0 -7
- package/console/observer/warning/index.js +0 -14
- package/console/observer/warning/locator.js +0 -17
- package/core/config.js +0 -21
- package/core/error.js +0 -10
- package/deepcopy/config.js +0 -7
- package/deepcopy/error/failed-to-fast-copy.js +0 -10
- package/deepcopy/index.js +0 -18
- package/deepcopy/locator.js +0 -11
- package/deepfind/config.js +0 -7
- package/deepfind/index.js +0 -11
- package/deepfind/locator.js +0 -11
- package/deepfreeze/config.js +0 -7
- package/deepfreeze/index.js +0 -20
- package/deepfreeze/locator.js +0 -11
- package/deepmerge/config.js +0 -7
- package/deepmerge/index.js +0 -42
- package/deepmerge/locator.js +0 -11
- package/eventbus/bootstrap/error/observer-contract-not-honered.js +0 -10
- package/eventbus/bootstrap/index.js +0 -33
- package/eventbus/bootstrap/locator.js +0 -20
- package/eventbus/config.js +0 -17
- package/eventbus/index.js +0 -21
- package/eventbus/locator.js +0 -25
- package/eventbus/observer.js +0 -9
- package/factory.js +0 -55
- package/http/request/config.js +0 -7
- package/http/request/locator.js +0 -21
- package/http/server/config.js +0 -23
- package/http/server/dispatcher/chain/error/dispatcher-chain-ended.js +0 -10
- package/http/server/dispatcher/chain/index.js +0 -41
- package/http/server/dispatcher/chain/locator.js +0 -20
- package/http/server/dispatcher/collection/builder/error/dispatcher-can-not-be-resolved.js +0 -10
- package/http/server/dispatcher/collection/builder/error/not-honering-dispatcher-contract.js +0 -10
- package/http/server/dispatcher/collection/builder/index.js +0 -56
- package/http/server/dispatcher/collection/builder/locator.js +0 -20
- package/http/server/dispatcher/error/bad-gateway.js +0 -12
- package/http/server/dispatcher/error/bad-request.js +0 -12
- package/http/server/dispatcher/error/conflict.js +0 -12
- package/http/server/dispatcher/error/forbidden.js +0 -12
- package/http/server/dispatcher/error/gateway-timeout.js +0 -12
- package/http/server/dispatcher/error/index.js +0 -10
- package/http/server/dispatcher/error/method-not-allowed.js +0 -12
- package/http/server/dispatcher/error/not-implemented.js +0 -12
- package/http/server/dispatcher/error/page-not-found.js +0 -12
- package/http/server/dispatcher/error/request-timeout.js +0 -12
- package/http/server/dispatcher/error/server-error.js +0 -12
- package/http/server/dispatcher/error/service-unavailable.js +0 -12
- package/http/server/dispatcher/error/unauthorized.js +0 -12
- package/http/server/dispatcher/index.js +0 -26
- package/http/server/dispatcher/rest.js +0 -75
- package/http/server/error/no-endpoint-defined-in-route.js +0 -10
- package/http/server/error/view-contract-not-honered.js +0 -10
- package/http/server/index.js +0 -195
- package/http/server/locator.js +0 -34
- package/http/server/request/builder/index.js +0 -53
- package/http/server/request/builder/locator.js +0 -20
- package/http/server/route/builder/error/dto-invalid-reference.js +0 -10
- package/http/server/route/builder/error/routes-invalid-type.js +0 -10
- package/http/server/route/builder/index.js +0 -88
- package/http/server/route/builder/locator.js +0 -20
- package/http/server/session/builder/index.js +0 -34
- package/http/server/session/builder/locator.js +0 -11
- package/http/server/view/index.js +0 -12
- package/http/server/view/json/index.js +0 -17
- package/http/server/view/json/locator.js +0 -11
- package/http/server/view/locator.js +0 -11
- package/http/server/view/stream/index.js +0 -10
- package/http/server/view/stream/locator.js +0 -11
- package/http/server/view/text/index.js +0 -15
- package/http/server/view/text/locator.js +0 -11
- package/locator/constituent.js +0 -26
- package/locator/error/locator-not-implemented.js +0 -10
- package/locator/error/service-undefined.js +0 -10
- package/locator/index.js +0 -29
- package/path/config.js +0 -7
- package/path/index.js +0 -63
- package/path/locator.js +0 -11
- package/process/bootstrap/index.js +0 -31
- package/process/bootstrap/locator.js +0 -17
- package/process/config.js +0 -12
- package/process/index.js +0 -9
- package/process/locator.js +0 -11
- package/test/api/config.js +0 -43
- package/test/api/endpoint/append-calculation.js +0 -41
- package/test/api/endpoint/create-calculation.js +0 -18
- package/test/api/middleware/authentication.js +0 -27
- package/test/calculator/calculation.js +0 -29
- package/test/calculator/config.js +0 -14
- package/test/calculator/error/calculation-could-not-be-found.js +0 -13
- package/test/calculator/error/invalid-calculation-type.js +0 -13
- package/test/calculator/index.js +0 -67
- package/test/calculator/locator.js +0 -20
- package/test/init.js +0 -2
- package/test/logger/config.js +0 -15
- package/test/logger/index.js +0 -17
- package/test/logger/locator.js +0 -20
- package/test/mocha.opts +0 -4
- package/test/test.calculation.js +0 -58
- package/test/test.logger.js +0 -35
package/test/mocha.opts
DELETED
package/test/test.calculation.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
describe('Calculations', () =>
|
|
2
|
-
{
|
|
3
|
-
const
|
|
4
|
-
expect = require('chai').expect,
|
|
5
|
-
context = require('mochawesome/addContext')
|
|
6
|
-
|
|
7
|
-
let core
|
|
8
|
-
|
|
9
|
-
before((done) =>
|
|
10
|
-
{
|
|
11
|
-
const
|
|
12
|
-
CoreFactory = require('../factory'),
|
|
13
|
-
coreFactory = new CoreFactory
|
|
14
|
-
|
|
15
|
-
core = coreFactory.create()
|
|
16
|
-
|
|
17
|
-
core.add('api')
|
|
18
|
-
core.add('calculator')
|
|
19
|
-
core.add('logger')
|
|
20
|
-
core.add('http/server')
|
|
21
|
-
|
|
22
|
-
core.load()
|
|
23
|
-
|
|
24
|
-
core.locate('bootstrap').bootstrap().then(() =>
|
|
25
|
-
{
|
|
26
|
-
core.locate('http/server').listen(9001)
|
|
27
|
-
core.locate('http/server').onListening(done)
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
after(() =>
|
|
32
|
-
{
|
|
33
|
-
core.locate('http/server').close()
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
it('A client can create a calculation', async function()
|
|
37
|
-
{
|
|
38
|
-
const configuration = core.locate('configuration')
|
|
39
|
-
const httpRequest = core.locate('http/request')
|
|
40
|
-
context(this, { title:'route', value:configuration.find('http.server.routes.create-calculation') })
|
|
41
|
-
const response = await httpRequest.post('http://localhost:9001/calculations')
|
|
42
|
-
expect(response.data.id).to.be.equal(1)
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it('A client can append a calculation to the result of a former calculation if authentication Api-Key', async function()
|
|
46
|
-
{
|
|
47
|
-
const configuration = core.locate('configuration')
|
|
48
|
-
const httpRequest = core.locate('http/request')
|
|
49
|
-
context(this, { title:'route', value:configuration.find('http.server.routes.append-calculation') })
|
|
50
|
-
const url = 'http://localhost:9001/calculations/1'
|
|
51
|
-
const data = { id:1, type:'addition', value:100 }
|
|
52
|
-
const response_unauthorized = await httpRequest.put({ url, data })
|
|
53
|
-
expect(response_unauthorized.status).to.be.equal(401)
|
|
54
|
-
const headers = { 'Api-Key':'ABC123456789' }
|
|
55
|
-
const response_authorized = await httpRequest.put({ headers, url, data })
|
|
56
|
-
expect(response_authorized.data.result).to.be.equal(data.value)
|
|
57
|
-
})
|
|
58
|
-
})
|
package/test/test.logger.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
describe('Logger', () =>
|
|
2
|
-
{
|
|
3
|
-
const
|
|
4
|
-
expect = require('chai').expect,
|
|
5
|
-
context = require('mochawesome/addContext')
|
|
6
|
-
|
|
7
|
-
let core
|
|
8
|
-
|
|
9
|
-
before((done) =>
|
|
10
|
-
{
|
|
11
|
-
const
|
|
12
|
-
CoreFactory = require('../factory'),
|
|
13
|
-
coreFactory = new CoreFactory
|
|
14
|
-
|
|
15
|
-
core = coreFactory.create()
|
|
16
|
-
|
|
17
|
-
core.add('api')
|
|
18
|
-
core.add('calculator')
|
|
19
|
-
core.add('logger')
|
|
20
|
-
core.add('http/server')
|
|
21
|
-
|
|
22
|
-
core.load()
|
|
23
|
-
|
|
24
|
-
core.locate('bootstrap').bootstrap().then(done)
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('the logger is logging', function(done)
|
|
28
|
-
{
|
|
29
|
-
const configuration = core.locate('configuration')
|
|
30
|
-
const eventbus = core.locate('eventbus')
|
|
31
|
-
context(this, { title:'observers', value:configuration.find('http.eventbus.observers') })
|
|
32
|
-
eventbus.once('logger.logged-event', () => done())
|
|
33
|
-
eventbus.emit('calculator.calculation-created', 'test')
|
|
34
|
-
})
|
|
35
|
-
})
|