@rdfc/js-runner 3.0.0 → 3.0.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 (54) hide show
  1. package/.idea/LNKD.tech Editor.xml +194 -0
  2. package/.idea/codeStyles/Project.xml +52 -0
  3. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  4. package/.idea/copilot.data.migration.agent.xml +6 -0
  5. package/.idea/copilot.data.migration.ask.xml +6 -0
  6. package/.idea/copilot.data.migration.ask2agent.xml +6 -0
  7. package/.idea/copilot.data.migration.edit.xml +6 -0
  8. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  9. package/.idea/js-runner.iml +12 -0
  10. package/{examples/echo/.idea → .idea}/modules.xml +1 -1
  11. package/.idea/vcs.xml +6 -0
  12. package/__tests__/echoProcessor.test.ts +12 -11
  13. package/dist/args.d.ts +4 -0
  14. package/dist/args.js +58 -0
  15. package/dist/connectors/file.d.ts +15 -0
  16. package/dist/connectors/file.js +89 -0
  17. package/dist/connectors/http.d.ts +14 -0
  18. package/dist/connectors/http.js +82 -0
  19. package/dist/connectors/kafka.d.ts +48 -0
  20. package/dist/connectors/kafka.js +68 -0
  21. package/dist/connectors/ws.d.ts +10 -0
  22. package/dist/connectors/ws.js +72 -0
  23. package/dist/connectors.d.ts +73 -0
  24. package/dist/connectors.js +168 -0
  25. package/dist/index.cjs +732 -0
  26. package/dist/index.d.ts +42 -0
  27. package/dist/index.js +83 -0
  28. package/dist/tsconfig.tsbuildinfo +1 -0
  29. package/dist/util.d.ts +71 -0
  30. package/dist/util.js +92 -0
  31. package/lib/reader.js +1 -1
  32. package/lib/runner.d.ts +1 -1
  33. package/lib/runner.js +1 -1
  34. package/lib/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +21 -21
  36. package/src/reader.ts +8 -8
  37. package/src/runner.ts +1 -2
  38. package/examples/echo/.idea/echo.iml +0 -9
  39. package/examples/echo/.idea/misc.xml +0 -6
  40. package/examples/echo/.idea/vcs.xml +0 -7
  41. package/examples/echo/.swls/config.json +0 -1
  42. package/examples/echo/index.ttl +0 -3
  43. package/examples/echo/minimal.ttl +0 -90
  44. package/examples/echo/shacl.ttl +0 -9
  45. package/examples/echo/shape.ttl +0 -1339
  46. package/examples/echo/test.ttl +0 -11
  47. package/examples/echo/untitled:/types/MyType.ttl +0 -0
  48. package/file:/home/silvius/Projects/mumo-pipeline/ldes/http_3A_2F_2Fdata.mumo.be_2Fstreams_2Fnodes_2Fdefault/root/index.trig +0 -3
  49. package/ldes/http_3A_2F_2Fdata.mumo.be_2Fstreams_2Fnodes_2Fdefault/root/index.trig +0 -3
  50. package/lib/jsonld.d.ts +0 -17
  51. package/lib/jsonld.js +0 -135
  52. package/lib/testUtils.d.ts +0 -24
  53. package/lib/testUtils.js +0 -150
  54. package/minimal.ttl +0 -99
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdfc/js-runner",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "main": "lib/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -29,38 +29,38 @@
29
29
  "license": "ISC",
30
30
  "description": "",
31
31
  "devDependencies": {
32
- "@eslint/js": "^9.21.0",
32
+ "@eslint/js": "^9.38.0",
33
33
  "@rdfjs/types": "^2.0.1",
34
- "@grpc/grpc-js": "^1.12.6",
35
- "@types/jest": "^29.5.14",
34
+ "@types/jest": "^30.0.0",
36
35
  "@types/jsonld": "^1.5.15",
37
- "@types/n3": "^1.21.1",
38
- "@types/node": "^22.13.5",
39
- "@typescript-eslint/eslint-plugin": "^8.25.0",
40
- "@typescript-eslint/parser": "^8.25.0",
36
+ "@types/n3": "^1.26.1",
37
+ "@types/node": "^22.18.12",
38
+ "@typescript-eslint/eslint-plugin": "^8.46.2",
39
+ "@typescript-eslint/parser": "^8.46.2",
41
40
  "@vitest/coverage-v8": "^3.2.4",
42
41
  "eslint": "^9.21.0",
43
- "eslint-config-prettier": "^10.0.1",
44
- "eslint-plugin-prettier": "^5.2.3",
45
- "globals": "^16.0.0",
42
+ "eslint-config-prettier": "^10.1.8",
43
+ "eslint-plugin-prettier": "^5.5.4",
44
+ "globals": "^16.4.0",
46
45
  "husky": "^9.1.7",
47
- "jest": "^29.7.0",
48
- "lint-staged": "^15.4.3",
49
- "prettier": "^3.5.2",
50
- "ts-jest": "^29.2.6",
51
- "tsc-alias": "^1.8.10",
52
- "typescript": "^5.7.3",
53
- "typescript-eslint": "^8.25.0",
46
+ "jest": "^30.2.0",
47
+ "lint-staged": "^15.5.2",
48
+ "prettier": "^3.6.2",
49
+ "ts-jest": "^29.4.5",
50
+ "tsc-alias": "^1.8.16",
51
+ "typescript": "^5.9.3",
52
+ "typescript-eslint": "^8.46.2",
54
53
  "vitest": "^3.2.4"
55
54
  },
56
55
  "dependencies": {
56
+ "@grpc/grpc-js": "^1.14.0",
57
57
  "@rdfc/proto": "^0.1.2",
58
58
  "@treecg/types": "^0.4.6",
59
59
  "jsonld": "^8.3.3",
60
60
  "jsonld-streaming-parser": "^5.0.0",
61
- "n3": "^1.23.1",
62
- "rdf-lens": "^1.3.5",
63
- "winston": "^3.17.0",
61
+ "n3": "^1.26.0",
62
+ "rdf-lens": "^1.3.6",
63
+ "winston": "^3.18.3",
64
64
  "winston-transport": "^4.9.0"
65
65
  }
66
66
  }
package/src/reader.ts CHANGED
@@ -18,14 +18,14 @@ import { promisify } from 'util'
18
18
 
19
19
  export type Any =
20
20
  | {
21
- string: string
22
- }
21
+ string: string
22
+ }
23
23
  | {
24
- stream: AsyncGenerator<Uint8Array>
25
- }
24
+ stream: AsyncGenerator<Uint8Array>
25
+ }
26
26
  | {
27
- buffer: Uint8Array
28
- }
27
+ buffer: Uint8Array
28
+ }
29
29
 
30
30
  export interface Reader {
31
31
  readonly uri: string
@@ -68,7 +68,7 @@ class MyIter<T> implements AsyncIterable<T> {
68
68
 
69
69
  async pushStream(chunks: AsyncIterable<DataChunk>, onComplete: () => void) {
70
70
  // This is an async generator that transforms DataChunks to Buffers
71
- const stream = (async function* (stream) {
71
+ const stream = (async function*(stream) {
72
72
  for await (const chunk of stream) {
73
73
  yield chunk.data
74
74
  }
@@ -165,7 +165,7 @@ export class ReaderInstance implements Reader {
165
165
 
166
166
  close() {
167
167
  for (const iter of this.consumers) {
168
- iter.close(() => {})
168
+ iter.close(() => { })
169
169
  }
170
170
  }
171
171
 
package/src/runner.ts CHANGED
@@ -47,8 +47,7 @@ type ProcessorConfig = {
47
47
  clazz?: string
48
48
  }
49
49
 
50
- export type FullProc<C extends Proc<unknown>> =
51
- C extends Proc<infer T> ? T & C : unknown
50
+ export type FullProc<C> = C extends Proc<infer T> ? T & C : never
52
51
  export class Runner {
53
52
  private readonly readers: { [uri: string]: ReaderInstance } = {}
54
53
  private readonly writers: { [uri: string]: WriterInstance } = {}
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- </component>
9
- </module>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" languageLevel="JDK_23" project-jdk-name="24" project-jdk-type="JavaSDK">
4
- <output url="file://$PROJECT_DIR$/out" />
5
- </component>
6
- </project>
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
5
- <mapping directory="$PROJECT_DIR$/node_modules/@rdfc/js-runner" vcs="Git" />
6
- </component>
7
- </project>
@@ -1 +0,0 @@
1
- { "disabled": ["shapes"] }
@@ -1,3 +0,0 @@
1
- @prefix foaf: <http://xmlns.com/foaf/0.1/>.
2
- <#me> a foaf:Person;
3
- foaf:name "".
@@ -1,90 +0,0 @@
1
- @prefix rdfc: <https://w3id.org/rdf-connect#>.
2
- @prefix prov: <http://www.w3.org/ns/prov#>.
3
- @prefix sds: <https://w3id.org/sds#>.
4
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
5
- @prefix owl: <http://www.w3.org/2002/07/owl#>.
6
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
7
- @prefix sh: <http://www.w3.org/ns/shacl#>.
8
-
9
- ############################################################
10
- # General statements #
11
- ############################################################
12
- # sds:Activity is a prov:Activity
13
- sds:Activity rdfs:subClassOf prov:Activity.
14
-
15
- # rdfc:Processor too
16
- rdfc:Processor rdfs:subClassOf sds:Activity.
17
-
18
- # sds:implementationOf is subClassOf
19
- sds:implementationOf rdfs:subPropertyOf rdfs:subClassOf.
20
-
21
- ############################################################
22
- # Javascript statements #
23
- ############################################################
24
- # specialized for js too
25
- rdfc:jsImplementationOf rdfs:subPropertyOf sds:implementationOf.
26
-
27
- # A node runner, runs things that are rdfc:jsImplementationOf rdfc:Processor (aka, rdfs:subClassOf prov:Activity)
28
- rdfc:NodeRunner a rdfc:Runner;
29
- rdfc:handlesSubjectsOf rdfc:jsImplementationOf;
30
- rdfc:command "npx js-runner".
31
-
32
- # Shape that a Js Processor should fulfil;
33
- [ ] a sh:NodeShape;
34
- # We target it with jsImplementationOf
35
- sh:targetSubjectsOf rdfc:jsImplementationOf;
36
- sh:property [
37
- sh:path rdfc:entrypoint;
38
- sh:name "location";
39
- sh:minCount 1;
40
- sh:maxCount 1;
41
- sh:datatype xsd:string;
42
- ], [
43
- sh:path rdfc:file;
44
- sh:name "file";
45
- sh:minCount 1;
46
- sh:maxCount 1;
47
- sh:datatype xsd:string;
48
- ], [
49
- sh:path rdfc:class;
50
- sh:name "clazz";
51
- sh:maxCount 1;
52
- sh:datatype xsd:string;
53
- ].
54
-
55
- ############################################################
56
- # Processor statements #
57
- ############################################################
58
- rdfc:FooBarProcessor a owl:Class, rdfs:Class;
59
- rdfc:jsImplementationOf rdfc:Processor;
60
- rdfs:label "My Epic FooBar Processor";
61
- rdfs:description "FooBars everything!";
62
- rdfc:entrypoint <./>;
63
- rdfc:file <./lib/processors.js>;
64
- rdfc:class "FooBarProcessor".
65
-
66
- [ ] a sh:NodeShape;
67
- sh:targetClass rdfc:FooBarProcessor;
68
- sh:property [
69
- sh:path rdfc:reader;
70
- sh:name "reader";
71
- sh:minCount 1;
72
- sh:maxCount 1;
73
- sh:class rdfc:Reader;
74
- ].
75
-
76
- ############################################################
77
- # Pipeline statements #
78
- ############################################################
79
- <> a rdfc:Pipeline;
80
- rdfc:consistsOf [
81
- rdfc:instantiates rdfc:NodeRunner;
82
- rdfc:processor <foobar>;
83
- ].
84
-
85
- # <incomingMessages> a rdfc:Reader.
86
- <incomingMessages> a rdfc:Reader.
87
-
88
- <fooBar> a rdfc:FooBarProcessor;
89
- rdfc:reader <incomingMessages>.
90
-
@@ -1,9 +0,0 @@
1
-
2
- @prefix foaf: <http://xmlns.com/foaf/0.1/>.
3
- @prefix sh: <http://www.w3.org/ns/shacl#>.
4
- [] a sh:NodeShape;
5
- sh:targetClass foaf:Person;
6
- sh:property [
7
- sh:path foaf:name;
8
- sh:minCount 1;
9
- ].