Compare commits
42 Commits
qbittorren
...
graphql-re
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a4569040f | |||
| de2a6abf68 | |||
| c05d16a91a | |||
| fc857baa4b | |||
| 4516d7892f | |||
| 193fffeb8d | |||
| fa3e8ebcfe | |||
| 2399431fde | |||
| cb500f0fe4 | |||
| 54ee896e15 | |||
| 40a0edadbb | |||
| 481878c19f | |||
| 8d588e9542 | |||
| ed06459450 | |||
| 56547034ef | |||
| 703f1e76fa | |||
| 175a67c5b2 | |||
| d97b69c92d | |||
| c65eb2c6ec | |||
| 5b2555aa61 | |||
| 6b732f1518 | |||
| 1900a3ddb8 | |||
| 63130b4e82 | |||
| f5a2e6505b | |||
| 6f11e84c1d | |||
| cb8e6bb3d6 | |||
| c0946e2ce4 | |||
| 36f08212a0 | |||
| cd9ea85b80 | |||
| e0954eb3e8 | |||
| 651e3ac7bb | |||
| 4045097eb0 | |||
| a710211a2c | |||
| 0430670a01 | |||
| ecdc3845cb | |||
| e6a85e6a39 | |||
| 55494abdc0 | |||
| 60e5b6f61b | |||
| 12e46334da | |||
| 6fb1374ce9 | |||
| 17ed663823 | |||
| 91199bcf0c |
19
.github/workflows/docker-image.yml
vendored
Normal file
19
.github/workflows/docker-image.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
name: Docker Image CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
- name: Publish to Registry
|
||||||
|
uses: elgohr/Publish-Docker-Github-Action@v5
|
||||||
|
with:
|
||||||
|
name: frishi/threetwo-acquisition-service
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
29
Dockerfile
Normal file
29
Dockerfile
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
FROM node:22.1.0
|
||||||
|
LABEL maintainer="Rishi Ghan <rishi.ghan@gmail.com>"
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /acquisition-service
|
||||||
|
|
||||||
|
# Copy package files first for efficient caching
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
|
||||||
|
# Install all dependencies (including devDependencies)
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# Copy necessary config files
|
||||||
|
COPY moleculer.config.ts tsconfig.json tsconfig.build.json ./
|
||||||
|
|
||||||
|
# Copy the rest of the source code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Now remove devDependencies to keep the final image small
|
||||||
|
RUN npm prune --omit=dev
|
||||||
|
|
||||||
|
# Expose the port
|
||||||
|
EXPOSE 3080
|
||||||
|
|
||||||
|
# Start the application
|
||||||
|
CMD ["npm", "start"]
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
import type { BrokerOptions, MetricRegistry, ServiceBroker } from "moleculer";
|
"use strict";
|
||||||
import { Errors } from "moleculer";
|
import {
|
||||||
|
BrokerOptions,
|
||||||
|
Errors,
|
||||||
|
MetricRegistry,
|
||||||
|
ServiceBroker,
|
||||||
|
} from "moleculer";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moleculer ServiceBroker configuration file
|
* Moleculer ServiceBroker configuration file
|
||||||
@@ -30,7 +35,7 @@ const brokerConfig: BrokerOptions = {
|
|||||||
// Namespace of nodes to segment your nodes on the same network.
|
// Namespace of nodes to segment your nodes on the same network.
|
||||||
namespace: "",
|
namespace: "",
|
||||||
// Unique node identifier. Must be unique in a namespace.
|
// Unique node identifier. Must be unique in a namespace.
|
||||||
nodeID: "threetwo-acquistion-service",
|
nodeID: "threetwo-acquisition-service",
|
||||||
// Custom metadata store. Store here what you want. Accessing: `this.broker.metadata`
|
// Custom metadata store. Store here what you want. Accessing: `this.broker.metadata`
|
||||||
metadata: {},
|
metadata: {},
|
||||||
|
|
||||||
@@ -42,7 +47,7 @@ const brokerConfig: BrokerOptions = {
|
|||||||
// Using colors on the output
|
// Using colors on the output
|
||||||
colors: true,
|
colors: true,
|
||||||
// Print module names with different colors (like docker-compose for containers)
|
// Print module names with different colors (like docker-compose for containers)
|
||||||
moduleColors: false,
|
moduleColors: true,
|
||||||
// Line formatter. It can be "json", "short", "simple", "full", a `Function` or a template string like "{timestamp} {level} {nodeID}/{mod}: {msg}"
|
// Line formatter. It can be "json", "short", "simple", "full", a `Function` or a template string like "{timestamp} {level} {nodeID}/{mod}: {msg}"
|
||||||
formatter: "full",
|
formatter: "full",
|
||||||
// Custom object printer. If not defined, it uses the `util.inspect` method.
|
// Custom object printer. If not defined, it uses the `util.inspect` method.
|
||||||
@@ -59,11 +64,11 @@ const brokerConfig: BrokerOptions = {
|
|||||||
// More info: https://moleculer.services/docs/0.14/networking.html
|
// More info: https://moleculer.services/docs/0.14/networking.html
|
||||||
// Note: During the development, you don't need to define it because all services will be loaded locally.
|
// Note: During the development, you don't need to define it because all services will be loaded locally.
|
||||||
// In production you can set it via `TRANSPORTER=nats://localhost:4222` environment variable.
|
// In production you can set it via `TRANSPORTER=nats://localhost:4222` environment variable.
|
||||||
transporter: process.env.REDIS_URI || "redis://localhost:6379",
|
transporter: process.env.REDIS_URI || "redis://localhost:6379", // "NATS"
|
||||||
|
|
||||||
// Define a cacher.
|
// Define a cacher.
|
||||||
// More info: https://moleculer.services/docs/0.14/caching.html
|
// More info: https://moleculer.services/docs/0.14/caching.html
|
||||||
cacher: "Redis",
|
cacher: "Memory",
|
||||||
|
|
||||||
// Define a serializer.
|
// Define a serializer.
|
||||||
// Available values: "JSON", "Avro", "ProtoBuf", "MsgPack", "Notepack", "Thrift".
|
// Available values: "JSON", "Avro", "ProtoBuf", "MsgPack", "Notepack", "Thrift".
|
||||||
@@ -86,8 +91,7 @@ const brokerConfig: BrokerOptions = {
|
|||||||
// Backoff factor for delay. 2 means exponential backoff.
|
// Backoff factor for delay. 2 means exponential backoff.
|
||||||
factor: 2,
|
factor: 2,
|
||||||
// A function to check failed requests.
|
// A function to check failed requests.
|
||||||
check: (err: Error) =>
|
check: (err: Errors.MoleculerError) => err && !!err.retryable,
|
||||||
err && err instanceof Errors.MoleculerRetryableError && !!err.retryable,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Limit of calling level. If it reaches the limit, broker will throw an MaxCallLevelError error. (Infinite loop protection)
|
// Limit of calling level. If it reaches the limit, broker will throw an MaxCallLevelError error. (Infinite loop protection)
|
||||||
@@ -134,7 +138,7 @@ const brokerConfig: BrokerOptions = {
|
|||||||
// Number of milliseconds to switch from open to half-open state
|
// Number of milliseconds to switch from open to half-open state
|
||||||
halfOpenTime: 10 * 1000,
|
halfOpenTime: 10 * 1000,
|
||||||
// A function to check failed requests.
|
// A function to check failed requests.
|
||||||
check: (err: Error) => err && err instanceof Errors.MoleculerError && err.code >= 500,
|
check: (err: Errors.MoleculerError) => err && err.code >= 500,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Settings of bulkhead feature. More info: https://moleculer.services/docs/0.14/fault-tolerance.html#Bulkhead
|
// Settings of bulkhead feature. More info: https://moleculer.services/docs/0.14/fault-tolerance.html#Bulkhead
|
||||||
@@ -195,16 +199,13 @@ const brokerConfig: BrokerOptions = {
|
|||||||
middlewares: [],
|
middlewares: [],
|
||||||
|
|
||||||
// Register custom REPL commands.
|
// Register custom REPL commands.
|
||||||
replCommands: null,
|
/*
|
||||||
|
|
||||||
// Called after broker created.
|
// Called after broker created.
|
||||||
// created(broker: ServiceBroker): void {},
|
created : (broker: ServiceBroker): void => {},
|
||||||
|
|
||||||
// Called after broker started.
|
// Called after broker started.
|
||||||
// async started(broker: ServiceBroker): Promise<void> {},
|
started: async (broker: ServiceBroker): Promise<void> => {},
|
||||||
|
stopped: async (broker: ServiceBroker): Promise<void> => {},
|
||||||
// Called after broker stopped.
|
*/
|
||||||
// async stopped(broker: ServiceBroker): Promise<void> {},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export = brokerConfig;
|
export = brokerConfig;
|
||||||
|
|||||||
189
package-lock.json
generated
189
package-lock.json
generated
@@ -9,19 +9,25 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@robertklep/qbittorrent": "^1.0.1",
|
"@robertklep/qbittorrent": "^1.0.1",
|
||||||
|
"axios": "^1.7.9",
|
||||||
"ioredis": "^5.0.0",
|
"ioredis": "^5.0.0",
|
||||||
"moleculer": "^0.14.27",
|
"kafkajs": "^2.2.4",
|
||||||
"moleculer-web": "^0.10.5",
|
"lodash": "^4.17.21",
|
||||||
"parse-torrent": "^9.1.5"
|
"moleculer": "^0.14.34",
|
||||||
|
"moleculer-web": "^0.10.7",
|
||||||
|
"parse-torrent": "^9.1.5",
|
||||||
|
"socket.io-client": "^4.7.5",
|
||||||
|
"string-similarity-alg": "^1.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jest/globals": "^29.3.1",
|
"@jest/globals": "^29.3.1",
|
||||||
"@types/jest": "^29.2.3",
|
"@types/jest": "^29.2.3",
|
||||||
|
"@types/lodash": "^4.17.4",
|
||||||
"@types/node": "^18.11.9",
|
"@types/node": "^18.11.9",
|
||||||
"@types/parse-torrent": "^5.8.7",
|
"@types/parse-torrent": "^5.8.7",
|
||||||
|
"@types/qs": "^6.9.18",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.44.0",
|
"@typescript-eslint/eslint-plugin": "^5.44.0",
|
||||||
"@typescript-eslint/parser": "^5.44.0",
|
"@typescript-eslint/parser": "^5.44.0",
|
||||||
"axios": "^1.5.0",
|
|
||||||
"concurrently": "^7.6.0",
|
"concurrently": "^7.6.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^8.28.0",
|
"eslint": "^8.28.0",
|
||||||
@@ -1359,6 +1365,11 @@
|
|||||||
"@sinonjs/commons": "^3.0.0"
|
"@sinonjs/commons": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@socket.io/component-emitter": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA=="
|
||||||
|
},
|
||||||
"node_modules/@tsconfig/node10": {
|
"node_modules/@tsconfig/node10": {
|
||||||
"version": "1.0.9",
|
"version": "1.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
|
||||||
@@ -1479,6 +1490,12 @@
|
|||||||
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
|
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/lodash": {
|
||||||
|
"version": "4.17.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.4.tgz",
|
||||||
|
"integrity": "sha512-wYCP26ZLxaT3R39kiN2+HcJ4kTd3U1waI/cY7ivWYqFP6pW3ZNpvi6Wd6PHZx7T/t8z0vlkXMg3QYLa7DZ/IJQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/@types/magnet-uri": {
|
"node_modules/@types/magnet-uri": {
|
||||||
"version": "5.1.5",
|
"version": "5.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/magnet-uri/-/magnet-uri-5.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/magnet-uri/-/magnet-uri-5.1.5.tgz",
|
||||||
@@ -1514,6 +1531,12 @@
|
|||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/qs": {
|
||||||
|
"version": "6.9.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.18.tgz",
|
||||||
|
"integrity": "sha512-kK7dgTYDyGqS+e2Q4aK9X3D7q234CIZ1Bv0q/7Z5IwRDoADNU81xXJK/YVyLbLTZCoIwUoDoffFeF+p/eIklAA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/@types/semver": {
|
"node_modules/@types/semver": {
|
||||||
"version": "7.5.1",
|
"version": "7.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.1.tgz",
|
||||||
@@ -2073,8 +2096,7 @@
|
|||||||
"node_modules/asynckit": {
|
"node_modules/asynckit": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"node_modules/available-typed-arrays": {
|
"node_modules/available-typed-arrays": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
@@ -2089,12 +2111,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "1.6.7",
|
"version": "1.7.9",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
|
||||||
"integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==",
|
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.4",
|
"follow-redirects": "^1.15.6",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"proxy-from-env": "^1.1.0"
|
"proxy-from-env": "^1.1.0"
|
||||||
}
|
}
|
||||||
@@ -2340,12 +2361,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/braces": {
|
"node_modules/braces": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fill-range": "^7.0.1"
|
"fill-range": "^7.1.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
@@ -2652,7 +2673,6 @@
|
|||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"delayed-stream": "~1.0.0"
|
"delayed-stream": "~1.0.0"
|
||||||
},
|
},
|
||||||
@@ -2890,7 +2910,6 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.4.0"
|
"node": ">=0.4.0"
|
||||||
}
|
}
|
||||||
@@ -3008,6 +3027,26 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/engine.io-client": {
|
||||||
|
"version": "6.5.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.4.tgz",
|
||||||
|
"integrity": "sha512-GeZeeRjpD2qf49cZQ0Wvh/8NJNfeXkXXcoGh+F77oEAgo9gUHwT1fCRxSNU+YEEaysOJTnsFHmM5oAcPy4ntvQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@socket.io/component-emitter": "~3.1.0",
|
||||||
|
"debug": "~4.3.1",
|
||||||
|
"engine.io-parser": "~5.2.1",
|
||||||
|
"ws": "~8.17.1",
|
||||||
|
"xmlhttprequest-ssl": "~2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/engine.io-parser": {
|
||||||
|
"version": "5.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.2.tgz",
|
||||||
|
"integrity": "sha512-RcyUFKA93/CXH20l4SoVvzZfrSDMOTUS3bWVpTt2FuFP+XYrL8i8oonHP7WInRyVHXh0n/ORtoeiE1os+8qkSw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/error-ex": {
|
"node_modules/error-ex": {
|
||||||
"version": "1.3.2",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
|
||||||
@@ -3798,9 +3837,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/fastest-validator": {
|
"node_modules/fastest-validator": {
|
||||||
"version": "1.17.0",
|
"version": "1.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/fastest-validator/-/fastest-validator-1.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/fastest-validator/-/fastest-validator-1.19.0.tgz",
|
||||||
"integrity": "sha512-37U/JDP72QSFqcvNnO81f0Aeu9og+5I3mc55b2v2RbV0S2I7KvQEdBtrFeIvaYVgam1bDUgy9F9AK9HolByogA=="
|
"integrity": "sha512-wUfJBrXmccVz4kARAiWTkuqsC6EFeqbNxwfysCDk+maExBPP8KxyBwaWtayrWjKIaBIbaz+rqI2kel6ecayxcg=="
|
||||||
},
|
},
|
||||||
"node_modules/fastq": {
|
"node_modules/fastq": {
|
||||||
"version": "1.15.0",
|
"version": "1.15.0",
|
||||||
@@ -3833,9 +3872,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fill-range": {
|
"node_modules/fill-range": {
|
||||||
"version": "7.0.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"to-regex-range": "^5.0.1"
|
"to-regex-range": "^5.0.1"
|
||||||
@@ -3881,10 +3920,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/follow-redirects": {
|
"node_modules/follow-redirects": {
|
||||||
"version": "1.15.5",
|
"version": "1.15.6",
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz",
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
||||||
"integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==",
|
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
|
||||||
"dev": true,
|
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "individual",
|
"type": "individual",
|
||||||
@@ -3913,7 +3951,6 @@
|
|||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"asynckit": "^0.4.0",
|
"asynckit": "^0.4.0",
|
||||||
"combined-stream": "^1.0.8",
|
"combined-stream": "^1.0.8",
|
||||||
@@ -4411,9 +4448,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ipaddr.js": {
|
"node_modules/ipaddr.js": {
|
||||||
"version": "2.1.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz",
|
||||||
"integrity": "sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ==",
|
"integrity": "sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10"
|
"node": ">= 10"
|
||||||
}
|
}
|
||||||
@@ -5412,6 +5449,14 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/kafkajs": {
|
||||||
|
"version": "2.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/kafkajs/-/kafkajs-2.2.4.tgz",
|
||||||
|
"integrity": "sha512-j/YeapB1vfPT2iOIUn/vxdyKEuhuY2PxMBvf5JWux6iSaukAccrMtXEY/Lb7OvavDhOWME589bpLrEdnVHjfjA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/keyv": {
|
"node_modules/keyv": {
|
||||||
"version": "4.5.3",
|
"version": "4.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz",
|
||||||
@@ -5720,15 +5765,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/moleculer": {
|
"node_modules/moleculer": {
|
||||||
"version": "0.14.31",
|
"version": "0.14.35",
|
||||||
"resolved": "https://registry.npmjs.org/moleculer/-/moleculer-0.14.31.tgz",
|
"resolved": "https://registry.npmjs.org/moleculer/-/moleculer-0.14.35.tgz",
|
||||||
"integrity": "sha512-EbcafGr4KWfltjwrV+k8xLA7majB7g8RvsD6aQ2bwzYpBo5e8xp9jYlJPpfScoORXAwT75puAqQTrFmAaBpYqA==",
|
"integrity": "sha512-KB4qs0zNTjE9z7Bl27FFLPaWkAsUFJajF2njozJeor1phFCAYP5S1JsWOSrnUBTtsH7SX4gTw8tGRdcgh1eyVQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"args": "^5.0.3",
|
"args": "^5.0.3",
|
||||||
"eventemitter2": "^6.4.9",
|
"eventemitter2": "^6.4.9",
|
||||||
"fastest-validator": "^1.17.0",
|
"fastest-validator": "^1.19.0",
|
||||||
"glob": "^7.2.0",
|
"glob": "^7.2.0",
|
||||||
"ipaddr.js": "^2.1.0",
|
"ipaddr.js": "^2.2.0",
|
||||||
"kleur": "^4.1.5",
|
"kleur": "^4.1.5",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"lru-cache": "^6.0.0",
|
"lru-cache": "^6.0.0",
|
||||||
@@ -5757,12 +5802,12 @@
|
|||||||
"jaeger-client": "^3.0.0",
|
"jaeger-client": "^3.0.0",
|
||||||
"kafka-node": "^5.0.0",
|
"kafka-node": "^5.0.0",
|
||||||
"log4js": "^6.0.0",
|
"log4js": "^6.0.0",
|
||||||
"mqtt": "^4.0.0",
|
"mqtt": "^4.0.0 || ^5.0.0",
|
||||||
"msgpack5": "^5.0.0 || ^6.0.0",
|
"msgpack5": "^5.0.0 || ^6.0.0",
|
||||||
"nats": "^1.0.0 || ^2.0.0",
|
"nats": "^1.0.0 || ^2.0.0",
|
||||||
"node-nats-streaming": "^0.0.51 || ^0.2.0 || ^0.3.0",
|
"node-nats-streaming": "^0.0.51 || ^0.2.0 || ^0.3.0",
|
||||||
"notepack.io": "^2.0.0 || ^3.0.0",
|
"notepack.io": "^2.0.0 || ^3.0.0",
|
||||||
"pino": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
"pino": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
|
||||||
"protobufjs": "^6.0.0 || ^7.0.0",
|
"protobufjs": "^6.0.0 || ^7.0.0",
|
||||||
"redlock": "^4.0.0",
|
"redlock": "^4.0.0",
|
||||||
"rhea-promise": "^1.0.0 || ^2.0.0",
|
"rhea-promise": "^1.0.0 || ^2.0.0",
|
||||||
@@ -5861,9 +5906,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/moleculer-web": {
|
"node_modules/moleculer-web": {
|
||||||
"version": "0.10.6",
|
"version": "0.10.7",
|
||||||
"resolved": "https://registry.npmjs.org/moleculer-web/-/moleculer-web-0.10.6.tgz",
|
"resolved": "https://registry.npmjs.org/moleculer-web/-/moleculer-web-0.10.7.tgz",
|
||||||
"integrity": "sha512-MGNIH6mXLU2Wj63bAgoVzdhMKXALp99F5UHuiBgS2ywakdWEUl/q7GlMblvscioCCkXuUWezId85J0yioYxedg==",
|
"integrity": "sha512-/UJtV+O7iQ3aSg/xi/sw3ZswhvzkigzGPjKOR5R97sm2FSihKuLTftUpXlk4dYls7/8c8WSz6H/M/40BenEx9Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fastify/busboy": "^1.0.0",
|
"@fastify/busboy": "^1.0.0",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
@@ -6510,8 +6555,7 @@
|
|||||||
"node_modules/proxy-from-env": {
|
"node_modules/proxy-from-env": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"node_modules/punycode": {
|
"node_modules/punycode": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
@@ -7109,6 +7153,32 @@
|
|||||||
"url": "https://github.com/chalk/slice-ansi?sponsor=1"
|
"url": "https://github.com/chalk/slice-ansi?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/socket.io-client": {
|
||||||
|
"version": "4.7.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.5.tgz",
|
||||||
|
"integrity": "sha512-sJ/tqHOCe7Z50JCBCXrsY3I2k03iOiUe+tj1OmKeD2lXPiGH/RUCdTZFoqVyN7l1MnpIzPrGtLcijffmeouNlQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@socket.io/component-emitter": "~3.1.0",
|
||||||
|
"debug": "~4.3.2",
|
||||||
|
"engine.io-client": "~6.5.2",
|
||||||
|
"socket.io-parser": "~4.2.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/socket.io-parser": {
|
||||||
|
"version": "4.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz",
|
||||||
|
"integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==",
|
||||||
|
"dependencies": {
|
||||||
|
"@socket.io/component-emitter": "~3.1.0",
|
||||||
|
"debug": "~4.3.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/source-map": {
|
"node_modules/source-map": {
|
||||||
"version": "0.6.1",
|
"version": "0.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
@@ -7205,6 +7275,11 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/string-similarity-alg": {
|
||||||
|
"version": "1.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-similarity-alg/-/string-similarity-alg-1.3.2.tgz",
|
||||||
|
"integrity": "sha512-M+jTGEJmWLfIg2dawXOifzbkUs/tp8HbeSCXZpNII2oZvU5uexaBFx+NoUBWS3M6VQ2ezJJCMstU8L8gq6YqsQ=="
|
||||||
|
},
|
||||||
"node_modules/string-width": {
|
"node_modules/string-width": {
|
||||||
"version": "4.2.3",
|
"version": "4.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||||
@@ -7960,6 +8035,34 @@
|
|||||||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ws": {
|
||||||
|
"version": "8.17.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
||||||
|
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"bufferutil": "^4.0.1",
|
||||||
|
"utf-8-validate": ">=5.0.2"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"bufferutil": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"utf-8-validate": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/xmlhttprequest-ssl": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/y18n": {
|
"node_modules/y18n": {
|
||||||
"version": "5.0.8",
|
"version": "5.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||||
|
|||||||
14
package.json
14
package.json
@@ -23,11 +23,12 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jest/globals": "^29.3.1",
|
"@jest/globals": "^29.3.1",
|
||||||
"@types/jest": "^29.2.3",
|
"@types/jest": "^29.2.3",
|
||||||
|
"@types/lodash": "^4.17.4",
|
||||||
"@types/node": "^18.11.9",
|
"@types/node": "^18.11.9",
|
||||||
"@types/parse-torrent": "^5.8.7",
|
"@types/parse-torrent": "^5.8.7",
|
||||||
|
"@types/qs": "^6.9.18",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.44.0",
|
"@typescript-eslint/eslint-plugin": "^5.44.0",
|
||||||
"@typescript-eslint/parser": "^5.44.0",
|
"@typescript-eslint/parser": "^5.44.0",
|
||||||
"axios": "^1.5.0",
|
|
||||||
"concurrently": "^7.6.0",
|
"concurrently": "^7.6.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^8.28.0",
|
"eslint": "^8.28.0",
|
||||||
@@ -47,9 +48,14 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@robertklep/qbittorrent": "^1.0.1",
|
"@robertklep/qbittorrent": "^1.0.1",
|
||||||
"ioredis": "^5.0.0",
|
"ioredis": "^5.0.0",
|
||||||
"moleculer": "^0.14.27",
|
"kafkajs": "^2.2.4",
|
||||||
"moleculer-web": "^0.10.5",
|
"axios": "^1.7.9",
|
||||||
"parse-torrent": "^9.1.5"
|
"lodash": "^4.17.21",
|
||||||
|
"moleculer": "^0.14.34",
|
||||||
|
"moleculer-web": "^0.10.7",
|
||||||
|
"parse-torrent": "^9.1.5",
|
||||||
|
"socket.io-client": "^4.7.5",
|
||||||
|
"string-similarity-alg": "^1.3.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 16.x.x"
|
"node": ">= 16.x.x"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Service, ServiceBroker } from "moleculer";
|
|||||||
import ApiGateway from "moleculer-web";
|
import ApiGateway from "moleculer-web";
|
||||||
|
|
||||||
export default class ApiService extends Service {
|
export default class ApiService extends Service {
|
||||||
public constructor(broker: ServiceBroker) {
|
constructor(broker: ServiceBroker) {
|
||||||
super(broker);
|
super(broker);
|
||||||
this.parseServiceSchema({
|
this.parseServiceSchema({
|
||||||
name: "api",
|
name: "api",
|
||||||
|
|||||||
114
services/autodownload.service.ts
Normal file
114
services/autodownload.service.ts
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
"use strict";
|
||||||
|
import { Kafka } from "kafkajs";
|
||||||
|
import type { Context, ServiceBroker, ServiceSchema } from "moleculer";
|
||||||
|
import { Errors, Service } from "moleculer";
|
||||||
|
|
||||||
|
interface Comic {
|
||||||
|
wanted: {
|
||||||
|
markEntireVolumeWanted?: boolean;
|
||||||
|
issues?: any[];
|
||||||
|
volume: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class AutoDownloadService extends Service {
|
||||||
|
private kafkaProducer: any;
|
||||||
|
|
||||||
|
private readonly BATCH_SIZE = 100; // Adjust based on your system capacity
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
constructor(
|
||||||
|
public broker: ServiceBroker,
|
||||||
|
schema: ServiceSchema<{}> = { name: "autodownload" },
|
||||||
|
) {
|
||||||
|
super(broker);
|
||||||
|
this.parseServiceSchema({
|
||||||
|
name: "autodownload",
|
||||||
|
actions: {
|
||||||
|
searchWantedComics: {
|
||||||
|
rest: "POST /searchWantedComics",
|
||||||
|
handler: async (ctx: Context<{}>) => {
|
||||||
|
try {
|
||||||
|
/* eslint-disable no-await-in-loop */
|
||||||
|
let page = 1;
|
||||||
|
const limit = this.BATCH_SIZE;
|
||||||
|
let comics: Comic[];
|
||||||
|
do {
|
||||||
|
comics = await this.broker.call(
|
||||||
|
"library.getComicsMarkedAsWanted",
|
||||||
|
{ page, limit },
|
||||||
|
);
|
||||||
|
// Log debugging info
|
||||||
|
this.logger.info(
|
||||||
|
"Received comics from getComicsMarkedAsWanted:",
|
||||||
|
JSON.stringify(comics, null, 2),
|
||||||
|
);
|
||||||
|
if (!Array.isArray(comics)) {
|
||||||
|
this.logger.error(
|
||||||
|
"Invalid response structure",
|
||||||
|
JSON.stringify(comics, null, 2),
|
||||||
|
);
|
||||||
|
throw new Errors.MoleculerError(
|
||||||
|
"Invalid response structure from getComicsMarkedAsWanted",
|
||||||
|
500,
|
||||||
|
"INVALID_RESPONSE_STRUCTURE",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.logger.info(
|
||||||
|
`Fetched ${comics.length} comics from page ${page}`,
|
||||||
|
);
|
||||||
|
for (const comic of comics) {
|
||||||
|
await this.produceJobToKafka(comic);
|
||||||
|
}
|
||||||
|
page += 1;
|
||||||
|
} while (comics.length === limit);
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
message: "Jobs enqueued for background processing.",
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.error("Error in searchWantedComics:", error);
|
||||||
|
throw new Errors.MoleculerError(
|
||||||
|
"Failed to search wanted comics.",
|
||||||
|
500,
|
||||||
|
"SEARCH_WANTED_COMICS_ERROR",
|
||||||
|
{ error },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
produceJobToKafka: async (comic: Comic) => {
|
||||||
|
const job = { comic };
|
||||||
|
try {
|
||||||
|
await this.kafkaProducer.send({
|
||||||
|
topic: "comic-search-jobs",
|
||||||
|
messages: [{ value: JSON.stringify(job) }],
|
||||||
|
});
|
||||||
|
this.logger.info("Produced job to Kafka:", job);
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.error("Error producing job to Kafka:", error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
async started() {
|
||||||
|
const kafka = new Kafka({
|
||||||
|
clientId: "comic-search-service",
|
||||||
|
brokers: [process.env.KAFKA_BROKER_URI],
|
||||||
|
});
|
||||||
|
this.kafkaProducer = kafka.producer();
|
||||||
|
await this.kafkaProducer.connect();
|
||||||
|
this.logger.info("Kafka producer connected successfully.");
|
||||||
|
},
|
||||||
|
async stopped() {
|
||||||
|
await this.kafkaProducer.disconnect();
|
||||||
|
this.logger.info("Kafka producer disconnected successfully.");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
304
services/comicprocessor.service.ts
Normal file
304
services/comicprocessor.service.ts
Normal file
@@ -0,0 +1,304 @@
|
|||||||
|
import type { EachMessagePayload } from "kafkajs";
|
||||||
|
import { Kafka, logLevel } from "kafkajs";
|
||||||
|
import { isNil, isUndefined } from "lodash";
|
||||||
|
import type { ServiceBroker, ServiceSchema } from "moleculer";
|
||||||
|
import { Service } from "moleculer";
|
||||||
|
import io from "socket.io-client";
|
||||||
|
import stringSimilarity from "string-similarity-alg";
|
||||||
|
|
||||||
|
interface SearchResult {
|
||||||
|
groupedResult: { entityId: number; payload: any };
|
||||||
|
updatedResult: { entityId: number; payload: any };
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class ComicProcessorService extends Service {
|
||||||
|
private kafkaConsumer: any;
|
||||||
|
private socketIOInstance: any;
|
||||||
|
private kafkaProducer: any;
|
||||||
|
private prowlarrResultsMap: Map<string, any> = new Map();
|
||||||
|
private airDCPPSearchResults: Map<number, any[]> = new Map();
|
||||||
|
private issuesToSearch: any = [];
|
||||||
|
|
||||||
|
// @ts-ignore: schema parameter is required by Service constructor
|
||||||
|
constructor(
|
||||||
|
public broker: ServiceBroker,
|
||||||
|
schema: ServiceSchema<object> = { name: "comicProcessor" },
|
||||||
|
) {
|
||||||
|
super(broker, schema);
|
||||||
|
this.parseServiceSchema({
|
||||||
|
name: "comicProcessor",
|
||||||
|
methods: {
|
||||||
|
parseStringDate: (dateString: string) => {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
return {
|
||||||
|
year: date.getFullYear(),
|
||||||
|
month: date.getMonth() + 1,
|
||||||
|
day: date.getDate(),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
rankSearchResults: async (results: Map<number, any[]>, query: string) => {
|
||||||
|
// Find the highest-ranked response based on similarity to the search string
|
||||||
|
let highestRankedResult = null;
|
||||||
|
let highestSimilarity = -1;
|
||||||
|
|
||||||
|
results.forEach((resultArray) => {
|
||||||
|
resultArray.forEach((result) => {
|
||||||
|
const similarity = stringSimilarity("jaro-winkler").compare(
|
||||||
|
result.name,
|
||||||
|
query,
|
||||||
|
);
|
||||||
|
if (similarity > highestSimilarity) {
|
||||||
|
highestSimilarity = similarity;
|
||||||
|
highestRankedResult = { ...result, similarity };
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return highestRankedResult;
|
||||||
|
},
|
||||||
|
processJob: async (job: any) => {
|
||||||
|
try {
|
||||||
|
this.logger.info("Processing job:", JSON.stringify(job, null, 2));
|
||||||
|
// Get the hub to search on
|
||||||
|
const settings: any = await this.broker.call("settings.getSettings", {
|
||||||
|
settingsKey: "directConnect",
|
||||||
|
});
|
||||||
|
const hubs = settings.client.hubs.map((hub: any) => hub.value);
|
||||||
|
|
||||||
|
const { comic } = job;
|
||||||
|
const { volume, issues, markEntireVolumeWanted } = comic.wanted;
|
||||||
|
|
||||||
|
// If entire volume is marked as wanted, get their details from CV
|
||||||
|
if (markEntireVolumeWanted) {
|
||||||
|
this.issuesToSearch = await this.broker.call(
|
||||||
|
"comicvine.getIssuesForVolume",
|
||||||
|
{ volumeId: volume.id },
|
||||||
|
);
|
||||||
|
this.logger.info(
|
||||||
|
`The entire volume with id: ${volume.id} was marked as wanted.`,
|
||||||
|
);
|
||||||
|
this.logger.info(`Fetched issues for ${volume.id}:`);
|
||||||
|
this.logger.info(`${this.issuesToSearch.length} issues to search`);
|
||||||
|
} else {
|
||||||
|
// Or proceed with `issues` from the wanted object.
|
||||||
|
this.issuesToSearch = issues;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const issue of this.issuesToSearch) {
|
||||||
|
// Query builder for DC++
|
||||||
|
// 1. issue number
|
||||||
|
const inferredIssueNumber =
|
||||||
|
issue.issueNumber || issue.issue_number || "";
|
||||||
|
// 2. year
|
||||||
|
const { year } = this.parseStringDate(issue.coverDate);
|
||||||
|
const inferredYear = year || issue.year || "";
|
||||||
|
|
||||||
|
// 3. Orchestrate the query
|
||||||
|
const dcppSearchQuery = {
|
||||||
|
query: {
|
||||||
|
pattern: `${volume.name
|
||||||
|
.replace(/[^\w\s]/g, "")
|
||||||
|
.replace(/\s+/g, " ")
|
||||||
|
.trim()}`,
|
||||||
|
extensions: ["cbz", "cbr", "cb7"],
|
||||||
|
},
|
||||||
|
hub_urls: hubs,
|
||||||
|
priority: 5,
|
||||||
|
};
|
||||||
|
this.logger.info(
|
||||||
|
"DC++ search query:",
|
||||||
|
JSON.stringify(dcppSearchQuery, null, 4),
|
||||||
|
);
|
||||||
|
|
||||||
|
await this.broker.call("socket.search", {
|
||||||
|
query: dcppSearchQuery,
|
||||||
|
config: {
|
||||||
|
hostname: "192.168.1.119:5600",
|
||||||
|
protocol: "http",
|
||||||
|
username: "admin",
|
||||||
|
password: "password",
|
||||||
|
},
|
||||||
|
namespace: "/automated",
|
||||||
|
});
|
||||||
|
|
||||||
|
// const prowlarrResults = await this.broker.call("prowlarr.search", {
|
||||||
|
// prowlarrQuery: {
|
||||||
|
// port: "9696",
|
||||||
|
// apiKey: "c4f42e265fb044dc81f7e88bd41c3367",
|
||||||
|
// offset: 0,
|
||||||
|
// categories: [7030],
|
||||||
|
// query: `${volume.name} ${issue.issueNumber} ${year}`,
|
||||||
|
// host: "localhost",
|
||||||
|
// limit: 100,
|
||||||
|
// type: "search",
|
||||||
|
// indexerIds: [2],
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// this.logger.info(
|
||||||
|
// "Prowlarr search results:",
|
||||||
|
// JSON.stringify(prowlarrResults, null, 4),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// Store prowlarr results in map using unique key
|
||||||
|
// const key = `${volume.name}-${issue.issueNumber}-${year}`;
|
||||||
|
// this.prowlarrResultsMap.set(key, prowlarrResults);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.error("Error processing job:", error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
produceResultsToKafka: async (query: string, result: any[]): Promise<void> => {
|
||||||
|
try {
|
||||||
|
/*
|
||||||
|
Match and rank
|
||||||
|
*/
|
||||||
|
const finalResult = await this.rankSearchResults(
|
||||||
|
this.airDCPPSearchResults,
|
||||||
|
query,
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
Kafka messages need to be in a format that can be serialized to JSON,
|
||||||
|
and a Map is not directly serializable in a way that retains its structure,
|
||||||
|
hence why we use Object.fromEntries
|
||||||
|
*/
|
||||||
|
await this.kafkaProducer.send({
|
||||||
|
topic: "comic-search-results",
|
||||||
|
messages: [
|
||||||
|
{
|
||||||
|
value: JSON.stringify(finalResult),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
this.logger.info(`Produced results to Kafka.`);
|
||||||
|
|
||||||
|
// socket event for UI
|
||||||
|
await this.broker.call("socket.broadcast", {
|
||||||
|
namespace: "/",
|
||||||
|
event: "searchResultsAvailable",
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
query,
|
||||||
|
finalResult,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.error("Error producing results to Kafka:", error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
async started() {
|
||||||
|
const kafka = new Kafka({
|
||||||
|
clientId: "comic-processor-service",
|
||||||
|
brokers: [process.env.KAFKA_BROKER_URI],
|
||||||
|
logLevel: logLevel.INFO,
|
||||||
|
});
|
||||||
|
this.kafkaConsumer = kafka.consumer({ groupId: "comic-processor-group" });
|
||||||
|
this.kafkaProducer = kafka.producer();
|
||||||
|
|
||||||
|
this.kafkaConsumer.on("consumer.crash", (event: any) => {
|
||||||
|
this.logger.error("Consumer crash:", event);
|
||||||
|
});
|
||||||
|
this.kafkaConsumer.on("consumer.connect", () => {
|
||||||
|
this.logger.info("Consumer connected");
|
||||||
|
});
|
||||||
|
this.kafkaConsumer.on("consumer.disconnect", () => {
|
||||||
|
this.logger.info("Consumer disconnected");
|
||||||
|
});
|
||||||
|
this.kafkaConsumer.on("consumer.network.request_timeout", () => {
|
||||||
|
this.logger.warn("Consumer network request timeout");
|
||||||
|
});
|
||||||
|
|
||||||
|
await this.kafkaConsumer.connect();
|
||||||
|
await this.kafkaProducer.connect();
|
||||||
|
|
||||||
|
await this.kafkaConsumer.subscribe({
|
||||||
|
topic: "comic-search-jobs",
|
||||||
|
fromBeginning: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
await this.kafkaConsumer.run({
|
||||||
|
eachMessage: async ({ topic, partition, message }: EachMessagePayload) => {
|
||||||
|
if (message.value) {
|
||||||
|
const job = JSON.parse(message.value.toString());
|
||||||
|
await this.processJob(job);
|
||||||
|
} else {
|
||||||
|
this.logger.warn("Received message with null value");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
this.socketIOInstance = io("ws://localhost:3001/automated", {
|
||||||
|
transports: ["websocket"],
|
||||||
|
withCredentials: true,
|
||||||
|
});
|
||||||
|
this.socketIOInstance.on("connect", () => {
|
||||||
|
this.logger.info("Socket.IO connected successfully.");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle searchResultAdded event
|
||||||
|
this.socketIOInstance.on("searchResultAdded", (result: SearchResult) => {
|
||||||
|
const {
|
||||||
|
groupedResult: { entityId, payload },
|
||||||
|
} = result;
|
||||||
|
|
||||||
|
this.logger.info(
|
||||||
|
`AirDC++ Search result added for entityId: ${entityId} - ${payload?.name}`,
|
||||||
|
);
|
||||||
|
if (!this.airDCPPSearchResults.has(entityId)) {
|
||||||
|
this.airDCPPSearchResults.set(entityId, []);
|
||||||
|
}
|
||||||
|
if (!isNil(payload)) {
|
||||||
|
this.airDCPPSearchResults.get(entityId).push(payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"Updated airDCPPSearchResults:",
|
||||||
|
JSON.stringify(Array.from(this.airDCPPSearchResults.entries()), null, 4),
|
||||||
|
);
|
||||||
|
console.log(JSON.stringify(payload, null, 4));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle searchResultUpdated event
|
||||||
|
this.socketIOInstance.on("searchResultUpdated", (result: SearchResult) => {
|
||||||
|
const {
|
||||||
|
updatedResult: { entityId, payload },
|
||||||
|
} = result;
|
||||||
|
const resultsForInstance = this.airDCPPSearchResults.get(entityId);
|
||||||
|
|
||||||
|
if (resultsForInstance) {
|
||||||
|
const toReplaceIndex = resultsForInstance.findIndex((element: any) => {
|
||||||
|
this.logger.info("search result updated!");
|
||||||
|
this.logger.info(JSON.stringify(element, null, 4));
|
||||||
|
return element.id === payload.id;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (toReplaceIndex !== -1) {
|
||||||
|
// Replace the existing result with the updated result
|
||||||
|
resultsForInstance[toReplaceIndex] = payload;
|
||||||
|
// Optionally, update the map with the modified array
|
||||||
|
this.airDCPPSearchResults.set(entityId, resultsForInstance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle searchComplete event
|
||||||
|
this.socketIOInstance.on("searchesSent", async (data: any) => {
|
||||||
|
this.logger.info(
|
||||||
|
`Search complete for query: "${data.searchInfo.query.pattern}"`,
|
||||||
|
);
|
||||||
|
await this.produceResultsToKafka(data.searchInfo.query.pattern);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async stopped() {
|
||||||
|
await this.kafkaConsumer.disconnect();
|
||||||
|
await this.kafkaProducer.disconnect();
|
||||||
|
|
||||||
|
if (this.socketIOInstance) {
|
||||||
|
this.socketIOInstance.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
"use strict";
|
|
||||||
import { Context, Service, ServiceBroker, ServiceSchema, Errors } from "moleculer";
|
import { Context, Service, ServiceBroker, ServiceSchema, Errors } from "moleculer";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
export default class ProwlarrService extends Service {
|
export default class ProwlarrService extends Service {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
public constructor(
|
constructor(
|
||||||
public broker: ServiceBroker,
|
public broker: ServiceBroker,
|
||||||
schema: ServiceSchema<{}> = { name: "prowlarr" },
|
schema: ServiceSchema<{}> = { name: "prowlarr" },
|
||||||
) {
|
) {
|
||||||
@@ -54,37 +54,42 @@ export default class ProwlarrService extends Service {
|
|||||||
rest: "GET /search",
|
rest: "GET /search",
|
||||||
handler: async (
|
handler: async (
|
||||||
ctx: Context<{
|
ctx: Context<{
|
||||||
host: string;
|
prowlarrQuery: {
|
||||||
port: string;
|
host: string;
|
||||||
apiKey: string;
|
port: string;
|
||||||
query: string;
|
apiKey: string;
|
||||||
type: string;
|
query: string;
|
||||||
indexerIds: [number];
|
type: string;
|
||||||
categories: [number];
|
indexerIds: [number];
|
||||||
limit: number;
|
categories: [number];
|
||||||
offset: number;
|
limit: number;
|
||||||
|
offset: number;
|
||||||
|
};
|
||||||
}>,
|
}>,
|
||||||
) => {
|
) => {
|
||||||
const {
|
const {
|
||||||
indexerIds,
|
prowlarrQuery: {
|
||||||
categories,
|
indexerIds,
|
||||||
host,
|
categories,
|
||||||
port,
|
host,
|
||||||
apiKey,
|
port,
|
||||||
query,
|
apiKey,
|
||||||
type,
|
query,
|
||||||
limit,
|
type,
|
||||||
offset,
|
limit,
|
||||||
|
offset,
|
||||||
|
},
|
||||||
} = ctx.params;
|
} = ctx.params;
|
||||||
|
const indexer = indexerIds[0] ? indexerIds.length === 1 : indexerIds;
|
||||||
|
const category = categories[0] ? categories.length === 1 : categories;
|
||||||
const result = await axios({
|
const result = await axios({
|
||||||
url: `http://${host}:${port}/api/v1/search`,
|
url: `http://${host}:${port}/api/v1/search`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
params: {
|
params: {
|
||||||
query,
|
query,
|
||||||
type,
|
type,
|
||||||
indexerIds,
|
indexer,
|
||||||
categories,
|
category,
|
||||||
limit,
|
limit,
|
||||||
offset,
|
offset,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ export default class QBittorrentService extends Service {
|
|||||||
getClientInfo: {
|
getClientInfo: {
|
||||||
rest: "GET /getClientInfo",
|
rest: "GET /getClientInfo",
|
||||||
handler: async (ctx: Context<{}>) => {
|
handler: async (ctx: Context<{}>) => {
|
||||||
console.log(this.meta.app);
|
|
||||||
await this.broker.call("qbittorrent.loginWithStoredCredentials", {});
|
await this.broker.call("qbittorrent.loginWithStoredCredentials", {});
|
||||||
return {
|
return {
|
||||||
buildInfo: await this.meta.app.buildInfo(),
|
buildInfo: await this.meta.app.buildInfo(),
|
||||||
@@ -212,6 +211,20 @@ export default class QBittorrentService extends Service {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
determineDownloadApps: {
|
||||||
|
rest: "",
|
||||||
|
handler: async () => {
|
||||||
|
// 1. Parse the incoming search query
|
||||||
|
// to make sure that it is well-formed
|
||||||
|
// At the very least, it should have name, year, number
|
||||||
|
// 2. Choose between download mediums based on user-preference?
|
||||||
|
// possible choices are: DC++, Torrent
|
||||||
|
// 3. Perform the search on those media with the aforementioned search query
|
||||||
|
// 4. Choose a subset of relevant search results,
|
||||||
|
// and score them
|
||||||
|
// 5. Download the highest-scoring, relevant result
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {},
|
methods: {},
|
||||||
async started() {
|
async started() {
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "./tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"allowJs": true
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"./.*.cjs", // root commonjs files
|
|
||||||
"./.*.js", // root javascript config files
|
|
||||||
"**/*.js", // javascript files
|
|
||||||
"**/*.ts" // typescript files
|
|
||||||
]
|
|
||||||
}
|
|
||||||
117
tsconfig.json
117
tsconfig.json
@@ -1,103 +1,18 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
"module": "commonjs",
|
||||||
|
"esModuleInterop": true,
|
||||||
/* Projects */
|
"noImplicitAny": true,
|
||||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
"removeComments": true,
|
||||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
"preserveConstEnums": true,
|
||||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
"sourceMap": true,
|
||||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
"pretty": true,
|
||||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
"target": "es6",
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
"outDir": "dist"
|
||||||
|
},
|
||||||
/* Language and Environment */
|
"include": ["./**/*"],
|
||||||
"target": "es2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
"exclude": [
|
||||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
"node_modules/**/*",
|
||||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
"test"
|
||||||
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
]
|
||||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
||||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
||||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
||||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
||||||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
||||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
||||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
||||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
||||||
|
|
||||||
/* Modules */
|
|
||||||
"module": "commonjs", /* Specify what module code is generated. */
|
|
||||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
||||||
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
||||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
||||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
||||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
||||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
||||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
||||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
||||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
||||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
||||||
|
|
||||||
/* JavaScript Support */
|
|
||||||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
||||||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
||||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
||||||
|
|
||||||
/* Emit */
|
|
||||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
||||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
||||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
||||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
||||||
// "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. */
|
|
||||||
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
|
||||||
// "removeComments": true, /* Disable emitting comments. */
|
|
||||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
||||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
||||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
||||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
||||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
||||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
||||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
||||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
||||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
||||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
||||||
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
||||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
||||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
||||||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
||||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
||||||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
||||||
|
|
||||||
/* Interop Constraints */
|
|
||||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
||||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
||||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
||||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
||||||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
||||||
|
|
||||||
/* Type Checking */
|
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
|
||||||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
||||||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
||||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
||||||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
||||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
||||||
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
||||||
"useUnknownInCatchVariables": false, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
||||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
||||||
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
||||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
||||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
||||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
||||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
||||||
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
||||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
||||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
||||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
||||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
||||||
|
|
||||||
/* Completeness */
|
|
||||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
||||||
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user