@itentialopensource/adapter-kafkav2 0.8.1 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
1
 
2
+ ## 0.8.2 [07-18-2023]
3
+
4
+ * Update dependencies and add fromBeginnimg config
5
+
6
+ See merge request itentialopensource/adapters/notification-messaging/adapter-kafkav2!9
7
+
8
+ ---
9
+
2
10
  ## 0.8.1 [07-10-2023]
3
11
 
4
12
  * Revert "Merge branch 'patch/ADAPT-2647' into 'master'"
package/adapter.js CHANGED
@@ -11,6 +11,7 @@
11
11
  /* eslint import/no-dynamic-require: warn */
12
12
  /* eslint global-require: warn */
13
13
  /* eslint no-await-in-loop: warn */
14
+ /* eslint no-promise-executor-return: warn */
14
15
 
15
16
  /* Required libraries. */
16
17
  const fs = require('fs-extra');
@@ -480,7 +481,7 @@ class Kafkav2 extends AdapterBaseCl {
480
481
  topics.push(this.topicsEvents[t].topic);
481
482
  }
482
483
  await this.consumer.connect();
483
- await this.consumer.subscribe({ topics, fromBeginning: true });
484
+ await this.consumer.subscribe({ topics, fromBeginning: this.props.fromBeginning || false });
484
485
 
485
486
  let isAppActive = null;
486
487
  const topicPartitions = topics.map((topic) => ({ topic }));
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-kafkav2",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Itential adapter to connect to kafka",
5
5
  "main": "adapter.js",
6
6
  "wizardVersion": "2.35.0",
7
7
  "engineVersion": "1.40.2",
8
8
  "scripts": {
9
9
  "artifactize": "npm i && node utils/packModificationScript.js",
10
- "preinstall": "node utils/setup.js && npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions",
10
+ "preinstall": "node utils/setup.js && npm install --package-lock-only --ignore-scripts",
11
11
  "lint": "eslint . --ext .json --ext .js",
12
12
  "lint:errors": "node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet",
13
13
  "test:baseunit": "mocha test/unit/adapterBaseTestUnit.js --LOG=error",
@@ -16,8 +16,7 @@
16
16
  "test:cover": "nyc --reporter html --reporter text mocha --reporter dot test/*",
17
17
  "test": "npm run test:unit && npm run test:integration",
18
18
  "deploy": "npm publish --registry=https://registry.npmjs.org --access=public",
19
- "build": "npm run deploy",
20
- "postinstall": "patch-package"
19
+ "build": "npm run deploy"
21
20
  },
22
21
  "keywords": [
23
22
  "Itential",
@@ -43,31 +42,27 @@
43
42
  "author": "Itential",
44
43
  "homepage": "https://gitlab.com/itentialopensource/adapters/notification-messaging/adapter-kafkav2",
45
44
  "dependencies": {
46
- "ajv": "^6.12.0",
45
+ "ajv": "^8.12.0",
47
46
  "avro-schema-registry": "^2.1.0",
48
47
  "avsc": "^5.4.21",
49
- "fs-extra": "^8.1.0",
48
+ "fs-extra": "^11.1.1",
50
49
  "json-query": "^2.2.2",
51
50
  "kafkajs": "2.2.3",
52
- "package-json-validator": "^0.6.3",
53
51
  "patch-package": "^6.4.7",
54
52
  "readline-sync": "^1.4.10",
55
53
  "request": "^2.88.2",
56
54
  "uuid": "^3.0.1"
57
55
  },
58
56
  "devDependencies": {
59
- "chai": "^4.2.0",
60
- "eslint": "^7.2.0",
61
- "eslint-config-airbnb-base": "^14.2.0",
62
- "eslint-plugin-import": "^2.21.2",
63
- "eslint-plugin-json": "^2.1.1",
57
+ "chai": "^4.3.7",
58
+ "eslint": "^8.44.0",
59
+ "eslint-config-airbnb-base": "^15.0.0",
60
+ "eslint-plugin-import": "^2.27.5",
61
+ "eslint-plugin-json": "^3.1.0",
64
62
  "mocha": "^9.0.1",
65
63
  "nyc": "^15.1.0",
66
- "testdouble": "^3.16.1",
64
+ "testdouble": "^3.18.0",
67
65
  "winston": "^3.3.3"
68
66
  },
69
- "resolutions": {
70
- "minimist": "^1.2.5"
71
- },
72
67
  "private": false
73
68
  }
Binary file
@@ -16,6 +16,9 @@ const execute = require('child_process').execSync;
16
16
  const { expect } = require('chai');
17
17
  const { use } = require('chai');
18
18
  const td = require('testdouble');
19
+ const Ajv = require('ajv');
20
+
21
+ const ajv = new Ajv({ allErrors: true, unknownFormats: 'ignore' });
19
22
 
20
23
  const anything = td.matchers.anything();
21
24
 
@@ -188,19 +191,24 @@ describe('[unit] Kafka Adapter Test', () => {
188
191
  });
189
192
  it('package.json should be validated', (done) => {
190
193
  const packageDotJson = require('../../package.json');
191
- const { PJV } = require('package-json-validator');
192
- const options = {
193
- warnings: true, // show warnings
194
- recommendations: true // show recommendations
194
+ // Define the JSON schema for package.json
195
+ const packageJsonSchema = {
196
+ type: 'object',
197
+ properties: {
198
+ name: { type: 'string' },
199
+ version: { type: 'string' }
200
+ // May need to add more properties as needed
201
+ },
202
+ required: ['name', 'version']
195
203
  };
196
- const results = PJV.validate(JSON.stringify(packageDotJson), 'npm', options);
204
+ const validate = ajv.compile(packageJsonSchema);
205
+ const isValid = validate(packageDotJson);
197
206
 
198
- if (results.valid === false) {
199
- log.error('The package.json contains the following errors: ');
200
- log.error(util.inspect(results));
201
- assert.equal(true, results.valid);
207
+ if (isValid === false) {
208
+ log.error('The package.json contains errors');
209
+ assert.equal(true, isValid);
202
210
  } else {
203
- assert.equal(true, results.valid);
211
+ assert.equal(true, isValid);
204
212
  }
205
213
 
206
214
  done();