Skip to content

Commit f38dd74

Browse files
authored
feat: update dependencies and refactor to remove elasticio-node (#61)
1 parent 5515359 commit f38dd74

File tree

11 files changed

+2391
-4913
lines changed

11 files changed

+2391
-4913
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
- node/install:
9696
node-version: << pipeline.parameters.node-version >>
9797
- setup_remote_docker:
98-
version: 19.03.13
98+
version: default
9999
docker_layer_caching: true
100100
# build and push Docker image
101101
- run:

.grype-ignore.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ignore:
2+
- vulnerability: CVE-2023-2650
3+
package:
4+
name: libssl3
5+
version: 3.1.0-r4
6+
7+
- vulnerability: CVE-2023-2650
8+
package:
9+
name: libcrypto3
10+
version: 3.1.0-r4
11+
12+
- vulnerability: CVE-2023-45853
13+
package:
14+
name: zlib
15+
version: 1.3.1-r2

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.1.0 (November 19, 2025)
2+
3+
* Updated dependencies to the latest versions
4+
* Removed unused `request` and `bunyan` dependencies
5+
* Refactored the code to remove `elasticio-node` dependency to fix security vulnerabilities
6+
* Improved `README.md`
7+
18
## 1.0.13 (March 22, 2024)
29

310
* Updated Sailor version to 2.7.2

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM node:18-alpine AS base
2+
RUN apk add --update git tini python3 make g++ && rm -rf /var/cache/apk/*
3+
WORKDIR /home/node
4+
COPY --chown=node:node . ./
5+
FROM base AS dependencies
6+
ENV LOG_OUTPUT_MODE=short
7+
USER node
8+
RUN npm config set update-notifier false
9+
RUN npm install --no-audit
10+
RUN npm test
11+
RUN npm prune --production
12+
RUN rm -rf spec* .circleci README.md LICENSE .idea
13+
FROM node:18-alpine AS release
14+
LABEL elastic.io.component="{\"title\":\"Transformation\",\"version\":\"1.0.13\",\"description\":\"Generic Data Transformation Component\",\"docsUrl\":\"https://docs.elastic.io/components/jsonata/index.html\",\"actions\":{\"transform\":{\"title\":\"Transform\",\"main\":\"./lib/actions/transform.js\",\"fields\":{\"expression\":{\"label\":\"JSONata Expression\",\"required\":true,\"viewClass\":\"JSONataView\"}},\"metadata\":{\"out\":{}}}},\"sailor_version\":\"2.7.7\",\"language\":\"nodejs\"}"
15+
LABEL elastic.io.logo="iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAAXNSR0IArs4c6QAAAvdQTFRFAAAAAAAAAICAVVVVAFVVQEBAMzMzJ01VK05VKFFXJ05VJVFXJlFRKlNTKFBVKFBUKlBUKVJVKE9TKVFUKFFTKVFUKFBUJ1BUKFFUKFFVKFFTJ1FUKFFUKFJVKFBVKFFUKFJUKFBUKFFVKFBUKFFUKFFTKFFUKFJUKFJUKFFUKFFUKFFUKFJUKFFUKFFUJ1FUKFFUKFFU/////v////7+/v7//f7+/v3+/f3+/f39/P39/Pz8+vv7+fr6+Pn59vj49vf49fb39Pb29PX29PX18vX18vT08fT08fPz8PLy7fDw6+7u6u3t6ezs5+vr5urq5Onp4+fn4ubn4OTl3uPj3OHh2t7f2d7e2N7e1tzc0tfY0NbWztTVzNPTy9LSytHRyM/Qxs3OxcvLwcjJv8fHvsbGvsXGvMTFu8LCucHBs7u8sLq7rbi5q7a3p7GypK+woq2voaytoKusnamqmqaomKWmlaOjlKKjkqChkZ+gjpydipmaiZiahJaXgpKUf5CSfI+ReoyOeIuMeIqLdomKdIeIcISGboKEbIGCaX+BZ36AYXl6X3d5XHR2WXN0VXByUm5wUGxuT2tuTmttUGhrSWhrSmRnQ2RmR2JlQ2BjQmBiQF5hO2BjOV5gOVlbNFtdM1pcNlhaNldaNVdaNFdaNFdZM1daNFZZM1ZZLlhbMlZZMFZZMlVYLVdaMVVYLlZZMFVYK1daLVZZK1ZaK1ZZL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to6sPMwwUyzv1HQo0LcGYz0GhQRzwKgcyPDzDo9hU5Jz4z0Ngvnmg9P0ZfE2zhSyTQZ2VNOsmJz4x0shlqVYUX3lhEky3L999ZIcvgtv/MUCsz1msbn1u72a8+TyB5PBpwS8aVzIz1tnawWSW7Xrdzoad5+SaJuWHVJMl9+cxgM+idSLQCf7N2R5APja7H+66uypXpURuLSOwDzMPtNld/f/tibwil9fiJn10ri07mvnzr4XbzeL8t/I5FJrykHr/saE16TNvYzHi/rYBDcsTN+zsWW+GnBMfXnLXxnxg2AYcWIx4GlexWrRkvpvEeEE4N+bP6rEzbVjQT8Wg55KK9W7N9kQUPIZy28kalPtIGnl3IpcWYjzZr60Ir/IxVd4zpUTbwLGM+LQad9IqiD814KY33X1tQniq3tfdsg04tR70UpWvFksd4yaz1xSVkjJ4dw3bUy0bYTR9b6g+9IPQKCC0rjlW0Ix4JT1vCbkzcTydo2oKSbyEcFbilslCuQO1ZAh0T97PsgqNOQzRz/g2Yu606PzoOtWsRFBN4ZAxeaCbySWWdKc2PItkCbEc+e5j5tkOvWhTLBs8p9MoY2DUT+9Xq2QI4xn65B5+ZYhF8/m9Gv/GE37HH//8F6XCXjUwsUQEAAAAASUVORK5CYII="
16+
WORKDIR /home/node
17+
COPY --from=base --chown=node:node /sbin/tini /sbin/tini
18+
COPY --from=dependencies --chown=node:node /home/node /home/node
19+
USER node
20+
ENTRYPOINT ["/sbin/tini", "-v", "-e", "143", "--"]

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
# jsonata-transform-component [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]
2-
> Dedicated data transformation component for elastic.io platform based on JSONata
1+
# JSONata Transform Component [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]
2+
3+
> A dedicated data transformation component for the elastic.io platform that is based on JSONata.
34
45
## Authentication
56

67
This component requires no authentication.
78

89
## How it works
910

10-
This component takes the incoming message body and applies the configured JSONata tranformation on it. It uses
11-
a fact that JSONata expression is a superset of JSON document so that by default any valid JSON document is
12-
a valid JSONata expression.
11+
This component takes the incoming message body and applies the configured JSONata transformation to it. It uses the fact that a JSONata expression is a superset of a JSON document, so by default, any valid JSON document is a valid JSONata expression.
1312

14-
For example let's take this sample incoming message body:
13+
For example, let's take this sample incoming message body:
1514

1615
```json
1716
{
@@ -56,7 +55,7 @@ For example let's take this sample incoming message body:
5655
}
5756
```
5857

59-
You can use following JSONata expressions to transform it:
58+
You can use the following JSONata expression to transform it:
6059

6160
```jsonata
6261
{
@@ -65,7 +64,7 @@ You can use following JSONata expressions to transform it:
6564
}
6665
```
6766

68-
result of that transofrmation will be the following JSON document ([jsonata link](http://try.jsonata.org/B1ctn36ub)):
67+
The result of that transformation will be the following JSON document ([JSONata link](http://try.jsonata.org/B1ctn36ub)):
6968

7069
```json
7170
{
@@ -87,7 +86,7 @@ I hope you've got the idea. Now you can also do something more complicated, like
8786
}
8887
```
8988

90-
resulting in ([jsonata link](http://try.jsonata.org/B1ctn36ub)):
89+
Resulting in ([JSONata link](http://try.jsonata.org/B1ctn36ub)):
9190

9291
```json
9392
{

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"title": "Transformation",
3-
"version": "1.0.13",
3+
"version": "1.1.0",
44
"description": "Generic Data Transformation Component",
55
"docsUrl": "https://docs.elastic.io/components/jsonata/index.html",
66
"actions": {

lib/actions/transform.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const eioUtils = require('elasticio-node').messages;
21
const { JsonataTransform } = require('@elastic.io/component-commons-library');
2+
const { messages } = require('../utils');
33

44
/**
55
* This method will be called from elastic.io platform providing following data
@@ -27,13 +27,13 @@ async function processAction(msg, cfg) {
2727
// eslint-disable-next-line no-restricted-syntax
2828
for (const item of result) {
2929
// eslint-disable-next-line no-await-in-loop
30-
await this.emit('data', eioUtils.newMessageWithBody(item));
30+
await this.emit('data', messages.newMessageWithBody(item));
3131
}
3232

3333
return Promise.resolve();
3434
}
3535
this.logger.info('1 message will be send to the next step');
36-
return Promise.resolve(eioUtils.newMessageWithBody(result));
36+
return Promise.resolve(messages.newMessageWithBody(result));
3737
}
3838

3939
module.exports.process = processAction;

lib/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
exports.messages = {
2+
newMessageWithBody: (body) => ({ body, headers: {} }),
3+
newEmptyMessage: () => ({ body: {}, headers: {} }),
4+
};

0 commit comments

Comments
 (0)