@rdfc/js-runner 3.0.1 → 3.0.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdfc/js-runner",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
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.38.0",
32
+ "@eslint/js": "^9.39.2",
33
33
  "@rdfjs/types": "^2.0.1",
34
34
  "@types/jest": "^30.0.0",
35
35
  "@types/jsonld": "^1.5.15",
36
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",
40
- "@vitest/coverage-v8": "^3.2.4",
37
+ "@types/node": "^24.10.9",
38
+ "@typescript-eslint/eslint-plugin": "^8.54.0",
39
+ "@typescript-eslint/parser": "^8.54.0",
40
+ "@vitest/coverage-v8": "^4.0.18",
41
41
  "eslint": "^9.21.0",
42
42
  "eslint-config-prettier": "^10.1.8",
43
- "eslint-plugin-prettier": "^5.5.4",
44
- "globals": "^16.4.0",
43
+ "eslint-plugin-prettier": "^5.5.5",
44
+ "globals": "^17.3.0",
45
45
  "husky": "^9.1.7",
46
46
  "jest": "^30.2.0",
47
- "lint-staged": "^15.5.2",
48
- "prettier": "^3.6.2",
49
- "ts-jest": "^29.4.5",
47
+ "lint-staged": "^16.2.7",
48
+ "prettier": "^3.8.1",
49
+ "ts-jest": "^29.4.6",
50
50
  "tsc-alias": "^1.8.16",
51
51
  "typescript": "^5.9.3",
52
- "typescript-eslint": "^8.46.2",
53
- "vitest": "^3.2.4"
52
+ "typescript-eslint": "^8.54.0",
53
+ "vitest": "^4.0.18"
54
54
  },
55
55
  "dependencies": {
56
- "@grpc/grpc-js": "^1.14.0",
56
+ "@grpc/grpc-js": "^1.14.3",
57
57
  "@rdfc/proto": "^0.1.2",
58
58
  "@treecg/types": "^0.4.6",
59
- "jsonld": "^8.3.3",
60
- "jsonld-streaming-parser": "^5.0.0",
61
- "n3": "^1.26.0",
59
+ "jsonld": "^9.0.0",
60
+ "jsonld-streaming-parser": "^5.0.1",
61
+ "n3": "^2.0.1",
62
62
  "rdf-lens": "^1.3.6",
63
- "winston": "^3.18.3",
63
+ "winston": "^3.19.0",
64
64
  "winston-transport": "^4.9.0"
65
65
  }
66
66
  }
package/src/runner.ts CHANGED
@@ -74,7 +74,7 @@ export class Runner {
74
74
  this.logger = logger
75
75
  }
76
76
 
77
- async addProcessor<P extends Proc<unknown>>(
77
+ async createProcessor<P extends Proc<unknown>>(
78
78
  proc: Processor,
79
79
  ): Promise<FullProc<P>> {
80
80
  const procLogger = createLogger({
@@ -93,7 +93,7 @@ export class Runner {
93
93
  )
94
94
  .map((x) => x.object.value)
95
95
 
96
- this.logger.info('parsing ' + proc.uri + ' type ' + ty)
96
+ this.logger.info(`Parsing processor '${proc.uri}' of type(s) [${ty.join(', ')}]`)
97
97
  const args = this.shapes.lenses[RDFL.TypedExtract].execute({
98
98
  id: new NamedNode(proc.uri),
99
99
  quads: this.quads,
@@ -103,9 +103,18 @@ export class Runner {
103
103
  const jsProgram = await import(config.file)
104
104
  const clazz = jsProgram[config.clazz || 'default']
105
105
  const instance: Proc<unknown> = new clazz(args, procLogger)
106
+
107
+ return <FullProc<P>>instance
108
+ }
109
+
110
+ async addProcessor<P extends Proc<unknown>>(
111
+ proc: Processor,
112
+ ): Promise<FullProc<P>> {
113
+ const instance = await this.createProcessor<P>(proc)
114
+
106
115
  await instance.init()
107
116
 
108
- this.logger.info('inited ' + proc.uri + ' type ' + ty)
117
+ this.logger.info(`Initiated processor '${proc.uri}'`)
109
118
 
110
119
  this.processors.push(instance)
111
120
  this.processorTransforms.push(instance.transform())
@@ -1,7 +1,7 @@
1
1
  import { Duplex } from 'stream'
2
2
  import type {
3
3
  ClientDuplexStream,
4
- InterceptingCallInterface,
4
+ InterceptingCall,
5
5
  } from '@grpc/grpc-js'
6
6
  import { AuthContext } from '@grpc/grpc-js/build/src/auth-context'
7
7
 
@@ -23,7 +23,7 @@ export class MockClientDuplexStream<Req, Res>
23
23
 
24
24
  public readonly id: number
25
25
 
26
- call?: InterceptingCallInterface | undefined
26
+ call?: InterceptingCall | undefined
27
27
  constructor() {
28
28
  super({ objectMode: true })
29
29
  this.id = count++
@@ -1,29 +1,22 @@
1
- import {
2
- DataChunk,
3
- FromRunner,
4
- LogMessage,
5
- Processor as ProcConfig,
6
- ToRunner,
7
- } from '@rdfc/proto'
8
- import {} from '../reexports'
9
- import { extractShapes } from 'rdf-lens'
10
- import { NamedNode, Parser, Writer as N3Writer } from 'n3'
11
- import { readFile } from 'fs/promises'
12
- import winston, { createLogger } from 'winston'
13
- import { Processor } from '../processor'
14
- import { FullProc, Runner, Writable } from '../runner'
15
- import { Quad } from '@rdfjs/types'
16
- import { createTermNamespace } from '@treecg/types'
1
+ import { DataChunk, FromRunner, LogMessage, Processor as ProcConfig, ToRunner } from "@rdfc/proto";
2
+ import { extractShapes } from "rdf-lens";
3
+ import { NamedNode, Parser, Writer as N3Writer } from "n3";
4
+ import { readFile } from "fs/promises";
5
+ import winston, { createLogger } from "winston";
6
+ import { Processor } from "../processor";
7
+ import { FullProc, Runner, Writable } from "../runner";
8
+ import { Quad } from "@rdfjs/types";
9
+ import { createTermNamespace } from "@treecg/types";
17
10
  import {
18
11
  ReceivingStreamControl,
19
12
  SendingStreamControl,
20
13
  StreamChunk,
21
14
  StreamIdentify,
22
- } from '@rdfc/proto/lib/generated/common'
23
- import { MockClientDuplexStream } from './duplex'
24
- import { promisify } from 'util'
25
- import { Reader } from '../reader'
26
- import { Writer } from '../writer'
15
+ } from "@rdfc/proto/lib/generated/common";
16
+ import { MockClientDuplexStream } from "./duplex";
17
+ import { promisify } from "util";
18
+ import { Reader } from "../reader";
19
+ import { Writer } from "../writer";
27
20
 
28
21
  export function channel(runner: Runner, name: string): [Writer, Reader] {
29
22
  const n = new NamedNode(name)
@@ -359,12 +352,13 @@ export class ProcHelper<T extends Processor<unknown>> {
359
352
  pipeline: new N3Writer().quadsToString(this.quads),
360
353
  })
361
354
 
362
- const proc = await this.runner.addProcessor<T>({
363
- config: JSON.stringify(this.config),
364
- arguments: '',
365
- uri,
366
- })
367
- return proc
355
+ return await this.runner.createProcessor<T>(
356
+ {
357
+ config: JSON.stringify(this.config),
358
+ arguments: '',
359
+ uri,
360
+ },
361
+ )
368
362
  }
369
363
  }
370
364