Skip to content

Commit

Permalink
feat: port handlersjs in node package (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
BelgianNoise authored Apr 22, 2021
1 parent bf9d2b3 commit 6bd8a5e
Show file tree
Hide file tree
Showing 40 changed files with 575 additions and 881 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# extra
componentsjs-error-state.json

# Logs
logs
*.log
Expand Down
3 changes: 2 additions & 1 deletion packages/semcom-node/.componentsignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"LoggerService",
"ComponentMetadata",
"ManageComponentService",
"QueryComponentService"
"QueryComponentService",
"HttpHandler"
]
2 changes: 1 addition & 1 deletion packages/semcom-node/config/config-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"files-dasn:config/presets/logger.json",
"files-dasn:config/presets/serializer.json",
"files-dasn:config/presets/component.json",
"files-dasn:config/presets/handlers.json",
"files-dasn:config/presets/server.json",
"files-dasn:config/presets/launcher.json",
"files-dasn:config/presets/store.json"
],
"@graph": [
Expand Down
18 changes: 11 additions & 7 deletions packages/semcom-node/config/presets/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,27 @@
{
"@id": "urn:semcom-node:default:QueryComponentService",
"@type": "QueryComponentStoreService",
"QueryComponentStoreService:_components": { "@id": "urn:semcom-node:default:ComponentStore" }
"QueryComponentStoreService:_components": {
"@id": "urn:semcom-node:default:ComponentStore"
}
},
{
"@id": "urn:semcom-node:default:ManageComponentService",
"@type": "ManageComponentStoreService",
"ManageComponentStoreService:_components": { "@id": "urn:semcom-node:default:ComponentStore" }
"ManageComponentStoreService:_components": {
"@id": "urn:semcom-node:default:ComponentStore"
}
},
{
"@id": "urn:semcom-node:default:ComponentControllerService",
"@type": "ComponentControllerService",
"ComponentControllerService:_queryService": {
"@id": "urn:semcom-node:default:ComponentService",
"@type": "ComponentService",
"ComponentService:_queryService": {
"@id": "urn:semcom-node:default:QueryComponentService"
},
"ComponentControllerService:_manageService": {
"ComponentService:_manageService": {
"@id": "urn:semcom-node:default:ManageComponentService"
},
"ComponentControllerService:_logger": {
"ComponentService:_logger": {
"@id": "urn:semcom-node:default:LoggerService"
}
},
Expand Down
40 changes: 40 additions & 0 deletions packages/semcom-node/config/presets/handlers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"@context": [
"https://linkedsoftwaredependencies.org/bundles/npm/@digita-ai/semcom-core/^0.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@digita-ai/semcom-node/^0.0.0/components/context.jsonld"
],
"@graph": [
{
"@id": "urn:semcom-node:default:ComponentHttpHandler",
"@type": "ComponentHttpHandler",
"ComponentHttpHandler:_components": {
"@id": "urn:semcom-node:default:ComponentService"
}
},
{
"@id": "urn:semcom-node:default:QueryComponentHttpHandler",
"@type": "QueryComponentHttpHandler",
"QueryComponentHttpHandler:_components": {
"@id": "urn:semcom-node:default:ComponentService"
}
},
{
"@id": "urn:semcom-node:default:ContentNegotiationHttpHandler",
"@type": "ContentNegotiationHttpHandler",
"ContentNegotiationHttpHandler:_logger": {
"@id": "urn:semcom-node:default:LoggerService"
},
"ContentNegotiationHttpHandler:_defaultContentType": "application/ld+json",
"ContentNegotiationHttpHandler:_transformer": {
"@id": "urn:semcom-node:default:ComponentTransformerService"
},
"ContentNegotiationHttpHandler:_serializer": {
"@id": "urn:semcom-node:default:QuadSerializationService"
}
}
]
}




40 changes: 0 additions & 40 deletions packages/semcom-node/config/presets/launcher.json

This file was deleted.

80 changes: 74 additions & 6 deletions packages/semcom-node/config/presets/server.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,80 @@
{
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@digita-ai/semcom-node/^0.0.0/components/context.jsonld",
"@context": [
"https://linkedsoftwaredependencies.org/bundles/npm/@digita-ai/handlersjs-core/^0.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@digita-ai/handlersjs-http/^0.0.0/components/context.jsonld"
],
"@graph": [
{
"@id": "urn:semcom-node:default:ServerService",
"@type": "ServerKoaService",
"ServerKoaService:_logger": {
"@id": "urn:semcom-node:default:LoggerService"
"@id": "urn:handlersjs-http:default:NodeHttpServer",
"@type": "NodeHttpServer",
"NodeHttpServer:_port": "3000",
"NodeHttpServer:_host": "localhost",
"NodeHttpServer:_nodeHttpStreamsHandler": {
"@id": "urn:handlersjs-http:default:NodeHttpRequestResponseHandler",
"@type": "NodeHttpRequestResponseHandler",
"NodeHttpRequestResponseHandler:_httpHandler": {
"@type": "SequenceHandler",
"SequenceHandler:_handlers": [
{
"@id": "urn:handlersjs-http:default:RoutedHttpRequestHandler",
"@type": "RoutedHttpRequestHandler",
"RoutedHttpRequestHandler:_handlerControllerList": [
{
"@id": "urn:handlersjs-http:default:HttpHandlerController",
"@type": "HttpHandlerController",
"HttpHandlerController:_label": "ControllerList",
"HttpHandlerController:_routes": [
{
"@id": "urn:semcom-node:default:ComponentsRoute"
},
{
"@id": "urn:semcom-node:default:QueryComponentsRoute"
}
]
}
]
},
{
"@id": "urn:semcom-node:default:ContentNegotiationHttpHandler"
}
]
}
}
},
{
"@id": "urn:semcom-node:default:ComponentsRoute",
"@type": "HttpHandlerRoute",
"HttpHandlerRoute:_operations": [
{
"@type": "HttpHandlerOperation",
"HttpHandlerOperation:_method": "GET",
"HttpHandlerOperation:_publish": true
},
{
"@type": "HttpHandlerOperation",
"HttpHandlerOperation:_method": "POST",
"HttpHandlerOperation:_publish": true
}
],
"HttpHandlerRoute:_handler": {
"@id": "urn:semcom-node:default:ComponentHttpHandler"
},
"HttpHandlerRoute:_path": "/component"
},
{
"@id": "urn:semcom-node:default:QueryComponentsRoute",
"@type": "HttpHandlerRoute",
"HttpHandlerRoute:_operations": [
{
"@type": "HttpHandlerOperation",
"HttpHandlerOperation:_method": "POST",
"HttpHandlerOperation:_publish": true
}
],
"HttpHandlerRoute:_handler": {
"@id": "urn:semcom-node:default:QueryComponentHttpHandler"
},
"HttpHandlerRoute:_path": "/component/query"
}
]
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentTransformerService } from './component-transformer.service';
import { LoggerConsoleService } from '@digita-ai/semcom-core';

describe('ComponentControllerService', () => {
describe('ComponentTransformerService', () => {
let transformer: ComponentTransformerService = null;

beforeEach(() => {
Expand Down
Loading

0 comments on commit 6bd8a5e

Please sign in to comment.