@volare.finance/nestjs.plugins 1.0.1
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/README.md +112 -0
- package/dist/aws/aws.config.d.ts +15 -0
- package/dist/aws/aws.config.js +7 -0
- package/dist/aws/aws.config.js.map +1 -0
- package/dist/aws/aws.module.d.ts +9 -0
- package/dist/aws/aws.module.js +30 -0
- package/dist/aws/aws.module.js.map +1 -0
- package/dist/aws/aws.service.d.ts +12 -0
- package/dist/aws/aws.service.js +66 -0
- package/dist/aws/aws.service.js.map +1 -0
- package/dist/aws/index.d.ts +7 -0
- package/dist/aws/index.js +11 -0
- package/dist/aws/index.js.map +1 -0
- package/dist/binance/binance.config.d.ts +10 -0
- package/dist/binance/binance.config.js +7 -0
- package/dist/binance/binance.config.js.map +1 -0
- package/dist/binance/binance.module.d.ts +9 -0
- package/dist/binance/binance.module.js +30 -0
- package/dist/binance/binance.module.js.map +1 -0
- package/dist/binance/binance.service.d.ts +16 -0
- package/dist/binance/binance.service.js +43 -0
- package/dist/binance/binance.service.js.map +1 -0
- package/dist/binance/index.d.ts +7 -0
- package/dist/binance/index.js +11 -0
- package/dist/binance/index.js.map +1 -0
- package/dist/config/config.interface.d.ts +7 -0
- package/dist/config/config.interface.js +7 -0
- package/dist/config/config.interface.js.map +1 -0
- package/dist/config/config.module.d.ts +9 -0
- package/dist/config/config.module.js +25 -0
- package/dist/config/config.module.js.map +1 -0
- package/dist/config/config.service.d.ts +11 -0
- package/dist/config/config.service.js +26 -0
- package/dist/config/config.service.js.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.js +11 -0
- package/dist/config/index.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/index.d.ts +7 -0
- package/dist/logger/index.js +11 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/logger.config.d.ts +17 -0
- package/dist/logger/logger.config.js +7 -0
- package/dist/logger/logger.config.js.map +1 -0
- package/dist/logger/logger.module.d.ts +9 -0
- package/dist/logger/logger.module.js +30 -0
- package/dist/logger/logger.module.js.map +1 -0
- package/dist/logger/logger.service.d.ts +19 -0
- package/dist/logger/logger.service.js +55 -0
- package/dist/logger/logger.service.js.map +1 -0
- package/dist/mexc/index.d.ts +7 -0
- package/dist/mexc/index.js +11 -0
- package/dist/mexc/index.js.map +1 -0
- package/dist/mexc/mexc.config.d.ts +10 -0
- package/dist/mexc/mexc.config.js +7 -0
- package/dist/mexc/mexc.config.js.map +1 -0
- package/dist/mexc/mexc.module.d.ts +9 -0
- package/dist/mexc/mexc.module.js +30 -0
- package/dist/mexc/mexc.module.js.map +1 -0
- package/dist/mexc/mexc.service.d.ts +15 -0
- package/dist/mexc/mexc.service.js +42 -0
- package/dist/mexc/mexc.service.js.map +1 -0
- package/dist/mongo/filter.dto.d.ts +10 -0
- package/dist/mongo/filter.dto.js +42 -0
- package/dist/mongo/filter.dto.js.map +1 -0
- package/dist/mongo/index.d.ts +6 -0
- package/dist/mongo/index.js +10 -0
- package/dist/mongo/index.js.map +1 -0
- package/dist/mongo/mongo.service.d.ts +10 -0
- package/dist/mongo/mongo.service.js +48 -0
- package/dist/mongo/mongo.service.js.map +1 -0
- package/dist/viabtc/index.d.ts +7 -0
- package/dist/viabtc/index.js +11 -0
- package/dist/viabtc/index.js.map +1 -0
- package/dist/viabtc/viabtc.config.d.ts +10 -0
- package/dist/viabtc/viabtc.config.js +7 -0
- package/dist/viabtc/viabtc.config.js.map +1 -0
- package/dist/viabtc/viabtc.module.d.ts +9 -0
- package/dist/viabtc/viabtc.module.js +30 -0
- package/dist/viabtc/viabtc.module.js.map +1 -0
- package/dist/viabtc/viabtc.service.d.ts +10 -0
- package/dist/viabtc/viabtc.service.js +41 -0
- package/dist/viabtc/viabtc.service.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file logger.interface.ts
|
|
3
|
+
* @date 2023
|
|
4
|
+
*/
|
|
5
|
+
export interface MyLoggerConfig {
|
|
6
|
+
console: {
|
|
7
|
+
level: string;
|
|
8
|
+
timestampFormat: string;
|
|
9
|
+
};
|
|
10
|
+
cloudwatch: {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
level: string;
|
|
13
|
+
region: string;
|
|
14
|
+
logGroupName: string;
|
|
15
|
+
logStreamName: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.config.js","sourceRoot":"","sources":["../../src/logger/logger.config.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file logger.module.ts
|
|
4
|
+
* @date 2023
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MyLoggerModule = void 0;
|
|
8
|
+
const config_1 = require("../config");
|
|
9
|
+
const logger_service_1 = require("./logger.service");
|
|
10
|
+
class MyLoggerModule {
|
|
11
|
+
static forRoot(options) {
|
|
12
|
+
return {
|
|
13
|
+
module: MyLoggerModule,
|
|
14
|
+
imports: [config_1.ConfigModule.forRoot(options)],
|
|
15
|
+
providers: [
|
|
16
|
+
{
|
|
17
|
+
provide: 'MyLoggerConstant',
|
|
18
|
+
useFactory: (myLoggerConfig) => {
|
|
19
|
+
return myLoggerConfig.config();
|
|
20
|
+
},
|
|
21
|
+
inject: [config_1.ConfigService],
|
|
22
|
+
},
|
|
23
|
+
logger_service_1.MyLoggerService,
|
|
24
|
+
],
|
|
25
|
+
exports: [logger_service_1.MyLoggerService],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.MyLoggerModule = MyLoggerModule;
|
|
30
|
+
//# sourceMappingURL=logger.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.module.js","sourceRoot":"","sources":["../../src/logger/logger.module.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,sCAAuE;AAEvE,qDAAmD;AAEnD,MAAa,cAAc;IACzB,MAAM,CAAC,OAAO,CAAC,OAAuB;QACpC,OAAO;YACL,MAAM,EAAE,cAAc;YACtB,OAAO,EAAE,CAAC,qBAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACxC,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,kBAAkB;oBAC3B,UAAU,EAAE,CAAC,cAA6C,EAAkB,EAAE;wBAC5E,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC;oBACjC,CAAC;oBACD,MAAM,EAAE,CAAC,sBAAa,CAAC;iBACxB;gBACD,gCAAe;aAChB;YACD,OAAO,EAAE,CAAC,gCAAe,CAAC;SAC3B,CAAC;IACJ,CAAC;CACF;AAlBD,wCAkBC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file logger.service.ts
|
|
3
|
+
* @date 2023
|
|
4
|
+
*/
|
|
5
|
+
import { LoggerService } from '@nestjs/common';
|
|
6
|
+
import winston from 'winston';
|
|
7
|
+
import { MyLoggerConfig } from './logger.config';
|
|
8
|
+
export declare class MyLoggerService implements LoggerService {
|
|
9
|
+
private readonly constant;
|
|
10
|
+
winstonLogger: winston.Logger;
|
|
11
|
+
constructor(constant: MyLoggerConfig);
|
|
12
|
+
debug(message: any, context?: string): any;
|
|
13
|
+
error(message: any, context?: string): any;
|
|
14
|
+
log(message: any, context?: string): any;
|
|
15
|
+
info(message: any, context?: string): any;
|
|
16
|
+
verbose(message: any, context?: string): any;
|
|
17
|
+
warn(message: any, context?: string): any;
|
|
18
|
+
warning(message: any, context?: string): any;
|
|
19
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file logger.service.ts
|
|
4
|
+
* @date 2023
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MyLoggerService = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const common_1 = require("@nestjs/common");
|
|
10
|
+
const winston_1 = tslib_1.__importDefault(require("winston"));
|
|
11
|
+
let MyLoggerService = class MyLoggerService {
|
|
12
|
+
constructor(constant) {
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
this.constant = constant;
|
|
15
|
+
const transports = new Array(2);
|
|
16
|
+
transports[0] = new winston_1.default.transports.Console({
|
|
17
|
+
level: ((_a = this.constant.console) === null || _a === void 0 ? void 0 : _a.level) || 'info',
|
|
18
|
+
format: winston_1.default.format.combine(winston_1.default.format.colorize(), winston_1.default.format.align(), winston_1.default.format.simple(), winston_1.default.format.timestamp({ format: (_b = this.constant.console) === null || _b === void 0 ? void 0 : _b.timestampFormat }), winston_1.default.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)),
|
|
19
|
+
});
|
|
20
|
+
if ((_c = this.constant.cloudwatch) === null || _c === void 0 ? void 0 : _c.enabled) {
|
|
21
|
+
// do nothing
|
|
22
|
+
}
|
|
23
|
+
this.winstonLogger = winston_1.default.createLogger({
|
|
24
|
+
levels: winston_1.default.config.syslog.levels,
|
|
25
|
+
transports,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
debug(message, context) {
|
|
29
|
+
this.winstonLogger.debug(message, context);
|
|
30
|
+
}
|
|
31
|
+
error(message, context) {
|
|
32
|
+
this.winstonLogger.error(message, context);
|
|
33
|
+
}
|
|
34
|
+
log(message, context) {
|
|
35
|
+
this.winstonLogger.info(message, context);
|
|
36
|
+
}
|
|
37
|
+
info(message, context) {
|
|
38
|
+
this.winstonLogger.info(message, context);
|
|
39
|
+
}
|
|
40
|
+
verbose(message, context) {
|
|
41
|
+
this.winstonLogger.verbose(message, context);
|
|
42
|
+
}
|
|
43
|
+
warn(message, context) {
|
|
44
|
+
this.winstonLogger.warning(message, context);
|
|
45
|
+
}
|
|
46
|
+
warning(message, context) {
|
|
47
|
+
this.winstonLogger.warning(message, context);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
MyLoggerService = tslib_1.__decorate([
|
|
51
|
+
(0, common_1.Injectable)(),
|
|
52
|
+
tslib_1.__param(0, (0, common_1.Inject)('MyLoggerConstant'))
|
|
53
|
+
], MyLoggerService);
|
|
54
|
+
exports.MyLoggerService = MyLoggerService;
|
|
55
|
+
//# sourceMappingURL=logger.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.service.js","sourceRoot":"","sources":["../../src/logger/logger.service.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,2CAAmE;AACnE,8DAA8B;AAIvB,IAAM,eAAe,GAArB,MAAM,eAAe;IAG1B,YAAyD,QAAwB;;QAAxB,aAAQ,GAAR,QAAQ,CAAgB;QAC/E,MAAM,UAAU,GAAG,IAAI,KAAK,CAAM,CAAC,CAAC,CAAC;QAErC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,iBAAO,CAAC,UAAU,CAAC,OAAO,CAAC;YAC7C,KAAK,EAAE,CAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,0CAAE,KAAK,KAAI,MAAM;YAC7C,MAAM,EAAE,iBAAO,CAAC,MAAM,CAAC,OAAO,CAC5B,iBAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EACzB,iBAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EACtB,iBAAO,CAAC,MAAM,CAAC,MAAM,EAAE,EACvB,iBAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,0CAAE,eAAe,EAAE,CAAC,EAC5E,iBAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,I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,CAAC,CAAA;GAH5B,eAAe,CAsD3B;AAtDY,0CAAe"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file index.ts
|
|
4
|
+
* @date 2023
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
tslib_1.__exportStar(require("./mexc.config"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./mexc.module"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./mexc.service"), exports);
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mexc/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,wDAA8B;AAC9B,wDAA8B;AAC9B,yDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mexc.config.js","sourceRoot":"","sources":["../../src/mexc/mexc.config.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file mexc.module.ts
|
|
4
|
+
* @date 2023
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MexcModule = void 0;
|
|
8
|
+
const config_1 = require("../config");
|
|
9
|
+
const mexc_service_1 = require("./mexc.service");
|
|
10
|
+
class MexcModule {
|
|
11
|
+
static forRoot(options) {
|
|
12
|
+
return {
|
|
13
|
+
module: MexcModule,
|
|
14
|
+
imports: [config_1.ConfigModule.forRoot(options)],
|
|
15
|
+
exports: [mexc_service_1.MexcService],
|
|
16
|
+
providers: [
|
|
17
|
+
{
|
|
18
|
+
provide: 'MexcConstant',
|
|
19
|
+
useFactory: (mexcConfig) => {
|
|
20
|
+
return mexcConfig.config();
|
|
21
|
+
},
|
|
22
|
+
inject: [config_1.ConfigService],
|
|
23
|
+
},
|
|
24
|
+
mexc_service_1.MexcService,
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.MexcModule = MexcModule;
|
|
30
|
+
//# sourceMappingURL=mexc.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mexc.module.js","sourceRoot":"","sources":["../../src/mexc/mexc.module.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,sCAAuE;AAEvE,iDAA6C;AAE7C,MAAa,UAAU;IACrB,MAAM,CAAC,OAAO,CAAC,OAAuB;QACpC,OAAO;YACL,MAAM,EAAE,UAAU;YAClB,OAAO,EAAE,CAAC,qBAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACxC,OAAO,EAAE,CAAC,0BAAW,CAAC;YACtB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,cAAc;oBACvB,UAAU,EAAE,CAAC,UAAqC,EAAO,EAAE;wBACzD,OAAO,UAAU,CAAC,MAAM,EAAE,CAAC;oBAC7B,CAAC;oBACD,MAAM,EAAE,CAAC,sBAAa,CAAC;iBACxB;gBACD,0BAAW;aACZ;SACF,CAAC;IACJ,CAAC;CACF;AAlBD,gCAkBC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file mexc.service.ts
|
|
3
|
+
* @date 2023
|
|
4
|
+
* @see https://mxcdevelop.github.io/APIDoc/
|
|
5
|
+
*/
|
|
6
|
+
import { MexcConfig } from './mexc.config';
|
|
7
|
+
export declare class MexcService {
|
|
8
|
+
private readonly constant;
|
|
9
|
+
constructor(constant: MexcConfig);
|
|
10
|
+
/**
|
|
11
|
+
* Market Data - Ticker Information
|
|
12
|
+
* @param symbol e.g. BTC_USDC
|
|
13
|
+
*/
|
|
14
|
+
marketTicker(symbol: string): Promise<any>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file mexc.service.ts
|
|
4
|
+
* @date 2023
|
|
5
|
+
* @see https://mxcdevelop.github.io/APIDoc/
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.MexcService = void 0;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
12
|
+
let MexcService = class MexcService {
|
|
13
|
+
constructor(constant) {
|
|
14
|
+
this.constant = constant;
|
|
15
|
+
// do nothing
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Market Data - Ticker Information
|
|
19
|
+
* @param symbol e.g. BTC_USDC
|
|
20
|
+
*/
|
|
21
|
+
marketTicker(symbol) {
|
|
22
|
+
var _a;
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
if (!((_a = this.constant.mexc) === null || _a === void 0 ? void 0 : _a.enabled)) {
|
|
25
|
+
throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
|
|
26
|
+
}
|
|
27
|
+
return (yield (0, axios_1.default)({
|
|
28
|
+
method: 'GET',
|
|
29
|
+
url: this.constant.mexc.url + '/open/api/v2/market/ticker',
|
|
30
|
+
params: {
|
|
31
|
+
symbol,
|
|
32
|
+
},
|
|
33
|
+
})).data;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
MexcService = tslib_1.__decorate([
|
|
38
|
+
(0, common_1.Injectable)(),
|
|
39
|
+
tslib_1.__param(0, (0, common_1.Inject)('MexcConstant'))
|
|
40
|
+
], MexcService);
|
|
41
|
+
exports.MexcService = MexcService;
|
|
42
|
+
//# sourceMappingURL=mexc.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mexc.service.js","sourceRoot":"","sources":["../../src/mexc/mexc.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,2CAA+E;AAC/E,0DAA0B;AAInB,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YAAqD,QAAoB;QAApB,aAAQ,GAAR,QAAQ,CAAY;QACvE,aAAa;IACf,CAAC;IAED;;;OAGG;IACG,YAAY,CAAC,MAAc;;;YAC/B,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,0CAAE,OAAO,CAAA,EAAE;gBAChC,MAAM,IAAI,sBAAa,CAAC,+BAA+B,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;aAClF;YACD,OAAO,CACL,MAAM,IAAA,eAAK,EAAC;gBACV,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,GAAG,4BAA4B;gBAC1D,MAAM,EAAE;oBACN,MAAM;iBACP;aACF,CAAC,CACH,CAAC,IAAI,CAAC;;KACR;CACF,CAAA;AAvBY,WAAW;IADvB,IAAA,mBAAU,GAAE;IAEE,mBAAA,IAAA,eAAM,EAAC,cAAc,CAAC,CAAA;GADxB,WAAW,CAuBvB;AAvBY,kCAAW"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file filter.dto.ts
|
|
4
|
+
* @date 2023
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.FilterDto = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
10
|
+
class FilterDto {
|
|
11
|
+
}
|
|
12
|
+
tslib_1.__decorate([
|
|
13
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
14
|
+
type: Object,
|
|
15
|
+
description: 'An object containing a JavaScript expression or a full JavaScript function passed to the query system.',
|
|
16
|
+
})
|
|
17
|
+
], FilterDto.prototype, "where", void 0);
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
20
|
+
type: Object,
|
|
21
|
+
description: 'Sorts all input documents and returns them to the pipeline in sorted order.',
|
|
22
|
+
})
|
|
23
|
+
], FilterDto.prototype, "sort", void 0);
|
|
24
|
+
tslib_1.__decorate([
|
|
25
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
26
|
+
type: Number,
|
|
27
|
+
minimum: 0,
|
|
28
|
+
description: 'The number of items to skip before starting to collect the result set.',
|
|
29
|
+
example: 0,
|
|
30
|
+
})
|
|
31
|
+
], FilterDto.prototype, "skip", void 0);
|
|
32
|
+
tslib_1.__decorate([
|
|
33
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
34
|
+
type: Number,
|
|
35
|
+
minimum: 0,
|
|
36
|
+
maximum: 30,
|
|
37
|
+
description: 'The number of items to return.',
|
|
38
|
+
example: 10,
|
|
39
|
+
})
|
|
40
|
+
], FilterDto.prototype, "limit", void 0);
|
|
41
|
+
exports.FilterDto = FilterDto;
|
|
42
|
+
//# sourceMappingURL=filter.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.dto.js","sourceRoot":"","sources":["../../src/mongo/filter.dto.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,6CAAsD;AAEtD,MAAa,SAAS;CA6BrB;AAxBC;IAJC,IAAA,6BAAmB,EAAC;QACnB,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,wGAAwG;KACtH,CAAC;wCACU;AAMZ;IAJC,IAAA,6BAAmB,EAAC;QACnB,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,6EAA6E;KAC3F,CAAC;uCACS;AAQX;IANC,IAAA,6BAAmB,EAAC;QACnB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,wEAAwE;QACrF,OAAO,EAAE,CAAC;KACX,CAAC;uCACY;AASd;IAPC,IAAA,6BAAmB,EAAC;QACnB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,gCAAgC;QAC7C,OAAO,EAAE,EAAE;KACZ,CAAC;wCACa;AA5BjB,8BA6BC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file index.ts
|
|
4
|
+
* @date 2023
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
tslib_1.__exportStar(require("./filter.dto"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./mongo.service"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mongo/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAA6B;AAC7B,0DAAgC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file mongo.service.ts
|
|
3
|
+
* @date 2023
|
|
4
|
+
*/
|
|
5
|
+
import { FilterDto } from './filter.dto';
|
|
6
|
+
export declare class MongoService {
|
|
7
|
+
static find(query: any, filter: FilterDto, selectArgs?: string | any): Promise<any[]>;
|
|
8
|
+
static aggregate(aggregate2: any, filter: FilterDto, selectArgs?: string | any): any;
|
|
9
|
+
static count(query: any, filter: FilterDto): Promise<number>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file mongo.service.ts
|
|
4
|
+
* @date 2023
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MongoService = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
class MongoService {
|
|
10
|
+
static find(query, filter, selectArgs = '-_id -__v') {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
if (filter.where && Object.keys(filter.where).length) {
|
|
13
|
+
query.where(filter.where);
|
|
14
|
+
}
|
|
15
|
+
if (filter.sort && Object.keys(filter.sort).length) {
|
|
16
|
+
query.sort(filter.sort);
|
|
17
|
+
}
|
|
18
|
+
if (filter.skip) {
|
|
19
|
+
query.skip(filter.skip);
|
|
20
|
+
}
|
|
21
|
+
query.limit(filter.limit && filter.limit < 30 ? filter.limit : 30);
|
|
22
|
+
return query.select(selectArgs).exec();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
static aggregate(aggregate2, filter, selectArgs = '-_id -__v') {
|
|
26
|
+
if (filter.where && Object.keys(filter.where).length) {
|
|
27
|
+
aggregate2.match(filter.where);
|
|
28
|
+
}
|
|
29
|
+
if (filter.sort && Object.keys(filter.sort).length) {
|
|
30
|
+
aggregate2.sort(filter.sort);
|
|
31
|
+
}
|
|
32
|
+
if (filter.skip) {
|
|
33
|
+
aggregate2.skip(filter.skip);
|
|
34
|
+
}
|
|
35
|
+
aggregate2.limit(filter.limit && filter.limit < 30 ? filter.limit : 30);
|
|
36
|
+
return aggregate2.project(selectArgs);
|
|
37
|
+
}
|
|
38
|
+
static count(query, filter) {
|
|
39
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (filter.where) {
|
|
41
|
+
query.where(filter.where);
|
|
42
|
+
}
|
|
43
|
+
return query.countDocuments();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.MongoService = MongoService;
|
|
48
|
+
//# sourceMappingURL=mongo.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo.service.js","sourceRoot":"","sources":["../../src/mongo/mongo.service.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAIH,MAAa,YAAY;IACvB,MAAM,CAAO,IAAI,CAA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;QACD,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACxE,OAAO,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAO,KAAK,CAAC,KAAU,EAAE,MAAiB;;YAC9C,IAAI,MAAM,CAAC,KAAK,EAAE;gBAChB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC3B;YACD,OAAO,KAAK,CAAC,cAAc,EAAE,CAAC;QAChC,CAAC;KAAA;CACF;AAnCD,oCAmCC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file index.ts
|
|
4
|
+
* @date 2023
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
tslib_1.__exportStar(require("./viabtc.config"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./viabtc.module"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./viabtc.service"), exports);
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/viabtc/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0DAAgC;AAChC,0DAAgC;AAChC,2DAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viabtc.config.js","sourceRoot":"","sources":["../../src/viabtc/viabtc.config.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file viabtc.module.ts
|
|
4
|
+
* @date 2023
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ViabtcModule = void 0;
|
|
8
|
+
const config_1 = require("../config");
|
|
9
|
+
const viabtc_service_1 = require("./viabtc.service");
|
|
10
|
+
class ViabtcModule {
|
|
11
|
+
static forRoot(options) {
|
|
12
|
+
return {
|
|
13
|
+
module: ViabtcModule,
|
|
14
|
+
imports: [config_1.ConfigModule.forRoot(options)],
|
|
15
|
+
exports: [viabtc_service_1.ViabtcService],
|
|
16
|
+
providers: [
|
|
17
|
+
{
|
|
18
|
+
provide: 'ViabtcConstant',
|
|
19
|
+
useFactory: (viabtcConfig) => {
|
|
20
|
+
return viabtcConfig.config();
|
|
21
|
+
},
|
|
22
|
+
inject: [config_1.ConfigService],
|
|
23
|
+
},
|
|
24
|
+
viabtc_service_1.ViabtcService,
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ViabtcModule = ViabtcModule;
|
|
30
|
+
//# sourceMappingURL=viabtc.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viabtc.module.js","sourceRoot":"","sources":["../../src/viabtc/viabtc.module.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,sCAAuE;AAEvE,qDAAiD;AAEjD,MAAa,YAAY;IACvB,MAAM,CAAC,OAAO,CAAC,OAAuB;QACpC,OAAO;YACL,MAAM,EAAE,YAAY;YACpB,OAAO,EAAE,CAAC,qBAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACxC,OAAO,EAAE,CAAC,8BAAa,CAAC;YACxB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,gBAAgB;oBACzB,UAAU,EAAE,CAAC,YAAyC,EAAO,EAAE;wBAC7D,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;oBAC/B,CAAC;oBACD,MAAM,EAAE,CAAC,sBAAa,CAAC;iBACxB;gBACD,8BAAa;aACd;SACF,CAAC;IACJ,CAAC;CACF;AAlBD,oCAkBC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file viabtc.service.ts
|
|
4
|
+
* @date 2023
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ViabtcService = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const common_1 = require("@nestjs/common");
|
|
10
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
11
|
+
let ViabtcService = class ViabtcService {
|
|
12
|
+
constructor(constant) {
|
|
13
|
+
this.constant = constant;
|
|
14
|
+
// do nothing
|
|
15
|
+
}
|
|
16
|
+
// @see https://github.com/viabtc/viabtc_exchange_server/wiki/HTTP-Protocol#market-api
|
|
17
|
+
marketKline(params) {
|
|
18
|
+
var _a;
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
if (!((_a = this.constant.viabtc) === null || _a === void 0 ? void 0 : _a.enabled)) {
|
|
21
|
+
throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
|
|
22
|
+
}
|
|
23
|
+
return (yield (0, axios_1.default)({
|
|
24
|
+
method: 'POST',
|
|
25
|
+
url: this.constant.viabtc.url,
|
|
26
|
+
data: {
|
|
27
|
+
id: 68,
|
|
28
|
+
jsonrpc: '2.0',
|
|
29
|
+
method: 'market.kline',
|
|
30
|
+
params,
|
|
31
|
+
},
|
|
32
|
+
})).data;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
ViabtcService = tslib_1.__decorate([
|
|
37
|
+
(0, common_1.Injectable)(),
|
|
38
|
+
tslib_1.__param(0, (0, common_1.Inject)('ViabtcConstant'))
|
|
39
|
+
], ViabtcService);
|
|
40
|
+
exports.ViabtcService = ViabtcService;
|
|
41
|
+
//# sourceMappingURL=viabtc.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viabtc.service.js","sourceRoot":"","sources":["../../src/viabtc/viabtc.service.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,2CAA+E;AAC/E,0DAA0B;AAInB,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAAuD,QAAsB;QAAtB,aAAQ,GAAR,QAAQ,CAAc;QAC3E,aAAa;IACf,CAAC;IAED,sFAAsF;IAChF,WAAW,CAAC,MAAW;;;YAC3B,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,0CAAE,OAAO,CAAA,EAAE;gBAClC,MAAM,IAAI,sBAAa,CAAC,+BAA+B,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;aAClF;YACD,OAAO,CACL,MAAM,IAAA,eAAK,EAAC;gBACV,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG;gBAC7B,IAAI,EAAE;oBACJ,EAAE,EAAE,EAAE;oBACN,OAAO,EAAE,KAAK;oBACd,MAAM,EAAE,cAAc;oBACtB,MAAM;iBACP;aACF,CAAC,CACH,CAAC,IAAI,CAAC;;KACR;CACF,CAAA;AAvBY,aAAa;IADzB,IAAA,mBAAU,GAAE;IAEE,mBAAA,IAAA,eAAM,EAAC,gBAAgB,CAAC,CAAA;GAD1B,aAAa,CAuBzB;AAvBY,sCAAa"}
|