@rdfc/js-runner 1.0.0-alpha.7 → 2.0.0-alpha.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.
Files changed (80) hide show
  1. package/.husky/pre-commit +6 -0
  2. package/.prettierrc +4 -0
  3. package/README.md +3 -38
  4. package/__tests__/channels.test.ts +133 -0
  5. package/bin/runner.js +8 -0
  6. package/eslint.config.mjs +21 -0
  7. package/examples/echo/package-lock.json +80 -0
  8. package/examples/echo/package.json +18 -0
  9. package/examples/echo/pipeline.ttl +30 -0
  10. package/examples/echo/processors.ttl +84 -0
  11. package/examples/echo/src/processors.ts +75 -0
  12. package/examples/echo/test.ttl +14 -0
  13. package/examples/echo/tsconfig.json +114 -0
  14. package/examples/echo/untitled:/types/MyType.ttl +0 -0
  15. package/index.ttl +63 -0
  16. package/jest.config.js +2 -0
  17. package/lib/client.d.ts +1 -0
  18. package/lib/client.js +43 -0
  19. package/lib/convertor.d.ts +9 -0
  20. package/lib/convertor.js +51 -0
  21. package/lib/index.d.ts +4 -0
  22. package/lib/index.js +5 -0
  23. package/lib/jsonld.d.ts +17 -0
  24. package/lib/jsonld.js +134 -0
  25. package/lib/logger.d.ts +15 -0
  26. package/lib/logger.js +27 -0
  27. package/lib/processor.d.ts +19 -0
  28. package/lib/processor.js +13 -0
  29. package/lib/reader.d.ts +29 -0
  30. package/lib/reader.js +110 -0
  31. package/lib/runner.d.ts +25 -0
  32. package/lib/runner.js +111 -0
  33. package/lib/tsconfig.tsbuildinfo +1 -0
  34. package/lib/util_processors.d.ts +11 -0
  35. package/lib/util_processors.js +13 -0
  36. package/lib/writer.d.ts +25 -0
  37. package/lib/writer.js +57 -0
  38. package/package.json +53 -59
  39. package/src/client.ts +52 -0
  40. package/src/convertor.ts +59 -0
  41. package/src/index.ts +4 -0
  42. package/src/jsonld.ts +217 -0
  43. package/src/logger.ts +38 -0
  44. package/src/processor.ts +39 -0
  45. package/src/reader.ts +148 -0
  46. package/src/runner.ts +186 -0
  47. package/src/util_processors.ts +20 -0
  48. package/src/writer.ts +89 -0
  49. package/tsconfig.json +33 -0
  50. package/vite.config.ts +10 -0
  51. package/LICENSE +0 -21
  52. package/bin/js-runner.js +0 -4
  53. package/channels/file.ttl +0 -37
  54. package/channels/http.ttl +0 -59
  55. package/channels/kafka.ttl +0 -98
  56. package/channels/ws.ttl +0 -33
  57. package/dist/args.d.ts +0 -4
  58. package/dist/args.js +0 -59
  59. package/dist/connectors/file.d.ts +0 -15
  60. package/dist/connectors/file.js +0 -89
  61. package/dist/connectors/http.d.ts +0 -14
  62. package/dist/connectors/http.js +0 -82
  63. package/dist/connectors/kafka.d.ts +0 -48
  64. package/dist/connectors/kafka.js +0 -64
  65. package/dist/connectors/ws.d.ts +0 -10
  66. package/dist/connectors/ws.js +0 -69
  67. package/dist/connectors.d.ts +0 -57
  68. package/dist/connectors.js +0 -174
  69. package/dist/index.d.ts +0 -39
  70. package/dist/index.js +0 -88
  71. package/dist/profiling.d.ts +0 -6
  72. package/dist/profiling.js +0 -79
  73. package/dist/tsconfig.tsbuildinfo +0 -1
  74. package/dist/util.d.ts +0 -43
  75. package/dist/util.js +0 -75
  76. package/ontology.ttl +0 -196
  77. package/processor/echo.ttl +0 -38
  78. package/processor/resc.ttl +0 -34
  79. package/processor/send.ttl +0 -40
  80. package/processor/test.js +0 -35
@@ -1,40 +0,0 @@
1
- @prefix js: <https://w3id.org/conn/js#>.
2
- @prefix fno: <https://w3id.org/function/ontology#>.
3
- @prefix fnom: <https://w3id.org/function/vocabulary/mapping#>.
4
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
5
- @prefix : <https://w3id.org/conn#>.
6
- @prefix sh: <http://www.w3.org/ns/shacl#>.
7
-
8
- js:Send a js:JsProcess;
9
- js:file <./test.js>;
10
- js:function "send";
11
- js:location <./>;
12
- js:mapping [
13
- a fno:Mapping;
14
- fno:parameterMapping [
15
- a fnom:PositionParameterMapping;
16
- fnom:functionParameter "msg";
17
- fnom:implementationParameterPosition "0"^^xsd:int;
18
- ], [
19
- a fnom:PositionParameterMapping;
20
- fnom:functionParameter "output";
21
- fnom:implementationParameterPosition "1"^^xsd:int;
22
- ];
23
- ].
24
-
25
- [ ] a sh:NodeShape;
26
- sh:targetClass js:Send;
27
- sh:property [
28
- sh:datatype xsd:string;
29
- sh:path js:msg;
30
- sh:name "msg";
31
- sh:maxCount 1;
32
- sh:minCount 1;
33
- ], [
34
- sh:class :WriterChannel;
35
- sh:path js:sendWriter;
36
- sh:name "output";
37
- sh:maxCount 1;
38
- sh:minCount 1;
39
- ].
40
-
package/processor/test.js DELETED
@@ -1,35 +0,0 @@
1
- import http from "http";
2
-
3
- function streamToString(ev) {
4
- const datas = [];
5
- return new Promise((res) => {
6
- ev.on("data", (d) => datas.push(d));
7
- ev.on("end", () => res(Buffer.concat(datas)));
8
- });
9
- }
10
-
11
- export async function send(msg, writer) {
12
- const host = "0.0.0.0";
13
- const port = 8000;
14
- const requestListener = async function (req, res) {
15
- const data = await streamToString(req);
16
- const ret = `${msg} ${data}`;
17
- await writer.push(ret);
18
- res.writeHead(200);
19
- res.end(ret);
20
- };
21
- const server = http.createServer(requestListener);
22
-
23
- await new Promise((res) => {
24
- server.listen(port, host, () => {
25
- console.log(`Server is running on http://${host}:${port} prefix ${msg}`);
26
- res();
27
- });
28
- });
29
-
30
- return () => writer.push("Hallo!");
31
- }
32
-
33
- export function resc(reader) {
34
- reader.data((x) => console.log("data", x));
35
- }