Skip to content

Commit

Permalink
fix: adjust processing logic with core package changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChoGathK committed Aug 31, 2022
1 parent dfa2c07 commit b4670b3
Show file tree
Hide file tree
Showing 10 changed files with 3,565 additions and 1,889 deletions.
5,389 changes: 3,533 additions & 1,856 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,27 @@
]
},
"dependencies": {
"@nestjs/common": "8.4.4",
"@vodyani/class-decorator": "^8.1.2",
"@vodyani/core": "^8.5.1",
"@vodyani/core": "^8.6.1",
"@vodyani/utils": "^8.4.3",
"chokidar": "3.5.3",
"lodash": "4.17.21",
"object-hash": "3.0.0"
},
"devDependencies": {
"@commitlint/cli": "16.2.3",
"@commitlint/config-conventional": "16.2.1",
"@nestjs/testing": "8.4.4",
"@types/express": "4.17.13",
"@types/jest": "27.4.1",
"@commitlint/cli": "16.3.0",
"@commitlint/config-conventional": "16.2.4",
"@nestjs/testing": "8.4.7",
"@types/jest": "27.5.2",
"@types/lodash": "^4.14.182",
"@types/node": "16.11.26",
"@types/node": "16.11.56",
"@types/object-hash": "2.2.1",
"@vodyani/eslint-config": "^1.0.10",
"@types/supertest": "2.0.12",
"@vodyani/eslint-config": "^1.1.0",
"husky": "7.0.4",
"jest": "27.5.1",
"ts-jest": "27.1.4",
"typescript": "4.6.3"
"supertest": "6.2.4",
"ts-jest": "27.1.5",
"typescript": "4.8.2"
}
}
2 changes: 1 addition & 1 deletion src/common/interface/manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { WatchOptions } from 'chokidar';
import { DynamicModule, ForwardReference, Provider, Type } from '@nestjs/common';
import { Type, DynamicModule, ForwardReference, Provider } from '@vodyani/core';

export interface EnvConfigOptions {
current: any;
Expand Down
15 changes: 9 additions & 6 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { DynamicModule } from '@nestjs/common';
import { DynamicModule } from '@vodyani/core';
import { isValidArray, toConvert } from '@vodyani/utils';

import {
ArkManager,
AsyncDynamicDataSourceProvider,
ConfigHandler,
ConfigMonitor,
ConfigProvider,
DynamicDataSourceProvider,
} from './provider';
import { ArkModuleOptions } from './common';
import { ArkManager } from './provider/manager';
import { ConfigProvider } from './provider/config';
import { ConfigMonitor } from './provider/monitor';
import { ConfigHandler } from './provider/handler';
import { DynamicDataSourceProvider, AsyncDynamicDataSourceProvider } from './provider/dynamic-data-source';

export class ArkModule {
static forRoot(options: ArkModuleOptions): DynamicModule {
Expand Down
6 changes: 3 additions & 3 deletions src/provider/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cloneDeep, Dictionary } from 'lodash';
import { Injectable } from '@nestjs/common';
import { cloneDeep } from 'lodash';
import { Injectable } from '@vodyani/core';
import { ArgumentValidator, CustomValidated, Required, This } from '@vodyani/class-decorator';
import { toDeepMerge, toDeepMatch, toDeepRestore, isValidObject, isKeyof } from '@vodyani/utils';
import { toDeepMerge, toDeepMatch, toDeepRestore, isValidObject, isKeyof, Dictionary } from '@vodyani/utils';

@Injectable()
export class ConfigProvider<T = any> {
Expand Down
3 changes: 1 addition & 2 deletions src/provider/dynamic-data-source.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { toConvert } from '@vodyani/utils';
import { Injectable } from '@nestjs/common';
import { AsyncInject } from '@vodyani/core';
import { AsyncInject, Injectable } from '@vodyani/core';
import { ArgumentValidator, Required, This } from '@vodyani/class-decorator';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/provider/handler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readFileSync } from 'fs';

import { Injectable } from '@nestjs/common';
import { Injectable } from '@vodyani/core';
import { isValidObject } from '@vodyani/utils';
import { ArgumentValidator, CustomValidated, This } from '@vodyani/class-decorator';

Expand Down
10 changes: 4 additions & 6 deletions src/provider/manager.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { existsSync } from 'fs';

import { FactoryProvider } from '@nestjs/common';
import { isValidArray, isValidDict, toConvert } from '@vodyani/utils';
import { AsyncInjectable, AsyncProviderFactory, getToken } from '@vodyani/core';
import { ArgumentValidator, CustomValidated, This } from '@vodyani/class-decorator';
import { AsyncInjectable, AsyncProvider, AsyncProviderFactory } from '@vodyani/core';

import { ArkManagerOptions, RemoteConfigClient, RemoteConfigOptions } from '../common';

Expand All @@ -12,15 +11,14 @@ import { ConfigMonitor } from './monitor';
import { ConfigProvider } from './config';

@AsyncInjectable
export class ArkManager implements AsyncProviderFactory {
export class ArkManager extends AsyncProvider implements AsyncProviderFactory {
private options: ArkManagerOptions;

@This
@ArgumentValidator()
public create(
@CustomValidated(isValidDict, 'options is a required parameter!') options: ArkManagerOptions,
): FactoryProvider
{
) {
this.options = options;

const inject: any[] = [
Expand All @@ -36,7 +34,7 @@ export class ArkManager implements AsyncProviderFactory {
return {
inject,
useFactory: this.useFactory,
provide: getToken(ArkManager),
provide: ArkManager.getToken(),
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/provider/monitor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { existsSync, readFileSync } from 'fs';

import { uniqueId } from 'lodash';
import { Injectable } from '@nestjs/common';
import { Injectable } from '@vodyani/core';
import { This } from '@vodyani/class-decorator';
import { isValid, Method, toCycle } from '@vodyani/utils';
import { FSWatcher, watch, WatchOptions } from 'chokidar';
Expand Down
3 changes: 1 addition & 2 deletions test/config-manager.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { resolve } from 'path';

import { getToken } from '@vodyani/core';
import { toDelay } from '@vodyani/utils';
import { This } from '@vodyani/class-decorator';
import { Injectable, Module } from '@nestjs/common';
Expand Down Expand Up @@ -105,7 +104,7 @@ describe('ArkModule', () => {
})],
}).compile();

config = moduleRef.get<ConfigProvider>(getToken(ArkManager));
config = moduleRef.get<ConfigProvider>(ArkManager.getToken());

await toDelay(1000);

Expand Down

0 comments on commit b4670b3

Please sign in to comment.