├── .gitignore ├── dist ├── cjs │ ├── specs │ │ ├── cache-buster.decorator.spec.d.ts │ │ ├── promise.cache-buster.decorator.spec.d.ts │ │ ├── cat.d.ts │ │ ├── service.interface.js │ │ ├── service.interface.js.map │ │ ├── cat.js.map │ │ ├── observable-cacheable.decorator.spec.d.ts │ │ ├── promise-cacheable.decorator.spec.d.ts │ │ ├── cat.js │ │ ├── service.interface.d.ts │ │ ├── cache-buster.decorator.spec.js.map │ │ └── promise.cache-buster.decorator.spec.js.map │ ├── common │ │ ├── ICachePair.d.ts │ │ ├── ICachePair.js │ │ ├── ICacheConfig.js │ │ ├── ICachePair.js.map │ │ ├── ICacheConfig.js.map │ │ ├── ICacheBusterConfig.js │ │ ├── ICacheBusterConfig.js.map │ │ ├── IObservableCacheConfig.js │ │ ├── IObservableCacheConfig.js.map │ │ ├── IStorageStrategy.js.map │ │ ├── IAsyncStorageStrategy.js.map │ │ ├── CacheBusterFunctions.d.ts │ │ ├── IStorageStrategy.js │ │ ├── IAsyncStorageStrategy.js │ │ ├── CacheBusterFunctions.js.map │ │ ├── IObservableCacheConfig.d.ts │ │ ├── InMemoryStorageStrategy.d.ts │ │ ├── CacheBusterFunctions.js │ │ ├── LocalStorageStrategy.d.ts │ │ ├── index.js.map │ │ ├── DOMStorageStrategy.d.ts │ │ ├── IStorageStrategy.d.ts │ │ ├── IAsyncStorageStrategy.d.ts │ │ ├── InMemoryStorageStrategy.js.map │ │ ├── ICacheBusterConfig.d.ts │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── ICacheConfig.d.ts │ │ ├── InMemoryStorageStrategy.js │ │ ├── LocalStorageStrategy.js.map │ │ ├── DOMStorageStrategy.js.map │ │ ├── LocalStorageStrategy.js │ │ └── DOMStorageStrategy.js │ ├── index.js.map │ ├── index.d.ts │ ├── promise.cacheable.decorator.d.ts │ ├── cacheable.decorator.d.ts │ ├── promise.cache-buster.decorator.d.ts │ ├── cache-buster.decorator.d.ts │ ├── promise.cache-buster.decorator.js.map │ ├── cache-buster.decorator.js.map │ ├── index.js │ ├── promise.cache-buster.decorator.js │ ├── cache-buster.decorator.js │ ├── cacheable.decorator.js.map │ └── promise.cacheable.decorator.js.map ├── esm5 │ ├── common │ │ ├── ICachePair.js │ │ ├── ICacheConfig.js │ │ ├── ICacheBusterConfig.js │ │ ├── IObservableCacheConfig.js │ │ ├── ICachePair.d.ts │ │ ├── ICachePair.js.map │ │ ├── ICacheConfig.js.map │ │ ├── ICacheBusterConfig.js.map │ │ ├── IObservableCacheConfig.js.map │ │ ├── IStorageStrategy.js.map │ │ ├── IAsyncStorageStrategy.js.map │ │ ├── IStorageStrategy.js │ │ ├── IAsyncStorageStrategy.js │ │ ├── CacheBusterFunctions.d.ts │ │ ├── CacheBusterFunctions.js.map │ │ ├── CacheBusterFunctions.js │ │ ├── IObservableCacheConfig.d.ts │ │ ├── InMemoryStorageStrategy.d.ts │ │ ├── LocalStorageStrategy.d.ts │ │ ├── DOMStorageStrategy.d.ts │ │ ├── IStorageStrategy.d.ts │ │ ├── index.js.map │ │ ├── IAsyncStorageStrategy.d.ts │ │ ├── index.js │ │ ├── InMemoryStorageStrategy.js.map │ │ ├── ICacheBusterConfig.d.ts │ │ ├── index.d.ts │ │ ├── ICacheConfig.d.ts │ │ ├── InMemoryStorageStrategy.js │ │ ├── LocalStorageStrategy.js.map │ │ ├── DOMStorageStrategy.js.map │ │ ├── LocalStorageStrategy.js │ │ └── DOMStorageStrategy.js │ ├── index.js.map │ ├── index.d.ts │ ├── index.js │ ├── promise.cacheable.decorator.d.ts │ ├── cacheable.decorator.d.ts │ ├── promise.cache-buster.decorator.d.ts │ ├── cache-buster.decorator.d.ts │ ├── promise.cache-buster.decorator.js.map │ ├── cache-buster.decorator.js.map │ ├── promise.cache-buster.decorator.js │ ├── cache-buster.decorator.js │ └── cacheable.decorator.js.map └── esm2015 │ ├── common │ ├── ICachePair.js │ ├── ICacheConfig.js │ ├── ICacheBusterConfig.js │ ├── IObservableCacheConfig.js │ ├── IStorageStrategy.js │ ├── IAsyncStorageStrategy.js │ ├── ICachePair.d.ts │ ├── ICachePair.js.map │ ├── ICacheConfig.js.map │ ├── ICacheBusterConfig.js.map │ ├── IObservableCacheConfig.js.map │ ├── IStorageStrategy.js.map │ ├── IAsyncStorageStrategy.js.map │ ├── CacheBusterFunctions.d.ts │ ├── CacheBusterFunctions.js.map │ ├── CacheBusterFunctions.js │ ├── IObservableCacheConfig.d.ts │ ├── InMemoryStorageStrategy.d.ts │ ├── LocalStorageStrategy.d.ts │ ├── DOMStorageStrategy.d.ts │ ├── IStorageStrategy.d.ts │ ├── index.js.map │ ├── index.js │ ├── IAsyncStorageStrategy.d.ts │ ├── InMemoryStorageStrategy.js.map │ ├── InMemoryStorageStrategy.js │ ├── ICacheBusterConfig.d.ts │ ├── index.d.ts │ ├── ICacheConfig.d.ts │ ├── LocalStorageStrategy.js.map │ ├── DOMStorageStrategy.js.map │ ├── LocalStorageStrategy.js │ └── DOMStorageStrategy.js │ ├── index.js.map │ ├── index.d.ts │ ├── index.js │ ├── promise.cacheable.decorator.d.ts │ ├── cacheable.decorator.d.ts │ ├── promise.cache-buster.decorator.d.ts │ ├── cache-buster.decorator.d.ts │ ├── promise.cache-buster.decorator.js.map │ ├── cache-buster.decorator.js.map │ ├── promise.cache-buster.decorator.js │ ├── cache-buster.decorator.js │ ├── cacheable.decorator.js.map │ └── promise.cacheable.decorator.js.map ├── .npmignore ├── common ├── ICacheConfig.js ├── ICachePair.js ├── ICacheBusterConfig.js ├── ICachePair.ts ├── IStorageStrategy.js ├── CacheBusterFunctions.ts ├── IObservableCacheConfig.ts ├── index.js ├── IStorageStrategy.ts ├── IAsyncStorageStrategy.ts ├── InMemoryStorageStrategy.ts ├── ICacheBusterConfig.ts ├── InMemoryStorageStrategy.js ├── index.ts ├── ICacheConfig.ts ├── LocalStorageStrategy.ts └── DOMStorageStrategy.ts ├── specs ├── cat.ts ├── service.interface.ts ├── promise.cache-buster.decorator.spec.ts └── cache-buster.decorator.spec.ts ├── .travis.yml ├── tsconfig.esm5.json ├── tsconfig.esm2015.json ├── index.ts ├── tsconfig.json ├── .github ├── stale.yml └── workflows │ ├── nodejs.yml │ └── release.yml ├── LICENSE ├── package.json ├── promise.cache-buster.decorator.ts ├── karma.conf.js └── cache-buster.decorator.ts /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | coverage/ -------------------------------------------------------------------------------- /dist/cjs/specs/cache-buster.decorator.spec.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | codecov 2 | codecov.SHA256SUM 3 | codecov.SHA256SUM.sig -------------------------------------------------------------------------------- /common/ICacheConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | -------------------------------------------------------------------------------- /common/ICachePair.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | -------------------------------------------------------------------------------- /dist/cjs/specs/promise.cache-buster.decorator.spec.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /common/ICacheBusterConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | -------------------------------------------------------------------------------- /dist/esm5/common/ICachePair.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=ICachePair.js.map -------------------------------------------------------------------------------- /dist/esm2015/common/ICachePair.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=ICachePair.js.map -------------------------------------------------------------------------------- /dist/esm5/common/ICacheConfig.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=ICacheConfig.js.map -------------------------------------------------------------------------------- /dist/esm2015/common/ICacheConfig.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=ICacheConfig.js.map -------------------------------------------------------------------------------- /dist/esm2015/common/ICacheBusterConfig.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=ICacheBusterConfig.js.map -------------------------------------------------------------------------------- /dist/esm5/common/ICacheBusterConfig.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=ICacheBusterConfig.js.map -------------------------------------------------------------------------------- /dist/esm5/common/IObservableCacheConfig.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=IObservableCacheConfig.js.map -------------------------------------------------------------------------------- /dist/esm2015/common/IObservableCacheConfig.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=IObservableCacheConfig.js.map -------------------------------------------------------------------------------- /dist/cjs/specs/cat.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Cat { 2 | meow(phrase: string): string; 3 | name: string; 4 | } 5 | -------------------------------------------------------------------------------- /common/ICachePair.ts: -------------------------------------------------------------------------------- 1 | export interface ICachePair { 2 | parameters: any; 3 | response: T; 4 | created: Date; 5 | } 6 | -------------------------------------------------------------------------------- /dist/esm2015/common/IStorageStrategy.js: -------------------------------------------------------------------------------- 1 | export class IStorageStrategy { 2 | } 3 | //# sourceMappingURL=IStorageStrategy.js.map -------------------------------------------------------------------------------- /specs/cat.ts: -------------------------------------------------------------------------------- 1 | export class Cat { 2 | meow(phrase: string) { return this.name + ' says ' + phrase }; 3 | name: string; 4 | } -------------------------------------------------------------------------------- /dist/cjs/common/ICachePair.d.ts: -------------------------------------------------------------------------------- 1 | export interface ICachePair { 2 | parameters: any; 3 | response: T; 4 | created: Date; 5 | } 6 | -------------------------------------------------------------------------------- /dist/esm2015/common/IAsyncStorageStrategy.js: -------------------------------------------------------------------------------- 1 | export class IAsyncStorageStrategy { 2 | } 3 | //# sourceMappingURL=IAsyncStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/esm2015/common/ICachePair.d.ts: -------------------------------------------------------------------------------- 1 | export interface ICachePair { 2 | parameters: any; 3 | response: T; 4 | created: Date; 5 | } 6 | -------------------------------------------------------------------------------- /dist/esm5/common/ICachePair.d.ts: -------------------------------------------------------------------------------- 1 | export interface ICachePair { 2 | parameters: any; 3 | response: T; 4 | created: Date; 5 | } 6 | -------------------------------------------------------------------------------- /dist/cjs/common/ICachePair.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=ICachePair.js.map -------------------------------------------------------------------------------- /dist/cjs/common/ICacheConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=ICacheConfig.js.map -------------------------------------------------------------------------------- /dist/cjs/common/ICachePair.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ICachePair.js","sourceRoot":"","sources":["../../../common/ICachePair.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/esm2015/common/ICachePair.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ICachePair.js","sourceRoot":"","sources":["../../../common/ICachePair.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/esm5/common/ICachePair.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ICachePair.js","sourceRoot":"","sources":["../../../common/ICachePair.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/cjs/common/ICacheConfig.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ICacheConfig.js","sourceRoot":"","sources":["../../../common/ICacheConfig.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/esm5/common/ICacheConfig.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ICacheConfig.js","sourceRoot":"","sources":["../../../common/ICacheConfig.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/cjs/common/ICacheBusterConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=ICacheBusterConfig.js.map -------------------------------------------------------------------------------- /dist/cjs/specs/service.interface.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=service.interface.js.map -------------------------------------------------------------------------------- /dist/esm2015/common/ICacheConfig.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ICacheConfig.js","sourceRoot":"","sources":["../../../common/ICacheConfig.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/cjs/specs/service.interface.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"service.interface.js","sourceRoot":"","sources":["../../../specs/service.interface.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/cjs/common/ICacheBusterConfig.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ICacheBusterConfig.js","sourceRoot":"","sources":["../../../common/ICacheBusterConfig.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/cjs/common/IObservableCacheConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=IObservableCacheConfig.js.map -------------------------------------------------------------------------------- /dist/esm2015/common/ICacheBusterConfig.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ICacheBusterConfig.js","sourceRoot":"","sources":["../../../common/ICacheBusterConfig.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/esm5/common/ICacheBusterConfig.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ICacheBusterConfig.js","sourceRoot":"","sources":["../../../common/ICacheBusterConfig.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/cjs/common/IObservableCacheConfig.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"IObservableCacheConfig.js","sourceRoot":"","sources":["../../../common/IObservableCacheConfig.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/esm5/common/IObservableCacheConfig.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"IObservableCacheConfig.js","sourceRoot":"","sources":["../../../common/IObservableCacheConfig.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/esm2015/common/IObservableCacheConfig.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"IObservableCacheConfig.js","sourceRoot":"","sources":["../../../common/IObservableCacheConfig.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/esm2015/common/IStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"IStorageStrategy.js","sourceRoot":"","sources":["../../../common/IStorageStrategy.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,gBAAgB;CAerC"} -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language : node_js 2 | sudo: required 3 | addons: 4 | chrome: stable 5 | node_js : 6 | - stable 7 | install: 8 | - npm install 9 | - npm install rxjs@6.2.0 10 | script: 11 | - npm test 12 | -------------------------------------------------------------------------------- /dist/esm2015/common/IAsyncStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"IAsyncStorageStrategy.js","sourceRoot":"","sources":["../../../common/IAsyncStorageStrategy.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,qBAAqB;CAe1C"} -------------------------------------------------------------------------------- /dist/esm5/common/IStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"IStorageStrategy.js","sourceRoot":"","sources":["../../../common/IStorageStrategy.ts"],"names":[],"mappings":"AAEA;IAAA;IAeA,CAAC;IAAD,uBAAC;AAAD,CAAC,AAfD,IAeC"} -------------------------------------------------------------------------------- /dist/cjs/common/IStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"IStorageStrategy.js","sourceRoot":"","sources":["../../../common/IStorageStrategy.ts"],"names":[],"mappings":";;;AAEA;IAAA;IAeA,CAAC;IAAD,uBAAC;AAAD,CAAC,AAfD,IAeC;AAfqB,4CAAgB"} -------------------------------------------------------------------------------- /dist/cjs/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAyC;AACzC,wDAAsC;AACtC,mEAAiD;AACjD,gEAA8C;AAC9C,2CAAyB;AACzB,mEAAiD;AACjD,8DAA4C;AAC5C,gEAA8C"} -------------------------------------------------------------------------------- /dist/esm5/common/IAsyncStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"IAsyncStorageStrategy.js","sourceRoot":"","sources":["../../../common/IAsyncStorageStrategy.ts"],"names":[],"mappings":"AAEA;IAAA;IAeA,CAAC;IAAD,4BAAC;AAAD,CAAC,AAfD,IAeC"} -------------------------------------------------------------------------------- /tsconfig.esm5.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "esnext", 5 | "target": "es5", 6 | "outDir": "./dist/esm5", 7 | }, 8 | "exclude": ["dist/**/*.ts", "specs/**/*.ts"] 9 | } -------------------------------------------------------------------------------- /tsconfig.esm2015.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "esnext", 5 | "target": "es2015", 6 | "outDir": "./dist/esm2015", 7 | }, 8 | "exclude": ["dist/**/*.ts", "specs/**/*.ts"] 9 | } -------------------------------------------------------------------------------- /dist/cjs/common/IAsyncStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"IAsyncStorageStrategy.js","sourceRoot":"","sources":["../../../common/IAsyncStorageStrategy.ts"],"names":[],"mappings":";;;AAEA;IAAA;IAeA,CAAC;IAAD,4BAAC;AAAD,CAAC,AAfD,IAeC;AAfqB,sDAAqB"} -------------------------------------------------------------------------------- /dist/esm5/common/IStorageStrategy.js: -------------------------------------------------------------------------------- 1 | var IStorageStrategy = /** @class */ (function () { 2 | function IStorageStrategy() { 3 | } 4 | return IStorageStrategy; 5 | }()); 6 | export { IStorageStrategy }; 7 | //# sourceMappingURL=IStorageStrategy.js.map -------------------------------------------------------------------------------- /common/IStorageStrategy.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | var IStorageStrategy = /** @class */ (function () { 4 | function IStorageStrategy() { 5 | } 6 | return IStorageStrategy; 7 | }()); 8 | exports.IStorageStrategy = IStorageStrategy; 9 | -------------------------------------------------------------------------------- /dist/cjs/specs/cat.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"cat.js","sourceRoot":"","sources":["../../../specs/cat.ts"],"names":[],"mappings":";;;AAAA;IAAA;IAGA,CAAC;IAFC,kBAAI,GAAJ,UAAK,MAAc,IAAI,OAAO,IAAI,CAAC,IAAI,GAAG,QAAQ,GAAG,MAAM,CAAA,CAAC,CAAC;IAAA,CAAC;IAEhE,UAAC;AAAD,CAAC,AAHD,IAGC;AAHY,kBAAG"} -------------------------------------------------------------------------------- /dist/esm5/common/IAsyncStorageStrategy.js: -------------------------------------------------------------------------------- 1 | var IAsyncStorageStrategy = /** @class */ (function () { 2 | function IAsyncStorageStrategy() { 3 | } 4 | return IAsyncStorageStrategy; 5 | }()); 6 | export { IAsyncStorageStrategy }; 7 | //# sourceMappingURL=IAsyncStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/esm5/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,UAAU,CAAC;AACzB,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC"} -------------------------------------------------------------------------------- /dist/esm2015/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,UAAU,CAAC;AACzB,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC"} -------------------------------------------------------------------------------- /dist/cjs/common/CacheBusterFunctions.d.ts: -------------------------------------------------------------------------------- 1 | import { ICacheBusterConfig, ICacheBusterConfigInstant } from "./ICacheBusterConfig"; 2 | export declare function bustCache(cacheBusterConfig: ICacheBusterConfig): void; 3 | export declare function isInstant(cacheBusterConfig?: ICacheBusterConfig | ICacheBusterConfigInstant): boolean; 4 | -------------------------------------------------------------------------------- /dist/esm5/common/CacheBusterFunctions.d.ts: -------------------------------------------------------------------------------- 1 | import { ICacheBusterConfig, ICacheBusterConfigInstant } from "./ICacheBusterConfig"; 2 | export declare function bustCache(cacheBusterConfig: ICacheBusterConfig): void; 3 | export declare function isInstant(cacheBusterConfig?: ICacheBusterConfig | ICacheBusterConfigInstant): boolean; 4 | -------------------------------------------------------------------------------- /dist/esm2015/common/CacheBusterFunctions.d.ts: -------------------------------------------------------------------------------- 1 | import { ICacheBusterConfig, ICacheBusterConfigInstant } from "./ICacheBusterConfig"; 2 | export declare function bustCache(cacheBusterConfig: ICacheBusterConfig): void; 3 | export declare function isInstant(cacheBusterConfig?: ICacheBusterConfig | ICacheBusterConfigInstant): boolean; 4 | -------------------------------------------------------------------------------- /dist/cjs/specs/observable-cacheable.decorator.spec.d.ts: -------------------------------------------------------------------------------- 1 | import { ICachePair } from '../common'; 2 | import { InMemoryStorageStrategy } from '../common/InMemoryStorageStrategy'; 3 | export declare class CustomContextStrategy extends InMemoryStorageStrategy { 4 | add(cachePair: ICachePair, cacheKey: string, ctx?: any): void; 5 | } 6 | -------------------------------------------------------------------------------- /dist/cjs/specs/promise-cacheable.decorator.spec.d.ts: -------------------------------------------------------------------------------- 1 | import { ICachePair } from '../common'; 2 | import { InMemoryStorageStrategy } from '../common/InMemoryStorageStrategy'; 3 | export declare class CustomContextStrategy extends InMemoryStorageStrategy { 4 | add(cachePair: ICachePair, cacheKey: string, ctx?: any): void; 5 | } 6 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | export * from './cache-buster.decorator'; 2 | export * from './cacheable.decorator'; 3 | export * from './promise.cache-buster.decorator'; 4 | export * from './promise.cacheable.decorator'; 5 | export * from './common'; 6 | export * from './common/InMemoryStorageStrategy'; 7 | export * from './common/DOMStorageStrategy'; 8 | export * from './common/LocalStorageStrategy'; 9 | -------------------------------------------------------------------------------- /dist/cjs/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './cache-buster.decorator'; 2 | export * from './cacheable.decorator'; 3 | export * from './promise.cache-buster.decorator'; 4 | export * from './promise.cacheable.decorator'; 5 | export * from './common'; 6 | export * from './common/InMemoryStorageStrategy'; 7 | export * from './common/DOMStorageStrategy'; 8 | export * from './common/LocalStorageStrategy'; 9 | -------------------------------------------------------------------------------- /dist/esm5/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './cache-buster.decorator'; 2 | export * from './cacheable.decorator'; 3 | export * from './promise.cache-buster.decorator'; 4 | export * from './promise.cacheable.decorator'; 5 | export * from './common'; 6 | export * from './common/InMemoryStorageStrategy'; 7 | export * from './common/DOMStorageStrategy'; 8 | export * from './common/LocalStorageStrategy'; 9 | -------------------------------------------------------------------------------- /dist/esm2015/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './cache-buster.decorator'; 2 | export * from './cacheable.decorator'; 3 | export * from './promise.cache-buster.decorator'; 4 | export * from './promise.cacheable.decorator'; 5 | export * from './common'; 6 | export * from './common/InMemoryStorageStrategy'; 7 | export * from './common/DOMStorageStrategy'; 8 | export * from './common/LocalStorageStrategy'; 9 | -------------------------------------------------------------------------------- /dist/cjs/specs/cat.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Cat = void 0; 4 | var Cat = /** @class */ (function () { 5 | function Cat() { 6 | } 7 | Cat.prototype.meow = function (phrase) { return this.name + ' says ' + phrase; }; 8 | ; 9 | return Cat; 10 | }()); 11 | exports.Cat = Cat; 12 | //# sourceMappingURL=cat.js.map -------------------------------------------------------------------------------- /dist/cjs/common/IStorageStrategy.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.IStorageStrategy = void 0; 4 | var IStorageStrategy = /** @class */ (function () { 5 | function IStorageStrategy() { 6 | } 7 | return IStorageStrategy; 8 | }()); 9 | exports.IStorageStrategy = IStorageStrategy; 10 | //# sourceMappingURL=IStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/esm2015/index.js: -------------------------------------------------------------------------------- 1 | export * from './cache-buster.decorator'; 2 | export * from './cacheable.decorator'; 3 | export * from './promise.cache-buster.decorator'; 4 | export * from './promise.cacheable.decorator'; 5 | export * from './common'; 6 | export * from './common/InMemoryStorageStrategy'; 7 | export * from './common/DOMStorageStrategy'; 8 | export * from './common/LocalStorageStrategy'; 9 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /dist/esm5/index.js: -------------------------------------------------------------------------------- 1 | export * from './cache-buster.decorator'; 2 | export * from './cacheable.decorator'; 3 | export * from './promise.cache-buster.decorator'; 4 | export * from './promise.cacheable.decorator'; 5 | export * from './common'; 6 | export * from './common/InMemoryStorageStrategy'; 7 | export * from './common/DOMStorageStrategy'; 8 | export * from './common/LocalStorageStrategy'; 9 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "sourceMap": true, 4 | "target": "es5", 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "declaration": true, 8 | "outDir": "./dist/cjs", 9 | "experimentalDecorators": true, 10 | "lib": ["es2016", "dom"], 11 | "noUnusedLocals": true, 12 | "noImplicitAny": true, 13 | "baseUrl": "./" 14 | }, 15 | "include": ["**/*.ts"] 16 | } 17 | -------------------------------------------------------------------------------- /dist/cjs/common/IAsyncStorageStrategy.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.IAsyncStorageStrategy = void 0; 4 | var IAsyncStorageStrategy = /** @class */ (function () { 5 | function IAsyncStorageStrategy() { 6 | } 7 | return IAsyncStorageStrategy; 8 | }()); 9 | exports.IAsyncStorageStrategy = IAsyncStorageStrategy; 10 | //# sourceMappingURL=IAsyncStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/esm2015/common/CacheBusterFunctions.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"CacheBusterFunctions.js","sourceRoot":"","sources":["../../../common/CacheBusterFunctions.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CAAC,iBAAqC;IAC7D,IAAI,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,mBAAmB,EAAE;QAC1C,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC;KAC9C;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,iBAAkE;IAC1F,OAAO,iBAAiB,IAAI,WAAW,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,SAAS,CAAA;AAC7F,CAAC"} -------------------------------------------------------------------------------- /dist/esm5/common/CacheBusterFunctions.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"CacheBusterFunctions.js","sourceRoot":"","sources":["../../../common/CacheBusterFunctions.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CAAC,iBAAqC;IAC7D,IAAI,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,mBAAmB,EAAE;QAC1C,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC;KAC9C;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,iBAAkE;IAC1F,OAAO,iBAAiB,IAAI,WAAW,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,SAAS,CAAA;AAC7F,CAAC"} -------------------------------------------------------------------------------- /dist/cjs/common/CacheBusterFunctions.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"CacheBusterFunctions.js","sourceRoot":"","sources":["../../../common/CacheBusterFunctions.ts"],"names":[],"mappings":";;;AAEA,SAAgB,SAAS,CAAC,iBAAqC;IAC7D,IAAI,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,mBAAmB,EAAE;QAC1C,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC;KAC9C;AACH,CAAC;AAJD,8BAIC;AAED,SAAgB,SAAS,CAAC,iBAAkE;IAC1F,OAAO,iBAAiB,IAAI,WAAW,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,SAAS,CAAA;AAC7F,CAAC;AAFD,8BAEC"} -------------------------------------------------------------------------------- /dist/cjs/promise.cacheable.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { Subject } from 'rxjs'; 2 | import { ICacheable } from './common'; 3 | import { ICacheConfig } from './common/ICacheConfig'; 4 | export declare const promiseGlobalCacheBusterNotifier: Subject; 5 | export declare function PCacheable(cacheConfig?: ICacheConfig): (_target: Object, _propertyKey: string, propertyDescriptor: TypedPropertyDescriptor>>) => TypedPropertyDescriptor>>; 6 | -------------------------------------------------------------------------------- /dist/esm5/promise.cacheable.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { Subject } from 'rxjs'; 2 | import { ICacheable } from './common'; 3 | import { ICacheConfig } from './common/ICacheConfig'; 4 | export declare const promiseGlobalCacheBusterNotifier: Subject; 5 | export declare function PCacheable(cacheConfig?: ICacheConfig): (_target: Object, _propertyKey: string, propertyDescriptor: TypedPropertyDescriptor>>) => TypedPropertyDescriptor>>; 6 | -------------------------------------------------------------------------------- /dist/esm2015/promise.cacheable.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { Subject } from 'rxjs'; 2 | import { ICacheable } from './common'; 3 | import { ICacheConfig } from './common/ICacheConfig'; 4 | export declare const promiseGlobalCacheBusterNotifier: Subject; 5 | export declare function PCacheable(cacheConfig?: ICacheConfig): (_target: Object, _propertyKey: string, propertyDescriptor: TypedPropertyDescriptor>>) => TypedPropertyDescriptor>>; 6 | -------------------------------------------------------------------------------- /dist/esm2015/common/CacheBusterFunctions.js: -------------------------------------------------------------------------------- 1 | export function bustCache(cacheBusterConfig) { 2 | if (cacheBusterConfig === null || cacheBusterConfig === void 0 ? void 0 : cacheBusterConfig.cacheBusterNotifier) { 3 | cacheBusterConfig.cacheBusterNotifier.next(); 4 | } 5 | } 6 | export function isInstant(cacheBusterConfig) { 7 | return cacheBusterConfig && 'isInstant' in cacheBusterConfig && cacheBusterConfig.isInstant; 8 | } 9 | //# sourceMappingURL=CacheBusterFunctions.js.map -------------------------------------------------------------------------------- /dist/esm5/common/CacheBusterFunctions.js: -------------------------------------------------------------------------------- 1 | export function bustCache(cacheBusterConfig) { 2 | if (cacheBusterConfig === null || cacheBusterConfig === void 0 ? void 0 : cacheBusterConfig.cacheBusterNotifier) { 3 | cacheBusterConfig.cacheBusterNotifier.next(); 4 | } 5 | } 6 | export function isInstant(cacheBusterConfig) { 7 | return cacheBusterConfig && 'isInstant' in cacheBusterConfig && cacheBusterConfig.isInstant; 8 | } 9 | //# sourceMappingURL=CacheBusterFunctions.js.map -------------------------------------------------------------------------------- /dist/cjs/cacheable.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { Observable, Subject } from 'rxjs'; 2 | import { ICacheable } from './common'; 3 | import { IObservableCacheConfig } from './common/IObservableCacheConfig'; 4 | export declare const globalCacheBusterNotifier: Subject; 5 | export declare function Cacheable(cacheConfig?: IObservableCacheConfig): (_target: Object, _propertyKey: string, propertyDescriptor: TypedPropertyDescriptor>>) => TypedPropertyDescriptor>>; 6 | -------------------------------------------------------------------------------- /dist/esm5/cacheable.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { Observable, Subject } from 'rxjs'; 2 | import { ICacheable } from './common'; 3 | import { IObservableCacheConfig } from './common/IObservableCacheConfig'; 4 | export declare const globalCacheBusterNotifier: Subject; 5 | export declare function Cacheable(cacheConfig?: IObservableCacheConfig): (_target: Object, _propertyKey: string, propertyDescriptor: TypedPropertyDescriptor>>) => TypedPropertyDescriptor>>; 6 | -------------------------------------------------------------------------------- /dist/esm2015/cacheable.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { Observable, Subject } from 'rxjs'; 2 | import { ICacheable } from './common'; 3 | import { IObservableCacheConfig } from './common/IObservableCacheConfig'; 4 | export declare const globalCacheBusterNotifier: Subject; 5 | export declare function Cacheable(cacheConfig?: IObservableCacheConfig): (_target: Object, _propertyKey: string, propertyDescriptor: TypedPropertyDescriptor>>) => TypedPropertyDescriptor>>; 6 | -------------------------------------------------------------------------------- /common/CacheBusterFunctions.ts: -------------------------------------------------------------------------------- 1 | import {ICacheBusterConfig, ICacheBusterConfigInstant} from "./ICacheBusterConfig"; 2 | 3 | export function bustCache(cacheBusterConfig: ICacheBusterConfig): void { 4 | if (cacheBusterConfig?.cacheBusterNotifier) { 5 | cacheBusterConfig.cacheBusterNotifier.next(); 6 | } 7 | } 8 | 9 | export function isInstant(cacheBusterConfig?: ICacheBusterConfig | ICacheBusterConfigInstant): boolean { 10 | return cacheBusterConfig && 'isInstant' in cacheBusterConfig && cacheBusterConfig.isInstant 11 | } 12 | -------------------------------------------------------------------------------- /common/IObservableCacheConfig.ts: -------------------------------------------------------------------------------- 1 | import { ICacheConfig } from './ICacheConfig'; 2 | import { IStorageStrategy } from './'; 3 | 4 | export interface IObservableCacheConfig extends ICacheConfig { 5 | /** 6 | * cache will be resolved asynchronously - an extra change detection pass will be made by 7 | * @description should cache be resolved asynchronously? - helps with declarative forms and two-way databinding via ngModel 8 | */ 9 | async?: boolean; 10 | 11 | /** 12 | * storage strategy 13 | */ 14 | storageStrategy?: new () => IStorageStrategy; 15 | } -------------------------------------------------------------------------------- /common/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | var IStorageStrategy_1 = require("./IStorageStrategy"); 4 | exports.IStorageStrategy = IStorageStrategy_1.IStorageStrategy; 5 | var InMemoryStorageStrategy_1 = require("./InMemoryStorageStrategy"); 6 | exports.DEFAULT_CACHE_RESOLVER = function (oldParams, newParams) { 7 | return JSON.stringify(oldParams) === JSON.stringify(newParams); 8 | }; 9 | exports.GlobalCacheConfig = { 10 | storageStrategy: InMemoryStorageStrategy_1.InMemoryStorageStrategy, 11 | globalCacheKey: 'CACHE_STORAGE' 12 | }; 13 | -------------------------------------------------------------------------------- /dist/cjs/promise.cache-buster.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { DecoratorFactoryTypeOfAnyOrKReturnType, ICacheBusterConfigOrConfigWithInstant } from './common/ICacheBusterConfig'; 2 | import { ICacheable } from './common'; 3 | export declare function PCacheBuster(cacheBusterConfig?: T): DecoratorFactoryTypeOfAnyOrKReturnType>>; 4 | export declare const NO_PROMISE_ERROR_MESSAGE = "\n Method decorated with @CacheBuster should return Promise. \n If you don't want to change the method signature, set isInstant flag to true.\n"; 5 | -------------------------------------------------------------------------------- /dist/esm5/promise.cache-buster.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { DecoratorFactoryTypeOfAnyOrKReturnType, ICacheBusterConfigOrConfigWithInstant } from './common/ICacheBusterConfig'; 2 | import { ICacheable } from './common'; 3 | export declare function PCacheBuster(cacheBusterConfig?: T): DecoratorFactoryTypeOfAnyOrKReturnType>>; 4 | export declare const NO_PROMISE_ERROR_MESSAGE = "\n Method decorated with @CacheBuster should return Promise. \n If you don't want to change the method signature, set isInstant flag to true.\n"; 5 | -------------------------------------------------------------------------------- /dist/esm2015/promise.cache-buster.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { DecoratorFactoryTypeOfAnyOrKReturnType, ICacheBusterConfigOrConfigWithInstant } from './common/ICacheBusterConfig'; 2 | import { ICacheable } from './common'; 3 | export declare function PCacheBuster(cacheBusterConfig?: T): DecoratorFactoryTypeOfAnyOrKReturnType>>; 4 | export declare const NO_PROMISE_ERROR_MESSAGE = "\n Method decorated with @CacheBuster should return Promise. \n If you don't want to change the method signature, set isInstant flag to true.\n"; 5 | -------------------------------------------------------------------------------- /dist/cjs/common/IObservableCacheConfig.d.ts: -------------------------------------------------------------------------------- 1 | import { ICacheConfig } from './ICacheConfig'; 2 | import { IStorageStrategy } from './'; 3 | export interface IObservableCacheConfig extends ICacheConfig { 4 | /** 5 | * cache will be resolved asynchronously - an extra change detection pass will be made by 6 | * @description should cache be resolved asynchronously? - helps with declarative forms and two-way databinding via ngModel 7 | */ 8 | async?: boolean; 9 | /** 10 | * storage strategy 11 | */ 12 | storageStrategy?: new () => IStorageStrategy; 13 | } 14 | -------------------------------------------------------------------------------- /dist/esm2015/common/IObservableCacheConfig.d.ts: -------------------------------------------------------------------------------- 1 | import { ICacheConfig } from './ICacheConfig'; 2 | import { IStorageStrategy } from './'; 3 | export interface IObservableCacheConfig extends ICacheConfig { 4 | /** 5 | * cache will be resolved asynchronously - an extra change detection pass will be made by 6 | * @description should cache be resolved asynchronously? - helps with declarative forms and two-way databinding via ngModel 7 | */ 8 | async?: boolean; 9 | /** 10 | * storage strategy 11 | */ 12 | storageStrategy?: new () => IStorageStrategy; 13 | } 14 | -------------------------------------------------------------------------------- /dist/esm5/common/IObservableCacheConfig.d.ts: -------------------------------------------------------------------------------- 1 | import { ICacheConfig } from './ICacheConfig'; 2 | import { IStorageStrategy } from './'; 3 | export interface IObservableCacheConfig extends ICacheConfig { 4 | /** 5 | * cache will be resolved asynchronously - an extra change detection pass will be made by 6 | * @description should cache be resolved asynchronously? - helps with declarative forms and two-way databinding via ngModel 7 | */ 8 | async?: boolean; 9 | /** 10 | * storage strategy 11 | */ 12 | storageStrategy?: new () => IStorageStrategy; 13 | } 14 | -------------------------------------------------------------------------------- /dist/cjs/common/InMemoryStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { ICachePair } from '.'; 3 | export declare class InMemoryStorageStrategy extends IStorageStrategy { 4 | private cachePairs; 5 | add(cachePair: ICachePair, cacheKey: string, ctx?: any): void; 6 | addMany(cachePairs: ICachePair[]): void; 7 | updateAtIndex(index: number, entity: ICachePair): void; 8 | update(index: number, entity: ICachePair): void; 9 | getAll(): ICachePair[]; 10 | removeAtIndex(index: number): void; 11 | remove(index: number): void; 12 | removeAll(): void; 13 | } 14 | -------------------------------------------------------------------------------- /dist/esm2015/common/InMemoryStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { ICachePair } from '.'; 3 | export declare class InMemoryStorageStrategy extends IStorageStrategy { 4 | private cachePairs; 5 | add(cachePair: ICachePair, cacheKey: string, ctx?: any): void; 6 | addMany(cachePairs: ICachePair[]): void; 7 | updateAtIndex(index: number, entity: ICachePair): void; 8 | update(index: number, entity: ICachePair): void; 9 | getAll(): ICachePair[]; 10 | removeAtIndex(index: number): void; 11 | remove(index: number): void; 12 | removeAll(): void; 13 | } 14 | -------------------------------------------------------------------------------- /dist/esm5/common/InMemoryStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { ICachePair } from '.'; 3 | export declare class InMemoryStorageStrategy extends IStorageStrategy { 4 | private cachePairs; 5 | add(cachePair: ICachePair, cacheKey: string, ctx?: any): void; 6 | addMany(cachePairs: ICachePair[]): void; 7 | updateAtIndex(index: number, entity: ICachePair): void; 8 | update(index: number, entity: ICachePair): void; 9 | getAll(): ICachePair[]; 10 | removeAtIndex(index: number): void; 11 | remove(index: number): void; 12 | removeAll(): void; 13 | } 14 | -------------------------------------------------------------------------------- /dist/cjs/common/CacheBusterFunctions.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.isInstant = exports.bustCache = void 0; 4 | function bustCache(cacheBusterConfig) { 5 | if (cacheBusterConfig === null || cacheBusterConfig === void 0 ? void 0 : cacheBusterConfig.cacheBusterNotifier) { 6 | cacheBusterConfig.cacheBusterNotifier.next(); 7 | } 8 | } 9 | exports.bustCache = bustCache; 10 | function isInstant(cacheBusterConfig) { 11 | return cacheBusterConfig && 'isInstant' in cacheBusterConfig && cacheBusterConfig.isInstant; 12 | } 13 | exports.isInstant = isInstant; 14 | //# sourceMappingURL=CacheBusterFunctions.js.map -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 60 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: wontfix 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false -------------------------------------------------------------------------------- /dist/cjs/cache-buster.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { DecoratorFactoryTypeOfAnyOrKReturnType, ICacheBusterConfigOrConfigWithInstant } from './common/ICacheBusterConfig'; 2 | import { ICacheable } from './common'; 3 | import { Observable } from 'rxjs'; 4 | export declare function CacheBuster(cacheBusterConfig?: T): DecoratorFactoryTypeOfAnyOrKReturnType>>; 5 | export declare const NO_OBSERVABLE_ERROR_MESSAGE = "\n Method decorated with @CacheBuster should return observable. \n If you don't want to change the method signature, set isInstant flag to true.\n"; 6 | export declare function throwErrorIfResultIsNotObservable(decoratedMethodResult: any): asserts decoratedMethodResult is Observable; 7 | -------------------------------------------------------------------------------- /dist/esm5/cache-buster.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { DecoratorFactoryTypeOfAnyOrKReturnType, ICacheBusterConfigOrConfigWithInstant } from './common/ICacheBusterConfig'; 2 | import { ICacheable } from './common'; 3 | import { Observable } from 'rxjs'; 4 | export declare function CacheBuster(cacheBusterConfig?: T): DecoratorFactoryTypeOfAnyOrKReturnType>>; 5 | export declare const NO_OBSERVABLE_ERROR_MESSAGE = "\n Method decorated with @CacheBuster should return observable. \n If you don't want to change the method signature, set isInstant flag to true.\n"; 6 | export declare function throwErrorIfResultIsNotObservable(decoratedMethodResult: any): asserts decoratedMethodResult is Observable; 7 | -------------------------------------------------------------------------------- /dist/esm2015/cache-buster.decorator.d.ts: -------------------------------------------------------------------------------- 1 | import { DecoratorFactoryTypeOfAnyOrKReturnType, ICacheBusterConfigOrConfigWithInstant } from './common/ICacheBusterConfig'; 2 | import { ICacheable } from './common'; 3 | import { Observable } from 'rxjs'; 4 | export declare function CacheBuster(cacheBusterConfig?: T): DecoratorFactoryTypeOfAnyOrKReturnType>>; 5 | export declare const NO_OBSERVABLE_ERROR_MESSAGE = "\n Method decorated with @CacheBuster should return observable. \n If you don't want to change the method signature, set isInstant flag to true.\n"; 6 | export declare function throwErrorIfResultIsNotObservable(decoratedMethodResult: any): asserts decoratedMethodResult is Observable; 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2019, Angel Nikolov 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /dist/cjs/common/LocalStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { ICachePair } from '.'; 3 | export declare class LocalStorageStrategy extends IStorageStrategy { 4 | private masterCacheKey; 5 | constructor(); 6 | add(cachePair: ICachePair, cacheKey: string): void; 7 | addMany(cachePairs: ICachePair[], cacheKey: string): void; 8 | getAll(cacheKey: string): ICachePair[]; 9 | removeAtIndex(index: number, cacheKey: string): void; 10 | remove(index: number, entity: any, cacheKey: string): void; 11 | updateAtIndex(index: number, entity: any, cacheKey: string): void; 12 | update(index: number, entity: any, cacheKey: string): void; 13 | removeAll(cacheKey: string): void; 14 | private getRawData; 15 | private storeRawData; 16 | } 17 | -------------------------------------------------------------------------------- /dist/esm5/common/LocalStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { ICachePair } from '.'; 3 | export declare class LocalStorageStrategy extends IStorageStrategy { 4 | private masterCacheKey; 5 | constructor(); 6 | add(cachePair: ICachePair, cacheKey: string): void; 7 | addMany(cachePairs: ICachePair[], cacheKey: string): void; 8 | getAll(cacheKey: string): ICachePair[]; 9 | removeAtIndex(index: number, cacheKey: string): void; 10 | remove(index: number, entity: any, cacheKey: string): void; 11 | updateAtIndex(index: number, entity: any, cacheKey: string): void; 12 | update(index: number, entity: any, cacheKey: string): void; 13 | removeAll(cacheKey: string): void; 14 | private getRawData; 15 | private storeRawData; 16 | } 17 | -------------------------------------------------------------------------------- /dist/esm2015/common/LocalStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { ICachePair } from '.'; 3 | export declare class LocalStorageStrategy extends IStorageStrategy { 4 | private masterCacheKey; 5 | constructor(); 6 | add(cachePair: ICachePair, cacheKey: string): void; 7 | addMany(cachePairs: ICachePair[], cacheKey: string): void; 8 | getAll(cacheKey: string): ICachePair[]; 9 | removeAtIndex(index: number, cacheKey: string): void; 10 | remove(index: number, entity: any, cacheKey: string): void; 11 | updateAtIndex(index: number, entity: any, cacheKey: string): void; 12 | update(index: number, entity: any, cacheKey: string): void; 13 | removeAll(cacheKey: string): void; 14 | private getRawData; 15 | private storeRawData; 16 | } 17 | -------------------------------------------------------------------------------- /.github/workflows/nodejs.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | strategy: 11 | matrix: 12 | node-version: [18.x] 13 | 14 | steps: 15 | - uses: actions/checkout@v1 16 | - name: Use Node.js ${{ matrix.node-version }} 17 | uses: actions/setup-node@v1 18 | with: 19 | node-version: ${{ matrix.node-version }} 20 | - name: npm install and test 21 | run: | 22 | npm ci 23 | npm install rxjs@6.2.0 24 | npm test 25 | ls 26 | env: 27 | CI: true 28 | - name: Upload coverage to Codecov 29 | uses: codecov/codecov-action@v5.0.7 30 | with: 31 | files: ./coverage/lcov/coverage.xml 32 | token: ${{ secrets.CODECOV_TOKEN }} 33 | fail_ci_if_error: true -------------------------------------------------------------------------------- /dist/cjs/common/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":";;;AAGA,uDAAsD;AA0C7C,iGA1CA,mCAAgB,OA0CA;AAzCzB,qEAAoE;AACpE,iEAAgE;AAyCvD,sGAzCA,6CAAqB,OAyCA;AAxC9B,2DAA0D;AAyCjD,mGAzCA,uCAAkB,OAyCA;AAxC3B,+DAA8D;AAyCrD,qGAzCA,2CAAoB,OAyCA;AAxC7B,+DAA8D;AAyCrD,0FAzCA,gCAAS,OAyCA;AAAE,0FAzCA,gCAAS,OAyCA;AAvCtB,IAAM,sBAAsB,GAAG,UAAC,SAAc,EAAE,SAAc;IACnE,OAAA,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;AAAvD,CAAuD,CAAC;AAD7C,QAAA,sBAAsB,0BACuB;AAEnD,IAAM,cAAc,GAAG,UAAC,UAAsB,IAAK,OAAA,UAAU,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAA/D,CAA+D,CAAC,EAAxF,CAAwF,CAAC;AAAtI,QAAA,cAAc,kBAAwH;AAiBtI,QAAA,iBAAiB,GAS1B;IACF,eAAe,EAAE,iDAAuB;IACxC,cAAc,EAAE,eAAe;IAC/B,qBAAqB,EAAE,OAAO;CAC/B,CAAA"} -------------------------------------------------------------------------------- /dist/cjs/common/DOMStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { ICachePair } from '.'; 3 | /** 4 | * @deprecated Use {@link LocalStorageStrategy} instead. 5 | */ 6 | export declare class DOMStorageStrategy extends IStorageStrategy { 7 | private masterCacheKey; 8 | constructor(); 9 | add(cachePair: ICachePair, cacheKey: string): void; 10 | addMany(cachePairs: ICachePair[], cacheKey: string): void; 11 | getAll(cacheKey: string): ICachePair[]; 12 | removeAtIndex(index: number, cacheKey: string): void; 13 | remove(index: number, entity: any, cacheKey: string): void; 14 | updateAtIndex(index: number, entity: any, cacheKey: string): void; 15 | update(index: number, entity: any, cacheKey: string): void; 16 | removeAll(cacheKey: string): void; 17 | private getRawData; 18 | private storeRawData; 19 | } 20 | -------------------------------------------------------------------------------- /dist/esm5/common/DOMStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { ICachePair } from '.'; 3 | /** 4 | * @deprecated Use {@link LocalStorageStrategy} instead. 5 | */ 6 | export declare class DOMStorageStrategy extends IStorageStrategy { 7 | private masterCacheKey; 8 | constructor(); 9 | add(cachePair: ICachePair, cacheKey: string): void; 10 | addMany(cachePairs: ICachePair[], cacheKey: string): void; 11 | getAll(cacheKey: string): ICachePair[]; 12 | removeAtIndex(index: number, cacheKey: string): void; 13 | remove(index: number, entity: any, cacheKey: string): void; 14 | updateAtIndex(index: number, entity: any, cacheKey: string): void; 15 | update(index: number, entity: any, cacheKey: string): void; 16 | removeAll(cacheKey: string): void; 17 | private getRawData; 18 | private storeRawData; 19 | } 20 | -------------------------------------------------------------------------------- /dist/esm2015/common/DOMStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { ICachePair } from '.'; 3 | /** 4 | * @deprecated Use {@link LocalStorageStrategy} instead. 5 | */ 6 | export declare class DOMStorageStrategy extends IStorageStrategy { 7 | private masterCacheKey; 8 | constructor(); 9 | add(cachePair: ICachePair, cacheKey: string): void; 10 | addMany(cachePairs: ICachePair[], cacheKey: string): void; 11 | getAll(cacheKey: string): ICachePair[]; 12 | removeAtIndex(index: number, cacheKey: string): void; 13 | remove(index: number, entity: any, cacheKey: string): void; 14 | updateAtIndex(index: number, entity: any, cacheKey: string): void; 15 | update(index: number, entity: any, cacheKey: string): void; 16 | removeAll(cacheKey: string): void; 17 | private getRawData; 18 | private storeRawData; 19 | } 20 | -------------------------------------------------------------------------------- /common/IStorageStrategy.ts: -------------------------------------------------------------------------------- 1 | import {ICachePair} from '.'; 2 | 3 | export abstract class IStorageStrategy { 4 | abstract getAll(cacheKey: string, ctx?: any): Array>; 5 | abstract add(entity: ICachePair, cacheKey: string, ctx?: any): void; 6 | /** 7 | * @deprecated Use update instead. 8 | */ 9 | abstract updateAtIndex(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 10 | abstract update?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 11 | /** 12 | * @deprecated Use remove instead. 13 | */ 14 | abstract removeAtIndex(index: number, cacheKey: string, ctx?: any): void; 15 | abstract remove?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 16 | abstract removeAll(cacheKey: string, ctx?: any): void; 17 | abstract addMany(entities: ICachePair[], cacheKey: string, ctx?: any): void; 18 | } -------------------------------------------------------------------------------- /dist/cjs/common/IStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { ICachePair } from '.'; 2 | export declare abstract class IStorageStrategy { 3 | abstract getAll(cacheKey: string, ctx?: any): Array>; 4 | abstract add(entity: ICachePair, cacheKey: string, ctx?: any): void; 5 | /** 6 | * @deprecated Use update instead. 7 | */ 8 | abstract updateAtIndex(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 9 | abstract update?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 10 | /** 11 | * @deprecated Use remove instead. 12 | */ 13 | abstract removeAtIndex(index: number, cacheKey: string, ctx?: any): void; 14 | abstract remove?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 15 | abstract removeAll(cacheKey: string, ctx?: any): void; 16 | abstract addMany(entities: ICachePair[], cacheKey: string, ctx?: any): void; 17 | } 18 | -------------------------------------------------------------------------------- /dist/esm2015/common/IStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { ICachePair } from '.'; 2 | export declare abstract class IStorageStrategy { 3 | abstract getAll(cacheKey: string, ctx?: any): Array>; 4 | abstract add(entity: ICachePair, cacheKey: string, ctx?: any): void; 5 | /** 6 | * @deprecated Use update instead. 7 | */ 8 | abstract updateAtIndex(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 9 | abstract update?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 10 | /** 11 | * @deprecated Use remove instead. 12 | */ 13 | abstract removeAtIndex(index: number, cacheKey: string, ctx?: any): void; 14 | abstract remove?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 15 | abstract removeAll(cacheKey: string, ctx?: any): void; 16 | abstract addMany(entities: ICachePair[], cacheKey: string, ctx?: any): void; 17 | } 18 | -------------------------------------------------------------------------------- /dist/esm5/common/IStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { ICachePair } from '.'; 2 | export declare abstract class IStorageStrategy { 3 | abstract getAll(cacheKey: string, ctx?: any): Array>; 4 | abstract add(entity: ICachePair, cacheKey: string, ctx?: any): void; 5 | /** 6 | * @deprecated Use update instead. 7 | */ 8 | abstract updateAtIndex(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 9 | abstract update?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 10 | /** 11 | * @deprecated Use remove instead. 12 | */ 13 | abstract removeAtIndex(index: number, cacheKey: string, ctx?: any): void; 14 | abstract remove?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void; 15 | abstract removeAll(cacheKey: string, ctx?: any): void; 16 | abstract addMany(entities: ICachePair[], cacheKey: string, ctx?: any): void; 17 | } 18 | -------------------------------------------------------------------------------- /dist/esm2015/common/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAc,EAAE,SAAc,EAAE,EAAE,CACvE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAiBnJ,MAAM,CAAC,MAAM,iBAAiB,GAS1B;IACF,eAAe,EAAE,uBAAuB;IACxC,cAAc,EAAE,eAAe;IAC/B,qBAAqB,EAAE,OAAO;CAC/B,CAAA;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC"} -------------------------------------------------------------------------------- /common/IAsyncStorageStrategy.ts: -------------------------------------------------------------------------------- 1 | import {ICachePair} from '.'; 2 | 3 | export abstract class IAsyncStorageStrategy { 4 | abstract getAll(cacheKey: string, ctx?: any): Array> | Promise>>; 5 | abstract add(entity: ICachePair, cacheKey: string, ctx?: any): void | Promise; 6 | /** 7 | * @deprecated Use update instead. 8 | */ 9 | abstract updateAtIndex(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void | Promise; 10 | abstract update?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): Promise; 11 | /** 12 | * @deprecated Use remove instead. 13 | */ 14 | abstract removeAtIndex(index: number, cacheKey: string, ctx?: any): void | Promise; 15 | abstract remove?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): Promise; 16 | abstract removeAll(cacheKey: string, ctx?: any): void | Promise; 17 | abstract addMany(entities: ICachePair[], cacheKey: string, ctx?: any): Promise; 18 | } -------------------------------------------------------------------------------- /dist/esm5/common/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,CAAC,IAAM,sBAAsB,GAAG,UAAC,SAAc,EAAE,SAAc;IACnE,OAAA,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;AAAvD,CAAuD,CAAC;AAE1D,MAAM,CAAC,IAAM,cAAc,GAAG,UAAC,UAAsB,IAAK,OAAA,UAAU,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAA/D,CAA+D,CAAC,EAAxF,CAAwF,CAAC;AAiBnJ,MAAM,CAAC,IAAM,iBAAiB,GAS1B;IACF,eAAe,EAAE,uBAAuB;IACxC,cAAc,EAAE,eAAe;IAC/B,qBAAqB,EAAE,OAAO;CAC/B,CAAA;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC"} -------------------------------------------------------------------------------- /dist/esm2015/common/index.js: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { InMemoryStorageStrategy } from './InMemoryStorageStrategy'; 3 | import { IAsyncStorageStrategy } from './IAsyncStorageStrategy'; 4 | import { DOMStorageStrategy } from './DOMStorageStrategy'; 5 | import { LocalStorageStrategy } from './LocalStorageStrategy'; 6 | import { isInstant, bustCache } from './CacheBusterFunctions'; 7 | export const DEFAULT_CACHE_RESOLVER = (oldParams, newParams) => JSON.stringify(oldParams) === JSON.stringify(newParams); 8 | export const DEFAULT_HASHER = (parameters) => parameters.map(param => param !== undefined ? JSON.parse(JSON.stringify(param)) : param); 9 | export const GlobalCacheConfig = { 10 | storageStrategy: InMemoryStorageStrategy, 11 | globalCacheKey: 'CACHE_STORAGE', 12 | promiseImplementation: Promise 13 | }; 14 | export { IStorageStrategy }; 15 | export { IAsyncStorageStrategy }; 16 | export { DOMStorageStrategy }; 17 | export { LocalStorageStrategy }; 18 | export { isInstant, bustCache }; 19 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /dist/esm2015/promise.cache-buster.decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"promise.cache-buster.decorator.js","sourceRoot":"","sources":["../../promise.cache-buster.decorator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAc,SAAS,EAAC,MAAM,UAAU,CAAC;AAE1D,MAAM,UAAU,YAAY,CAAkD,iBAAqB;IAEjG,OAAO,UACL,OAAe,EACf,YAAoB,EACpB,kBAAqE;QAErE,MAAM,eAAe,GAAG,kBAAkB,CAAC,KAAK,CAAC;QACjD,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,KAAK,EAAE;YAClD,6EAA6E;YAC5E,kBAAkB,CAAC,KAAa,GAAG,UAAU,GAAG,UAAsB;gBACrE,IAAG,SAAS,CAAC,iBAAiB,CAAC,EAAC;oBAC9B,SAAS,CAAC,iBAAiB,CAAC,CAAC;oBAC7B,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,CAAC;iBAClD;gBAED,MAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,CAAA;gBAEvE,8BAA8B,CAAC,qBAAqB,CAAC,CAAC;gBAEtD,OAAO,qBAAqB,CAAC,IAAI,CAC/B,QAAQ,CAAC,EAAE;oBACT,SAAS,CAAC,iBAAiB,CAAC,CAAA;oBAC5B,OAAO,QAAQ,CAAC;gBAClB,CAAC,CACF,CAAC;YACJ,CAAC,CAAC;SACH;QAAA,CAAC;QACF,OAAO,kBAAkB,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AAAA,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;CAGvC,CAAC;AAEF,SAAS,8BAA8B,CAAC,qBAA0B;IAChE,IAAI,qBAAqB,YAAY,OAAO,KAAK,KAAK,EAAE;QACtD,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;KAC3C;AACH,CAAC"} -------------------------------------------------------------------------------- /dist/cjs/common/IAsyncStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { ICachePair } from '.'; 2 | export declare abstract class IAsyncStorageStrategy { 3 | abstract getAll(cacheKey: string, ctx?: any): Array> | Promise>>; 4 | abstract add(entity: ICachePair, cacheKey: string, ctx?: any): void | Promise; 5 | /** 6 | * @deprecated Use update instead. 7 | */ 8 | abstract updateAtIndex(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void | Promise; 9 | abstract update?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): Promise; 10 | /** 11 | * @deprecated Use remove instead. 12 | */ 13 | abstract removeAtIndex(index: number, cacheKey: string, ctx?: any): void | Promise; 14 | abstract remove?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): Promise; 15 | abstract removeAll(cacheKey: string, ctx?: any): void | Promise; 16 | abstract addMany(entities: ICachePair[], cacheKey: string, ctx?: any): Promise; 17 | } 18 | -------------------------------------------------------------------------------- /dist/esm2015/common/IAsyncStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { ICachePair } from '.'; 2 | export declare abstract class IAsyncStorageStrategy { 3 | abstract getAll(cacheKey: string, ctx?: any): Array> | Promise>>; 4 | abstract add(entity: ICachePair, cacheKey: string, ctx?: any): void | Promise; 5 | /** 6 | * @deprecated Use update instead. 7 | */ 8 | abstract updateAtIndex(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void | Promise; 9 | abstract update?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): Promise; 10 | /** 11 | * @deprecated Use remove instead. 12 | */ 13 | abstract removeAtIndex(index: number, cacheKey: string, ctx?: any): void | Promise; 14 | abstract remove?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): Promise; 15 | abstract removeAll(cacheKey: string, ctx?: any): void | Promise; 16 | abstract addMany(entities: ICachePair[], cacheKey: string, ctx?: any): Promise; 17 | } 18 | -------------------------------------------------------------------------------- /dist/esm2015/common/InMemoryStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"InMemoryStorageStrategy.js","sourceRoot":"","sources":["../../../common/InMemoryStorageStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAGpD,MAAM,OAAO,uBAAwB,SAAQ,gBAAgB;IAA7D;;QACU,eAAU,GAA2B,EAAE,CAAC;IAmClD,CAAC;IAjCC,GAAG,CAAC,SAA0B,EAAE,QAAgB,EAAE,GAAS;QACzD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAAA,CAAC;IAEF,OAAO,CAAC,UAA6B;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAAA,CAAC;IAEF,aAAa,CAAC,KAAa,EAAE,MAAuB;QAClD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,MAAuB;QAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAAA,CAAC;IAEF,aAAa,CAAC,KAAa;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,SAAS;QACP,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7B,CAAC;CACF"} -------------------------------------------------------------------------------- /dist/esm5/common/IAsyncStorageStrategy.d.ts: -------------------------------------------------------------------------------- 1 | import { ICachePair } from '.'; 2 | export declare abstract class IAsyncStorageStrategy { 3 | abstract getAll(cacheKey: string, ctx?: any): Array> | Promise>>; 4 | abstract add(entity: ICachePair, cacheKey: string, ctx?: any): void | Promise; 5 | /** 6 | * @deprecated Use update instead. 7 | */ 8 | abstract updateAtIndex(index: number, entity: ICachePair, cacheKey: string, ctx?: any): void | Promise; 9 | abstract update?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): Promise; 10 | /** 11 | * @deprecated Use remove instead. 12 | */ 13 | abstract removeAtIndex(index: number, cacheKey: string, ctx?: any): void | Promise; 14 | abstract remove?(index: number, entity: ICachePair, cacheKey: string, ctx?: any): Promise; 15 | abstract removeAll(cacheKey: string, ctx?: any): void | Promise; 16 | abstract addMany(entities: ICachePair[], cacheKey: string, ctx?: any): Promise; 17 | } 18 | -------------------------------------------------------------------------------- /common/InMemoryStorageStrategy.ts: -------------------------------------------------------------------------------- 1 | import {IStorageStrategy} from './IStorageStrategy'; 2 | import {ICachePair} from '.'; 3 | 4 | export class InMemoryStorageStrategy extends IStorageStrategy { 5 | private cachePairs: Array> = []; 6 | 7 | add(cachePair: ICachePair, cacheKey: string, ctx?: any) { 8 | this.cachePairs.push(cachePair); 9 | }; 10 | 11 | addMany(cachePairs: ICachePair[]) { 12 | this.cachePairs = cachePairs; 13 | }; 14 | 15 | updateAtIndex(index: number, entity: ICachePair) { 16 | const updatee = this.cachePairs[index]; 17 | Object.assign(updatee, entity); 18 | } 19 | 20 | update(index: number, entity: ICachePair) { 21 | const updatee = this.cachePairs[index]; 22 | Object.assign(updatee, entity); 23 | } 24 | 25 | getAll() { 26 | return this.cachePairs; 27 | }; 28 | 29 | removeAtIndex(index: number) { 30 | this.cachePairs.splice(index, 1); 31 | } 32 | 33 | remove(index: number) { 34 | this.cachePairs.splice(index, 1); 35 | } 36 | 37 | removeAll() { 38 | this.cachePairs.length = 0; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /dist/cjs/promise.cache-buster.decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"promise.cache-buster.decorator.js","sourceRoot":"","sources":["../../promise.cache-buster.decorator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,mCAA0D;AAE1D,SAAgB,YAAY,CAAkD,iBAAqB;IAEjG,OAAO,UACL,OAAe,EACf,YAAoB,EACpB,kBAAqE;QAErE,IAAM,eAAe,GAAG,kBAAkB,CAAC,KAAK,CAAC;QACjD,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,KAAK,EAAE;YAClD,6EAA6E;YAC5E,kBAAkB,CAAC,KAAa,GAAG;gBAAU,oBAAyB;qBAAzB,UAAyB,EAAzB,qBAAyB,EAAzB,IAAyB;oBAAzB,+BAAyB;;gBACrE,IAAG,IAAA,kBAAS,EAAC,iBAAiB,CAAC,EAAC;oBAC9B,IAAA,kBAAS,EAAC,iBAAiB,CAAC,CAAC;oBAC7B,OAAO,eAAe,CAAC,IAAI,OAApB,eAAe,iBAAM,IAAI,GAAK,UAAU,UAAE;iBAClD;gBAED,IAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,OAApB,eAAe,iBAAM,IAAI,GAAK,UAAU,SAAC,CAAA;gBAEvE,8BAA8B,CAAC,qBAAqB,CAAC,CAAC;gBAEtD,OAAO,qBAAqB,CAAC,IAAI,CAC/B,UAAA,QAAQ;oBACN,IAAA,kBAAS,EAAC,iBAAiB,CAAC,CAAA;oBAC5B,OAAO,QAAQ,CAAC;gBAClB,CAAC,CACF,CAAC;YACJ,CAAC,CAAC;SACH;QAAA,CAAC;QACF,OAAO,kBAAkB,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AA9BD,oCA8BC;AAAA,CAAC;AAEW,QAAA,wBAAwB,GAAG,mJAGvC,CAAC;AAEF,SAAS,8BAA8B,CAAC,qBAA0B;IAChE,IAAI,qBAAqB,YAAY,OAAO,KAAK,KAAK,EAAE;QACtD,MAAM,IAAI,KAAK,CAAC,gCAAwB,CAAC,CAAC;KAC3C;AACH,CAAC"} -------------------------------------------------------------------------------- /dist/cjs/cache-buster.decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"cache-buster.decorator.js","sourceRoot":"","sources":["../../cache-buster.decorator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,mCAA0D;AAC1D,6BAAgC;AAChC,4CAAmC;AAEnC,SAAgB,WAAW,CAAkD,iBAAqB;IAEhG,OAAO,UACL,OAAe,EACf,YAAoB,EACpB,kBAA8E;QAE9E,IAAM,eAAe,GAAG,kBAAkB,CAAC,KAAK,CAAC;QACjD,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,KAAK,EAAE;YAClD,6EAA6E;YAC7E,kBAAkB,CAAC,KAAK,GAAG;gBAAU,oBAAyB;qBAAzB,UAAyB,EAAzB,qBAAyB,EAAzB,IAAyB;oBAAzB,+BAAyB;;gBAC5D,IAAG,IAAA,kBAAS,EAAC,iBAAiB,CAAC,EAAE;oBAC/B,IAAA,kBAAS,EAAC,iBAAiB,CAAC,CAAC;oBAC7B,OAAO,eAAe,CAAC,IAAI,OAApB,eAAe,iBAAM,IAAI,GAAK,UAAU,UAAE;iBAClD;gBAED,IAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,OAApB,eAAe,iBAAM,IAAI,GAAK,UAAU,SAAC,CAAC;gBAExE,iCAAiC,CAAC,qBAAqB,CAAC,CAAC;gBAEzD,OAAO,qBAAqB,CAAC,IAAI,CAC/B,IAAA,eAAG,EAAC;oBACF,IAAA,kBAAS,EAAC,iBAAiB,CAAC,CAAC;gBAC/B,CAAC,CAAC,CACH,CAAC;YACJ,CAAC,CAAC;SACH;QAAA,CAAC;QACF,OAAO,kBAAkB,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AA7BD,kCA6BC;AAAA,CAAC;AAEW,QAAA,2BAA2B,GAAG,sJAG1C,CAAC;AAEF,SAAgB,iCAAiC,CAAC,qBAA0B;IAC1E,IAAI,qBAAqB,YAAY,iBAAU,KAAK,KAAK,EAAE;QACzD,MAAM,IAAI,KAAK,CAAC,mCAA2B,CAAC,CAAC;KAC9C;AACH,CAAC;AAJD,8EAIC"} -------------------------------------------------------------------------------- /dist/esm2015/common/InMemoryStorageStrategy.js: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | export class InMemoryStorageStrategy extends IStorageStrategy { 3 | constructor() { 4 | super(...arguments); 5 | this.cachePairs = []; 6 | } 7 | add(cachePair, cacheKey, ctx) { 8 | this.cachePairs.push(cachePair); 9 | } 10 | ; 11 | addMany(cachePairs) { 12 | this.cachePairs = cachePairs; 13 | } 14 | ; 15 | updateAtIndex(index, entity) { 16 | const updatee = this.cachePairs[index]; 17 | Object.assign(updatee, entity); 18 | } 19 | update(index, entity) { 20 | const updatee = this.cachePairs[index]; 21 | Object.assign(updatee, entity); 22 | } 23 | getAll() { 24 | return this.cachePairs; 25 | } 26 | ; 27 | removeAtIndex(index) { 28 | this.cachePairs.splice(index, 1); 29 | } 30 | remove(index) { 31 | this.cachePairs.splice(index, 1); 32 | } 33 | removeAll() { 34 | this.cachePairs.length = 0; 35 | } 36 | } 37 | //# sourceMappingURL=InMemoryStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/esm5/common/index.js: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { InMemoryStorageStrategy } from './InMemoryStorageStrategy'; 3 | import { IAsyncStorageStrategy } from './IAsyncStorageStrategy'; 4 | import { DOMStorageStrategy } from './DOMStorageStrategy'; 5 | import { LocalStorageStrategy } from './LocalStorageStrategy'; 6 | import { isInstant, bustCache } from './CacheBusterFunctions'; 7 | export var DEFAULT_CACHE_RESOLVER = function (oldParams, newParams) { 8 | return JSON.stringify(oldParams) === JSON.stringify(newParams); 9 | }; 10 | export var DEFAULT_HASHER = function (parameters) { return parameters.map(function (param) { return param !== undefined ? JSON.parse(JSON.stringify(param)) : param; }); }; 11 | export var GlobalCacheConfig = { 12 | storageStrategy: InMemoryStorageStrategy, 13 | globalCacheKey: 'CACHE_STORAGE', 14 | promiseImplementation: Promise 15 | }; 16 | export { IStorageStrategy }; 17 | export { IAsyncStorageStrategy }; 18 | export { DOMStorageStrategy }; 19 | export { LocalStorageStrategy }; 20 | export { isInstant, bustCache }; 21 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /dist/esm2015/cache-buster.decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"cache-buster.decorator.js","sourceRoot":"","sources":["../../cache-buster.decorator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,SAAS,EAAc,SAAS,EAAC,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAC;AAChC,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAEnC,MAAM,UAAU,WAAW,CAAkD,iBAAqB;IAEhG,OAAO,UACL,OAAe,EACf,YAAoB,EACpB,kBAA8E;QAE9E,MAAM,eAAe,GAAG,kBAAkB,CAAC,KAAK,CAAC;QACjD,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,KAAK,EAAE;YAClD,6EAA6E;YAC7E,kBAAkB,CAAC,KAAK,GAAG,UAAU,GAAG,UAAsB;gBAC5D,IAAG,SAAS,CAAC,iBAAiB,CAAC,EAAE;oBAC/B,SAAS,CAAC,iBAAiB,CAAC,CAAC;oBAC7B,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,CAAC;iBAClD;gBAED,MAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,CAAC;gBAExE,iCAAiC,CAAC,qBAAqB,CAAC,CAAC;gBAEzD,OAAO,qBAAqB,CAAC,IAAI,CAC/B,GAAG,CAAC,GAAG,EAAE;oBACP,SAAS,CAAC,iBAAiB,CAAC,CAAC;gBAC/B,CAAC,CAAC,CACH,CAAC;YACJ,CAAC,CAAC;SACH;QAAA,CAAC;QACF,OAAO,kBAAkB,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AAAA,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;CAG1C,CAAC;AAEF,MAAM,UAAU,iCAAiC,CAAC,qBAA0B;IAC1E,IAAI,qBAAqB,YAAY,UAAU,KAAK,KAAK,EAAE;QACzD,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAC9C;AACH,CAAC"} -------------------------------------------------------------------------------- /dist/esm5/promise.cache-buster.decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"promise.cache-buster.decorator.js","sourceRoot":"","sources":["../../promise.cache-buster.decorator.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAC,SAAS,EAAc,SAAS,EAAC,MAAM,UAAU,CAAC;AAE1D,MAAM,UAAU,YAAY,CAAkD,iBAAqB;IAEjG,OAAO,UACL,OAAe,EACf,YAAoB,EACpB,kBAAqE;QAErE,IAAM,eAAe,GAAG,kBAAkB,CAAC,KAAK,CAAC;QACjD,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,KAAK,EAAE;YAClD,6EAA6E;YAC5E,kBAAkB,CAAC,KAAa,GAAG;gBAAU,oBAAyB;qBAAzB,UAAyB,EAAzB,qBAAyB,EAAzB,IAAyB;oBAAzB,+BAAyB;;gBACrE,IAAG,SAAS,CAAC,iBAAiB,CAAC,EAAC;oBAC9B,SAAS,CAAC,iBAAiB,CAAC,CAAC;oBAC7B,OAAO,eAAe,CAAC,IAAI,OAApB,eAAe,iBAAM,IAAI,GAAK,UAAU,UAAE;iBAClD;gBAED,IAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,OAApB,eAAe,iBAAM,IAAI,GAAK,UAAU,SAAC,CAAA;gBAEvE,8BAA8B,CAAC,qBAAqB,CAAC,CAAC;gBAEtD,OAAO,qBAAqB,CAAC,IAAI,CAC/B,UAAA,QAAQ;oBACN,SAAS,CAAC,iBAAiB,CAAC,CAAA;oBAC5B,OAAO,QAAQ,CAAC;gBAClB,CAAC,CACF,CAAC;YACJ,CAAC,CAAC;SACH;QAAA,CAAC;QACF,OAAO,kBAAkB,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AAAA,CAAC;AAEF,MAAM,CAAC,IAAM,wBAAwB,GAAG,mJAGvC,CAAC;AAEF,SAAS,8BAA8B,CAAC,qBAA0B;IAChE,IAAI,qBAAqB,YAAY,OAAO,KAAK,KAAK,EAAE;QACtD,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;KAC3C;AACH,CAAC"} -------------------------------------------------------------------------------- /dist/cjs/common/InMemoryStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"InMemoryStorageStrategy.js","sourceRoot":"","sources":["../../../common/InMemoryStorageStrategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uDAAoD;AAGpD;IAA6C,2CAAgB;IAA7D;QAAA,qEAoCC;QAnCS,gBAAU,GAA2B,EAAE,CAAC;;IAmClD,CAAC;IAjCC,qCAAG,GAAH,UAAI,SAA0B,EAAE,QAAgB,EAAE,GAAS;QACzD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAAA,CAAC;IAEF,yCAAO,GAAP,UAAQ,UAA6B;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAAA,CAAC;IAEF,+CAAa,GAAb,UAAc,KAAa,EAAE,MAAuB;QAClD,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,wCAAM,GAAN,UAAO,KAAa,EAAE,MAAuB;QAC3C,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,wCAAM,GAAN;QACE,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAAA,CAAC;IAEF,+CAAa,GAAb,UAAc,KAAa;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,wCAAM,GAAN,UAAO,KAAa;QAClB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,2CAAS,GAAT;QACE,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7B,CAAC;IACH,8BAAC;AAAD,CAAC,AApCD,CAA6C,mCAAgB,GAoC5D;AApCY,0DAAuB"} -------------------------------------------------------------------------------- /common/ICacheBusterConfig.ts: -------------------------------------------------------------------------------- 1 | import { Subject } from 'rxjs'; 2 | 3 | export interface ICacheBusterConfig { 4 | /** 5 | * pass a Subject which will emit whenever the inner source stream has emitted 6 | * this can later be subscribed to from Cacheables so they can get rid of their caches 7 | */ 8 | cacheBusterNotifier?: Subject; 9 | } 10 | 11 | /** 12 | * flag that indicates whether cache should be cleared before decorated method has been called. 13 | * False by default, i.e. cache is cleared after observable from decorated method emits 14 | */ 15 | export type ICacheBusterConfigInstant = ICacheBusterConfig & { isInstant: true }; 16 | 17 | export type DecoratorFactoryType = (_target: Object, _propertyKey: string, propertyDescriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor 18 | 19 | export type ICacheBusterConfigOrConfigWithInstant = ICacheBusterConfig | ICacheBusterConfigInstant; 20 | 21 | export type DecoratorFactoryTypeOfAnyOrKReturnType = 22 | TConfig extends ICacheBusterConfigInstant 23 | ? DecoratorFactoryType 24 | : DecoratorFactoryType 25 | -------------------------------------------------------------------------------- /dist/esm5/cache-buster.decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"cache-buster.decorator.js","sourceRoot":"","sources":["../../cache-buster.decorator.ts"],"names":[],"mappings":";;;;;;;;;AAIA,OAAO,EAAC,SAAS,EAAc,SAAS,EAAC,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAC;AAChC,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAEnC,MAAM,UAAU,WAAW,CAAkD,iBAAqB;IAEhG,OAAO,UACL,OAAe,EACf,YAAoB,EACpB,kBAA8E;QAE9E,IAAM,eAAe,GAAG,kBAAkB,CAAC,KAAK,CAAC;QACjD,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,KAAK,EAAE;YAClD,6EAA6E;YAC7E,kBAAkB,CAAC,KAAK,GAAG;gBAAU,oBAAyB;qBAAzB,UAAyB,EAAzB,qBAAyB,EAAzB,IAAyB;oBAAzB,+BAAyB;;gBAC5D,IAAG,SAAS,CAAC,iBAAiB,CAAC,EAAE;oBAC/B,SAAS,CAAC,iBAAiB,CAAC,CAAC;oBAC7B,OAAO,eAAe,CAAC,IAAI,OAApB,eAAe,iBAAM,IAAI,GAAK,UAAU,UAAE;iBAClD;gBAED,IAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,OAApB,eAAe,iBAAM,IAAI,GAAK,UAAU,SAAC,CAAC;gBAExE,iCAAiC,CAAC,qBAAqB,CAAC,CAAC;gBAEzD,OAAO,qBAAqB,CAAC,IAAI,CAC/B,GAAG,CAAC;oBACF,SAAS,CAAC,iBAAiB,CAAC,CAAC;gBAC/B,CAAC,CAAC,CACH,CAAC;YACJ,CAAC,CAAC;SACH;QAAA,CAAC;QACF,OAAO,kBAAkB,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AAAA,CAAC;AAEF,MAAM,CAAC,IAAM,2BAA2B,GAAG,sJAG1C,CAAC;AAEF,MAAM,UAAU,iCAAiC,CAAC,qBAA0B;IAC1E,IAAI,qBAAqB,YAAY,UAAU,KAAK,KAAK,EAAE;QACzD,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAC9C;AACH,CAAC"} -------------------------------------------------------------------------------- /dist/esm5/common/InMemoryStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"InMemoryStorageStrategy.js","sourceRoot":"","sources":["../../../common/InMemoryStorageStrategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAGpD;IAA6C,2CAAgB;IAA7D;QAAA,qEAoCC;QAnCS,gBAAU,GAA2B,EAAE,CAAC;;IAmClD,CAAC;IAjCC,qCAAG,GAAH,UAAI,SAA0B,EAAE,QAAgB,EAAE,GAAS;QACzD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAAA,CAAC;IAEF,yCAAO,GAAP,UAAQ,UAA6B;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAAA,CAAC;IAEF,+CAAa,GAAb,UAAc,KAAa,EAAE,MAAuB;QAClD,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,wCAAM,GAAN,UAAO,KAAa,EAAE,MAAuB;QAC3C,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,wCAAM,GAAN;QACE,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAAA,CAAC;IAEF,+CAAa,GAAb,UAAc,KAAa;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,wCAAM,GAAN,UAAO,KAAa;QAClB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,2CAAS,GAAT;QACE,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7B,CAAC;IACH,8BAAC;AAAD,CAAC,AApCD,CAA6C,gBAAgB,GAoC5D"} -------------------------------------------------------------------------------- /dist/cjs/common/ICacheBusterConfig.d.ts: -------------------------------------------------------------------------------- 1 | import { Subject } from 'rxjs'; 2 | export interface ICacheBusterConfig { 3 | /** 4 | * pass a Subject which will emit whenever the inner source stream has emitted 5 | * this can later be subscribed to from Cacheables so they can get rid of their caches 6 | */ 7 | cacheBusterNotifier?: Subject; 8 | } 9 | /** 10 | * flag that indicates whether cache should be cleared before decorated method has been called. 11 | * False by default, i.e. cache is cleared after observable from decorated method emits 12 | */ 13 | export declare type ICacheBusterConfigInstant = ICacheBusterConfig & { 14 | isInstant: true; 15 | }; 16 | export declare type DecoratorFactoryType = (_target: Object, _propertyKey: string, propertyDescriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor; 17 | export declare type ICacheBusterConfigOrConfigWithInstant = ICacheBusterConfig | ICacheBusterConfigInstant; 18 | export declare type DecoratorFactoryTypeOfAnyOrKReturnType = TConfig extends ICacheBusterConfigInstant ? DecoratorFactoryType : DecoratorFactoryType; 19 | -------------------------------------------------------------------------------- /dist/cjs/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 3 | if (k2 === undefined) k2 = k; 4 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); 5 | }) : (function(o, m, k, k2) { 6 | if (k2 === undefined) k2 = k; 7 | o[k2] = m[k]; 8 | })); 9 | var __exportStar = (this && this.__exportStar) || function(m, exports) { 10 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 11 | }; 12 | Object.defineProperty(exports, "__esModule", { value: true }); 13 | __exportStar(require("./cache-buster.decorator"), exports); 14 | __exportStar(require("./cacheable.decorator"), exports); 15 | __exportStar(require("./promise.cache-buster.decorator"), exports); 16 | __exportStar(require("./promise.cacheable.decorator"), exports); 17 | __exportStar(require("./common"), exports); 18 | __exportStar(require("./common/InMemoryStorageStrategy"), exports); 19 | __exportStar(require("./common/DOMStorageStrategy"), exports); 20 | __exportStar(require("./common/LocalStorageStrategy"), exports); 21 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /dist/esm2015/common/ICacheBusterConfig.d.ts: -------------------------------------------------------------------------------- 1 | import { Subject } from 'rxjs'; 2 | export interface ICacheBusterConfig { 3 | /** 4 | * pass a Subject which will emit whenever the inner source stream has emitted 5 | * this can later be subscribed to from Cacheables so they can get rid of their caches 6 | */ 7 | cacheBusterNotifier?: Subject; 8 | } 9 | /** 10 | * flag that indicates whether cache should be cleared before decorated method has been called. 11 | * False by default, i.e. cache is cleared after observable from decorated method emits 12 | */ 13 | export declare type ICacheBusterConfigInstant = ICacheBusterConfig & { 14 | isInstant: true; 15 | }; 16 | export declare type DecoratorFactoryType = (_target: Object, _propertyKey: string, propertyDescriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor; 17 | export declare type ICacheBusterConfigOrConfigWithInstant = ICacheBusterConfig | ICacheBusterConfigInstant; 18 | export declare type DecoratorFactoryTypeOfAnyOrKReturnType = TConfig extends ICacheBusterConfigInstant ? DecoratorFactoryType : DecoratorFactoryType; 19 | -------------------------------------------------------------------------------- /dist/esm5/common/ICacheBusterConfig.d.ts: -------------------------------------------------------------------------------- 1 | import { Subject } from 'rxjs'; 2 | export interface ICacheBusterConfig { 3 | /** 4 | * pass a Subject which will emit whenever the inner source stream has emitted 5 | * this can later be subscribed to from Cacheables so they can get rid of their caches 6 | */ 7 | cacheBusterNotifier?: Subject; 8 | } 9 | /** 10 | * flag that indicates whether cache should be cleared before decorated method has been called. 11 | * False by default, i.e. cache is cleared after observable from decorated method emits 12 | */ 13 | export declare type ICacheBusterConfigInstant = ICacheBusterConfig & { 14 | isInstant: true; 15 | }; 16 | export declare type DecoratorFactoryType = (_target: Object, _propertyKey: string, propertyDescriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor; 17 | export declare type ICacheBusterConfigOrConfigWithInstant = ICacheBusterConfig | ICacheBusterConfigInstant; 18 | export declare type DecoratorFactoryTypeOfAnyOrKReturnType = TConfig extends ICacheBusterConfigInstant ? DecoratorFactoryType : DecoratorFactoryType; 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ts-cacheable", 3 | "version": "1.0.19", 4 | "description": "Promise/Observable cache decorators", 5 | "main": "./dist/cjs/index.js", 6 | "module": "./dist/esm5/index.js", 7 | "es2015": "./dist/esm2015/index.js", 8 | "types": "./dist/cjs/index.d.ts", 9 | "sideEffects": false, 10 | "scripts": { 11 | "test": "karma start", 12 | "test:watch": "karma start --auto-watch", 13 | "build:cjs": "rm -rf dist && tsc", 14 | "build:esm5": "tsc --p tsconfig.esm5.json", 15 | "build:esm2015": "tsc --p tsconfig.esm2015.json", 16 | "build:all": "npm run build:cjs && npm run build:esm5 && npm run build:esm2015" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "git+https://github.com/angelnikolov/ts-cacheable.git" 21 | }, 22 | "author": "Angel Nikolov ", 23 | "license": "ISC", 24 | "devDependencies": { 25 | "@types/jasmine": "^2.8.6", 26 | "@types/node": "^8.10.0", 27 | "jasmine": "^3.1.0", 28 | "karma": "^6.3.16", 29 | "karma-chrome-launcher": "^2.2.0", 30 | "karma-commonjs": "^1.0.0", 31 | "karma-jasmine": "^2.0.1", 32 | "karma-jasmine-seed-reporter": "^0.2.0", 33 | "karma-typescript": "^5.5.2", 34 | "typescript": "^4.3.2", 35 | "rxjs": "7.8.2" 36 | }, 37 | "bugs": { 38 | "url": "https://github.com/angelnikolov/ts-cacheable/issues" 39 | }, 40 | "homepage": "https://github.com/angelnikolov/ts-cacheable#readme" 41 | } 42 | -------------------------------------------------------------------------------- /dist/cjs/common/index.d.ts: -------------------------------------------------------------------------------- 1 | import { ICacheBusterConfig } from './ICacheBusterConfig'; 2 | import { ICacheConfig } from './ICacheConfig'; 3 | import { ICachePair } from './ICachePair'; 4 | import { IStorageStrategy } from './IStorageStrategy'; 5 | import { IAsyncStorageStrategy } from './IAsyncStorageStrategy'; 6 | import { DOMStorageStrategy } from './DOMStorageStrategy'; 7 | import { LocalStorageStrategy } from './LocalStorageStrategy'; 8 | import { isInstant, bustCache } from './CacheBusterFunctions'; 9 | export declare const DEFAULT_CACHE_RESOLVER: (oldParams: any, newParams: any) => boolean; 10 | export declare const DEFAULT_HASHER: (parameters: Array) => any[]; 11 | export declare type ICacheResolver = (oldParameters: any, newParameters: any) => boolean; 12 | export declare type ICacheHasher = (parameters: Array) => any; 13 | export declare type IShouldCacheDecider = (response: any) => boolean; 14 | export declare type ICacheable = (...args: Array) => T; 15 | export { ICacheBusterConfig, ICacheConfig, ICachePair }; 16 | export declare const GlobalCacheConfig: { 17 | maxAge?: number; 18 | slidingExpiration?: boolean; 19 | maxCacheCount?: number; 20 | cacheResolver?: ICacheResolver; 21 | cacheHasher?: ICacheHasher; 22 | storageStrategy: new () => IStorageStrategy | IAsyncStorageStrategy; 23 | globalCacheKey: string; 24 | promiseImplementation: (() => PromiseConstructorLike) | PromiseConstructorLike; 25 | }; 26 | export { IStorageStrategy }; 27 | export { IAsyncStorageStrategy }; 28 | export { DOMStorageStrategy }; 29 | export { LocalStorageStrategy }; 30 | export { isInstant, bustCache }; 31 | -------------------------------------------------------------------------------- /dist/esm5/common/index.d.ts: -------------------------------------------------------------------------------- 1 | import { ICacheBusterConfig } from './ICacheBusterConfig'; 2 | import { ICacheConfig } from './ICacheConfig'; 3 | import { ICachePair } from './ICachePair'; 4 | import { IStorageStrategy } from './IStorageStrategy'; 5 | import { IAsyncStorageStrategy } from './IAsyncStorageStrategy'; 6 | import { DOMStorageStrategy } from './DOMStorageStrategy'; 7 | import { LocalStorageStrategy } from './LocalStorageStrategy'; 8 | import { isInstant, bustCache } from './CacheBusterFunctions'; 9 | export declare const DEFAULT_CACHE_RESOLVER: (oldParams: any, newParams: any) => boolean; 10 | export declare const DEFAULT_HASHER: (parameters: Array) => any[]; 11 | export declare type ICacheResolver = (oldParameters: any, newParameters: any) => boolean; 12 | export declare type ICacheHasher = (parameters: Array) => any; 13 | export declare type IShouldCacheDecider = (response: any) => boolean; 14 | export declare type ICacheable = (...args: Array) => T; 15 | export { ICacheBusterConfig, ICacheConfig, ICachePair }; 16 | export declare const GlobalCacheConfig: { 17 | maxAge?: number; 18 | slidingExpiration?: boolean; 19 | maxCacheCount?: number; 20 | cacheResolver?: ICacheResolver; 21 | cacheHasher?: ICacheHasher; 22 | storageStrategy: new () => IStorageStrategy | IAsyncStorageStrategy; 23 | globalCacheKey: string; 24 | promiseImplementation: (() => PromiseConstructorLike) | PromiseConstructorLike; 25 | }; 26 | export { IStorageStrategy }; 27 | export { IAsyncStorageStrategy }; 28 | export { DOMStorageStrategy }; 29 | export { LocalStorageStrategy }; 30 | export { isInstant, bustCache }; 31 | -------------------------------------------------------------------------------- /dist/esm2015/common/index.d.ts: -------------------------------------------------------------------------------- 1 | import { ICacheBusterConfig } from './ICacheBusterConfig'; 2 | import { ICacheConfig } from './ICacheConfig'; 3 | import { ICachePair } from './ICachePair'; 4 | import { IStorageStrategy } from './IStorageStrategy'; 5 | import { IAsyncStorageStrategy } from './IAsyncStorageStrategy'; 6 | import { DOMStorageStrategy } from './DOMStorageStrategy'; 7 | import { LocalStorageStrategy } from './LocalStorageStrategy'; 8 | import { isInstant, bustCache } from './CacheBusterFunctions'; 9 | export declare const DEFAULT_CACHE_RESOLVER: (oldParams: any, newParams: any) => boolean; 10 | export declare const DEFAULT_HASHER: (parameters: Array) => any[]; 11 | export declare type ICacheResolver = (oldParameters: any, newParameters: any) => boolean; 12 | export declare type ICacheHasher = (parameters: Array) => any; 13 | export declare type IShouldCacheDecider = (response: any) => boolean; 14 | export declare type ICacheable = (...args: Array) => T; 15 | export { ICacheBusterConfig, ICacheConfig, ICachePair }; 16 | export declare const GlobalCacheConfig: { 17 | maxAge?: number; 18 | slidingExpiration?: boolean; 19 | maxCacheCount?: number; 20 | cacheResolver?: ICacheResolver; 21 | cacheHasher?: ICacheHasher; 22 | storageStrategy: new () => IStorageStrategy | IAsyncStorageStrategy; 23 | globalCacheKey: string; 24 | promiseImplementation: (() => PromiseConstructorLike) | PromiseConstructorLike; 25 | }; 26 | export { IStorageStrategy }; 27 | export { IAsyncStorageStrategy }; 28 | export { DOMStorageStrategy }; 29 | export { LocalStorageStrategy }; 30 | export { isInstant, bustCache }; 31 | -------------------------------------------------------------------------------- /dist/esm2015/promise.cache-buster.decorator.js: -------------------------------------------------------------------------------- 1 | import { bustCache, isInstant } from './common'; 2 | export function PCacheBuster(cacheBusterConfig) { 3 | return function (_target, _propertyKey, propertyDescriptor) { 4 | const decoratedMethod = propertyDescriptor.value; 5 | if (propertyDescriptor && propertyDescriptor.value) { 6 | /* use function instead of an arrow function to keep context of invocation */ 7 | propertyDescriptor.value = function (...parameters) { 8 | if (isInstant(cacheBusterConfig)) { 9 | bustCache(cacheBusterConfig); 10 | return decoratedMethod.call(this, ...parameters); 11 | } 12 | const decoratedMethodResult = decoratedMethod.call(this, ...parameters); 13 | throwErrorIfResultIsNotPromise(decoratedMethodResult); 14 | return decoratedMethodResult.then(response => { 15 | bustCache(cacheBusterConfig); 16 | return response; 17 | }); 18 | }; 19 | } 20 | ; 21 | return propertyDescriptor; 22 | }; 23 | } 24 | ; 25 | export const NO_PROMISE_ERROR_MESSAGE = ` 26 | Method decorated with @CacheBuster should return Promise. 27 | If you don't want to change the method signature, set isInstant flag to true. 28 | `; 29 | function throwErrorIfResultIsNotPromise(decoratedMethodResult) { 30 | if (decoratedMethodResult instanceof Promise === false) { 31 | throw new Error(NO_PROMISE_ERROR_MESSAGE); 32 | } 33 | } 34 | //# sourceMappingURL=promise.cache-buster.decorator.js.map -------------------------------------------------------------------------------- /specs/service.interface.ts: -------------------------------------------------------------------------------- 1 | import { Cat } from './cat'; 2 | export interface IService { 3 | mockServiceCall(parameter: any): T; 4 | mockSaveServiceCall(): T; 5 | mockServiceCallWithMultipleParameters(parameter1: any, parameter2: any): T; 6 | getData(parameter: string): T; 7 | getDataWithParamsObj(parameter: any): T; 8 | getDataAndReturnCachedStream(parameter: string): T; 9 | getDataWithExpiration(parameter: string): T; 10 | getDataWithSlidingExpiration(parameter: string): T; 11 | getDataWithMaxCacheCount(parameter: string): T; 12 | getDataWithMaxCacheCountAndExpiration(parameter: string): T; 13 | getDataWithMaxCacheCountAndSlidingExpiration(parameter: string): T; 14 | getDataWithCustomCacheResolver( 15 | parameter: string, 16 | _cacheRerouterParameter?: { straightToLastCache: boolean } 17 | ): T; 18 | getDataWithCustomCacheResolverAndHasher( 19 | parameter: number 20 | ): T; 21 | getWithAComplexType( 22 | parameter: Cat 23 | ): T; 24 | getDataWithCustomCacheDecider(parameter: string): T; 25 | saveDataAndCacheBust(): T; 26 | saveDataAndCacheBustWithInstant(): T; 27 | getDataWithCacheBusting(parameter: string): T; 28 | getDataWithUndefinedParameter(parameter?: string): T; 29 | getDataWithMultipleUndefinedParameters(parameter: string, parameter1: string): T; 30 | getDataWithCustomStorageStrategyProvided(parameter: string): T; 31 | getDataWithCustomContextStorageStrategy(parameter: string): T; 32 | getDataAsync?(parameter: string): T; 33 | getData1?(parameter: string): T; 34 | getData2?(parameter: string): T; 35 | getData3?(parameter: string): T; 36 | getMutableData(parameter: string): T; 37 | } 38 | -------------------------------------------------------------------------------- /dist/esm2015/cache-buster.decorator.js: -------------------------------------------------------------------------------- 1 | import { bustCache, isInstant } from './common'; 2 | import { Observable } from 'rxjs'; 3 | import { tap } from 'rxjs/operators'; 4 | export function CacheBuster(cacheBusterConfig) { 5 | return function (_target, _propertyKey, propertyDescriptor) { 6 | const decoratedMethod = propertyDescriptor.value; 7 | if (propertyDescriptor && propertyDescriptor.value) { 8 | /* use function instead of an arrow function to keep context of invocation */ 9 | propertyDescriptor.value = function (...parameters) { 10 | if (isInstant(cacheBusterConfig)) { 11 | bustCache(cacheBusterConfig); 12 | return decoratedMethod.call(this, ...parameters); 13 | } 14 | const decoratedMethodResult = decoratedMethod.call(this, ...parameters); 15 | throwErrorIfResultIsNotObservable(decoratedMethodResult); 16 | return decoratedMethodResult.pipe(tap(() => { 17 | bustCache(cacheBusterConfig); 18 | })); 19 | }; 20 | } 21 | ; 22 | return propertyDescriptor; 23 | }; 24 | } 25 | ; 26 | export const NO_OBSERVABLE_ERROR_MESSAGE = ` 27 | Method decorated with @CacheBuster should return observable. 28 | If you don't want to change the method signature, set isInstant flag to true. 29 | `; 30 | export function throwErrorIfResultIsNotObservable(decoratedMethodResult) { 31 | if (decoratedMethodResult instanceof Observable === false) { 32 | throw new Error(NO_OBSERVABLE_ERROR_MESSAGE); 33 | } 34 | } 35 | //# sourceMappingURL=cache-buster.decorator.js.map -------------------------------------------------------------------------------- /dist/cjs/specs/service.interface.d.ts: -------------------------------------------------------------------------------- 1 | import { Cat } from './cat'; 2 | export interface IService { 3 | mockServiceCall(parameter: any): T; 4 | mockSaveServiceCall(): T; 5 | mockServiceCallWithMultipleParameters(parameter1: any, parameter2: any): T; 6 | getData(parameter: string): T; 7 | getDataWithParamsObj(parameter: any): T; 8 | getDataAndReturnCachedStream(parameter: string): T; 9 | getDataWithExpiration(parameter: string): T; 10 | getDataWithSlidingExpiration(parameter: string): T; 11 | getDataWithMaxCacheCount(parameter: string): T; 12 | getDataWithMaxCacheCountAndExpiration(parameter: string): T; 13 | getDataWithMaxCacheCountAndSlidingExpiration(parameter: string): T; 14 | getDataWithCustomCacheResolver(parameter: string, _cacheRerouterParameter?: { 15 | straightToLastCache: boolean; 16 | }): T; 17 | getDataWithCustomCacheResolverAndHasher(parameter: number): T; 18 | getWithAComplexType(parameter: Cat): T; 19 | getDataWithCustomCacheDecider(parameter: string): T; 20 | saveDataAndCacheBust(): T; 21 | saveDataAndCacheBustWithInstant(): T; 22 | getDataWithCacheBusting(parameter: string): T; 23 | getDataWithUndefinedParameter(parameter?: string): T; 24 | getDataWithMultipleUndefinedParameters(parameter: string, parameter1: string): T; 25 | getDataWithCustomStorageStrategyProvided(parameter: string): T; 26 | getDataWithCustomContextStorageStrategy(parameter: string): T; 27 | getDataAsync?(parameter: string): T; 28 | getData1?(parameter: string): T; 29 | getData2?(parameter: string): T; 30 | getData3?(parameter: string): T; 31 | getMutableData(parameter: string): T; 32 | } 33 | -------------------------------------------------------------------------------- /common/InMemoryStorageStrategy.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __extends = (this && this.__extends) || (function () { 3 | var extendStatics = Object.setPrototypeOf || 4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 6 | return function (d, b) { 7 | extendStatics(d, b); 8 | function __() { this.constructor = d; } 9 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 10 | }; 11 | })(); 12 | exports.__esModule = true; 13 | var IStorageStrategy_1 = require("./IStorageStrategy"); 14 | var InMemoryStorageStrategy = /** @class */ (function (_super) { 15 | __extends(InMemoryStorageStrategy, _super); 16 | function InMemoryStorageStrategy() { 17 | var _this = _super !== null && _super.apply(this, arguments) || this; 18 | _this.cachePairs = []; 19 | return _this; 20 | } 21 | InMemoryStorageStrategy.prototype.add = function (cachePair) { 22 | this.cachePairs.push(cachePair); 23 | }; 24 | ; 25 | InMemoryStorageStrategy.prototype.updateAtIndex = function (index, entity) { 26 | var updatee = this.cachePairs[index]; 27 | Object.assign(updatee, entity); 28 | }; 29 | InMemoryStorageStrategy.prototype.getAll = function () { 30 | return this.cachePairs; 31 | }; 32 | ; 33 | InMemoryStorageStrategy.prototype.removeAtIndex = function (index) { 34 | this.cachePairs.splice(index, 1); 35 | }; 36 | InMemoryStorageStrategy.prototype.removeAll = function () { 37 | this.cachePairs.length = 0; 38 | }; 39 | return InMemoryStorageStrategy; 40 | }(IStorageStrategy_1.IStorageStrategy)); 41 | exports.InMemoryStorageStrategy = InMemoryStorageStrategy; 42 | -------------------------------------------------------------------------------- /promise.cache-buster.decorator.ts: -------------------------------------------------------------------------------- 1 | import { 2 | DecoratorFactoryTypeOfAnyOrKReturnType, ICacheBusterConfigOrConfigWithInstant 3 | } from './common/ICacheBusterConfig'; 4 | import {bustCache, ICacheable, isInstant} from './common'; 5 | 6 | export function PCacheBuster(cacheBusterConfig?: T) 7 | : DecoratorFactoryTypeOfAnyOrKReturnType>> { 8 | return function ( 9 | _target: Object, 10 | _propertyKey: string, 11 | propertyDescriptor: TypedPropertyDescriptor>> 12 | ) { 13 | const decoratedMethod = propertyDescriptor.value; 14 | if (propertyDescriptor && propertyDescriptor.value) { 15 | /* use function instead of an arrow function to keep context of invocation */ 16 | (propertyDescriptor.value as any) = function (...parameters: Array) { 17 | if(isInstant(cacheBusterConfig)){ 18 | bustCache(cacheBusterConfig); 19 | return decoratedMethod.call(this, ...parameters); 20 | } 21 | 22 | const decoratedMethodResult = decoratedMethod.call(this, ...parameters) 23 | 24 | throwErrorIfResultIsNotPromise(decoratedMethodResult); 25 | 26 | return decoratedMethodResult.then( 27 | response => { 28 | bustCache(cacheBusterConfig) 29 | return response; 30 | } 31 | ); 32 | }; 33 | }; 34 | return propertyDescriptor; 35 | }; 36 | }; 37 | 38 | export const NO_PROMISE_ERROR_MESSAGE = ` 39 | Method decorated with @CacheBuster should return Promise. 40 | If you don't want to change the method signature, set isInstant flag to true. 41 | `; 42 | 43 | function throwErrorIfResultIsNotPromise(decoratedMethodResult: any): asserts decoratedMethodResult is Promise { 44 | if (decoratedMethodResult instanceof Promise === false) { 45 | throw new Error(NO_PROMISE_ERROR_MESSAGE); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /common/index.ts: -------------------------------------------------------------------------------- 1 | import { ICacheBusterConfig } from './ICacheBusterConfig'; 2 | import { ICacheConfig } from './ICacheConfig'; 3 | import { ICachePair } from './ICachePair'; 4 | import { IStorageStrategy } from './IStorageStrategy'; 5 | import { InMemoryStorageStrategy } from './InMemoryStorageStrategy'; 6 | import { IAsyncStorageStrategy } from './IAsyncStorageStrategy'; 7 | import { DOMStorageStrategy } from './DOMStorageStrategy'; 8 | import { LocalStorageStrategy } from './LocalStorageStrategy'; 9 | import { isInstant, bustCache } from './CacheBusterFunctions'; 10 | 11 | export const DEFAULT_CACHE_RESOLVER = (oldParams: any, newParams: any) => 12 | JSON.stringify(oldParams) === JSON.stringify(newParams); 13 | 14 | export const DEFAULT_HASHER = (parameters: Array) => parameters.map(param => param !== undefined ? JSON.parse(JSON.stringify(param)) : param); 15 | 16 | export type ICacheResolver = ( 17 | oldParameters: any, 18 | newParameters: any 19 | ) => boolean; 20 | 21 | export type ICacheHasher = ( 22 | parameters: Array 23 | ) => any; 24 | 25 | export type IShouldCacheDecider = (response: any) => boolean; 26 | 27 | export type ICacheable = (...args: Array) => T; 28 | 29 | export { ICacheBusterConfig, ICacheConfig, ICachePair }; 30 | 31 | export const GlobalCacheConfig: { 32 | maxAge?: number; 33 | slidingExpiration?: boolean; 34 | maxCacheCount?: number; 35 | cacheResolver?: ICacheResolver; 36 | cacheHasher?: ICacheHasher; 37 | storageStrategy: new () => IStorageStrategy | IAsyncStorageStrategy; 38 | globalCacheKey: string; 39 | promiseImplementation: (() => PromiseConstructorLike) | PromiseConstructorLike; 40 | } = { 41 | storageStrategy: InMemoryStorageStrategy, 42 | globalCacheKey: 'CACHE_STORAGE', 43 | promiseImplementation: Promise 44 | } 45 | 46 | export { IStorageStrategy }; 47 | export { IAsyncStorageStrategy }; 48 | export { DOMStorageStrategy }; 49 | export { LocalStorageStrategy }; 50 | export { isInstant, bustCache }; 51 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | const jasmineSeedReporter = require('karma-jasmine-seed-reporter'); 2 | 3 | module.exports = function (config) { 4 | config.set({ 5 | frameworks: ['jasmine', 'karma-typescript'], 6 | browsers: ['ChromeHeadlessNoSandbox'], 7 | reporters: ['progress', 'karma-typescript', 'jasmine-seed'], 8 | plugins: ['karma-*', jasmineSeedReporter], 9 | client: { 10 | jasmine: { 11 | random: true, 12 | // seed: process.env['JASMINE_SEED'] // allows you to override the seed via an environment variable 13 | }, 14 | }, 15 | files: [ 16 | './index.ts', 17 | './common/index.ts', 18 | './common/IAsyncStorageStrategy.ts', 19 | './common/IStorageStrategy.ts', 20 | './common/DOMStorageStrategy.ts', 21 | './common/LocalStorageStrategy.ts', 22 | './common/InMemoryStorageStrategy.ts', 23 | './common/CacheBusterFunctions.ts', 24 | './cacheable.decorator.ts', 25 | './cache-buster.decorator.ts', 26 | './promise.cache-buster.decorator.ts', 27 | './promise.cacheable.decorator.ts', 28 | './specs/observable-cacheable.decorator.spec.ts', 29 | './specs/promise-cacheable.decorator.spec.ts', 30 | './specs/cache-buster.decorator.spec.ts', 31 | './specs/promise.cache-buster.decorator.spec.ts', 32 | './specs/cat.ts', 33 | './specs/service.interface.ts', 34 | ], 35 | preprocessors: { 36 | '**/*.ts': 'karma-typescript', 37 | }, 38 | karmaTypescriptConfig: { 39 | tsconfig: './tsconfig.json', 40 | reports: { 41 | lcovonly: { 42 | directory: 'coverage', 43 | subdirectory: 'lcov', 44 | filename: 'coverage.xml', 45 | }, 46 | }, 47 | }, 48 | // you can define custom flags 49 | customLaunchers: { 50 | ChromeHeadlessNoSandbox: { 51 | base: 'ChromeHeadless', 52 | flags: ['--no-sandbox'], 53 | }, 54 | }, 55 | singleRun: true 56 | }); 57 | }; 58 | -------------------------------------------------------------------------------- /cache-buster.decorator.ts: -------------------------------------------------------------------------------- 1 | import { 2 | DecoratorFactoryTypeOfAnyOrKReturnType, 3 | ICacheBusterConfigOrConfigWithInstant 4 | } from './common/ICacheBusterConfig'; 5 | import {bustCache, ICacheable, isInstant} from './common'; 6 | import {Observable} from 'rxjs'; 7 | import {tap} from 'rxjs/operators'; 8 | 9 | export function CacheBuster(cacheBusterConfig?: T) 10 | : DecoratorFactoryTypeOfAnyOrKReturnType>> { 11 | return function ( 12 | _target: Object, 13 | _propertyKey: string, 14 | propertyDescriptor: TypedPropertyDescriptor> | any> 15 | ) { 16 | const decoratedMethod = propertyDescriptor.value; 17 | if (propertyDescriptor && propertyDescriptor.value) { 18 | /* use function instead of an arrow function to keep context of invocation */ 19 | propertyDescriptor.value = function (...parameters: Array) { 20 | if(isInstant(cacheBusterConfig)) { 21 | bustCache(cacheBusterConfig); 22 | return decoratedMethod.call(this, ...parameters); 23 | } 24 | 25 | const decoratedMethodResult = decoratedMethod.call(this, ...parameters); 26 | 27 | throwErrorIfResultIsNotObservable(decoratedMethodResult); 28 | 29 | return decoratedMethodResult.pipe( 30 | tap(() => { 31 | bustCache(cacheBusterConfig); 32 | }) 33 | ); 34 | }; 35 | }; 36 | return propertyDescriptor; 37 | }; 38 | }; 39 | 40 | export const NO_OBSERVABLE_ERROR_MESSAGE = ` 41 | Method decorated with @CacheBuster should return observable. 42 | If you don't want to change the method signature, set isInstant flag to true. 43 | `; 44 | 45 | export function throwErrorIfResultIsNotObservable(decoratedMethodResult: any): asserts decoratedMethodResult is Observable { 46 | if (decoratedMethodResult instanceof Observable === false) { 47 | throw new Error(NO_OBSERVABLE_ERROR_MESSAGE); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /dist/cjs/common/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.bustCache = exports.isInstant = exports.LocalStorageStrategy = exports.DOMStorageStrategy = exports.IAsyncStorageStrategy = exports.IStorageStrategy = exports.GlobalCacheConfig = exports.DEFAULT_HASHER = exports.DEFAULT_CACHE_RESOLVER = void 0; 4 | var IStorageStrategy_1 = require("./IStorageStrategy"); 5 | Object.defineProperty(exports, "IStorageStrategy", { enumerable: true, get: function () { return IStorageStrategy_1.IStorageStrategy; } }); 6 | var InMemoryStorageStrategy_1 = require("./InMemoryStorageStrategy"); 7 | var IAsyncStorageStrategy_1 = require("./IAsyncStorageStrategy"); 8 | Object.defineProperty(exports, "IAsyncStorageStrategy", { enumerable: true, get: function () { return IAsyncStorageStrategy_1.IAsyncStorageStrategy; } }); 9 | var DOMStorageStrategy_1 = require("./DOMStorageStrategy"); 10 | Object.defineProperty(exports, "DOMStorageStrategy", { enumerable: true, get: function () { return DOMStorageStrategy_1.DOMStorageStrategy; } }); 11 | var LocalStorageStrategy_1 = require("./LocalStorageStrategy"); 12 | Object.defineProperty(exports, "LocalStorageStrategy", { enumerable: true, get: function () { return LocalStorageStrategy_1.LocalStorageStrategy; } }); 13 | var CacheBusterFunctions_1 = require("./CacheBusterFunctions"); 14 | Object.defineProperty(exports, "isInstant", { enumerable: true, get: function () { return CacheBusterFunctions_1.isInstant; } }); 15 | Object.defineProperty(exports, "bustCache", { enumerable: true, get: function () { return CacheBusterFunctions_1.bustCache; } }); 16 | var DEFAULT_CACHE_RESOLVER = function (oldParams, newParams) { 17 | return JSON.stringify(oldParams) === JSON.stringify(newParams); 18 | }; 19 | exports.DEFAULT_CACHE_RESOLVER = DEFAULT_CACHE_RESOLVER; 20 | var DEFAULT_HASHER = function (parameters) { return parameters.map(function (param) { return param !== undefined ? JSON.parse(JSON.stringify(param)) : param; }); }; 21 | exports.DEFAULT_HASHER = DEFAULT_HASHER; 22 | exports.GlobalCacheConfig = { 23 | storageStrategy: InMemoryStorageStrategy_1.InMemoryStorageStrategy, 24 | globalCacheKey: 'CACHE_STORAGE', 25 | promiseImplementation: Promise 26 | }; 27 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /common/ICacheConfig.ts: -------------------------------------------------------------------------------- 1 | import {Observable, Subject} from 'rxjs'; 2 | import {ICacheResolver, IShouldCacheDecider, ICacheHasher, ICachePair} from './index'; 3 | import {IStorageStrategy} from './IStorageStrategy'; 4 | import {IAsyncStorageStrategy} from './IAsyncStorageStrategy'; 5 | export interface ICacheConfig { 6 | /** 7 | * @description cache resolver which will get old and new paramaters passed to and based on those 8 | * will figure out if we need to bail out of cache or not 9 | */ 10 | cacheResolver?: ICacheResolver; 11 | /** 12 | * @description cache hasher which will be called to hash the parameters into a cache key 13 | */ 14 | cacheHasher?: ICacheHasher; 15 | /** 16 | * @description cache decider that will figure out if the response should be cached or not, based on it 17 | */ 18 | shouldCacheDecider?: IShouldCacheDecider; 19 | /** 20 | * maxAge of cache in milliseconds 21 | * @description if time between method calls is larger - we bail out of cache 22 | */ 23 | maxAge?: number; 24 | /** 25 | * whether should use a sliding expiration strategy on caches 26 | * this will reset the cache created property and keep the cache alive for @param maxAge milliseconds more 27 | */ 28 | slidingExpiration?: boolean; 29 | /** 30 | * max cacheCount for different parameters 31 | * @description maximum allowed unique caches (different parameters) 32 | */ 33 | maxCacheCount?: number; 34 | 35 | /** 36 | * pass an Observable upon whose emission all caches will be busted 37 | */ 38 | cacheBusterObserver?: Observable; 39 | 40 | /** 41 | * storage strategy 42 | */ 43 | storageStrategy?: new () => IStorageStrategy | IAsyncStorageStrategy; 44 | 45 | /** 46 | * property name under which to store the cached pairs for this method 47 | * if not provided a combination of class name + method name will be used 48 | */ 49 | cacheKey?: string; 50 | 51 | /** 52 | * Emit a callback which changes the caches and returns it. 53 | * Whatever is returned from the callback will be automatically stored against the chosen cacheKey in the 54 | * storage of the storage strategy you've chosen. 55 | */ 56 | cacheModifier?: Subject<(cachePairs: ICachePair[]) => ICachePair[]>; 57 | } 58 | -------------------------------------------------------------------------------- /dist/esm5/promise.cache-buster.decorator.js: -------------------------------------------------------------------------------- 1 | var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { 2 | if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 3 | if (ar || !(i in from)) { 4 | if (!ar) ar = Array.prototype.slice.call(from, 0, i); 5 | ar[i] = from[i]; 6 | } 7 | } 8 | return to.concat(ar || Array.prototype.slice.call(from)); 9 | }; 10 | import { bustCache, isInstant } from './common'; 11 | export function PCacheBuster(cacheBusterConfig) { 12 | return function (_target, _propertyKey, propertyDescriptor) { 13 | var decoratedMethod = propertyDescriptor.value; 14 | if (propertyDescriptor && propertyDescriptor.value) { 15 | /* use function instead of an arrow function to keep context of invocation */ 16 | propertyDescriptor.value = function () { 17 | var parameters = []; 18 | for (var _i = 0; _i < arguments.length; _i++) { 19 | parameters[_i] = arguments[_i]; 20 | } 21 | if (isInstant(cacheBusterConfig)) { 22 | bustCache(cacheBusterConfig); 23 | return decoratedMethod.call.apply(decoratedMethod, __spreadArray([this], parameters, false)); 24 | } 25 | var decoratedMethodResult = decoratedMethod.call.apply(decoratedMethod, __spreadArray([this], parameters, false)); 26 | throwErrorIfResultIsNotPromise(decoratedMethodResult); 27 | return decoratedMethodResult.then(function (response) { 28 | bustCache(cacheBusterConfig); 29 | return response; 30 | }); 31 | }; 32 | } 33 | ; 34 | return propertyDescriptor; 35 | }; 36 | } 37 | ; 38 | export var NO_PROMISE_ERROR_MESSAGE = "\n Method decorated with @CacheBuster should return Promise. \n If you don't want to change the method signature, set isInstant flag to true.\n"; 39 | function throwErrorIfResultIsNotPromise(decoratedMethodResult) { 40 | if (decoratedMethodResult instanceof Promise === false) { 41 | throw new Error(NO_PROMISE_ERROR_MESSAGE); 42 | } 43 | } 44 | //# sourceMappingURL=promise.cache-buster.decorator.js.map -------------------------------------------------------------------------------- /dist/esm5/cache-buster.decorator.js: -------------------------------------------------------------------------------- 1 | var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { 2 | if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 3 | if (ar || !(i in from)) { 4 | if (!ar) ar = Array.prototype.slice.call(from, 0, i); 5 | ar[i] = from[i]; 6 | } 7 | } 8 | return to.concat(ar || Array.prototype.slice.call(from)); 9 | }; 10 | import { bustCache, isInstant } from './common'; 11 | import { Observable } from 'rxjs'; 12 | import { tap } from 'rxjs/operators'; 13 | export function CacheBuster(cacheBusterConfig) { 14 | return function (_target, _propertyKey, propertyDescriptor) { 15 | var decoratedMethod = propertyDescriptor.value; 16 | if (propertyDescriptor && propertyDescriptor.value) { 17 | /* use function instead of an arrow function to keep context of invocation */ 18 | propertyDescriptor.value = function () { 19 | var parameters = []; 20 | for (var _i = 0; _i < arguments.length; _i++) { 21 | parameters[_i] = arguments[_i]; 22 | } 23 | if (isInstant(cacheBusterConfig)) { 24 | bustCache(cacheBusterConfig); 25 | return decoratedMethod.call.apply(decoratedMethod, __spreadArray([this], parameters, false)); 26 | } 27 | var decoratedMethodResult = decoratedMethod.call.apply(decoratedMethod, __spreadArray([this], parameters, false)); 28 | throwErrorIfResultIsNotObservable(decoratedMethodResult); 29 | return decoratedMethodResult.pipe(tap(function () { 30 | bustCache(cacheBusterConfig); 31 | })); 32 | }; 33 | } 34 | ; 35 | return propertyDescriptor; 36 | }; 37 | } 38 | ; 39 | export var NO_OBSERVABLE_ERROR_MESSAGE = "\n Method decorated with @CacheBuster should return observable. \n If you don't want to change the method signature, set isInstant flag to true.\n"; 40 | export function throwErrorIfResultIsNotObservable(decoratedMethodResult) { 41 | if (decoratedMethodResult instanceof Observable === false) { 42 | throw new Error(NO_OBSERVABLE_ERROR_MESSAGE); 43 | } 44 | } 45 | //# sourceMappingURL=cache-buster.decorator.js.map -------------------------------------------------------------------------------- /dist/cjs/common/ICacheConfig.d.ts: -------------------------------------------------------------------------------- 1 | import { Observable, Subject } from 'rxjs'; 2 | import { ICacheResolver, IShouldCacheDecider, ICacheHasher, ICachePair } from './index'; 3 | import { IStorageStrategy } from './IStorageStrategy'; 4 | import { IAsyncStorageStrategy } from './IAsyncStorageStrategy'; 5 | export interface ICacheConfig { 6 | /** 7 | * @description cache resolver which will get old and new paramaters passed to and based on those 8 | * will figure out if we need to bail out of cache or not 9 | */ 10 | cacheResolver?: ICacheResolver; 11 | /** 12 | * @description cache hasher which will be called to hash the parameters into a cache key 13 | */ 14 | cacheHasher?: ICacheHasher; 15 | /** 16 | * @description cache decider that will figure out if the response should be cached or not, based on it 17 | */ 18 | shouldCacheDecider?: IShouldCacheDecider; 19 | /** 20 | * maxAge of cache in milliseconds 21 | * @description if time between method calls is larger - we bail out of cache 22 | */ 23 | maxAge?: number; 24 | /** 25 | * whether should use a sliding expiration strategy on caches 26 | * this will reset the cache created property and keep the cache alive for @param maxAge milliseconds more 27 | */ 28 | slidingExpiration?: boolean; 29 | /** 30 | * max cacheCount for different parameters 31 | * @description maximum allowed unique caches (different parameters) 32 | */ 33 | maxCacheCount?: number; 34 | /** 35 | * pass an Observable upon whose emission all caches will be busted 36 | */ 37 | cacheBusterObserver?: Observable; 38 | /** 39 | * storage strategy 40 | */ 41 | storageStrategy?: new () => IStorageStrategy | IAsyncStorageStrategy; 42 | /** 43 | * property name under which to store the cached pairs for this method 44 | * if not provided a combination of class name + method name will be used 45 | */ 46 | cacheKey?: string; 47 | /** 48 | * Emit a callback which changes the caches and returns it. 49 | * Whatever is returned from the callback will be automatically stored against the chosen cacheKey in the 50 | * storage of the storage strategy you've chosen. 51 | */ 52 | cacheModifier?: Subject<(cachePairs: ICachePair[]) => ICachePair[]>; 53 | } 54 | -------------------------------------------------------------------------------- /dist/esm5/common/ICacheConfig.d.ts: -------------------------------------------------------------------------------- 1 | import { Observable, Subject } from 'rxjs'; 2 | import { ICacheResolver, IShouldCacheDecider, ICacheHasher, ICachePair } from './index'; 3 | import { IStorageStrategy } from './IStorageStrategy'; 4 | import { IAsyncStorageStrategy } from './IAsyncStorageStrategy'; 5 | export interface ICacheConfig { 6 | /** 7 | * @description cache resolver which will get old and new paramaters passed to and based on those 8 | * will figure out if we need to bail out of cache or not 9 | */ 10 | cacheResolver?: ICacheResolver; 11 | /** 12 | * @description cache hasher which will be called to hash the parameters into a cache key 13 | */ 14 | cacheHasher?: ICacheHasher; 15 | /** 16 | * @description cache decider that will figure out if the response should be cached or not, based on it 17 | */ 18 | shouldCacheDecider?: IShouldCacheDecider; 19 | /** 20 | * maxAge of cache in milliseconds 21 | * @description if time between method calls is larger - we bail out of cache 22 | */ 23 | maxAge?: number; 24 | /** 25 | * whether should use a sliding expiration strategy on caches 26 | * this will reset the cache created property and keep the cache alive for @param maxAge milliseconds more 27 | */ 28 | slidingExpiration?: boolean; 29 | /** 30 | * max cacheCount for different parameters 31 | * @description maximum allowed unique caches (different parameters) 32 | */ 33 | maxCacheCount?: number; 34 | /** 35 | * pass an Observable upon whose emission all caches will be busted 36 | */ 37 | cacheBusterObserver?: Observable; 38 | /** 39 | * storage strategy 40 | */ 41 | storageStrategy?: new () => IStorageStrategy | IAsyncStorageStrategy; 42 | /** 43 | * property name under which to store the cached pairs for this method 44 | * if not provided a combination of class name + method name will be used 45 | */ 46 | cacheKey?: string; 47 | /** 48 | * Emit a callback which changes the caches and returns it. 49 | * Whatever is returned from the callback will be automatically stored against the chosen cacheKey in the 50 | * storage of the storage strategy you've chosen. 51 | */ 52 | cacheModifier?: Subject<(cachePairs: ICachePair[]) => ICachePair[]>; 53 | } 54 | -------------------------------------------------------------------------------- /dist/esm2015/common/ICacheConfig.d.ts: -------------------------------------------------------------------------------- 1 | import { Observable, Subject } from 'rxjs'; 2 | import { ICacheResolver, IShouldCacheDecider, ICacheHasher, ICachePair } from './index'; 3 | import { IStorageStrategy } from './IStorageStrategy'; 4 | import { IAsyncStorageStrategy } from './IAsyncStorageStrategy'; 5 | export interface ICacheConfig { 6 | /** 7 | * @description cache resolver which will get old and new paramaters passed to and based on those 8 | * will figure out if we need to bail out of cache or not 9 | */ 10 | cacheResolver?: ICacheResolver; 11 | /** 12 | * @description cache hasher which will be called to hash the parameters into a cache key 13 | */ 14 | cacheHasher?: ICacheHasher; 15 | /** 16 | * @description cache decider that will figure out if the response should be cached or not, based on it 17 | */ 18 | shouldCacheDecider?: IShouldCacheDecider; 19 | /** 20 | * maxAge of cache in milliseconds 21 | * @description if time between method calls is larger - we bail out of cache 22 | */ 23 | maxAge?: number; 24 | /** 25 | * whether should use a sliding expiration strategy on caches 26 | * this will reset the cache created property and keep the cache alive for @param maxAge milliseconds more 27 | */ 28 | slidingExpiration?: boolean; 29 | /** 30 | * max cacheCount for different parameters 31 | * @description maximum allowed unique caches (different parameters) 32 | */ 33 | maxCacheCount?: number; 34 | /** 35 | * pass an Observable upon whose emission all caches will be busted 36 | */ 37 | cacheBusterObserver?: Observable; 38 | /** 39 | * storage strategy 40 | */ 41 | storageStrategy?: new () => IStorageStrategy | IAsyncStorageStrategy; 42 | /** 43 | * property name under which to store the cached pairs for this method 44 | * if not provided a combination of class name + method name will be used 45 | */ 46 | cacheKey?: string; 47 | /** 48 | * Emit a callback which changes the caches and returns it. 49 | * Whatever is returned from the callback will be automatically stored against the chosen cacheKey in the 50 | * storage of the storage strategy you've chosen. 51 | */ 52 | cacheModifier?: Subject<(cachePairs: ICachePair[]) => ICachePair[]>; 53 | } 54 | -------------------------------------------------------------------------------- /dist/cjs/promise.cache-buster.decorator.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { 3 | if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 4 | if (ar || !(i in from)) { 5 | if (!ar) ar = Array.prototype.slice.call(from, 0, i); 6 | ar[i] = from[i]; 7 | } 8 | } 9 | return to.concat(ar || Array.prototype.slice.call(from)); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.NO_PROMISE_ERROR_MESSAGE = exports.PCacheBuster = void 0; 13 | var common_1 = require("./common"); 14 | function PCacheBuster(cacheBusterConfig) { 15 | return function (_target, _propertyKey, propertyDescriptor) { 16 | var decoratedMethod = propertyDescriptor.value; 17 | if (propertyDescriptor && propertyDescriptor.value) { 18 | /* use function instead of an arrow function to keep context of invocation */ 19 | propertyDescriptor.value = function () { 20 | var parameters = []; 21 | for (var _i = 0; _i < arguments.length; _i++) { 22 | parameters[_i] = arguments[_i]; 23 | } 24 | if ((0, common_1.isInstant)(cacheBusterConfig)) { 25 | (0, common_1.bustCache)(cacheBusterConfig); 26 | return decoratedMethod.call.apply(decoratedMethod, __spreadArray([this], parameters, false)); 27 | } 28 | var decoratedMethodResult = decoratedMethod.call.apply(decoratedMethod, __spreadArray([this], parameters, false)); 29 | throwErrorIfResultIsNotPromise(decoratedMethodResult); 30 | return decoratedMethodResult.then(function (response) { 31 | (0, common_1.bustCache)(cacheBusterConfig); 32 | return response; 33 | }); 34 | }; 35 | } 36 | ; 37 | return propertyDescriptor; 38 | }; 39 | } 40 | exports.PCacheBuster = PCacheBuster; 41 | ; 42 | exports.NO_PROMISE_ERROR_MESSAGE = "\n Method decorated with @CacheBuster should return Promise. \n If you don't want to change the method signature, set isInstant flag to true.\n"; 43 | function throwErrorIfResultIsNotPromise(decoratedMethodResult) { 44 | if (decoratedMethodResult instanceof Promise === false) { 45 | throw new Error(exports.NO_PROMISE_ERROR_MESSAGE); 46 | } 47 | } 48 | //# sourceMappingURL=promise.cache-buster.decorator.js.map -------------------------------------------------------------------------------- /dist/esm5/common/InMemoryStorageStrategy.js: -------------------------------------------------------------------------------- 1 | var __extends = (this && this.__extends) || (function () { 2 | var extendStatics = function (d, b) { 3 | extendStatics = Object.setPrototypeOf || 4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 6 | return extendStatics(d, b); 7 | }; 8 | return function (d, b) { 9 | if (typeof b !== "function" && b !== null) 10 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 11 | extendStatics(d, b); 12 | function __() { this.constructor = d; } 13 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 14 | }; 15 | })(); 16 | import { IStorageStrategy } from './IStorageStrategy'; 17 | var InMemoryStorageStrategy = /** @class */ (function (_super) { 18 | __extends(InMemoryStorageStrategy, _super); 19 | function InMemoryStorageStrategy() { 20 | var _this = _super !== null && _super.apply(this, arguments) || this; 21 | _this.cachePairs = []; 22 | return _this; 23 | } 24 | InMemoryStorageStrategy.prototype.add = function (cachePair, cacheKey, ctx) { 25 | this.cachePairs.push(cachePair); 26 | }; 27 | ; 28 | InMemoryStorageStrategy.prototype.addMany = function (cachePairs) { 29 | this.cachePairs = cachePairs; 30 | }; 31 | ; 32 | InMemoryStorageStrategy.prototype.updateAtIndex = function (index, entity) { 33 | var updatee = this.cachePairs[index]; 34 | Object.assign(updatee, entity); 35 | }; 36 | InMemoryStorageStrategy.prototype.update = function (index, entity) { 37 | var updatee = this.cachePairs[index]; 38 | Object.assign(updatee, entity); 39 | }; 40 | InMemoryStorageStrategy.prototype.getAll = function () { 41 | return this.cachePairs; 42 | }; 43 | ; 44 | InMemoryStorageStrategy.prototype.removeAtIndex = function (index) { 45 | this.cachePairs.splice(index, 1); 46 | }; 47 | InMemoryStorageStrategy.prototype.remove = function (index) { 48 | this.cachePairs.splice(index, 1); 49 | }; 50 | InMemoryStorageStrategy.prototype.removeAll = function () { 51 | this.cachePairs.length = 0; 52 | }; 53 | return InMemoryStorageStrategy; 54 | }(IStorageStrategy)); 55 | export { InMemoryStorageStrategy }; 56 | //# sourceMappingURL=InMemoryStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/cjs/cache-buster.decorator.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { 3 | if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 4 | if (ar || !(i in from)) { 5 | if (!ar) ar = Array.prototype.slice.call(from, 0, i); 6 | ar[i] = from[i]; 7 | } 8 | } 9 | return to.concat(ar || Array.prototype.slice.call(from)); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.throwErrorIfResultIsNotObservable = exports.NO_OBSERVABLE_ERROR_MESSAGE = exports.CacheBuster = void 0; 13 | var common_1 = require("./common"); 14 | var rxjs_1 = require("rxjs"); 15 | var operators_1 = require("rxjs/operators"); 16 | function CacheBuster(cacheBusterConfig) { 17 | return function (_target, _propertyKey, propertyDescriptor) { 18 | var decoratedMethod = propertyDescriptor.value; 19 | if (propertyDescriptor && propertyDescriptor.value) { 20 | /* use function instead of an arrow function to keep context of invocation */ 21 | propertyDescriptor.value = function () { 22 | var parameters = []; 23 | for (var _i = 0; _i < arguments.length; _i++) { 24 | parameters[_i] = arguments[_i]; 25 | } 26 | if ((0, common_1.isInstant)(cacheBusterConfig)) { 27 | (0, common_1.bustCache)(cacheBusterConfig); 28 | return decoratedMethod.call.apply(decoratedMethod, __spreadArray([this], parameters, false)); 29 | } 30 | var decoratedMethodResult = decoratedMethod.call.apply(decoratedMethod, __spreadArray([this], parameters, false)); 31 | throwErrorIfResultIsNotObservable(decoratedMethodResult); 32 | return decoratedMethodResult.pipe((0, operators_1.tap)(function () { 33 | (0, common_1.bustCache)(cacheBusterConfig); 34 | })); 35 | }; 36 | } 37 | ; 38 | return propertyDescriptor; 39 | }; 40 | } 41 | exports.CacheBuster = CacheBuster; 42 | ; 43 | exports.NO_OBSERVABLE_ERROR_MESSAGE = "\n Method decorated with @CacheBuster should return observable. \n If you don't want to change the method signature, set isInstant flag to true.\n"; 44 | function throwErrorIfResultIsNotObservable(decoratedMethodResult) { 45 | if (decoratedMethodResult instanceof rxjs_1.Observable === false) { 46 | throw new Error(exports.NO_OBSERVABLE_ERROR_MESSAGE); 47 | } 48 | } 49 | exports.throwErrorIfResultIsNotObservable = throwErrorIfResultIsNotObservable; 50 | //# sourceMappingURL=cache-buster.decorator.js.map -------------------------------------------------------------------------------- /dist/cjs/common/InMemoryStorageStrategy.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __extends = (this && this.__extends) || (function () { 3 | var extendStatics = function (d, b) { 4 | extendStatics = Object.setPrototypeOf || 5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 6 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 7 | return extendStatics(d, b); 8 | }; 9 | return function (d, b) { 10 | if (typeof b !== "function" && b !== null) 11 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 12 | extendStatics(d, b); 13 | function __() { this.constructor = d; } 14 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15 | }; 16 | })(); 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | exports.InMemoryStorageStrategy = void 0; 19 | var IStorageStrategy_1 = require("./IStorageStrategy"); 20 | var InMemoryStorageStrategy = /** @class */ (function (_super) { 21 | __extends(InMemoryStorageStrategy, _super); 22 | function InMemoryStorageStrategy() { 23 | var _this = _super !== null && _super.apply(this, arguments) || this; 24 | _this.cachePairs = []; 25 | return _this; 26 | } 27 | InMemoryStorageStrategy.prototype.add = function (cachePair, cacheKey, ctx) { 28 | this.cachePairs.push(cachePair); 29 | }; 30 | ; 31 | InMemoryStorageStrategy.prototype.addMany = function (cachePairs) { 32 | this.cachePairs = cachePairs; 33 | }; 34 | ; 35 | InMemoryStorageStrategy.prototype.updateAtIndex = function (index, entity) { 36 | var updatee = this.cachePairs[index]; 37 | Object.assign(updatee, entity); 38 | }; 39 | InMemoryStorageStrategy.prototype.update = function (index, entity) { 40 | var updatee = this.cachePairs[index]; 41 | Object.assign(updatee, entity); 42 | }; 43 | InMemoryStorageStrategy.prototype.getAll = function () { 44 | return this.cachePairs; 45 | }; 46 | ; 47 | InMemoryStorageStrategy.prototype.removeAtIndex = function (index) { 48 | this.cachePairs.splice(index, 1); 49 | }; 50 | InMemoryStorageStrategy.prototype.remove = function (index) { 51 | this.cachePairs.splice(index, 1); 52 | }; 53 | InMemoryStorageStrategy.prototype.removeAll = function () { 54 | this.cachePairs.length = 0; 55 | }; 56 | return InMemoryStorageStrategy; 57 | }(IStorageStrategy_1.IStorageStrategy)); 58 | exports.InMemoryStorageStrategy = InMemoryStorageStrategy; 59 | //# sourceMappingURL=InMemoryStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/esm2015/common/LocalStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"LocalStorageStrategy.js","sourceRoot":"","sources":["../../../common/LocalStorageStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAa,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAChD,MAAM,OAAO,oBAAqB,SAAQ,gBAAgB;IAExD;QACE,KAAK,EAAE,CAAC;QAFF,mBAAc,GAAW,iBAAiB,CAAC,cAAc,CAAC;QAGhE,IAAI,OAAO,YAAY,IAAI,WAAW,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;SAC3C;IACH,CAAC;IAED,GAAG,CAAC,SAA0B,EAAE,QAAgB;QAC9C,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;YAC5B,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;SAC9B;QACD,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAAA,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CACF"} -------------------------------------------------------------------------------- /dist/esm2015/common/DOMStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"DOMStorageStrategy.js","sourceRoot":"","sources":["../../../common/DOMStorageStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAa,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAChD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,gBAAgB;IAEtD;QACE,KAAK,EAAE,CAAC;QAFF,mBAAc,GAAW,iBAAiB,CAAC,cAAc,CAAC;QAGhE,IAAI,OAAO,YAAY,IAAI,WAAW,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;SAC3C;IACH,CAAC;IAED,GAAG,CAAC,SAA0B,EAAE,QAAgB;QAC9C,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;YAC5B,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;SAC9B;QACD,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAAA,CAAC;IAGF,OAAO,CAAC,UAA6B,EAAE,QAAgB;QACrD,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;YAC5B,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;SAC9B;QACD,aAAa,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;QACrC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAAA,CAAC;IAEF,MAAM,CAAC,QAAgB;QACrB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,QA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,EAAE;YAC7D,aAAa,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;SACzC;QACD,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAED,SAAS,CAAC,QAAgB;QACxB,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE;YAC7D,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;SACpC;QACD,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAEO,UAAU;QAChB,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACvD,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC/B;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;IACH,CAAC;IAEO,YAAY,CAAC,IAA6C;QAChE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC;CACF"} -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: 🔒 NPM Release Preview 2 | 3 | on: 4 | push: 5 | branches: 6 | - master # Only run this on master for now 7 | 8 | jobs: 9 | release: 10 | name: NPM release 11 | runs-on: ubuntu-latest 12 | 13 | permissions: 14 | contents: write # Needed to push tags 15 | packages: write # Allow publishing to NPM 16 | 17 | steps: 18 | - name: 📦 Checkout code 19 | uses: actions/checkout@v4 20 | with: 21 | fetch-depth: 0 # ensure full history for tags 22 | 23 | - name: 🧰 Setup Node.js 24 | uses: actions/setup-node@v4 25 | with: 26 | node-version: 18.x 27 | registry-url: 'https://registry.npmjs.org/' 28 | 29 | - name: 📥 Install dependencies 30 | run: | 31 | npm ci 32 | 33 | - name: 🧪 Run tests 34 | run: npm test 35 | 36 | - name: Upload coverage to Codecov 37 | uses: codecov/codecov-action@v5.0.7 38 | with: 39 | files: ./coverage/lcov/coverage.xml 40 | token: ${{ secrets.CODECOV_TOKEN }} 41 | fail_ci_if_error: true 42 | 43 | - name: 🔍 Get current version 44 | id: version_info 45 | run: | 46 | CURRENT_VERSION=$(node -p "require('./package.json').version") 47 | cat package.json 48 | echo "Current package version is: $CURRENT_VERSION" 49 | echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT 50 | 51 | - name: 🚨 Bump version 52 | id: version_step 53 | run: | 54 | npm version patch --no-git-tag-version 55 | NEW_VERSION=$(node -p "require('./package.json').version") 56 | cat package.json 57 | echo "Bumped to version: $NEW_VERSION" 58 | echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT 59 | 60 | - name: ✅ Commit and tag version 61 | run: | 62 | git config user.name "github-actions[bot]" 63 | git config user.email "github-actions[bot]@users.noreply.github.com" 64 | git add package.json package-lock.json 65 | git commit -m "chore: release ${{ steps.version_step.outputs.version }}" 66 | git tag -a ${{ steps.version_step.outputs.version }} -m "Release ${{ steps.version_step.outputs.version }}" 67 | git push origin master --follow-tags 68 | 69 | 70 | - name: 🧐 Preview npm package contents 71 | run: | 72 | echo "Previewing npm package contents for version ${{ steps.version_step.outputs.version }}..." 73 | npm pack --dry-run 74 | 75 | - name: 🚀 Publish to NPM 76 | run: npm publish --access public 77 | env: 78 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 79 | CI: true 80 | -------------------------------------------------------------------------------- /dist/cjs/common/LocalStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"LocalStorageStrategy.js","sourceRoot":"","sources":["../../../common/LocalStorageStrategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uDAAoD;AACpD,sBAAgD;AA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CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE;YAC7D,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;SACpC;QACD,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAEO,yCAAU,GAAlB;QACE,IAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACvD,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC/B;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;IACH,CAAC;IAEO,2CAAY,GAApB,UAAqB,IAA6C;QAChE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC;IACH,2BAAC;AAAD,CAAC,AArFD,CAA0C,mCAAgB,GAqFzD;AArFY,oDAAoB"} -------------------------------------------------------------------------------- /dist/cjs/common/DOMStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"DOMStorageStrategy.js","sourceRoot":"","sources":["../../../common/DOMStorageStrategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uDAAoD;AACpD,sBAAgD;AAChD;;GAEG;AACH;IAAwC,sCAAgB;IAEtD;QAAA,YACE,iBAAO,SAIR;QANO,oBAAc,GAAW,oBAAiB,CAAC,cAAc,CAAC;QAGhE,IAAI,OAAO,YAAY,IAAI,WAAW,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;SAC3C;;IACH,CAAC;IAED,gCAAG,GAAH,UAAI,SAA0B,EAAE,QAAgB;QAC9C,IAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,aAAa,C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,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC/B;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;IACH,CAAC;IAEO,yCAAY,GAApB,UAAqB,IAA6C;QAChE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC;IACH,yBAAC;AAAD,CAAC,AApFD,CAAwC,mCAAgB,GAoFvD;AApFY,gDAAkB"} -------------------------------------------------------------------------------- /dist/esm5/common/LocalStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"LocalStorageStrategy.js","sourceRoot":"","sources":["../../../common/LocalStorageStrategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAa,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAChD;IAA0C,wCAAgB;IAExD;QAAA,YACE,iBAAO,SAIR;QANO,oBAAc,GAAW,iBAAiB,CAAC,cAAc,CAAC;QAGhE,IAAI,OAAO,YAAY,IAAI,WAAW,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;SAC3C;;IACH,CAAC;IAED,kCAAG,GAAH,UAAI,SAA0B,EAAE,QAAgB;QAC9C,IAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;YAC5B,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;SAC9B;QACD,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAAA,CAAC;IAGF,sCAAO,GAAP,UAAQ,UAA6B,EAAE,QAAgB;QACrD,IA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CAAC;IACH,2BAAC;AAAD,CAAC,AArFD,CAA0C,gBAAgB,GAqFzD"} -------------------------------------------------------------------------------- /dist/esm5/common/DOMStorageStrategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"DOMStorageStrategy.js","sourceRoot":"","sources":["../../../common/DOMStorageStrategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAa,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAChD;;GAEG;AACH;IAAwC,sCAAgB;IAEtD;QAAA,YACE,iBAAO,SAIR;QANO,oBAAc,GAAW,iBAAiB,CAAC,cAAc,CAAC;QAGhE,IAAI,OAAO,YAAY,IAAI,WAAW,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;SAC3C;;IACH,CAAC;IAED,gCAAG,GAAH,UAAI,SAA0B,EAAE,QAAgB;QAC9C,IAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;YAC5B,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;SAC9B;QACD,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAAA,CAAC;IAGF,oCAAO,GAAP,UAAQ,UAA6B,EAAE,QAAgB;QACrD,IAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;YAC5B,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;SAC9B;QACD,aAAa,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;QACrC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAAA,CAAC;IA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UAAU,EAAE,CAAC;QACxC,IAAI,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE;YAC7D,aAAa,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;SACzC;QACD,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAED,sCAAS,GAAT,UAAU,QAAgB;QACxB,IAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE;YAC7D,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;SACpC;QACD,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAEO,uCAAU,GAAlB;QACE,IAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACvD,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC/B;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;IACH,CAAC;IAEO,yCAAY,GAApB,UAAqB,IAA6C;QAChE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC;IACH,yBAAC;AAAD,CAAC,AApFD,CAAwC,gBAAgB,GAoFvD"} -------------------------------------------------------------------------------- /common/LocalStorageStrategy.ts: -------------------------------------------------------------------------------- 1 | import {IStorageStrategy} from './IStorageStrategy'; 2 | import {ICachePair, GlobalCacheConfig} from '.'; 3 | export class LocalStorageStrategy extends IStorageStrategy { 4 | private masterCacheKey: string = GlobalCacheConfig.globalCacheKey; 5 | constructor() { 6 | super(); 7 | if (typeof localStorage == 'undefined') { 8 | throw new Error('Platform not supported.') 9 | } 10 | } 11 | 12 | add(cachePair: ICachePair, cacheKey: string) { 13 | const allCachedData = this.getRawData(); 14 | if (!allCachedData[cacheKey]) { 15 | allCachedData[cacheKey] = []; 16 | } 17 | allCachedData[cacheKey].push(cachePair); 18 | this.storeRawData(allCachedData); 19 | }; 20 | 21 | 22 | addMany(cachePairs: ICachePair[], cacheKey: string) { 23 | const allCachedData = this.getRawData(); 24 | if (!allCachedData[cacheKey]) { 25 | allCachedData[cacheKey] = []; 26 | } 27 | allCachedData[cacheKey] = cachePairs; 28 | this.storeRawData(allCachedData); 29 | }; 30 | 31 | getAll(cacheKey: string) { 32 | return this.getRawData()[cacheKey] || []; 33 | }; 34 | 35 | removeAtIndex(index: number, cacheKey: string) { 36 | const allCachedData = this.getRawData(); 37 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 38 | allCachedData[cacheKey].splice(index, 1); 39 | } 40 | this.storeRawData(allCachedData); 41 | } 42 | 43 | 44 | remove(index: number, entity: any, cacheKey: string) { 45 | const allCachedData = this.getRawData(); 46 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 47 | allCachedData[cacheKey].splice(index, 1); 48 | } 49 | this.storeRawData(allCachedData); 50 | } 51 | 52 | updateAtIndex(index: number, entity: any, cacheKey: string) { 53 | const allCachedData = this.getRawData(); 54 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 55 | allCachedData[cacheKey][index] = entity; 56 | } 57 | this.storeRawData(allCachedData); 58 | } 59 | 60 | update(index: number, entity: any, cacheKey: string) { 61 | const allCachedData = this.getRawData(); 62 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 63 | allCachedData[cacheKey][index] = entity; 64 | } 65 | this.storeRawData(allCachedData); 66 | } 67 | 68 | removeAll(cacheKey: string) { 69 | const allCachedData = this.getRawData(); 70 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 71 | allCachedData[cacheKey].length = 0; 72 | } 73 | this.storeRawData(allCachedData); 74 | } 75 | 76 | private getRawData(): {[key: string]: Array>} { 77 | const data = localStorage.getItem(this.masterCacheKey); 78 | try { 79 | return JSON.parse(data) || {}; 80 | } catch (error) { 81 | throw new Error(error); 82 | } 83 | } 84 | 85 | private storeRawData(data: {[key: string]: Array>}): void { 86 | localStorage.setItem(this.masterCacheKey, JSON.stringify(data)); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /dist/esm2015/common/LocalStorageStrategy.js: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { GlobalCacheConfig } from '.'; 3 | export class LocalStorageStrategy extends IStorageStrategy { 4 | constructor() { 5 | super(); 6 | this.masterCacheKey = GlobalCacheConfig.globalCacheKey; 7 | if (typeof localStorage == 'undefined') { 8 | throw new Error('Platform not supported.'); 9 | } 10 | } 11 | add(cachePair, cacheKey) { 12 | const allCachedData = this.getRawData(); 13 | if (!allCachedData[cacheKey]) { 14 | allCachedData[cacheKey] = []; 15 | } 16 | allCachedData[cacheKey].push(cachePair); 17 | this.storeRawData(allCachedData); 18 | } 19 | ; 20 | addMany(cachePairs, cacheKey) { 21 | const allCachedData = this.getRawData(); 22 | if (!allCachedData[cacheKey]) { 23 | allCachedData[cacheKey] = []; 24 | } 25 | allCachedData[cacheKey] = cachePairs; 26 | this.storeRawData(allCachedData); 27 | } 28 | ; 29 | getAll(cacheKey) { 30 | return this.getRawData()[cacheKey] || []; 31 | } 32 | ; 33 | removeAtIndex(index, cacheKey) { 34 | const allCachedData = this.getRawData(); 35 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 36 | allCachedData[cacheKey].splice(index, 1); 37 | } 38 | this.storeRawData(allCachedData); 39 | } 40 | remove(index, entity, cacheKey) { 41 | const allCachedData = this.getRawData(); 42 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 43 | allCachedData[cacheKey].splice(index, 1); 44 | } 45 | this.storeRawData(allCachedData); 46 | } 47 | updateAtIndex(index, entity, cacheKey) { 48 | const allCachedData = this.getRawData(); 49 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 50 | allCachedData[cacheKey][index] = entity; 51 | } 52 | this.storeRawData(allCachedData); 53 | } 54 | update(index, entity, cacheKey) { 55 | const allCachedData = this.getRawData(); 56 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 57 | allCachedData[cacheKey][index] = entity; 58 | } 59 | this.storeRawData(allCachedData); 60 | } 61 | removeAll(cacheKey) { 62 | const allCachedData = this.getRawData(); 63 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 64 | allCachedData[cacheKey].length = 0; 65 | } 66 | this.storeRawData(allCachedData); 67 | } 68 | getRawData() { 69 | const data = localStorage.getItem(this.masterCacheKey); 70 | try { 71 | return JSON.parse(data) || {}; 72 | } 73 | catch (error) { 74 | throw new Error(error); 75 | } 76 | } 77 | storeRawData(data) { 78 | localStorage.setItem(this.masterCacheKey, JSON.stringify(data)); 79 | } 80 | } 81 | //# sourceMappingURL=LocalStorageStrategy.js.map -------------------------------------------------------------------------------- /common/DOMStorageStrategy.ts: -------------------------------------------------------------------------------- 1 | import {IStorageStrategy} from './IStorageStrategy'; 2 | import {ICachePair, GlobalCacheConfig} from '.'; 3 | /** 4 | * @deprecated Use {@link LocalStorageStrategy} instead. 5 | */ 6 | export class DOMStorageStrategy extends IStorageStrategy { 7 | private masterCacheKey: string = GlobalCacheConfig.globalCacheKey; 8 | constructor() { 9 | super(); 10 | if (typeof localStorage == 'undefined') { 11 | throw new Error('Platform not supported.') 12 | } 13 | } 14 | 15 | add(cachePair: ICachePair, cacheKey: string) { 16 | const allCachedData = this.getRawData(); 17 | if (!allCachedData[cacheKey]) { 18 | allCachedData[cacheKey] = []; 19 | } 20 | allCachedData[cacheKey].push(cachePair); 21 | this.storeRawData(allCachedData); 22 | }; 23 | 24 | 25 | addMany(cachePairs: ICachePair[], cacheKey: string) { 26 | const allCachedData = this.getRawData(); 27 | if (!allCachedData[cacheKey]) { 28 | allCachedData[cacheKey] = []; 29 | } 30 | allCachedData[cacheKey] = cachePairs; 31 | this.storeRawData(allCachedData); 32 | }; 33 | 34 | getAll(cacheKey: string) { 35 | return this.getRawData()[cacheKey] || []; 36 | }; 37 | 38 | removeAtIndex(index: number, cacheKey: string) { 39 | const allCachedData = this.getRawData(); 40 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 41 | allCachedData[cacheKey].splice(index, 1); 42 | } 43 | this.storeRawData(allCachedData); 44 | } 45 | 46 | remove(index: number, entity: any, cacheKey: string) { 47 | const allCachedData = this.getRawData(); 48 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 49 | allCachedData[cacheKey].splice(index, 1); 50 | } 51 | this.storeRawData(allCachedData); 52 | } 53 | 54 | updateAtIndex(index: number, entity: any, cacheKey: string) { 55 | const allCachedData = this.getRawData(); 56 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 57 | allCachedData[cacheKey][index] = entity; 58 | } 59 | this.storeRawData(allCachedData); 60 | } 61 | 62 | update(index: number, entity: any, cacheKey: string) { 63 | const allCachedData = this.getRawData(); 64 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 65 | allCachedData[cacheKey][index] = entity; 66 | } 67 | this.storeRawData(allCachedData); 68 | } 69 | 70 | removeAll(cacheKey: string) { 71 | const allCachedData = this.getRawData(); 72 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 73 | allCachedData[cacheKey].length = 0; 74 | } 75 | this.storeRawData(allCachedData); 76 | } 77 | 78 | private getRawData(): {[key: string]: Array>} { 79 | const data = localStorage.getItem(this.masterCacheKey); 80 | try { 81 | return JSON.parse(data) || {}; 82 | } catch (error) { 83 | throw new Error(error); 84 | } 85 | } 86 | 87 | private storeRawData(data: {[key: string]: Array>}): void { 88 | localStorage.setItem(this.masterCacheKey, JSON.stringify(data)); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /dist/cjs/specs/cache-buster.decorator.spec.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"cache-buster.decorator.spec.js","sourceRoot":"","sources":["../../../specs/cache-buster.decorator.spec.ts"],"names":[],"mappings":";;;;;;;;AAAA,6BAA6C;AAC7C,oEAAmF;AACnF,4CAAqC;AACrC,wCAA2C;AAE3C,QAAQ,CAAC,sBAAsB,EAAE;IAC/B,IAAM,mBAAmB,GAAG,IAAI,cAAO,EAAQ,CAAC;IAChD,IAAI,OAAoB,CAAC;IACzB,IAAI,aAA4B,CAAC;IAEjC;QAAA;QAgCA,CAAC;QA5BQ,iDAA2B,GAAlC,UAAmC,CAAS,EAAE,CAAS;YACrD,OAAO,IAAA,SAAE,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,IAAI,CAAC,CAAC,CAAC;QACpD,CAAC;QAED,mBAAmB;QAIZ,sDAAgC,GAAvC;YACE;;;cAGE;QACJ,CAAC;QAQM,oCAAc,GAArB,UAAsB,CAAS,EAAE,CAAS;YACxC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9B,CAAC;QAEM,+BAAS,GAAhB,UAAiB,CAAS,EAAE,CAAS;YACnC,OAAO,CAAC,GAAG,CAAC,CAAC;QACf,CAAC;QA3BD;YAHC,IAAA,oCAAW,EAAC;gBACX,mBAAmB,EAAE,mBAAmB;aACzC,CAAC;sEAGD;QAMD;YAHC,IAAA,oCAAW,EAAC;gBACX,mBAAmB,EAAE,mBAAmB;aACzC,CAAC;2EAMD;QAQD;YANC,IAAA,oCAAW,EACV;gBACE,mBAAmB,EAAE,mBAAmB;gBACxC,SAAS,EAAE,IAAI;aAChB,CACF;yDAGA;QAKH,kBAAC;KAAA,AAhCD,IAgCC;IAED,UAAU,CAAC;QACT,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAC5B,aAAa,GAAG,IAAI,uBAAa,CAAC,UAAC,MAAM,EAAE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CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"} -------------------------------------------------------------------------------- /dist/esm2015/common/DOMStorageStrategy.js: -------------------------------------------------------------------------------- 1 | import { IStorageStrategy } from './IStorageStrategy'; 2 | import { GlobalCacheConfig } from '.'; 3 | /** 4 | * @deprecated Use {@link LocalStorageStrategy} instead. 5 | */ 6 | export class DOMStorageStrategy extends IStorageStrategy { 7 | constructor() { 8 | super(); 9 | this.masterCacheKey = GlobalCacheConfig.globalCacheKey; 10 | if (typeof localStorage == 'undefined') { 11 | throw new Error('Platform not supported.'); 12 | } 13 | } 14 | add(cachePair, cacheKey) { 15 | const allCachedData = this.getRawData(); 16 | if (!allCachedData[cacheKey]) { 17 | allCachedData[cacheKey] = []; 18 | } 19 | allCachedData[cacheKey].push(cachePair); 20 | this.storeRawData(allCachedData); 21 | } 22 | ; 23 | addMany(cachePairs, cacheKey) { 24 | const allCachedData = this.getRawData(); 25 | if (!allCachedData[cacheKey]) { 26 | allCachedData[cacheKey] = []; 27 | } 28 | allCachedData[cacheKey] = cachePairs; 29 | this.storeRawData(allCachedData); 30 | } 31 | ; 32 | getAll(cacheKey) { 33 | return this.getRawData()[cacheKey] || []; 34 | } 35 | ; 36 | removeAtIndex(index, cacheKey) { 37 | const allCachedData = this.getRawData(); 38 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 39 | allCachedData[cacheKey].splice(index, 1); 40 | } 41 | this.storeRawData(allCachedData); 42 | } 43 | remove(index, entity, cacheKey) { 44 | const allCachedData = this.getRawData(); 45 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 46 | allCachedData[cacheKey].splice(index, 1); 47 | } 48 | this.storeRawData(allCachedData); 49 | } 50 | updateAtIndex(index, entity, cacheKey) { 51 | const allCachedData = this.getRawData(); 52 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 53 | allCachedData[cacheKey][index] = entity; 54 | } 55 | this.storeRawData(allCachedData); 56 | } 57 | update(index, entity, cacheKey) { 58 | const allCachedData = this.getRawData(); 59 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 60 | allCachedData[cacheKey][index] = entity; 61 | } 62 | this.storeRawData(allCachedData); 63 | } 64 | removeAll(cacheKey) { 65 | const allCachedData = this.getRawData(); 66 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 67 | allCachedData[cacheKey].length = 0; 68 | } 69 | this.storeRawData(allCachedData); 70 | } 71 | getRawData() { 72 | const data = localStorage.getItem(this.masterCacheKey); 73 | try { 74 | return JSON.parse(data) || {}; 75 | } 76 | catch (error) { 77 | throw new Error(error); 78 | } 79 | } 80 | storeRawData(data) { 81 | localStorage.setItem(this.masterCacheKey, JSON.stringify(data)); 82 | } 83 | } 84 | //# sourceMappingURL=DOMStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/cjs/specs/promise.cache-buster.decorator.spec.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"promise.cache-buster.decorator.spec.js","sourceRoot":"","sources":["../../../specs/promise.cache-buster.decorator.spec.ts"],"names":[],"mappings":";;;;;;;;AAAA,6BAA6B;AAC7B,oFAAyF;AAEzF,QAAQ,CAAC,uBAAuB,EAAE;IAChC,IAAM,mBAAmB,GAAG,IAAI,cAAO,EAAQ,CAAC;IAChD,IAAI,OAAoB,CAAC;IAEzB;QAAA;QA0CA,CAAC;QAtCQ,oCAAc,GAArB,UAAsB,CAAS,EAAE,CAAS;YACxC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QAED,mBAAmB;QAIZ,mDAA6B,GAApC;YACE;;;cAGE;QACJ,CAAC;QAQM,oCAAc,GAArB,UAAsB,CAAS,EAAE,CAAS;YACxC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9B,CAAC;QAQM,8CAAwB,GAA/B,UAAgC,CAAS,EAAE,CAAS;YAClD,OAAO,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AAC,CAAC;YAC1D,IAAI,EAAE,CAAC;QACT,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4BAA4B,EAAE,UAAC,IAAI;QACpC,IAAM,aAAa,GAAG,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;QACpE,IAAM,WAAW,GAAG,KAAK,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;QAEzE,OAAO,CAAC,wBAAwB,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAA,CAAC;YAC1C,MAAM,CAAC,aAAa,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;YAC/C,MAAM,CAAC,WAAW,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;YAC7C,IAAI,EAAE,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"} -------------------------------------------------------------------------------- /specs/promise.cache-buster.decorator.spec.ts: -------------------------------------------------------------------------------- 1 | import {Subject} from "rxjs"; 2 | import {NO_PROMISE_ERROR_MESSAGE, PCacheBuster} from "../promise.cache-buster.decorator"; 3 | 4 | describe('PCacheBusterDecorator', () => { 5 | const cacheBusterNotifier = new Subject(); 6 | let service: TestService; 7 | 8 | class TestService { 9 | @PCacheBuster({ 10 | cacheBusterNotifier: cacheBusterNotifier 11 | }) 12 | public sumWithPromise(a: number, b: number): Promise { 13 | return Promise.resolve(this.sumValues(a, b)); 14 | } 15 | 16 | // @ts-expect-error 17 | @PCacheBuster({ 18 | cacheBusterNotifier: cacheBusterNotifier 19 | }) 20 | public throwWithNonPromiseNonInstant(): void { 21 | /* 22 | Method decorated with @PCacheBuster should return Promise. 23 | If you don't want to change the method signature, set isInstant flag to true. 24 | */ 25 | } 26 | 27 | @PCacheBuster( 28 | { 29 | cacheBusterNotifier: cacheBusterNotifier, 30 | isInstant: true 31 | } 32 | ) 33 | public sumWithInstant(a: number, b: number): number { 34 | return this.sumValues(a, b); 35 | } 36 | 37 | @PCacheBuster( 38 | { 39 | cacheBusterNotifier: cacheBusterNotifier, 40 | isInstant: true 41 | } 42 | ) 43 | public sumWithInstantAndPromise(a: number, b: number): Promise { 44 | return Promise.resolve(this.sumValues(a, b)); 45 | } 46 | 47 | public sumValues(a: number, b: number): number { 48 | return a + b; 49 | } 50 | } 51 | 52 | beforeEach(() => { 53 | service = new TestService(); 54 | }) 55 | 56 | it('should create', () => { 57 | expect(service).toBeTruthy(); 58 | }) 59 | 60 | it('should call original method body and return result [isInstant: undefined]', (done) => { 61 | service.sumWithPromise(1,2).then(res => { 62 | expect(res).toEqual(3); 63 | done(); 64 | }); 65 | }) 66 | 67 | it('should call original method body and return result [isInstant: true]', () => { 68 | const res = service.sumWithInstant(1,2); 69 | 70 | expect(res).toEqual(3); 71 | }) 72 | 73 | it('it should throw error if [isInstant: undefined] is decorating method that does not return Promise', () => { 74 | expect(() => service.throwWithNonPromiseNonInstant()).toThrowError(NO_PROMISE_ERROR_MESSAGE) 75 | }) 76 | 77 | it('should bust the cache before original method has been executed', () => { 78 | const methodBodySpy = spyOn(service, 'sumValues').and.callThrough(); 79 | const notifierSpy = spyOn(cacheBusterNotifier, 'next').and.callThrough(); 80 | 81 | service.sumWithInstant(1, 3); 82 | 83 | expect(methodBodySpy).toHaveBeenCalledTimes(1); 84 | expect(notifierSpy).toHaveBeenCalledTimes(1); 85 | expect(notifierSpy).toHaveBeenCalledBefore(methodBodySpy); 86 | }) 87 | 88 | it('should bust the cache after original has been executed (Promise resolved)', (done) => { 89 | const methodBodySpy = spyOn(service, 'sumValues').and.callThrough(); 90 | const notifierSpy = spyOn(cacheBusterNotifier, 'next').and.callThrough(); 91 | 92 | service.sumWithPromise(1, 3).then(res => { 93 | expect(methodBodySpy).toHaveBeenCalledTimes(1); 94 | expect(notifierSpy).toHaveBeenCalledTimes(1); 95 | expect(methodBodySpy).toHaveBeenCalledBefore(notifierSpy); 96 | done(); 97 | }) 98 | }); 99 | 100 | it('should bust the cache once', (done) => { 101 | const methodBodySpy = spyOn(service, 'sumValues').and.callThrough(); 102 | const notifierSpy = spyOn(cacheBusterNotifier, 'next').and.callThrough(); 103 | 104 | service.sumWithInstantAndPromise(1,2).then(_ => { 105 | expect(methodBodySpy).toHaveBeenCalledTimes(1); 106 | expect(notifierSpy).toHaveBeenCalledTimes(1); 107 | done(); 108 | }); 109 | }) 110 | }) 111 | -------------------------------------------------------------------------------- /specs/cache-buster.decorator.spec.ts: -------------------------------------------------------------------------------- 1 | import {Observable, of, Subject} from "rxjs"; 2 | import {CacheBuster, NO_OBSERVABLE_ERROR_MESSAGE} from "../cache-buster.decorator"; 3 | import {delay} from "rxjs/operators"; 4 | import {TestScheduler} from "rxjs/testing"; 5 | 6 | describe('CacheBusterDecorator', () => { 7 | const cacheBusterNotifier = new Subject(); 8 | let service: TestService; 9 | let testScheduler: TestScheduler; 10 | 11 | class TestService { 12 | @CacheBuster({ 13 | cacheBusterNotifier: cacheBusterNotifier 14 | }) 15 | public sumWithObservableNonInstant(a: number, b: number): Observable { 16 | return of(this.sumValues(a, b)).pipe(delay(1000)); 17 | } 18 | 19 | // @ts-expect-error 20 | @CacheBuster({ 21 | cacheBusterNotifier: cacheBusterNotifier 22 | }) 23 | public throwWithNonObservableNonInstant(): void { 24 | /* 25 | Method decorated with @CacheBuster should return observable. 26 | If you don't want to change the method signature, set isInstant flag to true. 27 | */ 28 | } 29 | 30 | @CacheBuster( 31 | { 32 | cacheBusterNotifier: cacheBusterNotifier, 33 | isInstant: true 34 | } 35 | ) 36 | public sumWithInstant(a: number, b: number): number { 37 | return this.sumValues(a, b); 38 | } 39 | 40 | public sumValues(a: number, b: number): number { 41 | return a + b; 42 | } 43 | } 44 | 45 | beforeEach(() => { 46 | service = new TestService(); 47 | testScheduler = new TestScheduler((actual, expected) => { 48 | expect(actual).toEqual(expected); 49 | }); 50 | }) 51 | 52 | it('should create', () => { 53 | expect(service).toBeTruthy(); 54 | }) 55 | 56 | it('should call original method body and return result [isInstant: undefined]', (done) => { 57 | service.sumWithObservableNonInstant(1,2).subscribe(res => { 58 | expect(res).toEqual(3); 59 | done(); 60 | }); 61 | }) 62 | 63 | it('should call original method body and return result [isInstant: true]', () => { 64 | const res = service.sumWithInstant(1,2); 65 | 66 | expect(res).toEqual(3); 67 | }) 68 | 69 | it('it should throw error if [isInstant: undefined] is decorating method that does not return Observable', () => { 70 | expect(() => service.throwWithNonObservableNonInstant()).toThrowError(NO_OBSERVABLE_ERROR_MESSAGE) 71 | }) 72 | 73 | it('should bust the cache before original method has been executed', () => { 74 | const methodBodySpy = spyOn(service, 'sumValues').and.callThrough(); 75 | const notifierSpy = spyOn(cacheBusterNotifier, 'next').and.callThrough(); 76 | 77 | service.sumWithInstant(1, 3); 78 | 79 | expect(methodBodySpy).toHaveBeenCalledTimes(1); 80 | expect(notifierSpy).toHaveBeenCalledTimes(1); 81 | expect(notifierSpy).toHaveBeenCalledBefore(methodBodySpy); 82 | }) 83 | 84 | it('should bust the cache after original has been executed (observable emitted)', (done) => { 85 | const methodBodySpy = spyOn(service, 'sumValues').and.callThrough(); 86 | const notifierSpy = spyOn(cacheBusterNotifier, 'next').and.callThrough(); 87 | 88 | service.sumWithObservableNonInstant(1, 3).subscribe(res => { 89 | expect(methodBodySpy).toHaveBeenCalledTimes(1); 90 | expect(notifierSpy).toHaveBeenCalledTimes(1); 91 | expect(methodBodySpy).toHaveBeenCalledBefore(notifierSpy); 92 | done(); 93 | }) 94 | }); 95 | 96 | it('should wait until observable from decorated method emits and then bust the cache', () => { 97 | testScheduler.run(({ expectObservable }) => { 98 | const source$ = service.sumWithObservableNonInstant(1, 2); 99 | const notifier$ = cacheBusterNotifier; 100 | 101 | expectObservable(source$).toBe('1000ms (a|)', { a: 3 }); 102 | expectObservable(notifier$).toBe('1000ms a', { a: undefined }); 103 | }) 104 | }) 105 | }) 106 | -------------------------------------------------------------------------------- /dist/esm2015/cacheable.decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"cacheable.decorator.js","sourceRoot":"","sources":["../../cacheable.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,KAAK,EAAc,EAAE,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AAC3D,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAC,sBAAsB,EAAc,iBAAiB,EAAoB,cAAc,EAAC,MAAM,UAAU,CAAC;AAGjH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,OAAO,EAAQ,CAAC;AAE7D,MAAM,UAAU,SAAS,CAAC,cAAsC,EAAE;IAChE,OAAO,UACL,OAAe,EACf,YAAoB,EACpB,kBAAwE;QAExE,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,GAAG,GAAG,GAAG,YAAY,CAAC;QACvF,MAAM,SAAS,GAAG,kBAAkB,CAAC,KAAK,CAAC;QAC3C,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,KAAK,EAAE;YAClD,IAAI,eAAe,GAAqB,CAAC,WAAW,CAAC,eAAe;gBAClE,CAAC,CAAC,IAAI,iBAAiB,CAAC,eAAe,EAAsB;gBAC7D,CAAC,CAAC,IAAI,WAAW,CAAC,eAAe,EAAE,CAAC;YACtC,MAAM,iBAAiB,GAAuC,EAAE,CAAC;YACjE,IAAI,WAAW,CAAC,aAAa,EAAE;gBAC7B,WAAW,CAAC,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAA;aAC3I;YAC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B,UAAU,EAAE,eAAe;gCAC3B,QAAQ;gCACR,OAAO,EAAE,CAAC,WAAW,CAAC,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;6BAC9E,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;yBACpB;oBACH,CAAC,CAAC,EACF,aAAa,CAAC,CAAC,CAAC,EAChB,QAAQ,EAAE,CACX,CAAC;oBACF;;uBAEG;oBACH,iBAAiB,CAAC,IAAI,CAAC;wBACrB,UAAU,EAAE,eAAe;wBAC3B,QAAQ,EAAE,SAAS;wBACnB,OAAO,EAAE,IAAI,IAAI,EAAE;qBACpB,CAAC,CAAC;oBACH,OAAO,SAAS,CAAC;iBAClB;YACH,CAAC,CAAC;SACH;QACD,OAAO,kBAAkB,CAAC;IAC5B,CAAC,CAAA;AACH,CAAC;AAAA,CAAC"} -------------------------------------------------------------------------------- /dist/cjs/cacheable.decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"cacheable.decorator.js","sourceRoot":"","sources":["../../cacheable.decorator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAA2D;AAC3D,4CAA6E;AAC7E,mCAAiH;AAGpG,QAAA,yBAAyB,GAAG,IAAI,cAAO,EAAQ,CAAC;AAE7D,SAAgB,SAAS,CAAC,WAAwC;IAAxC,4BAAA,EAAA,gBAAwC;IAChE,OAAO,UACL,OAAe,EACf,YAAoB,EACpB,kBAAwE;QAHnE,iBAkIN;QA7HC,IAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,GAAG,GAAG,GAAG,YAAY,CAAC;QACvF,IAAM,SAAS,GAAG,kBAAkB,CAAC,KAAK,CAAC;QAC3C,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,KAAK,EAAE;YAClD,IAAI,iBAAe,GAAqB,CAAC,WAAW,CAAC,eAAe;gBAClE,C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AW,CAAC,aAAa,IAAI,0BAAiB,CAAC,aAAa,CAAC;gCAC/D,CAAC,WAAW,CAAC,aAAa,IAAI,0BAAiB,CAAC,aAAa,CAAC,KAAK,CAAC;gCACpE,CAAC,CAAC,WAAW,CAAC,aAAa,IAAI,0BAAiB,CAAC,aAAa,CAAC;oCAC7D,CAAC,WAAW,CAAC,aAAa,IAAI,0BAAiB,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,EACzF;gCACA,iBAAe,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAe,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAI,CAAC,CAAC,CAAC,CAAC,iBAAe,CAAC,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAI,CAAC,CAAC;6BACtI;4BACD,iBAAe,CAAC,GAAG,CAAC;gCAClB,UAAU,EAAE,eAAe;gCAC3B,QAAQ,UAAA;gCACR,OAAO,EAAE,CAAC,WAAW,CAAC,MAAM,IAAI,0BAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;6BAC9E,EAAE,QAAQ,EAAE,KAAI,CAAC,CAAC;yBACpB;oBACH,CAAC,CAAC,EACF,IAAA,yBAAa,EAAC,CAAC,CAAC,EAChB,IAAA,oBAAQ,GAAE,CACX,CAAC;oBACF;;uBAEG;oBACH,mBAAiB,CAAC,IAAI,CAAC;wBACrB,UAAU,EAAE,eAAe;wBAC3B,QAAQ,EAAE,SAAS;wBACnB,OAAO,EAAE,IAAI,IAAI,EAAE;qBACpB,CAAC,CAAC;oBACH,OAAO,SAAS,CAAC;iBAClB;YACH,CAAC,CAAC;SACH;QACD,OAAO,kBAAkB,CAAC;IAC5B,CAAC,CAAA;AACH,CAAC;AApID,8BAoIC;AAAA,CAAC"} -------------------------------------------------------------------------------- /dist/esm5/common/LocalStorageStrategy.js: -------------------------------------------------------------------------------- 1 | var __extends = (this && this.__extends) || (function () { 2 | var extendStatics = function (d, b) { 3 | extendStatics = Object.setPrototypeOf || 4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 6 | return extendStatics(d, b); 7 | }; 8 | return function (d, b) { 9 | if (typeof b !== "function" && b !== null) 10 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 11 | extendStatics(d, b); 12 | function __() { this.constructor = d; } 13 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 14 | }; 15 | })(); 16 | import { IStorageStrategy } from './IStorageStrategy'; 17 | import { GlobalCacheConfig } from '.'; 18 | var LocalStorageStrategy = /** @class */ (function (_super) { 19 | __extends(LocalStorageStrategy, _super); 20 | function LocalStorageStrategy() { 21 | var _this = _super.call(this) || this; 22 | _this.masterCacheKey = GlobalCacheConfig.globalCacheKey; 23 | if (typeof localStorage == 'undefined') { 24 | throw new Error('Platform not supported.'); 25 | } 26 | return _this; 27 | } 28 | LocalStorageStrategy.prototype.add = function (cachePair, cacheKey) { 29 | var allCachedData = this.getRawData(); 30 | if (!allCachedData[cacheKey]) { 31 | allCachedData[cacheKey] = []; 32 | } 33 | allCachedData[cacheKey].push(cachePair); 34 | this.storeRawData(allCachedData); 35 | }; 36 | ; 37 | LocalStorageStrategy.prototype.addMany = function (cachePairs, cacheKey) { 38 | var allCachedData = this.getRawData(); 39 | if (!allCachedData[cacheKey]) { 40 | allCachedData[cacheKey] = []; 41 | } 42 | allCachedData[cacheKey] = cachePairs; 43 | this.storeRawData(allCachedData); 44 | }; 45 | ; 46 | LocalStorageStrategy.prototype.getAll = function (cacheKey) { 47 | return this.getRawData()[cacheKey] || []; 48 | }; 49 | ; 50 | LocalStorageStrategy.prototype.removeAtIndex = function (index, cacheKey) { 51 | var allCachedData = this.getRawData(); 52 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 53 | allCachedData[cacheKey].splice(index, 1); 54 | } 55 | this.storeRawData(allCachedData); 56 | }; 57 | LocalStorageStrategy.prototype.remove = function (index, entity, cacheKey) { 58 | var allCachedData = this.getRawData(); 59 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 60 | allCachedData[cacheKey].splice(index, 1); 61 | } 62 | this.storeRawData(allCachedData); 63 | }; 64 | LocalStorageStrategy.prototype.updateAtIndex = function (index, entity, cacheKey) { 65 | var allCachedData = this.getRawData(); 66 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 67 | allCachedData[cacheKey][index] = entity; 68 | } 69 | this.storeRawData(allCachedData); 70 | }; 71 | LocalStorageStrategy.prototype.update = function (index, entity, cacheKey) { 72 | var allCachedData = this.getRawData(); 73 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 74 | allCachedData[cacheKey][index] = entity; 75 | } 76 | this.storeRawData(allCachedData); 77 | }; 78 | LocalStorageStrategy.prototype.removeAll = function (cacheKey) { 79 | var allCachedData = this.getRawData(); 80 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 81 | allCachedData[cacheKey].length = 0; 82 | } 83 | this.storeRawData(allCachedData); 84 | }; 85 | LocalStorageStrategy.prototype.getRawData = function () { 86 | var data = localStorage.getItem(this.masterCacheKey); 87 | try { 88 | return JSON.parse(data) || {}; 89 | } 90 | catch (error) { 91 | throw new Error(error); 92 | } 93 | }; 94 | LocalStorageStrategy.prototype.storeRawData = function (data) { 95 | localStorage.setItem(this.masterCacheKey, JSON.stringify(data)); 96 | }; 97 | return LocalStorageStrategy; 98 | }(IStorageStrategy)); 99 | export { LocalStorageStrategy }; 100 | //# sourceMappingURL=LocalStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/esm5/common/DOMStorageStrategy.js: -------------------------------------------------------------------------------- 1 | var __extends = (this && this.__extends) || (function () { 2 | var extendStatics = function (d, b) { 3 | extendStatics = Object.setPrototypeOf || 4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 6 | return extendStatics(d, b); 7 | }; 8 | return function (d, b) { 9 | if (typeof b !== "function" && b !== null) 10 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 11 | extendStatics(d, b); 12 | function __() { this.constructor = d; } 13 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 14 | }; 15 | })(); 16 | import { IStorageStrategy } from './IStorageStrategy'; 17 | import { GlobalCacheConfig } from '.'; 18 | /** 19 | * @deprecated Use {@link LocalStorageStrategy} instead. 20 | */ 21 | var DOMStorageStrategy = /** @class */ (function (_super) { 22 | __extends(DOMStorageStrategy, _super); 23 | function DOMStorageStrategy() { 24 | var _this = _super.call(this) || this; 25 | _this.masterCacheKey = GlobalCacheConfig.globalCacheKey; 26 | if (typeof localStorage == 'undefined') { 27 | throw new Error('Platform not supported.'); 28 | } 29 | return _this; 30 | } 31 | DOMStorageStrategy.prototype.add = function (cachePair, cacheKey) { 32 | var allCachedData = this.getRawData(); 33 | if (!allCachedData[cacheKey]) { 34 | allCachedData[cacheKey] = []; 35 | } 36 | allCachedData[cacheKey].push(cachePair); 37 | this.storeRawData(allCachedData); 38 | }; 39 | ; 40 | DOMStorageStrategy.prototype.addMany = function (cachePairs, cacheKey) { 41 | var allCachedData = this.getRawData(); 42 | if (!allCachedData[cacheKey]) { 43 | allCachedData[cacheKey] = []; 44 | } 45 | allCachedData[cacheKey] = cachePairs; 46 | this.storeRawData(allCachedData); 47 | }; 48 | ; 49 | DOMStorageStrategy.prototype.getAll = function (cacheKey) { 50 | return this.getRawData()[cacheKey] || []; 51 | }; 52 | ; 53 | DOMStorageStrategy.prototype.removeAtIndex = function (index, cacheKey) { 54 | var allCachedData = this.getRawData(); 55 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 56 | allCachedData[cacheKey].splice(index, 1); 57 | } 58 | this.storeRawData(allCachedData); 59 | }; 60 | DOMStorageStrategy.prototype.remove = function (index, entity, cacheKey) { 61 | var allCachedData = this.getRawData(); 62 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 63 | allCachedData[cacheKey].splice(index, 1); 64 | } 65 | this.storeRawData(allCachedData); 66 | }; 67 | DOMStorageStrategy.prototype.updateAtIndex = function (index, entity, cacheKey) { 68 | var allCachedData = this.getRawData(); 69 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 70 | allCachedData[cacheKey][index] = entity; 71 | } 72 | this.storeRawData(allCachedData); 73 | }; 74 | DOMStorageStrategy.prototype.update = function (index, entity, cacheKey) { 75 | var allCachedData = this.getRawData(); 76 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 77 | allCachedData[cacheKey][index] = entity; 78 | } 79 | this.storeRawData(allCachedData); 80 | }; 81 | DOMStorageStrategy.prototype.removeAll = function (cacheKey) { 82 | var allCachedData = this.getRawData(); 83 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 84 | allCachedData[cacheKey].length = 0; 85 | } 86 | this.storeRawData(allCachedData); 87 | }; 88 | DOMStorageStrategy.prototype.getRawData = function () { 89 | var data = localStorage.getItem(this.masterCacheKey); 90 | try { 91 | return JSON.parse(data) || {}; 92 | } 93 | catch (error) { 94 | throw new Error(error); 95 | } 96 | }; 97 | DOMStorageStrategy.prototype.storeRawData = function (data) { 98 | localStorage.setItem(this.masterCacheKey, JSON.stringify(data)); 99 | }; 100 | return DOMStorageStrategy; 101 | }(IStorageStrategy)); 102 | export { DOMStorageStrategy }; 103 | //# sourceMappingURL=DOMStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/esm5/cacheable.decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"cacheable.decorator.js","sourceRoot":"","sources":["../../cacheable.decorator.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,KAAK,EAAE,KAAK,EAAc,EAAE,EAAE,OAAO,EAAC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C3B,QAAQ,UAAA;gCACR,OAAO,EAAE,CAAC,WAAW,CAAC,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;6BAC9E,EAAE,QAAQ,EAAE,KAAI,CAAC,CAAC;yBACpB;oBACH,CAAC,CAAC,EACF,aAAa,CAAC,CAAC,CAAC,EAChB,QAAQ,EAAE,CACX,CAAC;oBACF;;uBAEG;oBACH,mBAAiB,CAAC,IAAI,CAAC;wBACrB,UAAU,EAAE,eAAe;wBAC3B,QAAQ,EAAE,SAAS;wBACnB,OAAO,EAAE,IAAI,IAAI,EAAE;qBACpB,CAAC,CAAC;oBACH,OAAO,SAAS,CAAC;iBAClB;YACH,CAAC,CAAC;SACH;QACD,OAAO,kBAAkB,CAAC;IAC5B,CAAC,CAAA;AACH,CAAC;AAAA,CAAC"} -------------------------------------------------------------------------------- /dist/cjs/common/LocalStorageStrategy.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __extends = (this && this.__extends) || (function () { 3 | var extendStatics = function (d, b) { 4 | extendStatics = Object.setPrototypeOf || 5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 6 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 7 | return extendStatics(d, b); 8 | }; 9 | return function (d, b) { 10 | if (typeof b !== "function" && b !== null) 11 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 12 | extendStatics(d, b); 13 | function __() { this.constructor = d; } 14 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15 | }; 16 | })(); 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | exports.LocalStorageStrategy = void 0; 19 | var IStorageStrategy_1 = require("./IStorageStrategy"); 20 | var _1 = require("."); 21 | var LocalStorageStrategy = /** @class */ (function (_super) { 22 | __extends(LocalStorageStrategy, _super); 23 | function LocalStorageStrategy() { 24 | var _this = _super.call(this) || this; 25 | _this.masterCacheKey = _1.GlobalCacheConfig.globalCacheKey; 26 | if (typeof localStorage == 'undefined') { 27 | throw new Error('Platform not supported.'); 28 | } 29 | return _this; 30 | } 31 | LocalStorageStrategy.prototype.add = function (cachePair, cacheKey) { 32 | var allCachedData = this.getRawData(); 33 | if (!allCachedData[cacheKey]) { 34 | allCachedData[cacheKey] = []; 35 | } 36 | allCachedData[cacheKey].push(cachePair); 37 | this.storeRawData(allCachedData); 38 | }; 39 | ; 40 | LocalStorageStrategy.prototype.addMany = function (cachePairs, cacheKey) { 41 | var allCachedData = this.getRawData(); 42 | if (!allCachedData[cacheKey]) { 43 | allCachedData[cacheKey] = []; 44 | } 45 | allCachedData[cacheKey] = cachePairs; 46 | this.storeRawData(allCachedData); 47 | }; 48 | ; 49 | LocalStorageStrategy.prototype.getAll = function (cacheKey) { 50 | return this.getRawData()[cacheKey] || []; 51 | }; 52 | ; 53 | LocalStorageStrategy.prototype.removeAtIndex = function (index, cacheKey) { 54 | var allCachedData = this.getRawData(); 55 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 56 | allCachedData[cacheKey].splice(index, 1); 57 | } 58 | this.storeRawData(allCachedData); 59 | }; 60 | LocalStorageStrategy.prototype.remove = function (index, entity, cacheKey) { 61 | var allCachedData = this.getRawData(); 62 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 63 | allCachedData[cacheKey].splice(index, 1); 64 | } 65 | this.storeRawData(allCachedData); 66 | }; 67 | LocalStorageStrategy.prototype.updateAtIndex = function (index, entity, cacheKey) { 68 | var allCachedData = this.getRawData(); 69 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 70 | allCachedData[cacheKey][index] = entity; 71 | } 72 | this.storeRawData(allCachedData); 73 | }; 74 | LocalStorageStrategy.prototype.update = function (index, entity, cacheKey) { 75 | var allCachedData = this.getRawData(); 76 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 77 | allCachedData[cacheKey][index] = entity; 78 | } 79 | this.storeRawData(allCachedData); 80 | }; 81 | LocalStorageStrategy.prototype.removeAll = function (cacheKey) { 82 | var allCachedData = this.getRawData(); 83 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 84 | allCachedData[cacheKey].length = 0; 85 | } 86 | this.storeRawData(allCachedData); 87 | }; 88 | LocalStorageStrategy.prototype.getRawData = function () { 89 | var data = localStorage.getItem(this.masterCacheKey); 90 | try { 91 | return JSON.parse(data) || {}; 92 | } 93 | catch (error) { 94 | throw new Error(error); 95 | } 96 | }; 97 | LocalStorageStrategy.prototype.storeRawData = function (data) { 98 | localStorage.setItem(this.masterCacheKey, JSON.stringify(data)); 99 | }; 100 | return LocalStorageStrategy; 101 | }(IStorageStrategy_1.IStorageStrategy)); 102 | exports.LocalStorageStrategy = LocalStorageStrategy; 103 | //# sourceMappingURL=LocalStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/cjs/common/DOMStorageStrategy.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __extends = (this && this.__extends) || (function () { 3 | var extendStatics = function (d, b) { 4 | extendStatics = Object.setPrototypeOf || 5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 6 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 7 | return extendStatics(d, b); 8 | }; 9 | return function (d, b) { 10 | if (typeof b !== "function" && b !== null) 11 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 12 | extendStatics(d, b); 13 | function __() { this.constructor = d; } 14 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15 | }; 16 | })(); 17 | Object.defineProperty(exports, "__esModule", { value: true }); 18 | exports.DOMStorageStrategy = void 0; 19 | var IStorageStrategy_1 = require("./IStorageStrategy"); 20 | var _1 = require("."); 21 | /** 22 | * @deprecated Use {@link LocalStorageStrategy} instead. 23 | */ 24 | var DOMStorageStrategy = /** @class */ (function (_super) { 25 | __extends(DOMStorageStrategy, _super); 26 | function DOMStorageStrategy() { 27 | var _this = _super.call(this) || this; 28 | _this.masterCacheKey = _1.GlobalCacheConfig.globalCacheKey; 29 | if (typeof localStorage == 'undefined') { 30 | throw new Error('Platform not supported.'); 31 | } 32 | return _this; 33 | } 34 | DOMStorageStrategy.prototype.add = function (cachePair, cacheKey) { 35 | var allCachedData = this.getRawData(); 36 | if (!allCachedData[cacheKey]) { 37 | allCachedData[cacheKey] = []; 38 | } 39 | allCachedData[cacheKey].push(cachePair); 40 | this.storeRawData(allCachedData); 41 | }; 42 | ; 43 | DOMStorageStrategy.prototype.addMany = function (cachePairs, cacheKey) { 44 | var allCachedData = this.getRawData(); 45 | if (!allCachedData[cacheKey]) { 46 | allCachedData[cacheKey] = []; 47 | } 48 | allCachedData[cacheKey] = cachePairs; 49 | this.storeRawData(allCachedData); 50 | }; 51 | ; 52 | DOMStorageStrategy.prototype.getAll = function (cacheKey) { 53 | return this.getRawData()[cacheKey] || []; 54 | }; 55 | ; 56 | DOMStorageStrategy.prototype.removeAtIndex = function (index, cacheKey) { 57 | var allCachedData = this.getRawData(); 58 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 59 | allCachedData[cacheKey].splice(index, 1); 60 | } 61 | this.storeRawData(allCachedData); 62 | }; 63 | DOMStorageStrategy.prototype.remove = function (index, entity, cacheKey) { 64 | var allCachedData = this.getRawData(); 65 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 66 | allCachedData[cacheKey].splice(index, 1); 67 | } 68 | this.storeRawData(allCachedData); 69 | }; 70 | DOMStorageStrategy.prototype.updateAtIndex = function (index, entity, cacheKey) { 71 | var allCachedData = this.getRawData(); 72 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 73 | allCachedData[cacheKey][index] = entity; 74 | } 75 | this.storeRawData(allCachedData); 76 | }; 77 | DOMStorageStrategy.prototype.update = function (index, entity, cacheKey) { 78 | var allCachedData = this.getRawData(); 79 | if (allCachedData[cacheKey] && allCachedData[cacheKey][index]) { 80 | allCachedData[cacheKey][index] = entity; 81 | } 82 | this.storeRawData(allCachedData); 83 | }; 84 | DOMStorageStrategy.prototype.removeAll = function (cacheKey) { 85 | var allCachedData = this.getRawData(); 86 | if (allCachedData[cacheKey] && allCachedData[cacheKey].length) { 87 | allCachedData[cacheKey].length = 0; 88 | } 89 | this.storeRawData(allCachedData); 90 | }; 91 | DOMStorageStrategy.prototype.getRawData = function () { 92 | var data = localStorage.getItem(this.masterCacheKey); 93 | try { 94 | return JSON.parse(data) || {}; 95 | } 96 | catch (error) { 97 | throw new Error(error); 98 | } 99 | }; 100 | DOMStorageStrategy.prototype.storeRawData = function (data) { 101 | localStorage.setItem(this.masterCacheKey, JSON.stringify(data)); 102 | }; 103 | return DOMStorageStrategy; 104 | }(IStorageStrategy_1.IStorageStrategy)); 105 | exports.DOMStorageStrategy = DOMStorageStrategy; 106 | //# sourceMappingURL=DOMStorageStrategy.js.map -------------------------------------------------------------------------------- /dist/esm2015/promise.cacheable.decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"promise.cacheable.decorator.js","sourceRoot":"","sources":["../../promise.cacheable.decorator.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAC,sBAAsB,EAAc,iBAAiB,EAAoB,cAAc,EAAC,MAAM,UAAU,CAAC;AAIjH,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,OAAO,EAAQ,CAAC;AAGpE,MAAM,WAAW,GAAG,CAAC,SAAmB,EAAE,QAAgB,EAAE,WAAyB,EAAE,OAAY,EAAE,UAA6B,EAAE,UAAiB,EAAE,iBAA2G,EAAE,eAAyD,EAAE,qBAA0B,EAAE,EAAE;IAC3V,IAAI,eAAe,GAAG,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC1D,IAAI,eAAe,GAAG,UAAU,CAAC,IAAI,CAA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GAAG,OAAO,iBAAiB,CAAC,qBAAqB,KAAK,UAAU,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,KAAK,OAAO,CAAC,CAAC,CAAC;oBACnJ,iBAAiB,CAAC,qBAAsD,CAAC,IAAI,CAAC,IAAI,CAAC;oBACpF,CAAC,CAAC,iBAAiB,CAAC,qBAA+C,CAAC;gBACtE,IAAI,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;gBACxD,IAAI,CAAC,CAAC,UAAU,YAAY,qBAAqB,CAAC,EAAE;oBAClD,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;iBACxD;gBACD,OAAQ,UAAyC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,qBAAqB,CAAC,CAAC,CAAA;YAC9M,CAAC,CAAC;SACH;QAED,OAAO,kBAAkB,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AAAA,CAAC"} -------------------------------------------------------------------------------- /dist/cjs/promise.cacheable.decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"promise.cacheable.decorator.js","sourceRoot":"","sources":["../../promise.cacheable.decorator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iBA+JE;;;AA/JF,6BAA2C;AAC3C,mCAAiH;AAIpG,QAAA,gCAAgC,GAAG,IAAI,cAAO,EAAQ,CAAC;AAGpE,IAAM,WAAW,GAAG,UAAC,SAAmB,EAAE,QAAgB,EAAE,WAAyB,EAAE,OAAY,EAAE,UAA6B,EAAE,UAAiB,EAAE,iBAA2G,EAAE,eAAyD,EAAE,qBAA0B;IACvV,IAAI,eAAe,GAAG,WAAW,CAAC,WAAW,CAAC,UAAU,CA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