Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Commit ac4d8a2

Browse files
committed
feat: provide es6 module
1 parent c61886e commit ac4d8a2

13 files changed

Lines changed: 307 additions & 163 deletions

README.adoc

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

README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
[![npm](https://img.shields.io/npm/v/kronos-interceptor-object-data-processor-chunk.svg)](https://www.npmjs.com/package/kronos-interceptor-object-data-processor-chunk)
2+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/Kronos-integration/kronos-interceptor-object-data-processor-chunk)
3+
[![Build Status](https://secure.travis-ci.org/Kronos-integration/kronos-interceptor-object-data-processor-chunk.png)](http://travis-ci.org/Kronos-integration/kronos-interceptor-object-data-processor-chunk)
4+
[![bithound](https://www.bithound.io/github/Kronos-integration/kronos-interceptor-object-data-processor-chunk/badges/score.svg)](https://www.bithound.io/github/Kronos-integration/kronos-interceptor-object-data-processor-chunk)
5+
[![codecov.io](http://codecov.io/github/Kronos-integration/kronos-interceptor-object-data-processor-chunk/coverage.svg?branch=master)](http://codecov.io/github/Kronos-integration/kronos-interceptor-object-data-processor-chunk?branch=master)
6+
[![Coverage Status](https://coveralls.io/repos/Kronos-integration/kronos-interceptor-object-data-processor-chunk/badge.svg)](https://coveralls.io/r/Kronos-integration/kronos-interceptor-object-data-processor-chunk)
7+
[![Code Climate](https://codeclimate.com/github/Kronos-integration/kronos-interceptor-object-data-processor-chunk/badges/gpa.svg)](https://codeclimate.com/github/Kronos-integration/kronos-interceptor-object-data-processor-chunk)
8+
[![Known Vulnerabilities](https://snyk.io/test/github/Kronos-integration/kronos-interceptor-object-data-processor-chunk/badge.svg)](https://snyk.io/test/github/Kronos-integration/kronos-interceptor-object-data-processor-chunk)
9+
[![GitHub Issues](https://img.shields.io/github/issues/Kronos-integration/kronos-interceptor-object-data-processor-chunk.svg?style=flat-square)](https://github.com/Kronos-integration/kronos-interceptor-object-data-processor-chunk/issues)
10+
[![Stories in Ready](https://badge.waffle.io/Kronos-integration/kronos-interceptor-object-data-processor-chunk.svg?label=ready&title=Ready)](http://waffle.io/Kronos-integration/kronos-interceptor-object-data-processor-chunk)
11+
[![Dependency Status](https://david-dm.org/Kronos-integration/kronos-interceptor-object-data-processor-chunk.svg)](https://david-dm.org/Kronos-integration/kronos-interceptor-object-data-processor-chunk)
12+
[![devDependency Status](https://david-dm.org/Kronos-integration/kronos-interceptor-object-data-processor-chunk/dev-status.svg)](https://david-dm.org/Kronos-integration/kronos-interceptor-object-data-processor-chunk#info=devDependencies)
13+
[![docs](http://inch-ci.org/github/Kronos-integration/kronos-interceptor-object-data-processor-chunk.svg?branch=master)](http://inch-ci.org/github/Kronos-integration/kronos-interceptor-object-data-processor-chunk)
14+
[![downloads](http://img.shields.io/npm/dm/kronos-interceptor-object-data-processor-chunk.svg?style=flat-square)](https://npmjs.org/package/kronos-interceptor-object-data-processor-chunk)
15+
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
16+
17+
18+
kronos-interceptor-object-data-processor-chunk
19+
=====
20+
Splits a line by a sparator into tokens
21+
22+
# API Reference
23+
24+
* <a name="createFunctions"></a>
25+
26+
## createFunctions(chunkDefinition)
27+
Creates the checks for checking boolean values
28+
29+
**Kind**: global function
30+
31+
| Param | Description |
32+
| --- | --- |
33+
| chunkDefinition | The chunk definition for these records. |
34+
35+
36+
* <a name="createHashFunction"></a>
37+
38+
## createHashFunction(hashFields, hashName)
39+
Creates a function which generates a hash from the given content and stores the generated Hash under the given name in the record
40+
41+
**Kind**: global function
42+
43+
| Param | Description |
44+
| --- | --- |
45+
| hashFields | All the field names used to create the hash |
46+
| hashName | The name to be used to store the hash value back in the record |
47+
48+
49+
* <a name="addError"></a>
50+
51+
## addError(data, error)
52+
Adds an error to the stream data
53+
54+
**Kind**: global function
55+
56+
| Param | Description |
57+
| --- | --- |
58+
| data | The current stream data |
59+
| error | The error to be added. |
60+
61+
62+
* <a name="createTmpHashAction"></a>
63+
64+
## createTmpHashAction()
65+
Creates a hash function to compute a content hash without the multirow fields
66+
67+
**Kind**: global function
68+
69+
* <a name="DataProcessorChunk+addRowActions"></a>
70+
71+
## dataProcessorChunk.addRowActions()
72+
Add custom actions to the rowActions.
73+
These actions will be executed per row
74+
75+
**Kind**: instance method of <code>[DataProcessorChunk](#DataProcessorChunk)</code>
76+
77+
* <a name="DataProcessorChunk+_transform"></a>
78+
79+
## dataProcessorChunk._transform()
80+
Reads the stream data and split it into lines.
81+
82+
**Kind**: instance method of <code>[DataProcessorChunk](#DataProcessorChunk)</code>
83+
84+
* <a name="DataProcessorChunk+_flush"></a>
85+
86+
## dataProcessorChunk._flush()
87+
Flushes the data.
88+
Only needed if there are multi row fields used
89+
90+
**Kind**: instance method of <code>[DataProcessorChunk](#DataProcessorChunk)</code>
91+
92+
* * *
93+
94+
install
95+
=======
96+
97+
With [npm](http://npmjs.org) do:
98+
99+
```shell
100+
npm install kronos-interceptor-object-data-processor-chunk
101+
```
102+
103+
license
104+
=======
105+
106+
BSD-2-Clause

doc/README.hbs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,30 @@
1414
[![downloads](http://img.shields.io/npm/dm/kronos-interceptor-object-data-processor-chunk.svg?style=flat-square)](https://npmjs.org/package/kronos-interceptor-object-data-processor-chunk)
1515
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
1616

17+
18+
kronos-interceptor-object-data-processor-chunk
19+
=====
20+
Splits a line by a sparator into tokens
21+
22+
# API Reference
23+
{{#modules~}}
24+
- {{name}}
25+
{{/modules}}
26+
27+
{{#functions}}* {{>docs}}
28+
{{/functions}}
29+
* * *
30+
31+
install
32+
=======
33+
34+
With [npm](http://npmjs.org) do:
35+
36+
```shell
37+
npm install kronos-interceptor-object-data-processor-chunk
38+
```
39+
40+
license
41+
=======
42+
43+
BSD-2-Clause

index.js

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

lib/data-hash.js

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

package.json

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"name": "kronos-interceptor-object-data-processor-chunk",
33
"version": "0.0.0-semantic-release",
44
"description": "Splits a line by a sparator into tokens.",
5-
"main": "index.js",
5+
"module": "src/module.js",
6+
"main": "dist/module.js",
67
"scripts": {
78
"cover": "npm run build && node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -u exports tests/*_test.js",
8-
"doc": "./node_modules/.bin/jsdoc lib/*.js",
99
"test": "npm run build && node_modules/.bin/mocha tests/*_test.js && markdown-doctest",
1010
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
11-
"build": "node_modules/rollup/bin/rollup --output=index.js -c -- {{module}}",
11+
"build": "node_modules/rollup/bin/rollup --output=dist/module.js -c -- src/module.js",
1212
"docs": "jsdoc2md -l off -t doc/README.hbs -f src/*.js > README.md"
1313
},
1414
"repository": {
@@ -29,7 +29,6 @@
2929
"clone-deep": "0.2.4",
3030
"cz-conventional-changelog": "^1.2.0",
3131
"istanbul": "^0.4.5",
32-
"jsdoc": "3.4.2",
3332
"kronos-test-interceptor": "2.0.5",
3433
"mocha": "^3.2.0",
3534
"semantic-release": "^6.3.5",
@@ -38,16 +37,13 @@
3837
"markdown-doctest": "^0.9.1",
3938
"rollup": "^0.38.2"
4039
},
41-
"contributors": [
42-
{
43-
"name": "Torsten Link",
44-
"email": "torstenlink@gmx.de"
45-
},
46-
{
47-
"name": "Markus Felten",
48-
"email": "markus.felten@gmx.de"
49-
}
50-
],
40+
"contributors": [{
41+
"name": "Torsten Link",
42+
"email": "torstenlink@gmx.de"
43+
}, {
44+
"name": "Markus Felten",
45+
"email": "markus.felten@gmx.de"
46+
}],
5147
"license": "BSD-2-Clause",
5248
"engines": {
5349
"node": ">=6.9.2"
@@ -63,4 +59,4 @@
6359
"path": "./node_modules/cz-conventional-changelog"
6460
}
6561
}
66-
}
62+
}
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
/* jslint node: true, esnext: true */
22
'use strict';
33

4-
const Interceptor = require('kronos-interceptor').Interceptor;
5-
const parserFactory = require('./data-processor-chunk');
4+
import {
5+
Interceptor
6+
} 
7+
from 'kronos-interceptor';
8+
9+
import {
10+
DataProcessorChunkFactory
11+
}
12+
from './data-processor-chunk';
613

714
/**
815
* This interceptor cares about the handling of the messages.
916
* It will add the hops and copies the messages
1017
*/
11-
class ChunkProcessorInterceptor extends Interceptor {
18+
export default class ChunkProcessorInterceptor extends Interceptor {
1219

1320
constructor(config, endpoint) {
1421
super(config, endpoint);
1522

1623
// just validate the config once
17-
parserFactory(config.config, true);
24+
DataProcessorChunkFactory(config.config, true);
1825
}
1926

2027
static get name() {
@@ -23,11 +30,10 @@ class ChunkProcessorInterceptor extends Interceptor {
2330

2431
receive(request, oldRequest) {
2532
if (request.payload) {
26-
const streamFilter = parserFactory(this.config.config);
33+
const streamFilter = DataProcessorChunkFactory(this.config.config);
2734
const stream = request.payload;
2835
request.payload = stream.pipe(streamFilter);
2936
}
3037
return this.connected.receive(request, oldRequest);
3138
}
3239
}
33-
exports.Interceptor = ChunkProcessorInterceptor;

0 commit comments

Comments
 (0)