Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@appolo/cache

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appolo/cache - npm Package Compare versions

Comparing version 7.0.16 to 8.0.0

7

index.js
"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++;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc