exodus-framework 2.0.870 → 2.0.872
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app/classes/cache.d.ts +4 -3
- package/lib/app/classes/cache.d.ts.map +1 -1
- package/lib/app/classes/cache.js +16 -5
- package/lib/app/classes/index.d.ts +1 -0
- package/lib/app/classes/index.d.ts.map +1 -1
- package/lib/app/classes/index.js +12 -0
- package/lib/services/redis.d.ts +1 -1
- package/lib/services/redis.d.ts.map +1 -1
- package/package.json +1 -1
@@ -1,13 +1,14 @@
|
|
1
1
|
import { RedisClientType } from 'redis';
|
2
2
|
import System from './system';
|
3
|
-
declare class
|
3
|
+
export declare class Cache<T> extends System {
|
4
4
|
get(_key: string): Promise<T>;
|
5
5
|
set(_key: string, _data: T): Promise<void>;
|
6
6
|
delete(_key: string): Promise<void>;
|
7
7
|
all(): Promise<T[]>;
|
8
8
|
clear(): Promise<void>;
|
9
|
+
has(_key: string): Promise<boolean>;
|
9
10
|
}
|
10
|
-
export declare class RedisCache<T> extends
|
11
|
+
export declare class RedisCache<T> extends Cache<T> {
|
11
12
|
protected client: RedisClientType;
|
12
13
|
protected key: string;
|
13
14
|
constructor(client: RedisClientType, key: string);
|
@@ -16,6 +17,6 @@ export declare class RedisCache<T> extends CacheBase<T> {
|
|
16
17
|
delete(key: string): Promise<void>;
|
17
18
|
all(): Promise<T[]>;
|
18
19
|
clear(): Promise<void>;
|
20
|
+
has(key: string): Promise<boolean>;
|
19
21
|
}
|
20
|
-
export {};
|
21
22
|
//# sourceMappingURL=cache.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/app/classes/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,MAAM,MAAM,UAAU,CAAC;AAG9B,
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/app/classes/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,MAAM,MAAM,UAAU,CAAC;AAG9B,qBAAa,KAAK,CAAC,CAAC,CAAE,SAAQ,MAAM;IAC5B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAG7B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAG1B,MAAM,CAAC,IAAI,EAAE,MAAM;IAGnB,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC;IAGnB,KAAK;IAGL,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAG1C;AAED,qBAAa,UAAU,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IAEvC,SAAS,CAAC,MAAM,EAAE,eAAe;IACjC,SAAS,CAAC,GAAG,EAAE,MAAM;gBADX,MAAM,EAAE,eAAe,EACvB,GAAG,EAAE,MAAM;IAKjB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAS5B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IASxB,MAAM,CAAC,GAAG,EAAE,MAAM;IAQlB,GAAG;IAcH,KAAK;IAWL,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAOzC"}
|
package/lib/app/classes/cache.js
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.RedisCache = void 0;
|
6
|
+
exports.RedisCache = exports.Cache = void 0;
|
7
7
|
var _system = _interopRequireDefault(require("./system"));
|
8
8
|
var _error = require("../error");
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
10
|
-
class
|
10
|
+
class Cache extends _system.default {
|
11
11
|
async get(_key) {
|
12
12
|
throw new Error('Not implemented');
|
13
13
|
}
|
@@ -23,8 +23,12 @@ class CacheBase extends _system.default {
|
|
23
23
|
async clear() {
|
24
24
|
throw new Error('Not implemented');
|
25
25
|
}
|
26
|
+
async has(_key) {
|
27
|
+
throw new Error('Not implemented');
|
28
|
+
}
|
26
29
|
}
|
27
|
-
|
30
|
+
exports.Cache = Cache;
|
31
|
+
class RedisCache extends Cache {
|
28
32
|
constructor(client, key) {
|
29
33
|
super();
|
30
34
|
this.client = client;
|
@@ -64,7 +68,7 @@ class RedisCache extends CacheBase {
|
|
64
68
|
}
|
65
69
|
return data;
|
66
70
|
} catch (error) {
|
67
|
-
new _error.ErrorHandler('Falha no
|
71
|
+
new _error.ErrorHandler('Falha no all do redis cache', error);
|
68
72
|
}
|
69
73
|
}
|
70
74
|
async clear() {
|
@@ -76,7 +80,14 @@ class RedisCache extends CacheBase {
|
|
76
80
|
await this.delete(k);
|
77
81
|
}
|
78
82
|
} catch (error) {
|
79
|
-
new _error.ErrorHandler('Falha no
|
83
|
+
new _error.ErrorHandler('Falha no clear do redis cache', error);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
async has(key) {
|
87
|
+
try {
|
88
|
+
return !this.get(key);
|
89
|
+
} catch (error) {
|
90
|
+
new _error.ErrorHandler('Falha no has do redis cache', error);
|
80
91
|
}
|
81
92
|
}
|
82
93
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export { default as Broadcast } from './broadcast';
|
2
2
|
export * from './communication';
|
3
3
|
export * from './servicemodel';
|
4
|
+
export * from './cache';
|
4
5
|
export { default as ProcessEmitterManager } from './event';
|
5
6
|
export { default as Managed } from './managed';
|
6
7
|
export { default as Service } from './service';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/classes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/classes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,cAAc,UAAU,CAAC"}
|
package/lib/app/classes/index.js
CHANGED
@@ -72,6 +72,18 @@ Object.keys(_servicemodel).forEach(function (key) {
|
|
72
72
|
}
|
73
73
|
});
|
74
74
|
});
|
75
|
+
var _cache = require("./cache");
|
76
|
+
Object.keys(_cache).forEach(function (key) {
|
77
|
+
if (key === "default" || key === "__esModule") return;
|
78
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
79
|
+
if (key in exports && exports[key] === _cache[key]) return;
|
80
|
+
Object.defineProperty(exports, key, {
|
81
|
+
enumerable: true,
|
82
|
+
get: function () {
|
83
|
+
return _cache[key];
|
84
|
+
}
|
85
|
+
});
|
86
|
+
});
|
75
87
|
var _event = _interopRequireDefault(require("./event"));
|
76
88
|
var _managed = _interopRequireDefault(require("./managed"));
|
77
89
|
var _service = _interopRequireDefault(require("./service"));
|
package/lib/services/redis.d.ts
CHANGED
@@ -8,7 +8,7 @@ declare class RedisService extends Service {
|
|
8
8
|
setValue(key: string, value: string): Promise<void>;
|
9
9
|
getValue(key: string): Promise<string | null>;
|
10
10
|
deleteValue(key: string): Promise<void>;
|
11
|
-
createCache(key: string): RedisCache<
|
11
|
+
createCache<T>(key: string): RedisCache<T>;
|
12
12
|
private onClientError;
|
13
13
|
}
|
14
14
|
export default RedisService;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../src/services/redis.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AASlD,cAAM,YAAa,SAAQ,OAAO;IAChC,OAAO,CAAC,MAAM,CAAkB;IAG1B,aAAa;IAOnB,OAAO,CAAC,OAAO;IAgBT,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGnD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI7C,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGtC,WAAW,CAAC,GAAG,EAAE,MAAM;
|
1
|
+
{"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../src/services/redis.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AASlD,cAAM,YAAa,SAAQ,OAAO;IAChC,OAAO,CAAC,MAAM,CAAkB;IAG1B,aAAa;IAOnB,OAAO,CAAC,OAAO;IAgBT,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGnD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI7C,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGtC,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM;IAKjC,OAAO,CAAC,aAAa;CAGtB;AAED,eAAe,YAAY,CAAC"}
|