@daiso-tech/core 0.27.0 → 0.28.0
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/README.md +10 -10
- package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +57 -19
- package/dist/async/utilities/lazy-promise/lazy-promise.js +93 -52
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/async/utilities/retry/retry-or-fail.d.ts +2 -0
- package/dist/async/utilities/retry/retry-or-fail.js.map +1 -1
- package/dist/cache/contracts/cache.contract.d.ts +98 -14
- package/dist/cache/implementations/adapters/_module-exports.d.ts +1 -0
- package/dist/cache/implementations/adapters/_module-exports.js +1 -0
- package/dist/cache/implementations/adapters/_module-exports.js.map +1 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.d.ts +1 -0
- package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js +2 -0
- package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js.map +1 -0
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +23 -0
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +41 -0
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -0
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +2 -3
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/cache.d.ts +250 -45
- package/dist/cache/implementations/derivables/cache/cache.js +256 -28
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +20 -17
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +33 -19
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +4 -20
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +7 -4
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +1 -1
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +21 -36
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +24 -17
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +57 -14
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +61 -13
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/lock/contracts/lock-provider.contract.d.ts +19 -5
- package/dist/lock/contracts/lock.contract.d.ts +37 -8
- package/dist/lock/implementations/adapters/_module-exports.d.ts +1 -0
- package/dist/lock/implementations/adapters/_module-exports.js +1 -0
- package/dist/lock/implementations/adapters/_module-exports.js.map +1 -1
- package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.d.ts +1 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.js +2 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.js.map +1 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +17 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +24 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js.map +1 -0
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +2 -3
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +130 -62
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +134 -44
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +238 -0
- package/dist/lock/implementations/derivables/lock-provider/lock.js +258 -0
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +75 -9
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +85 -7
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +162 -8
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +1 -0
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +1 -0
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js.map +1 -1
- package/dist/utilities/_module-exports.d.ts +1 -1
- package/dist/utilities/_module-exports.js +1 -1
- package/dist/utilities/_module-exports.js.map +1 -1
- package/dist/utilities/classes/key-prefixer/key-prefixer.js +1 -1
- package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -1
- package/dist/utilities/{_constants.d.ts → constants.d.ts} +0 -3
- package/dist/utilities/constants.js +5 -0
- package/dist/utilities/constants.js.map +1 -0
- package/dist/utilities/contracts/_module.d.ts +2 -1
- package/dist/utilities/contracts/_module.js +2 -1
- package/dist/utilities/contracts/_module.js.map +1 -1
- package/dist/utilities/contracts/sqlite-database.contract.d.ts +26 -0
- package/dist/utilities/contracts/sqlite-database.contract.js +5 -0
- package/dist/utilities/contracts/sqlite-database.contract.js.map +1 -0
- package/dist/utilities/functions.d.ts +4 -0
- package/dist/utilities/functions.js +10 -4
- package/dist/utilities/functions.js.map +1 -1
- package/dist/utilities/types.d.ts +4 -4
- package/package.json +1 -1
- package/dist/utilities/_constants.js +0 -8
- package/dist/utilities/_constants.js.map +0 -1
|
@@ -22,72 +22,152 @@ export type ICacheListenable<TType = unknown> = IEventListenable<CacheEvents<TTy
|
|
|
22
22
|
export type ICacheBase<TType = unknown> = {
|
|
23
23
|
/**
|
|
24
24
|
* The <i>exists</i> method returns true when <i>key</i> is found otherwise false will be returned.
|
|
25
|
+
*
|
|
26
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
27
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
28
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
25
29
|
*/
|
|
26
30
|
exists(key: OneOrMore<string>): LazyPromise<boolean>;
|
|
27
31
|
/**
|
|
28
32
|
* The <i>missing</i> method returns true when <i>key</i> is not found otherwise false will be returned.
|
|
33
|
+
*
|
|
34
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
35
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
36
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
29
37
|
*/
|
|
30
38
|
missing(key: OneOrMore<string>): LazyPromise<boolean>;
|
|
31
39
|
/**
|
|
32
40
|
* The <i>get</i> method returns the value when <i>key</i> is found otherwise null will be returned.
|
|
41
|
+
*
|
|
42
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
43
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
44
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
33
45
|
*/
|
|
34
46
|
get(key: OneOrMore<string>): LazyPromise<TType | null>;
|
|
35
47
|
/**
|
|
36
48
|
* The <i>getOrFail</i> method returns the value when <i>key</i> is found otherwise an error will be thrown.
|
|
49
|
+
*
|
|
50
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
51
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
52
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
53
|
+
*
|
|
37
54
|
* @throws {KeyNotFoundCacheError} {@link KeyNotFoundCacheError}
|
|
38
55
|
*/
|
|
39
56
|
getOrFail(key: OneOrMore<string>): LazyPromise<TType>;
|
|
40
57
|
/**
|
|
41
58
|
* The <i>getAndRemove</i> method returns the value when <i>key</i> is found otherwise null will be returned.
|
|
42
59
|
* The key will be removed after it is returned.
|
|
60
|
+
*
|
|
61
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
62
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
63
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
43
64
|
*/
|
|
44
65
|
getAndRemove(key: OneOrMore<string>): LazyPromise<TType | null>;
|
|
45
66
|
/**
|
|
46
67
|
* The <i>getOr</i> method will retrieve the given <i>key</i> if found otherwise <i>defaultValue</i> will be returned.
|
|
47
|
-
*
|
|
68
|
+
*
|
|
69
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
70
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
71
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
72
|
+
*
|
|
73
|
+
* @param defaultValue - can be sync function, async function or <i>{@link LazyPromise}</i>.
|
|
48
74
|
*/
|
|
49
75
|
getOr(key: OneOrMore<string>, defaultValue: AsyncLazyable<NoneFunction<TType>>): LazyPromise<TType>;
|
|
50
76
|
/**
|
|
51
77
|
* The <i>getOrAdd</i> method will retrieve the given <i>key</i> if found otherwise <i>valueToAdd</i> will be added and returned.
|
|
52
|
-
*
|
|
78
|
+
*
|
|
79
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
80
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
81
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
82
|
+
*
|
|
83
|
+
* @param valueToAdd - can be sync function, async function or <i>{@link LazyPromise}</i>.
|
|
53
84
|
*/
|
|
54
85
|
getOrAdd(key: OneOrMore<string>, valueToAdd: AsyncLazyable<NoneFunction<TType>>, ttl?: TimeSpan | null): LazyPromise<TType>;
|
|
55
86
|
/**
|
|
56
|
-
* The <i>add</i> method adds a <i>key</i> with given <i>value</i> when key doesn't exists.
|
|
57
|
-
*
|
|
87
|
+
* The <i>add</i> method adds a <i>key</i> with given <i>value</i> when key doesn't exists.
|
|
88
|
+
*
|
|
89
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
90
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
91
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
92
|
+
*
|
|
93
|
+
* @param ttl - If null is passed, the item will not expire.
|
|
94
|
+
*
|
|
95
|
+
* @returns true when key doesn't exists otherwise false will be returned.
|
|
58
96
|
*/
|
|
59
97
|
add(key: OneOrMore<string>, value: TType, ttl?: TimeSpan | null): LazyPromise<boolean>;
|
|
60
98
|
/**
|
|
61
|
-
* The <i>put</i> method replaces th given <i>key</i> with the given <i>value</i> and <i>ttl</i> if the <i>key</i> exists
|
|
62
|
-
*
|
|
99
|
+
* The <i>put</i> method replaces th given <i>key</i> with the given <i>value</i> and <i>ttl</i> if the <i>key</i> exists
|
|
100
|
+
* othwerwise it will add the given <i>value</i> with the given <i>ttl</i>.
|
|
101
|
+
*
|
|
102
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
103
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
104
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
105
|
+
*
|
|
106
|
+
* @param ttl - If null is passed, the item will not expire.
|
|
107
|
+
*
|
|
108
|
+
* @returns true if the <i>key</i> where replaced otherwise false is returned.
|
|
63
109
|
*/
|
|
64
110
|
put(key: OneOrMore<string>, value: TType, ttl?: TimeSpan | null): LazyPromise<boolean>;
|
|
65
111
|
/**
|
|
66
|
-
* The <i>update</i> method updates the given <i>key</i> with given <i>value</i>.
|
|
112
|
+
* The <i>update</i> method updates the given <i>key</i> with given <i>value</i>.
|
|
113
|
+
*
|
|
114
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
115
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
116
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
117
|
+
*
|
|
118
|
+
* @returns true if the <i>key</i> where updated otherwise false will be returned.
|
|
67
119
|
*/
|
|
68
120
|
update(key: OneOrMore<string>, value: TType): LazyPromise<boolean>;
|
|
69
121
|
/**
|
|
70
|
-
* The <i>increment</i> method increments the given <i>key</i> with given <i>value</i>.
|
|
71
|
-
* If <i>values</i> is not defined then it will increment the key with 1.
|
|
122
|
+
* The <i>increment</i> method increments the given <i>key</i> with given <i>value</i>.
|
|
72
123
|
* An error will thrown if the key is not a number.
|
|
124
|
+
*
|
|
125
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
126
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
127
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
128
|
+
*
|
|
129
|
+
* @param value - If not defined then it will be defaulted to 1.
|
|
130
|
+
*
|
|
131
|
+
* @returns true if the <i>key</i> where incremented otherwise false will be returned.
|
|
132
|
+
*
|
|
73
133
|
* @throws {TypeCacheError} {@link TypeCacheError}
|
|
74
134
|
*/
|
|
75
135
|
increment(key: OneOrMore<string>, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
76
136
|
/**
|
|
77
|
-
* The <i>decrement</i> method decrements the given <i>key</i> with given <i>value</i>.
|
|
78
|
-
* If <i>values</i> is not defined then it will decrement the key with 1.
|
|
137
|
+
* The <i>decrement</i> method decrements the given <i>key</i> with given <i>value</i>.
|
|
79
138
|
* An error will thrown if the key is not a number.
|
|
139
|
+
*
|
|
140
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
141
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
142
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
143
|
+
*
|
|
144
|
+
* @param value - If not defined then it will be defaulted to 1.
|
|
145
|
+
*
|
|
146
|
+
* @returns true if the <i>key</i> where decremented otherwise false will be returned.
|
|
147
|
+
*
|
|
80
148
|
* @throws {TypeCacheError} {@link TypeCacheError}
|
|
81
149
|
*/
|
|
82
150
|
decrement(key: OneOrMore<string>, value?: Extract<TType, number>): LazyPromise<boolean>;
|
|
83
151
|
/**
|
|
84
|
-
* The <i>remove</i> method removes the given <i>key</i>.
|
|
152
|
+
* The <i>remove</i> method removes the given <i>key</i>.
|
|
153
|
+
*
|
|
154
|
+
* @param key - can be a string or an <i>Iterable</i> of strings.
|
|
155
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
156
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
157
|
+
*
|
|
158
|
+
* @returns true if the key is found otherwise false is returned.
|
|
85
159
|
*/
|
|
86
160
|
remove(key: OneOrMore<string>): LazyPromise<boolean>;
|
|
87
161
|
/**
|
|
88
|
-
* The <i>removeMany</i> method removes many keys.
|
|
162
|
+
* The <i>removeMany</i> method removes many keys.
|
|
163
|
+
*
|
|
164
|
+
* @param keys - The param items can be a string or an <i>Iterable</i> of strings.
|
|
165
|
+
* If the param items are an <i>Iterable</i>, it will be joined into a single string.
|
|
166
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
167
|
+
*
|
|
168
|
+
* @returns true if one of the keys where deleted otherwise false is returned.
|
|
89
169
|
*/
|
|
90
|
-
removeMany(keys: OneOrMore<string
|
|
170
|
+
removeMany(keys: Iterable<OneOrMore<string>>): PromiseLike<boolean>;
|
|
91
171
|
/**
|
|
92
172
|
* The <i>clear</i> method removes all the keys in the cache. If a cache is in a group then only the keys part of the group will be removed.
|
|
93
173
|
*/
|
|
@@ -115,6 +195,10 @@ export type IGroupableCache<TType = unknown> = ICache<TType> & {
|
|
|
115
195
|
* The <i>withGroup</i> method returns a new <i>{@link ICache}</i> instance that groups keys together.
|
|
116
196
|
* Only keys in the same group will be updated, removed, or retrieved, leaving keys outside the group unaffected.
|
|
117
197
|
* This useful for multitennat applications.
|
|
198
|
+
*
|
|
199
|
+
* @param group - can be a string or an <i>Iterable</i> of strings.
|
|
200
|
+
* If it's an <i>Iterable</i>, it will be joined into a single string.
|
|
201
|
+
* Think of an <i>Iterable</i> as representing a path.
|
|
118
202
|
*/
|
|
119
203
|
withGroup(group: OneOrMore<string>): ICache<TType>;
|
|
120
204
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "../../../cache/implementations/adapters/libsql-cache-adapter/_module.js";
|
|
2
2
|
export * from "../../../cache/implementations/adapters/memory-cache-adapter/_module.js";
|
|
3
3
|
export * from "../../../cache/implementations/adapters/mongodb-cache-adapter/_module.js";
|
|
4
|
+
export * from "../../../cache/implementations/adapters/no-op-cache-adapter/_module.js";
|
|
4
5
|
export * from "../../../cache/implementations/adapters/redis-cache-adapter/_module.js";
|
|
5
6
|
export * from "../../../cache/implementations/adapters/sqlite-cache-adapter/_module.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "../../../cache/implementations/adapters/libsql-cache-adapter/_module.js";
|
|
2
2
|
export * from "../../../cache/implementations/adapters/memory-cache-adapter/_module.js";
|
|
3
3
|
export * from "../../../cache/implementations/adapters/mongodb-cache-adapter/_module.js";
|
|
4
|
+
export * from "../../../cache/implementations/adapters/no-op-cache-adapter/_module.js";
|
|
4
5
|
export * from "../../../cache/implementations/adapters/redis-cache-adapter/_module.js";
|
|
5
6
|
export * from "../../../cache/implementations/adapters/sqlite-cache-adapter/_module.js";
|
|
6
7
|
//# sourceMappingURL=_module-exports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_module-exports.js","sourceRoot":"","sources":["../../../../src/cache/implementations/adapters/_module-exports.ts"],"names":[],"mappings":"AAAA,cAAc,kEAAkE,CAAC;AACjF,cAAc,kEAAkE,CAAC;AACjF,cAAc,mEAAmE,CAAC;AAClF,cAAc,iEAAiE,CAAC;AAChF,cAAc,kEAAkE,CAAC"}
|
|
1
|
+
{"version":3,"file":"_module-exports.js","sourceRoot":"","sources":["../../../../src/cache/implementations/adapters/_module-exports.ts"],"names":[],"mappings":"AAAA,cAAc,kEAAkE,CAAC;AACjF,cAAc,kEAAkE,CAAC;AACjF,cAAc,mEAAmE,CAAC;AAClF,cAAc,iEAAiE,CAAC;AAChF,cAAc,iEAAiE,CAAC;AAChF,cAAc,kEAAkE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../../cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/cache/implementations/adapters/no-op-cache-adapter/_module.ts"],"names":[],"mappings":"AAAA,cAAc,6EAA6E,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Cache
|
|
3
|
+
*/
|
|
4
|
+
import { type ICacheAdapter } from "../../../../cache/contracts/_module-exports.js";
|
|
5
|
+
import type { TimeSpan } from "../../../../utilities/_module-exports.js";
|
|
6
|
+
/**
|
|
7
|
+
* This <i>NoOpCacheAdapter</i> will do nothing and is used for easily mocking <i>{@link ICache}</i> for testing.
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* IMPORT_PATH: ```"@daiso-tech/core/cache/adapters"```
|
|
11
|
+
* @group Adapters
|
|
12
|
+
*/
|
|
13
|
+
export declare class NoOpCacheAdapter<TType> implements ICacheAdapter<TType> {
|
|
14
|
+
get(_key: string): PromiseLike<TType | null>;
|
|
15
|
+
getAndRemove(_key: string): PromiseLike<TType | null>;
|
|
16
|
+
add(_key: string, _value: TType, _ttl: TimeSpan | null): PromiseLike<boolean>;
|
|
17
|
+
put(_key: string, _value: TType, _ttl: TimeSpan | null): PromiseLike<boolean>;
|
|
18
|
+
update(_key: string, _value: TType): PromiseLike<boolean>;
|
|
19
|
+
increment(_key: string, _value: number): PromiseLike<boolean>;
|
|
20
|
+
removeMany(_keys: string[]): PromiseLike<boolean>;
|
|
21
|
+
removeAll(): PromiseLike<void>;
|
|
22
|
+
removeByKeyPrefix(_prefix: string): PromiseLike<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Cache
|
|
3
|
+
*/
|
|
4
|
+
import {} from "../../../../cache/contracts/_module-exports.js";
|
|
5
|
+
/**
|
|
6
|
+
* This <i>NoOpCacheAdapter</i> will do nothing and is used for easily mocking <i>{@link ICache}</i> for testing.
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* IMPORT_PATH: ```"@daiso-tech/core/cache/adapters"```
|
|
10
|
+
* @group Adapters
|
|
11
|
+
*/
|
|
12
|
+
export class NoOpCacheAdapter {
|
|
13
|
+
get(_key) {
|
|
14
|
+
return Promise.resolve(null);
|
|
15
|
+
}
|
|
16
|
+
getAndRemove(_key) {
|
|
17
|
+
return Promise.resolve(null);
|
|
18
|
+
}
|
|
19
|
+
add(_key, _value, _ttl) {
|
|
20
|
+
return Promise.resolve(true);
|
|
21
|
+
}
|
|
22
|
+
put(_key, _value, _ttl) {
|
|
23
|
+
return Promise.resolve(true);
|
|
24
|
+
}
|
|
25
|
+
update(_key, _value) {
|
|
26
|
+
return Promise.resolve(true);
|
|
27
|
+
}
|
|
28
|
+
increment(_key, _value) {
|
|
29
|
+
return Promise.resolve(true);
|
|
30
|
+
}
|
|
31
|
+
removeMany(_keys) {
|
|
32
|
+
return Promise.resolve(true);
|
|
33
|
+
}
|
|
34
|
+
removeAll() {
|
|
35
|
+
return Promise.resolve();
|
|
36
|
+
}
|
|
37
|
+
removeByKeyPrefix(_prefix) {
|
|
38
|
+
return Promise.resolve();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=no-op-cache-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-op-cache-adapter.js","sourceRoot":"","sources":["../../../../../src/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAIN,MAAM,sCAAsC,CAAC;AAG9C;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IACzB,GAAG,CAAC,IAAY;QACZ,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,YAAY,CAAC,IAAY;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,GAAG,CACC,IAAY,EACZ,MAAa,EACb,IAAqB;QAErB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,GAAG,CACC,IAAY,EACZ,MAAa,EACb,IAAqB;QAErB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,IAAY,EAAE,MAAa;QAC9B,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,MAAc;QAClC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,UAAU,CAAC,KAAe;QACtB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,SAAS;QACL,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,iBAAiB,CAAC,OAAe;QAC7B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ"}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
4
|
import { type ICacheData, type ICacheInsert, type ICacheUpdate, type IDatabaseCacheAdapter } from "../../../../cache/contracts/_module-exports.js";
|
|
5
|
-
import { type TimeSpan, type IInitizable, type IDeinitizable, type IPrunable } from "../../../../utilities/_module-exports.js";
|
|
6
|
-
import { type SqliteDatabase } from "kysely";
|
|
5
|
+
import { type TimeSpan, type IInitizable, type IDeinitizable, type IPrunable, type ISqliteDatabase } from "../../../../utilities/_module-exports.js";
|
|
7
6
|
import type { ISerde } from "../../../../serde/contracts/_module-exports.js";
|
|
8
7
|
/**
|
|
9
8
|
*
|
|
@@ -11,7 +10,7 @@ import type { ISerde } from "../../../../serde/contracts/_module-exports.js";
|
|
|
11
10
|
* @group Adapters
|
|
12
11
|
*/
|
|
13
12
|
export type SqliteCacheAdapterSettings = {
|
|
14
|
-
database:
|
|
13
|
+
database: ISqliteDatabase;
|
|
15
14
|
tableName?: string;
|
|
16
15
|
serde: ISerde<string>;
|
|
17
16
|
expiredKeysRemovalInterval?: TimeSpan;
|
package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-cache-adapter.js","sourceRoot":"","sources":["../../../../../src/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAKN,MAAM,sCAAsC,CAAC;AAC9C,6DAA6D;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,EAIH,gCAAgC,
|
|
1
|
+
{"version":3,"file":"sqlite-cache-adapter.js","sourceRoot":"","sources":["../../../../../src/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAKN,MAAM,sCAAsC,CAAC;AAC9C,6DAA6D;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,EAIH,gCAAgC,GAGnC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAG/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kEAAkE,CAAC;AAetG;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IAOV,OAAO,CAA4B;IAEpD;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,QAA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