mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Add support for StreamingHTTPChannel2023 notifications
* feat: initial StremingHTTPChannel2023 notifications Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> * test: unit for StremingHTTPChannel2023 notifications Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> * test: integration for StremingHTTPChannel2023 notifications Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> * emit initial notification on streaming http channel * fix linting erros * ensure canceling fetch body in integration tests * extract defaultChannel for topic into util * add documentation * Apply suggestions from code review Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com> * only generate notifications when needed Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> * test: set body timeout to pass on node >21 Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> * address review feedback * remove node 21 workaround * add architecture documentation * Apply suggestions from code review Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com> --------- Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com> Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
"css:config/http/notifications/base/http.json",
|
||||
"css:config/http/notifications/base/listener.json",
|
||||
"css:config/http/notifications/base/storage.json",
|
||||
"css:config/http/notifications/streaming-http/http.json",
|
||||
"css:config/http/notifications/websockets/handler.json",
|
||||
"css:config/http/notifications/websockets/http.json",
|
||||
"css:config/http/notifications/websockets/subscription.json",
|
||||
|
||||
14
config/http/notifications/streaming-http.json
Normal file
14
config/http/notifications/streaming-http.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^7.0.0/components/context.jsonld",
|
||||
"import": [
|
||||
"css:config/http/notifications/base/handler.json",
|
||||
"css:config/http/notifications/base/http.json",
|
||||
"css:config/http/notifications/base/storage.json",
|
||||
"css:config/http/notifications/streaming-http/http.json"
|
||||
],
|
||||
"@graph": [
|
||||
{
|
||||
"comment": "All the relevant components are made in the specific imports seen above."
|
||||
}
|
||||
]
|
||||
}
|
||||
87
config/http/notifications/streaming-http/http.json
Normal file
87
config/http/notifications/streaming-http/http.json
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^7.0.0/components/context.jsonld",
|
||||
"@graph": [
|
||||
{
|
||||
"comment": "Path prefix used by streaming HTTP receiveFrom endpoints",
|
||||
"@id": "urn:solid-server:default:variable:streamingHTTPReceiveFromPrefix",
|
||||
"valueRaw": ".notifications/StreamingHTTPChannel2023/"
|
||||
},
|
||||
{
|
||||
"comment": "Creates updatesViaStreamingHttp2023 Link relations",
|
||||
"@id": "urn:solid-server:default:StreamingHttpMetadataWriter",
|
||||
"@type": "StreamingHttpMetadataWriter",
|
||||
"baseUrl": { "@id": "urn:solid-server:default:variable:baseUrl" },
|
||||
"pathPrefix": { "@id": "urn:solid-server:default:variable:streamingHTTPReceiveFromPrefix" }
|
||||
},
|
||||
{
|
||||
"comment": "Allows discovery of the corresponding streaming HTTP channel",
|
||||
"@id": "urn:solid-server:default:MetadataWriter",
|
||||
"@type": "ParallelHandler",
|
||||
"handlers": [
|
||||
{ "@id": "urn:solid-server:default:StreamingHttpMetadataWriter" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "Handles the request targeting a StreamingHTTPChannel2023 receiveFrom endpoint.",
|
||||
"@id": "urn:solid-server:default:StreamingHttp2023Router",
|
||||
"@type": "OperationRouterHandler",
|
||||
"baseUrl": { "@id": "urn:solid-server:default:variable:baseUrl" },
|
||||
"allowedMethods": [ "GET" ],
|
||||
"allowedPathNames": [ "/StreamingHTTPChannel2023/" ],
|
||||
"handler": {
|
||||
"@id": "urn:solid-server:default:StreamingHttp2023RequestHandler",
|
||||
"@type": "StreamingHttpRequestHandler",
|
||||
"streamMap": { "@id": "urn:solid-server:default:StreamingHttpMap" },
|
||||
"pathPrefix": { "@id": "urn:solid-server:default:variable:streamingHTTPReceiveFromPrefix" },
|
||||
"generator": { "@id": "urn:solid-server:default:BaseNotificationGenerator" },
|
||||
"serializer": { "@id": "urn:solid-server:default:BaseNotificationSerializer" },
|
||||
"credentialsExtractor": { "@id": "urn:solid-server:default:CredentialsExtractor" },
|
||||
"permissionReader": { "@id": "urn:solid-server:default:PermissionReader" },
|
||||
"authorizer": { "@id": "urn:solid-server:default:Authorizer" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "Add the router to notification type handler",
|
||||
"@id": "urn:solid-server:default:NotificationTypeHandler",
|
||||
"@type": "WaterfallHandler",
|
||||
"handlers": [
|
||||
{ "@id": "urn:solid-server:default:StreamingHttp2023Router" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "Opened response streams will be stored in this Map.",
|
||||
"@id": "urn:solid-server:default:StreamingHttpMap",
|
||||
"@type": "StreamingHttpMap"
|
||||
},
|
||||
{
|
||||
"comment": "Emits serialized notifications through Streaming HTTP.",
|
||||
"@id": "urn:solid-server:default:StreamingHttp2023Emitter",
|
||||
"@type": "StreamingHttp2023Emitter",
|
||||
"streamMap": { "@id": "urn:solid-server:default:StreamingHttpMap" }
|
||||
},
|
||||
{
|
||||
"comment": "Listens to the activities emitted by the MonitoringStore.",
|
||||
"@id": "urn:solid-server:default:StreamingHttpListeningActivityHandler",
|
||||
"@type": "StreamingHttpListeningActivityHandler",
|
||||
"emitter": { "@id": "urn:solid-server:default:ResourceStore" },
|
||||
"streamMap": { "@id": "urn:solid-server:default:StreamingHttpMap" },
|
||||
"source": {
|
||||
"comment": "Handles the generation and serialization of notifications for StreamingHTTPChannel2023",
|
||||
"@id": "urn:solid-server:default:StreamingHttpNotificationHandler",
|
||||
"@type": "ComposedNotificationHandler",
|
||||
"generator": { "@id": "urn:solid-server:default:BaseNotificationGenerator" },
|
||||
"serializer": { "@id": "urn:solid-server:default:BaseNotificationSerializer" },
|
||||
"emitter": { "@id": "urn:solid-server:default:StreamingHttp2023Emitter" },
|
||||
"eTagHandler": { "@id": "urn:solid-server:default:ETagHandler" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "Add the activity handler to the primary initializer",
|
||||
"@id": "urn:solid-server:default:PrimaryParallelInitializer",
|
||||
"@type": "ParallelHandler",
|
||||
"handlers": [
|
||||
{ "@id": "urn:solid-server:default:StreamingHttpListeningActivityHandler" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user