@appolo/cache
Advanced tools
Comparing version 7.0.16 to 8.0.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CacheProvider = exports.cache = exports.CacheModule = void 0; | ||
const decorators_1 = require("./module/src/decorators"); | ||
exports.cache = decorators_1.cache; | ||
Object.defineProperty(exports, "cache", { enumerable: true, get: function () { return decorators_1.cache; } }); | ||
const cacheProvider_1 = require("./module/src/cacheProvider"); | ||
exports.CacheProvider = cacheProvider_1.CacheProvider; | ||
Object.defineProperty(exports, "CacheProvider", { enumerable: true, get: function () { return cacheProvider_1.CacheProvider; } }); | ||
const cacheModule_1 = require("./module/cacheModule"); | ||
exports.CacheModule = cacheModule_1.CacheModule; | ||
Object.defineProperty(exports, "CacheModule", { enumerable: true, get: function () { return cacheModule_1.CacheModule; } }); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
var CacheModule_1; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CacheModule = void 0; | ||
const tslib_1 = require("tslib"); | ||
const appolo_1 = require("appolo"); | ||
const engine_1 = require("@appolo/engine"); | ||
const _ = require("lodash"); | ||
const decorators_1 = require("./src/decorators"); | ||
const cacheProvider_1 = require("./src/cacheProvider"); | ||
let CacheModule = CacheModule_1 = class CacheModule extends appolo_1.Module { | ||
constructor(options) { | ||
super(options); | ||
let CacheModule = CacheModule_1 = class CacheModule extends engine_1.Module { | ||
constructor() { | ||
super(...arguments); | ||
this.Defaults = { | ||
@@ -21,3 +22,3 @@ id: "cacheProvider", | ||
static for(options) { | ||
return new CacheModule_1(options); | ||
return { type: CacheModule_1, options }; | ||
} | ||
@@ -27,4 +28,4 @@ get exports() { | ||
} | ||
beforeInitialize() { | ||
let meta = appolo_1.Util.findAllReflectData(decorators_1.CacheSymbol, this.app.parent.exported); | ||
beforeModuleInitialize() { | ||
let meta = this.app.tree.parent.discovery.findAllReflectData(decorators_1.CacheSymbol); | ||
_.forEach(meta, (item => this._createCacheActions(item))); | ||
@@ -48,5 +49,5 @@ } | ||
CacheModule = CacheModule_1 = tslib_1.__decorate([ | ||
appolo_1.module() | ||
engine_1.module() | ||
], CacheModule); | ||
exports.CacheModule = CacheModule; | ||
//# sourceMappingURL=cacheModule.js.map |
@@ -1,2 +0,3 @@ | ||
import {module, Module, Util} from 'appolo'; | ||
import {module, Module,IModuleParams} from '@appolo/engine'; | ||
import {Reflector} from '@appolo/utils'; | ||
import {ICacheMetadata, ICacheMetadataIndex, IOptions} from "./src/IOptions"; | ||
@@ -21,10 +22,6 @@ | ||
constructor(options?: IOptions) { | ||
super(options) | ||
public static for(options?: IOptions): IModuleParams { | ||
return {type:CacheModule,options}; | ||
} | ||
public static for(options: IOptions): CacheModule { | ||
return new CacheModule(options) | ||
} | ||
public get exports() { | ||
@@ -35,5 +32,5 @@ return [{id: this.moduleOptions.id, type: CacheProvider}]; | ||
public beforeInitialize() { | ||
public beforeModuleInitialize() { | ||
let meta = Util.findAllReflectData<ICacheMetadataIndex>(CacheSymbol, this.app.parent.exported); | ||
let meta = this.app.tree.parent.discovery.findAllReflectData<ICacheMetadataIndex>(CacheSymbol); | ||
@@ -40,0 +37,0 @@ _.forEach(meta, (item => this._createCacheActions(item))); |
@@ -1,7 +0,6 @@ | ||
import {IEnv as RootEnv} from 'appolo'; | ||
import {IOptions} from "../../src/IOptions"; | ||
export interface IEnv extends RootEnv { | ||
export interface IEnv { | ||
} |
@@ -6,6 +6,6 @@ "use strict"; | ||
if (!app.injector.getInstance("logger")) { | ||
await app.module(logger_1.LoggerModule); | ||
await app.module.load(logger_1.LoggerModule); | ||
} | ||
if (moduleOptions.connection) { | ||
await app.module(redis_1.RedisModule.for({ | ||
await app.module.use(redis_1.RedisModule.for({ | ||
connection: moduleOptions.connection, | ||
@@ -12,0 +12,0 @@ fallbackConnections: moduleOptions.fallbackConnections |
@@ -1,2 +0,2 @@ | ||
import {App} from 'appolo'; | ||
import {App} from '@appolo/core'; | ||
@@ -11,7 +11,7 @@ import {RedisModule} from '@appolo/redis'; | ||
if (!app.injector.getInstance("logger")) { | ||
await app.module(LoggerModule) | ||
await app.module.load(LoggerModule) | ||
} | ||
if (moduleOptions.connection) { | ||
await app.module(RedisModule.for({ | ||
await app.module.use(RedisModule.for({ | ||
connection: moduleOptions.connection, | ||
@@ -18,0 +18,0 @@ fallbackConnections: moduleOptions.fallbackConnections |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Cache = void 0; | ||
const tslib_1 = require("tslib"); | ||
const appolo_1 = require("appolo"); | ||
const inject_1 = require("@appolo/inject"); | ||
const appolo_cache_1 = require("appolo-cache"); | ||
@@ -195,17 +196,17 @@ const _ = require("lodash"); | ||
tslib_1.__decorate([ | ||
appolo_1.injectLazy() | ||
inject_1.lazy() | ||
], Cache.prototype, "redisProvider", void 0); | ||
tslib_1.__decorate([ | ||
appolo_1.inject() | ||
inject_1.inject() | ||
], Cache.prototype, "moduleOptions", void 0); | ||
tslib_1.__decorate([ | ||
appolo_1.inject() | ||
inject_1.inject() | ||
], Cache.prototype, "logger", void 0); | ||
tslib_1.__decorate([ | ||
appolo_1.initMethod() | ||
inject_1.init() | ||
], Cache.prototype, "initialize", null); | ||
Cache = tslib_1.__decorate([ | ||
appolo_1.define() | ||
inject_1.define() | ||
], Cache); | ||
exports.Cache = Cache; | ||
//# sourceMappingURL=cache.js.map |
@@ -1,2 +0,2 @@ | ||
import {define, initMethod, inject, injectLazy} from 'appolo'; | ||
import {define, init, inject, lazy} from '@appolo/inject'; | ||
import {RedisProvider} from '@appolo/redis'; | ||
@@ -14,3 +14,3 @@ import {Cache as ACache} from "appolo-cache"; | ||
@injectLazy() private redisProvider: RedisProvider; | ||
@lazy() private redisProvider: RedisProvider; | ||
@inject() private moduleOptions: IOptions; | ||
@@ -29,3 +29,3 @@ @inject() private logger: ILogger; | ||
@initMethod() | ||
@init() | ||
private initialize() { | ||
@@ -32,0 +32,0 @@ this._cache = new ACache<string, any>(this._options); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CacheProvider = void 0; | ||
const tslib_1 = require("tslib"); | ||
const index_1 = require("appolo/index"); | ||
const inject_1 = require("@appolo/inject"); | ||
const cache_1 = require("./cache"); | ||
@@ -53,12 +54,12 @@ const _ = require("lodash"); | ||
tslib_1.__decorate([ | ||
index_1.injectFactoryMethod(cache_1.Cache) | ||
inject_1.factoryMethod(cache_1.Cache) | ||
], CacheProvider.prototype, "createCacheInstance", void 0); | ||
tslib_1.__decorate([ | ||
index_1.inject() | ||
inject_1.inject() | ||
], CacheProvider.prototype, "moduleOptions", void 0); | ||
CacheProvider = tslib_1.__decorate([ | ||
index_1.define(), | ||
index_1.singleton() | ||
inject_1.define(), | ||
inject_1.singleton() | ||
], CacheProvider); | ||
exports.CacheProvider = CacheProvider; | ||
//# sourceMappingURL=cacheProvider.js.map |
@@ -1,2 +0,2 @@ | ||
import {define, inject, injectFactoryMethod, singleton} from "appolo/index"; | ||
import {define, inject, factoryMethod, singleton} from "@appolo/inject"; | ||
import {Cache} from "./cache"; | ||
@@ -10,3 +10,3 @@ import {ICacheOptions, IOptions} from "./IOptions"; | ||
@injectFactoryMethod(Cache) private createCacheInstance: (options: ICacheOptions, valueFn: Function, scope?: any) => Cache; | ||
@factoryMethod(Cache) private createCacheInstance: (options: ICacheOptions, valueFn: Function, scope?: any) => Cache; | ||
@inject() private moduleOptions: IOptions; | ||
@@ -13,0 +13,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const appolo_1 = require("appolo"); | ||
exports.cache = exports.CacheSymbol = void 0; | ||
const utils_1 = require("@appolo/utils"); | ||
exports.CacheSymbol = Symbol("CacheSymbol"); | ||
function cache(options = {}) { | ||
return function (target, propertyKey, descriptor) { | ||
let data = appolo_1.Util.getReflectData(exports.CacheSymbol, target.constructor, {}); | ||
let data = utils_1.Reflector.getFnMetadata(exports.CacheSymbol, target.constructor, {}); | ||
if (!data[propertyKey]) { | ||
@@ -9,0 +10,0 @@ data[propertyKey] = { |
@@ -1,2 +0,2 @@ | ||
import {Util} from 'appolo' | ||
import {Reflector} from '@appolo/utils' | ||
import {ICacheMetadata, ICacheMetadataIndex, ICacheOptions} from "./IOptions"; | ||
@@ -11,3 +11,3 @@ | ||
let data = Util.getReflectData<ICacheMetadataIndex>(CacheSymbol, target.constructor, {}); | ||
let data = Reflector.getFnMetadata<ICacheMetadataIndex>(CacheSymbol, target.constructor, {}); | ||
@@ -14,0 +14,0 @@ if (!data[propertyKey]) { |
@@ -1,5 +0,4 @@ | ||
import {IModuleOptions} from 'appolo'; | ||
import Timer = NodeJS.Timer; | ||
export interface IOptions extends IModuleOptions { | ||
export interface IOptions { | ||
id?: string | ||
@@ -6,0 +5,0 @@ connection?: string; |
{ | ||
"name": "@appolo/cache", | ||
"version": "7.0.16", | ||
"version": "8.0.0", | ||
"description": "appolo cache module", | ||
@@ -14,7 +14,8 @@ "publishConfig": { | ||
"dependencies": { | ||
"@appolo/logger": "^7.0.0", | ||
"@appolo/redis": "^7.0.6", | ||
"appolo": "^7.0.2", | ||
"appolo-cache": "^6.0.9", | ||
"lodash": "^4.17.15" | ||
"@appolo/core": "^8.0.5", | ||
"@appolo/logger": "^8.0.4", | ||
"@appolo/redis": "^8.0.0", | ||
"@appolo/utils": "^8.0.5", | ||
"appolo-cache": "^8.0.0", | ||
"lodash": "^4.17.20" | ||
}, | ||
@@ -25,15 +26,15 @@ "scripts": { | ||
"devDependencies": { | ||
"bluebird": "^3.7.1", | ||
"@types/bluebird": "^3.5.25", | ||
"@types/chai": "^4.1.7", | ||
"@types/lodash": "^4.14.120", | ||
"@types/mocha": "^5.2.5", | ||
"@types/node": "^10.12.18", | ||
"@types/sinon": "^7.0.4", | ||
"@types/sinon-chai": "^3.2.2", | ||
"bluebird": "^3.7.2", | ||
"@types/bluebird": "^3.5.33", | ||
"@types/chai": "^4.2.14", | ||
"@types/lodash": "^4.14.165", | ||
"@types/mocha": "^8.2.0", | ||
"@types/node": "^14.14.12", | ||
"@types/sinon": "^9.0.9", | ||
"@types/sinon-chai": "^3.2.5", | ||
"chai": "^4.2.0", | ||
"mocha": "^5.2.0", | ||
"sinon": "^7.2.3", | ||
"sinon-chai": "^3.3.0", | ||
"typescript": "^3.2.4" | ||
"mocha": "^8.2.1", | ||
"sinon": "^9.2.1", | ||
"sinon-chai": "^3.5.0", | ||
"typescript": "^4.1.2" | ||
}, | ||
@@ -40,0 +41,0 @@ "repository": { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const appolo_1 = require("appolo"); | ||
const core_1 = require("@appolo/core"); | ||
const Q = require("bluebird"); | ||
@@ -15,4 +15,4 @@ const handler_1 = require("./src/handler"); | ||
beforeEach(async () => { | ||
app = appolo_1.createApp({ root: __dirname, environment: "production", port: 8181 }); | ||
await app.module(new index_1.CacheModule({ connection: process.env.REDIS })); | ||
app = core_1.createApp({ root: __dirname, environment: "production", port: 8181 }); | ||
app.module.use(index_1.CacheModule.for({ connection: process.env.REDIS })); | ||
await app.launch(); | ||
@@ -19,0 +19,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
import {App, createApp} from 'appolo' | ||
import {App, createApp} from '@appolo/core' | ||
import * as Q from 'bluebird' | ||
@@ -23,3 +23,3 @@ import {Handler, InheritHandler1, InheritHandler2} from "./src/handler"; | ||
await app.module(new CacheModule({connection: process.env.REDIS})); | ||
app.module.use(CacheModule.for({connection: process.env.REDIS})); | ||
@@ -26,0 +26,0 @@ await app.launch(); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.InheritHandler2 = exports.InheritHandler1 = exports.BaseHandler = exports.Handler = void 0; | ||
const tslib_1 = require("tslib"); | ||
const appolo_1 = require("appolo"); | ||
const inject_1 = require("@appolo/inject"); | ||
const utils_1 = require("@appolo/utils"); | ||
const index_1 = require("../../index"); | ||
@@ -32,3 +34,3 @@ let Handler = class Handler { | ||
async handler7(id) { | ||
await appolo_1.Util.delay(10); | ||
await utils_1.Promises.delay(10); | ||
++this.test; | ||
@@ -38,3 +40,3 @@ return this.test; | ||
async handle8(id) { | ||
await appolo_1.Util.delay(10); | ||
await utils_1.Promises.delay(10); | ||
this.counter++; | ||
@@ -44,3 +46,3 @@ return null; | ||
async handle9(id) { | ||
await appolo_1.Util.delay(10); | ||
await utils_1.Promises.delay(10); | ||
this.counter++; | ||
@@ -78,4 +80,4 @@ return null; | ||
Handler = tslib_1.__decorate([ | ||
appolo_1.define(), | ||
appolo_1.singleton() | ||
inject_1.define(), | ||
inject_1.singleton() | ||
], Handler); | ||
@@ -95,4 +97,4 @@ exports.Handler = Handler; | ||
BaseHandler = tslib_1.__decorate([ | ||
appolo_1.define(), | ||
appolo_1.singleton() | ||
inject_1.define(), | ||
inject_1.singleton() | ||
], BaseHandler); | ||
@@ -103,4 +105,4 @@ exports.BaseHandler = BaseHandler; | ||
InheritHandler1 = tslib_1.__decorate([ | ||
appolo_1.define(), | ||
appolo_1.singleton() | ||
inject_1.define(), | ||
inject_1.singleton() | ||
], InheritHandler1); | ||
@@ -111,6 +113,6 @@ exports.InheritHandler1 = InheritHandler1; | ||
InheritHandler2 = tslib_1.__decorate([ | ||
appolo_1.define(), | ||
appolo_1.singleton() | ||
inject_1.define(), | ||
inject_1.singleton() | ||
], InheritHandler2); | ||
exports.InheritHandler2 = InheritHandler2; | ||
//# sourceMappingURL=handler.js.map |
@@ -1,2 +0,3 @@ | ||
import {define, singleton, Util} from 'appolo' | ||
import {define, singleton} from '@appolo/inject' | ||
import {Promises} from '@appolo/utils' | ||
import {cache} from "../../index"; | ||
@@ -48,3 +49,3 @@ | ||
await Util.delay(10); | ||
await Promises.delay(10); | ||
@@ -59,3 +60,3 @@ ++this.test; | ||
await Util.delay(10); | ||
await Promises.delay(10); | ||
@@ -70,3 +71,3 @@ this.counter++; | ||
await Util.delay(10); | ||
await Promises.delay(10); | ||
@@ -73,0 +74,0 @@ this.counter++; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46703
1165
6
+ Added@appolo/core@^8.0.5
+ Added@appolo/utils@^8.0.5
+ Added@appolo/agent@8.0.11(transitive)
+ Added@appolo/core@8.0.12(transitive)
+ Added@appolo/engine@8.0.26(transitive)
+ Added@appolo/events@8.0.2(transitive)
+ Added@appolo/inject@8.0.20(transitive)
+ Added@appolo/logger@8.1.2(transitive)
+ Added@appolo/redis@8.0.14(transitive)
+ Added@appolo/route@8.0.11(transitive)
+ Added@appolo/router@8.0.2(transitive)
+ Added@appolo/utils@8.0.57(transitive)
+ Added@ioredis/commands@1.2.0(transitive)
+ Addedabort-controller@3.0.0(transitive)
+ Addedappolo-cache@8.0.0(transitive)
+ Addedatomic-sleep@1.0.0(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedcolorette@2.0.20(transitive)
+ Addeddateformat@4.6.3(transitive)
+ Addeddenque@2.1.0(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedevent-target-shim@5.0.1(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedfast-copy@3.0.2(transitive)
+ Addedfast-redact@3.5.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@8.1.0(transitive)
+ Addedhelp-me@4.2.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedioredis@5.4.1(transitive)
+ Addedjoycon@3.1.1(transitive)
+ Addedmime@3.0.0(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedon-exit-leak-free@2.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpino@8.21.0(transitive)
+ Addedpino-abstract-transport@1.2.0(transitive)
+ Addedpino-pretty@9.4.1(transitive)
+ Addedpino-std-serializers@6.2.2(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedprocess-warning@3.0.0(transitive)
+ Addedpump@3.0.2(transitive)
+ Addedquick-format-unescaped@4.0.4(transitive)
+ Addedreadable-stream@4.5.2(transitive)
+ Addedreal-require@0.2.0(transitive)
+ Addedsecure-json-parse@2.7.0(transitive)
+ Addedsonic-boom@3.8.1(transitive)
+ Addedsplit2@4.2.0(transitive)
+ Addedstrip-json-comments@3.1.1(transitive)
+ Addedthread-stream@2.7.0(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedappolo@^7.0.2
- Removed@appolo/logger@7.0.1(transitive)
- Removed@appolo/redis@7.0.11(transitive)
- Removed@colors/colors@1.6.0(transitive)
- Removed@dabh/diagnostics@2.0.3(transitive)
- Removed@types/triple-beam@1.3.5(transitive)
- Removedappolo@7.0.5(transitive)
- Removedappolo-agent@7.0.1(transitive)
- Removedappolo-cache@6.0.9(transitive)
- Removedappolo-decorators@7.0.3(transitive)
- Removedappolo-engine@7.0.7(transitive)
- Removedappolo-event-dispatcher@7.0.2(transitive)
- Removedappolo-inject@7.0.12(transitive)
- Removedappolo-route@7.0.1(transitive)
- Removedappolo-utils@0.0.470.0.480.0.57(transitive)
- Removedasync@3.2.6(transitive)
- Removedbluebird@3.7.2(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedcolor@3.2.1(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcolor-string@1.9.1(transitive)
- Removedcolorspace@1.1.4(transitive)
- Removedcookie@0.4.2(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddenque@1.5.1(transitive)
- Removedenabled@2.0.0(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedfecha@4.2.3(transitive)
- Removedfn.name@1.1.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhasown@2.0.2(transitive)
- Removedioredis@4.28.5(transitive)
- Removedis-arrayish@0.3.2(transitive)
- Removedis-stream@2.0.1(transitive)
- Removedkuler@2.0.0(transitive)
- Removedlodash.flatten@4.4.0(transitive)
- Removedlogform@2.7.0(transitive)
- Removedmedia-typer@0.3.0(transitive)
- Removedmime@2.6.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedobject-inspect@1.13.3(transitive)
- Removedone-time@1.0.0(transitive)
- Removedp-map@2.1.0(transitive)
- Removedqs@6.13.1(transitive)
- Removedredis-commands@1.7.0(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedside-channel@1.0.6(transitive)
- Removedsimple-swizzle@0.2.2(transitive)
- Removedstack-trace@0.0.10(transitive)
- Removedtext-hex@1.0.0(transitive)
- Removedtriple-beam@1.4.1(transitive)
- Removedtslib@1.14.1(transitive)
- Removedtype-is@1.6.18(transitive)
- Removedwinston@3.17.0(transitive)
- Removedwinston-transport@4.9.0(transitive)
Updated@appolo/logger@^8.0.4
Updated@appolo/redis@^8.0.0
Updatedappolo-cache@^8.0.0
Updatedlodash@^4.17.20