Skip to content

Commit 6167815

Browse files
author
Eryk Solecki
committed
Topic class and tests
1 parent a251145 commit 6167815

File tree

17 files changed

+871
-419
lines changed

17 files changed

+871
-419
lines changed

packages/host/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"cloc": "cloc src --fullpath --include-lang TypeScript --not-match-d \"(node_modules|test|dist|bdd)\" --by-percent cm",
1212
"test": "npm run test:jest",
1313
"test:ava": "ava",
14-
"test:jest": "jest",
15-
"test:jest-watch": "jest --watch",
14+
"test:jest": "jest --verbose",
1615
"prebuild": "yarn savehash",
1716
"savehash": "node ../../scripts/hash-to-file.js ./src/"
1817
},
@@ -43,7 +42,7 @@
4342
"@scramjet/types": "^0.33.4",
4443
"@types/find-package-json": "^1.2.3",
4544
"@types/jest": "^29.4.4",
46-
"@types/node": "15.12.5",
45+
"@types/node": "^18.15.11",
4746
"ava": "^3.15.0",
4847
"jest": "^29.5.0",
4948
"ts-jest": "^29.0.5",

packages/host/src/lib/host.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -966,12 +966,8 @@ export class Host implements IComponent {
966966
this.logger.trace("CSIControlled ended", `Exit code: ${code}`);
967967

968968
if (csic.provides && csic.provides !== "") {
969-
csic.getOutputStream()!.unpipe(this.serviceDiscovery.getData(
970-
{
971-
topic: new TopicName(csic.provides),
972-
contentType: ""
973-
}
974-
) as Writable);
969+
const topic = this.serviceDiscovery.topicsController.get(new TopicName(csic.provides));
970+
if (topic) csic.getOutputStream()!.unpipe(topic);
975971
}
976972

977973
csic.logger.unpipe(this.logger);

packages/host/src/lib/serviceDiscovery/StreamHandler.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.

packages/host/src/lib/serviceDiscovery/StreamWrapper.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export type ContentType = "text/x-ndjson" | "application/x-ndjson" | "text/plain" | "application/octet-stream"
2+
3+
export const isContentType = (contentType: string): contentType is ContentType => {
4+
return [
5+
"text/x-ndjson",
6+
"application/x-ndjson",
7+
"text/plain",
8+
"application/octet-stream"
9+
].includes(contentType);
10+
}

0 commit comments

Comments
 (0)