cdm-kafkaconnector 1.1.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/businessLogic/kafkaBl.ts +42 -0
- package/businessLogic/kafkaConsumer.ts +56 -0
- package/businessLogic/kafkaProducer.ts +35 -0
- package/dist/businessLogic/kafkaBl.js +50 -0
- package/dist/businessLogic/kafkaConsumer.js +48 -0
- package/dist/businessLogic/kafkaProducer.js +29 -0
- package/dist/index.js +5 -0
- package/index.ts +2 -0
- package/kafkaconnector-1.1.2.tgz +0 -0
- package/packAndSend.js +53 -0
- package/package.json +15 -0
- package/tsconfig.json +109 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {ConsumerGroupOptions, KafkaClient, KafkaClientOptions, ProducerOptions} from "kafka-node";
|
|
2
|
+
import {KafkaProducer} from "./kafkaProducer";
|
|
3
|
+
import {KafkaConsumer} from "./kafkaConsumer";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class KafkaBusinessLogic {
|
|
7
|
+
static kafkaOptions: KafkaClientOptions;
|
|
8
|
+
static producer: KafkaProducer;
|
|
9
|
+
static async init(kafkaOptions?: KafkaClientOptions): Promise<void> {
|
|
10
|
+
this.kafkaOptions = {
|
|
11
|
+
kafkaHost: kafkaOptions?.kafkaHost ?? 'localhost:9092',
|
|
12
|
+
...kafkaOptions
|
|
13
|
+
};
|
|
14
|
+
console.log(this.kafkaOptions, kafkaOptions)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static async setKafkaProducer(callback?: (error: any, data: any) => void, producerOption?: ProducerOptions): Promise<void> {
|
|
18
|
+
this.producer = new KafkaProducer(new KafkaClient(this.kafkaOptions), producerOption, callback);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static async produceMessage(payloads: any, topic: string): Promise<void> {
|
|
22
|
+
if (!this.producer) {
|
|
23
|
+
throw new Error('Kafka Producer not initialized');
|
|
24
|
+
}
|
|
25
|
+
this.producer.produceMessage(payloads, topic);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static async setKafkaConsumer(topic: string, callback: (message: any, done: Function) => void, consumerOption?: ConsumerGroupOptions): Promise<void> {
|
|
29
|
+
consumerOption = {
|
|
30
|
+
kafkaHost: this.kafkaOptions.kafkaHost,
|
|
31
|
+
autoCommit: consumerOption?.autoCommit ?? false,
|
|
32
|
+
groupId: consumerOption?.groupId ?? 'groupId1',
|
|
33
|
+
fromOffset: consumerOption?.fromOffset ?? 'latest',
|
|
34
|
+
...consumerOption,
|
|
35
|
+
};
|
|
36
|
+
new KafkaConsumer(topic, callback, consumerOption);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static async closeProducer(): Promise<void> {
|
|
40
|
+
this.producer.close();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {ConsumerGroup, ConsumerGroupOptions} from "kafka-node";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class KafkaConsumer {
|
|
5
|
+
consumer: ConsumerGroup;
|
|
6
|
+
topic: string | string[];
|
|
7
|
+
callback: Function;
|
|
8
|
+
|
|
9
|
+
constructor(topic: string | string[], callback: Function, consumerOptions: ConsumerGroupOptions) {
|
|
10
|
+
this.callback = callback ?? this.defaultCallBack;
|
|
11
|
+
this.consumer = new ConsumerGroup(consumerOptions, topic);
|
|
12
|
+
this.topic = topic;
|
|
13
|
+
this.initConsumerEvents();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
defaultCallBack(message: string, done: Function): void {
|
|
17
|
+
done();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private initConsumerEvents(): void {
|
|
21
|
+
this.consumer.on('message', (message: any): void => {
|
|
22
|
+
console.log(`Message arrived from topic [${this.topic}] with offset [${message.offset}]`);
|
|
23
|
+
this.callback(message, () => {
|
|
24
|
+
const offset = {
|
|
25
|
+
topic: message.topic,
|
|
26
|
+
partition: message.partition,
|
|
27
|
+
offset: message.offset + 1,
|
|
28
|
+
metadata: 'updated offset'
|
|
29
|
+
};
|
|
30
|
+
this.consumer.sendOffsetCommitRequest([offset], (err: any, data: any) => {
|
|
31
|
+
if (err) {
|
|
32
|
+
this.logError(err);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
this.consumer.on('connect', ()=>{
|
|
39
|
+
console.log('Consumer connected');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
this.consumer.on('error', (error: any): void => {
|
|
43
|
+
this.logError(JSON.stringify(error));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private logError(error: any): void {
|
|
48
|
+
console.error(`ERROR: kafka consumer failed to consume message from topic [${this.topic}]. ${error}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
close(): void {
|
|
52
|
+
this.consumer.close(true, () => {
|
|
53
|
+
console.log(`Consumer for topic [${this.topic}] closed`);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {KafkaClient, Producer, ProducerOptions} from "kafka-node";
|
|
2
|
+
|
|
3
|
+
export class KafkaProducer {
|
|
4
|
+
client: KafkaClient;
|
|
5
|
+
producer: Producer;
|
|
6
|
+
callback: (error: any, data: any) => void;
|
|
7
|
+
|
|
8
|
+
constructor(client: KafkaClient, producerOptions?: ProducerOptions, callback?: (error?: any, data?: any) => void) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
this.producer = new Producer(client, producerOptions);
|
|
11
|
+
this.callback = callback ?? this.defaultCallback;
|
|
12
|
+
this.initProducerEvents();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
private defaultCallback(error: any, data: any): void {
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private initProducerEvents(): void {
|
|
20
|
+
this.producer.on('ready', () => {
|
|
21
|
+
console.log(`Kafka producer is ready`);
|
|
22
|
+
});
|
|
23
|
+
this.producer.on('error', (error: any): void => {
|
|
24
|
+
console.error(`ERROR: kafka producer failed to send message. ${JSON.stringify(error)}`);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public produceMessage(payloads: any, topic: string): void {
|
|
29
|
+
this.producer.send([{topic: topic , messages: JSON.stringify(payloads)}], this.callback);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public close(): void {
|
|
33
|
+
this.producer.close();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.KafkaBusinessLogic = void 0;
|
|
13
|
+
const kafka_node_1 = require("kafka-node");
|
|
14
|
+
const kafkaProducer_1 = require("./kafkaProducer");
|
|
15
|
+
const kafkaConsumer_1 = require("./kafkaConsumer");
|
|
16
|
+
class KafkaBusinessLogic {
|
|
17
|
+
static init(kafkaOptions) {
|
|
18
|
+
var _a;
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
this.kafkaOptions = Object.assign({ kafkaHost: (_a = kafkaOptions === null || kafkaOptions === void 0 ? void 0 : kafkaOptions.kafkaHost) !== null && _a !== void 0 ? _a : 'localhost:9092' }, kafkaOptions);
|
|
21
|
+
console.log(this.kafkaOptions, kafkaOptions);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
static setKafkaProducer(callback, producerOption) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
this.producer = new kafkaProducer_1.KafkaProducer(new kafka_node_1.KafkaClient(this.kafkaOptions), producerOption, callback);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
static produceMessage(payloads, topic) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
if (!this.producer) {
|
|
32
|
+
throw new Error('Kafka Producer not initialized');
|
|
33
|
+
}
|
|
34
|
+
this.producer.produceMessage(payloads, topic);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
static setKafkaConsumer(topic, callback, consumerOption) {
|
|
38
|
+
var _a, _b, _c;
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
consumerOption = Object.assign({ kafkaHost: this.kafkaOptions.kafkaHost, autoCommit: (_a = consumerOption === null || consumerOption === void 0 ? void 0 : consumerOption.autoCommit) !== null && _a !== void 0 ? _a : false, groupId: (_b = consumerOption === null || consumerOption === void 0 ? void 0 : consumerOption.groupId) !== null && _b !== void 0 ? _b : 'groupId1', fromOffset: (_c = consumerOption === null || consumerOption === void 0 ? void 0 : consumerOption.fromOffset) !== null && _c !== void 0 ? _c : 'latest' }, consumerOption);
|
|
41
|
+
new kafkaConsumer_1.KafkaConsumer(topic, callback, consumerOption);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
static closeProducer() {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
this.producer.close();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.KafkaBusinessLogic = KafkaBusinessLogic;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KafkaConsumer = void 0;
|
|
4
|
+
const kafka_node_1 = require("kafka-node");
|
|
5
|
+
class KafkaConsumer {
|
|
6
|
+
constructor(topic, callback, consumerOptions) {
|
|
7
|
+
this.callback = callback !== null && callback !== void 0 ? callback : this.defaultCallBack;
|
|
8
|
+
this.consumer = new kafka_node_1.ConsumerGroup(consumerOptions, topic);
|
|
9
|
+
this.topic = topic;
|
|
10
|
+
this.initConsumerEvents();
|
|
11
|
+
}
|
|
12
|
+
defaultCallBack(message, done) {
|
|
13
|
+
done();
|
|
14
|
+
}
|
|
15
|
+
initConsumerEvents() {
|
|
16
|
+
this.consumer.on('message', (message) => {
|
|
17
|
+
console.log(`Message arrived from topic [${this.topic}] with offset [${message.offset}]`);
|
|
18
|
+
this.callback(message, () => {
|
|
19
|
+
const offset = {
|
|
20
|
+
topic: message.topic,
|
|
21
|
+
partition: message.partition,
|
|
22
|
+
offset: message.offset + 1,
|
|
23
|
+
metadata: 'updated offset'
|
|
24
|
+
};
|
|
25
|
+
this.consumer.sendOffsetCommitRequest([offset], (err, data) => {
|
|
26
|
+
if (err) {
|
|
27
|
+
this.logError(err);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
this.consumer.on('connect', () => {
|
|
33
|
+
console.log('Consumer connected');
|
|
34
|
+
});
|
|
35
|
+
this.consumer.on('error', (error) => {
|
|
36
|
+
this.logError(JSON.stringify(error));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
logError(error) {
|
|
40
|
+
console.error(`ERROR: kafka consumer failed to consume message from topic [${this.topic}]. ${error}`);
|
|
41
|
+
}
|
|
42
|
+
close() {
|
|
43
|
+
this.consumer.close(true, () => {
|
|
44
|
+
console.log(`Consumer for topic [${this.topic}] closed`);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.KafkaConsumer = KafkaConsumer;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KafkaProducer = void 0;
|
|
4
|
+
const kafka_node_1 = require("kafka-node");
|
|
5
|
+
class KafkaProducer {
|
|
6
|
+
constructor(client, producerOptions, callback) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
this.producer = new kafka_node_1.Producer(client, producerOptions);
|
|
9
|
+
this.callback = callback !== null && callback !== void 0 ? callback : this.defaultCallback;
|
|
10
|
+
this.initProducerEvents();
|
|
11
|
+
}
|
|
12
|
+
defaultCallback(error, data) {
|
|
13
|
+
}
|
|
14
|
+
initProducerEvents() {
|
|
15
|
+
this.producer.on('ready', () => {
|
|
16
|
+
console.log(`Kafka producer is ready`);
|
|
17
|
+
});
|
|
18
|
+
this.producer.on('error', (error) => {
|
|
19
|
+
console.error(`ERROR: kafka producer failed to send message. ${JSON.stringify(error)}`);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
produceMessage(payloads, topic) {
|
|
23
|
+
this.producer.send([{ topic: topic, messages: JSON.stringify(payloads) }], this.callback);
|
|
24
|
+
}
|
|
25
|
+
close() {
|
|
26
|
+
this.producer.close();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.KafkaProducer = KafkaProducer;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KafkaBusinessLogic = void 0;
|
|
4
|
+
var kafkaBl_1 = require("./businessLogic/kafkaBl");
|
|
5
|
+
Object.defineProperty(exports, "KafkaBusinessLogic", { enumerable: true, get: function () { return kafkaBl_1.KafkaBusinessLogic; } });
|
package/index.ts
ADDED
|
Binary file
|
package/packAndSend.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const { execSync } = require('child_process');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
// Run TypeScript compilation and npm pack
|
|
6
|
+
execSync('tsc && npm pack', { stdio: 'inherit' });
|
|
7
|
+
|
|
8
|
+
// Get the generated .tgz file name and the new version from package.json
|
|
9
|
+
const packageJson = require('./package.json');
|
|
10
|
+
const packageName = `${packageJson.name}-${packageJson.version}.tgz`;
|
|
11
|
+
const newVersion = packageJson.version;
|
|
12
|
+
const servicesDir = '../../services/';
|
|
13
|
+
|
|
14
|
+
// Define target directories (root directories for each service)
|
|
15
|
+
const targetDirs = [
|
|
16
|
+
'itemService',
|
|
17
|
+
'userService',
|
|
18
|
+
'scannerManagerService',
|
|
19
|
+
'scannerService',
|
|
20
|
+
'clientUpdater'
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
// Copy the .tgz file, update package.json, and run npm install for each directory
|
|
24
|
+
targetDirs.forEach(dir => {
|
|
25
|
+
const packagePath = path.join(servicesDir, dir, 'packages', packageName);
|
|
26
|
+
|
|
27
|
+
// Copy the .tgz file to the 'packages' folder within each service
|
|
28
|
+
const packagesDir = path.join(servicesDir, dir, 'packages');
|
|
29
|
+
if (!fs.existsSync(packagesDir)) {
|
|
30
|
+
fs.mkdirSync(packagesDir, { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
fs.copyFileSync(packageName, packagePath);
|
|
33
|
+
console.log(`Copied to ${packagePath}`);
|
|
34
|
+
|
|
35
|
+
// Update the package.json version in the root of the service
|
|
36
|
+
const packageJsonPath = path.join(servicesDir, dir, 'package.json');
|
|
37
|
+
const targetPackageJson = require(packageJsonPath);
|
|
38
|
+
|
|
39
|
+
if (targetPackageJson.dependencies && targetPackageJson.dependencies[packageJson.name]) {
|
|
40
|
+
targetPackageJson.dependencies[packageJson.name] = `file:packages/${packageName}`;
|
|
41
|
+
|
|
42
|
+
// Write the updated package.json back to the file system
|
|
43
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(targetPackageJson, null, 2));
|
|
44
|
+
console.log(`Updated version in ${packageJsonPath} to ^${newVersion}`);
|
|
45
|
+
|
|
46
|
+
// Run npm install in the service root directory
|
|
47
|
+
execSync('npm install', { stdio: 'inherit', cwd: path.join(servicesDir, dir) });
|
|
48
|
+
console.log(`Ran npm install in ${dir}`);
|
|
49
|
+
} else {
|
|
50
|
+
console.log(`Package ${packageJson.name} not found in dependencies for ${dir}`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cdm-kafkaconnector",
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"pack": "tsc && node packAndSend.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "Chaim-Dovid-M",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"kafka-node": "^5.0.0"
|
|
14
|
+
}
|
|
15
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "ES6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
+
|
|
27
|
+
/* Modules */
|
|
28
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
29
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
+
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
+
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
+
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
40
|
+
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
41
|
+
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
42
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
43
|
+
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
44
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
45
|
+
|
|
46
|
+
/* JavaScript Support */
|
|
47
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
48
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
49
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
50
|
+
|
|
51
|
+
/* Emit */
|
|
52
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
53
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
54
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
55
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
56
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
57
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
58
|
+
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
|
59
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
60
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
62
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
63
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
64
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
65
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
66
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
67
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
68
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
69
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
70
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
71
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
72
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
73
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
74
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
75
|
+
|
|
76
|
+
/* Interop Constraints */
|
|
77
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
78
|
+
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
79
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
80
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
81
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
82
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
83
|
+
|
|
84
|
+
/* Type Checking */
|
|
85
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
86
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
87
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
88
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
89
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
90
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
91
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
92
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
93
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
94
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
95
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
96
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
97
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
98
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
99
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
100
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
101
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
102
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
103
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
104
|
+
|
|
105
|
+
/* Completeness */
|
|
106
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
107
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
108
|
+
}
|
|
109
|
+
}
|