@daiso-tech/core 0.17.4 → 0.19.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/dist/cjs/cache/contracts/cache.errors.js +19 -0
- package/dist/cjs/cache/contracts/cache.errors.js.map +1 -1
- package/dist/cjs/cache/contracts/cache.events.js +0 -12
- package/dist/cjs/cache/contracts/cache.events.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache-factory-settings.js +18 -0
- package/dist/cjs/cache/implementations/derivables/cache-factory-settings.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache-factory.js +32 -12
- package/dist/cjs/cache/implementations/derivables/cache-factory.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache-settings.js +18 -0
- package/dist/cjs/cache/implementations/derivables/cache-settings.js.map +1 -1
- package/dist/cjs/cache/implementations/derivables/cache.js +64 -1
- package/dist/cjs/cache/implementations/derivables/cache.js.map +1 -1
- package/dist/cjs/event-bus/contracts/event-bus.errors.js +19 -0
- package/dist/cjs/event-bus/contracts/event-bus.errors.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory-settings.js +12 -0
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory-settings.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js +27 -10
- package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus-settings.js +12 -0
- package/dist/cjs/event-bus/implementations/derivables/event-bus-settings.js.map +1 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus.js +29 -1
- package/dist/cjs/event-bus/implementations/derivables/event-bus.js.map +1 -1
- package/dist/cjs/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js +16 -0
- package/dist/cjs/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js.map +1 -1
- package/dist/cjs/serde/implementations/no-op-serde/no-op-serde.js +3 -0
- package/dist/cjs/serde/implementations/no-op-serde/no-op-serde.js.map +1 -1
- package/dist/cjs/serde/implementations/super-json-serde/super-json-serde.js +54 -111
- package/dist/cjs/serde/implementations/super-json-serde/super-json-serde.js.map +1 -1
- package/dist/cjs/utilities/contracts/_module.js +1 -0
- package/dist/cjs/utilities/contracts/_module.js.map +1 -1
- package/dist/cjs/utilities/contracts/serialized-error.contract.js +3 -0
- package/dist/cjs/utilities/contracts/serialized-error.contract.js.map +1 -0
- package/dist/esm/cache/contracts/cache.errors.js +19 -0
- package/dist/esm/cache/contracts/cache.errors.js.map +1 -1
- package/dist/esm/cache/contracts/cache.events.js +0 -11
- package/dist/esm/cache/contracts/cache.events.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache-factory-settings.js +18 -0
- package/dist/esm/cache/implementations/derivables/cache-factory-settings.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache-factory.js +32 -12
- package/dist/esm/cache/implementations/derivables/cache-factory.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache-settings.js +18 -0
- package/dist/esm/cache/implementations/derivables/cache-settings.js.map +1 -1
- package/dist/esm/cache/implementations/derivables/cache.js +65 -2
- package/dist/esm/cache/implementations/derivables/cache.js.map +1 -1
- package/dist/esm/event-bus/contracts/event-bus.errors.js +19 -0
- package/dist/esm/event-bus/contracts/event-bus.errors.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory-settings.js +12 -0
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory-settings.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js +27 -10
- package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus-settings.js +12 -0
- package/dist/esm/event-bus/implementations/derivables/event-bus-settings.js.map +1 -1
- package/dist/esm/event-bus/implementations/derivables/event-bus.js +30 -2
- package/dist/esm/event-bus/implementations/derivables/event-bus.js.map +1 -1
- package/dist/esm/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js +16 -0
- package/dist/esm/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js.map +1 -1
- package/dist/esm/serde/implementations/no-op-serde/no-op-serde.js +3 -0
- package/dist/esm/serde/implementations/no-op-serde/no-op-serde.js.map +1 -1
- package/dist/esm/serde/implementations/super-json-serde/super-json-serde.js +54 -111
- package/dist/esm/serde/implementations/super-json-serde/super-json-serde.js.map +1 -1
- package/dist/esm/utilities/contracts/_module.js +1 -0
- package/dist/esm/utilities/contracts/_module.js.map +1 -1
- package/dist/esm/utilities/contracts/serialized-error.contract.js +1 -0
- package/dist/esm/utilities/contracts/serialized-error.contract.js.map +1 -0
- package/dist/types/cache/contracts/cache.errors.d.ts +11 -4
- package/dist/types/cache/contracts/cache.events.d.ts +0 -6
- package/dist/types/cache/implementations/derivables/cache-factory-settings.d.ts +32 -1
- package/dist/types/cache/implementations/derivables/cache-factory.d.ts +10 -2
- package/dist/types/cache/implementations/derivables/cache-settings.d.ts +33 -1
- package/dist/types/cache/implementations/derivables/cache.d.ts +32 -2
- package/dist/types/event-bus/contracts/event-bus.errors.d.ts +8 -1
- package/dist/types/event-bus/implementations/derivables/event-bus-factory-settings.d.ts +23 -1
- package/dist/types/event-bus/implementations/derivables/event-bus-factory.d.ts +4 -0
- package/dist/types/event-bus/implementations/derivables/event-bus-settings.d.ts +23 -1
- package/dist/types/event-bus/implementations/derivables/event-bus.d.ts +13 -1
- package/dist/types/serde/contracts/flexible-serde.contract.d.ts +65 -1
- package/dist/types/serde/implementations/no-op-serde/no-op-serde.d.ts +2 -1
- package/dist/types/serde/implementations/super-json-serde/super-json-serde.d.ts +22 -1
- package/dist/types/utilities/contracts/_module.d.ts +1 -0
- package/dist/types/utilities/contracts/serialized-error.contract.d.ts +11 -0
- package/dist/types/utilities/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,8 +6,22 @@ export class SuperJsonSerde {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
this.registerAll();
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
registerCustom(transformer) {
|
|
10
10
|
this.superJson.registerCustom({
|
|
11
|
+
isApplicable(value) {
|
|
12
|
+
return transformer.isApplicable(value);
|
|
13
|
+
},
|
|
14
|
+
serialize(deserializedValue) {
|
|
15
|
+
return transformer.serialize(deserializedValue);
|
|
16
|
+
},
|
|
17
|
+
deserialize(serializedValue) {
|
|
18
|
+
return transformer.deserialize(serializedValue);
|
|
19
|
+
},
|
|
20
|
+
}, transformer.name);
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
registerBuffer() {
|
|
24
|
+
this.registerCustom({
|
|
11
25
|
isApplicable(value) {
|
|
12
26
|
return value instanceof Buffer;
|
|
13
27
|
},
|
|
@@ -29,207 +43,136 @@ export class SuperJsonSerde {
|
|
|
29
43
|
buffer: deserializedValue.toString("base64"),
|
|
30
44
|
};
|
|
31
45
|
},
|
|
32
|
-
|
|
46
|
+
name: Buffer.name,
|
|
47
|
+
});
|
|
33
48
|
}
|
|
34
49
|
registerUint8Array() {
|
|
35
|
-
this.
|
|
50
|
+
this.registerCustom({
|
|
36
51
|
isApplicable(value) {
|
|
37
52
|
return value instanceof Uint8Array;
|
|
38
53
|
},
|
|
39
54
|
deserialize(serializedValue) {
|
|
40
|
-
|
|
41
|
-
typeof serializedValue === "object" &&
|
|
42
|
-
serializedValue !== null;
|
|
43
|
-
if (!isObject) {
|
|
44
|
-
throw new DeserializationError("Serialized value is not object");
|
|
45
|
-
}
|
|
46
|
-
const { buffer } = serializedValue;
|
|
47
|
-
if (typeof buffer !== "string") {
|
|
48
|
-
throw new DeserializationError("Serialized value is not a string");
|
|
49
|
-
}
|
|
50
|
-
return new Uint8Array(Buffer.from(buffer, "base64"));
|
|
55
|
+
return new Uint8Array(Buffer.from(serializedValue.buffer, "base64"));
|
|
51
56
|
},
|
|
52
57
|
serialize(deserializedValue) {
|
|
53
58
|
return {
|
|
54
59
|
buffer: Buffer.from(deserializedValue).toString("base64"),
|
|
55
60
|
};
|
|
56
61
|
},
|
|
57
|
-
|
|
62
|
+
name: Uint8Array.name,
|
|
63
|
+
});
|
|
58
64
|
}
|
|
59
65
|
registerInt8Array() {
|
|
60
|
-
this.
|
|
66
|
+
this.registerCustom({
|
|
61
67
|
isApplicable(value) {
|
|
62
68
|
return value instanceof Int8Array;
|
|
63
69
|
},
|
|
64
70
|
deserialize(serializedValue) {
|
|
65
|
-
|
|
66
|
-
typeof serializedValue === "object" &&
|
|
67
|
-
serializedValue !== null;
|
|
68
|
-
if (!isObject) {
|
|
69
|
-
throw new DeserializationError("Serialized value is not object");
|
|
70
|
-
}
|
|
71
|
-
const { buffer } = serializedValue;
|
|
72
|
-
if (typeof buffer !== "string") {
|
|
73
|
-
throw new DeserializationError("Serialized value is not a string");
|
|
74
|
-
}
|
|
75
|
-
return new Int8Array(Buffer.from(buffer, "base64"));
|
|
71
|
+
return new Int8Array(Buffer.from(serializedValue.buffer, "base64"));
|
|
76
72
|
},
|
|
77
73
|
serialize(deserializedValue) {
|
|
78
74
|
return {
|
|
79
75
|
buffer: Buffer.from(deserializedValue).toString("base64"),
|
|
80
76
|
};
|
|
81
77
|
},
|
|
82
|
-
|
|
78
|
+
name: Int8Array.name,
|
|
79
|
+
});
|
|
83
80
|
}
|
|
84
81
|
registerUint16Array() {
|
|
85
|
-
this.
|
|
82
|
+
this.registerCustom({
|
|
86
83
|
isApplicable(value) {
|
|
87
84
|
return value instanceof Uint16Array;
|
|
88
85
|
},
|
|
89
86
|
deserialize(serializedValue) {
|
|
90
|
-
|
|
91
|
-
typeof serializedValue === "object" &&
|
|
92
|
-
serializedValue !== null;
|
|
93
|
-
if (!isObject) {
|
|
94
|
-
throw new DeserializationError("Serialized value is not object");
|
|
95
|
-
}
|
|
96
|
-
const { buffer } = serializedValue;
|
|
97
|
-
if (typeof buffer !== "string") {
|
|
98
|
-
throw new DeserializationError("Serialized value is not a string");
|
|
99
|
-
}
|
|
100
|
-
return new Uint16Array(Buffer.from(buffer, "base64"));
|
|
87
|
+
return new Uint16Array(Buffer.from(serializedValue.buffer, "base64"));
|
|
101
88
|
},
|
|
102
89
|
serialize(deserializedValue) {
|
|
103
90
|
return {
|
|
104
91
|
buffer: Buffer.from(deserializedValue).toString("base64"),
|
|
105
92
|
};
|
|
106
93
|
},
|
|
107
|
-
|
|
94
|
+
name: Uint16Array.name,
|
|
95
|
+
});
|
|
108
96
|
}
|
|
109
97
|
registerInt16Array() {
|
|
110
|
-
this.
|
|
98
|
+
this.registerCustom({
|
|
111
99
|
isApplicable(value) {
|
|
112
100
|
return value instanceof Int16Array;
|
|
113
101
|
},
|
|
114
102
|
deserialize(serializedValue) {
|
|
115
|
-
|
|
116
|
-
typeof serializedValue === "object" &&
|
|
117
|
-
serializedValue !== null;
|
|
118
|
-
if (!isObject) {
|
|
119
|
-
throw new DeserializationError("Serialized value is not object");
|
|
120
|
-
}
|
|
121
|
-
const { buffer } = serializedValue;
|
|
122
|
-
if (typeof buffer !== "string") {
|
|
123
|
-
throw new DeserializationError("Serialized value is not a string");
|
|
124
|
-
}
|
|
125
|
-
return new Int16Array(Buffer.from(buffer, "base64"));
|
|
103
|
+
return new Int16Array(Buffer.from(serializedValue.buffer, "base64"));
|
|
126
104
|
},
|
|
127
105
|
serialize(deserializedValue) {
|
|
128
106
|
return {
|
|
129
107
|
buffer: Buffer.from(deserializedValue).toString("base64"),
|
|
130
108
|
};
|
|
131
109
|
},
|
|
132
|
-
|
|
110
|
+
name: Int16Array.name,
|
|
111
|
+
});
|
|
133
112
|
}
|
|
134
113
|
registerUint32Array() {
|
|
135
|
-
this.
|
|
114
|
+
this.registerCustom({
|
|
136
115
|
isApplicable(value) {
|
|
137
116
|
return value instanceof Uint32Array;
|
|
138
117
|
},
|
|
139
118
|
deserialize(serializedValue) {
|
|
140
|
-
|
|
141
|
-
typeof serializedValue === "object" &&
|
|
142
|
-
serializedValue !== null;
|
|
143
|
-
if (!isObject) {
|
|
144
|
-
throw new DeserializationError("Serialized value is not object");
|
|
145
|
-
}
|
|
146
|
-
const { buffer } = serializedValue;
|
|
147
|
-
if (typeof buffer !== "string") {
|
|
148
|
-
throw new DeserializationError("Serialized value is not a string");
|
|
149
|
-
}
|
|
150
|
-
return new Uint32Array(Buffer.from(buffer, "base64"));
|
|
119
|
+
return new Uint32Array(Buffer.from(serializedValue.buffer, "base64"));
|
|
151
120
|
},
|
|
152
121
|
serialize(deserializedValue) {
|
|
153
122
|
return {
|
|
154
123
|
buffer: Buffer.from(deserializedValue).toString("base64"),
|
|
155
124
|
};
|
|
156
125
|
},
|
|
157
|
-
|
|
126
|
+
name: Uint32Array.name,
|
|
127
|
+
});
|
|
158
128
|
}
|
|
159
129
|
registerInt32Array() {
|
|
160
|
-
this.
|
|
130
|
+
this.registerCustom({
|
|
161
131
|
isApplicable(value) {
|
|
162
132
|
return value instanceof Int32Array;
|
|
163
133
|
},
|
|
164
134
|
deserialize(serializedValue) {
|
|
165
|
-
|
|
166
|
-
typeof serializedValue === "object" &&
|
|
167
|
-
serializedValue !== null;
|
|
168
|
-
if (!isObject) {
|
|
169
|
-
throw new DeserializationError("Serialized value is not object");
|
|
170
|
-
}
|
|
171
|
-
const { buffer } = serializedValue;
|
|
172
|
-
if (typeof buffer !== "string") {
|
|
173
|
-
throw new DeserializationError("Serialized value is not a string");
|
|
174
|
-
}
|
|
175
|
-
return new Int32Array(Buffer.from(buffer, "base64"));
|
|
135
|
+
return new Int32Array(Buffer.from(serializedValue.buffer, "base64"));
|
|
176
136
|
},
|
|
177
137
|
serialize(deserializedValue) {
|
|
178
138
|
return {
|
|
179
139
|
buffer: Buffer.from(deserializedValue).toString("base64"),
|
|
180
140
|
};
|
|
181
141
|
},
|
|
182
|
-
|
|
142
|
+
name: Int32Array.name,
|
|
143
|
+
});
|
|
183
144
|
}
|
|
184
145
|
registerFloat32Array() {
|
|
185
|
-
this.
|
|
146
|
+
this.registerCustom({
|
|
186
147
|
isApplicable(value) {
|
|
187
148
|
return value instanceof Float32Array;
|
|
188
149
|
},
|
|
189
150
|
deserialize(serializedValue) {
|
|
190
|
-
|
|
191
|
-
typeof serializedValue === "object" &&
|
|
192
|
-
serializedValue !== null;
|
|
193
|
-
if (!isObject) {
|
|
194
|
-
throw new DeserializationError("Serialized value is not object");
|
|
195
|
-
}
|
|
196
|
-
const { buffer } = serializedValue;
|
|
197
|
-
if (typeof buffer !== "string") {
|
|
198
|
-
throw new DeserializationError("Serialized value is not a string");
|
|
199
|
-
}
|
|
200
|
-
return new Float32Array(Buffer.from(buffer, "base64"));
|
|
151
|
+
return new Float32Array(Buffer.from(serializedValue.buffer, "base64"));
|
|
201
152
|
},
|
|
202
153
|
serialize(deserializedValue) {
|
|
203
154
|
return {
|
|
204
155
|
buffer: Buffer.from(deserializedValue).toString("base64"),
|
|
205
156
|
};
|
|
206
157
|
},
|
|
207
|
-
|
|
158
|
+
name: Float32Array.name,
|
|
159
|
+
});
|
|
208
160
|
}
|
|
209
161
|
registerFloat64Array() {
|
|
210
|
-
this.
|
|
162
|
+
this.registerCustom({
|
|
211
163
|
isApplicable(value) {
|
|
212
164
|
return value instanceof Float64Array;
|
|
213
165
|
},
|
|
214
166
|
deserialize(serializedValue) {
|
|
215
|
-
|
|
216
|
-
typeof serializedValue === "object" &&
|
|
217
|
-
serializedValue !== null;
|
|
218
|
-
if (!isObject) {
|
|
219
|
-
throw new DeserializationError("Serialized value is not object");
|
|
220
|
-
}
|
|
221
|
-
const { buffer } = serializedValue;
|
|
222
|
-
if (typeof buffer !== "string") {
|
|
223
|
-
throw new DeserializationError("Serialized value is not a string");
|
|
224
|
-
}
|
|
225
|
-
return new Float64Array(Buffer.from(buffer, "base64"));
|
|
167
|
+
return new Float64Array(Buffer.from(serializedValue.buffer, "base64"));
|
|
226
168
|
},
|
|
227
169
|
serialize(deserializedValue) {
|
|
228
170
|
return {
|
|
229
171
|
buffer: Buffer.from(deserializedValue).toString("base64"),
|
|
230
172
|
};
|
|
231
173
|
},
|
|
232
|
-
|
|
174
|
+
name: Float64Array.name,
|
|
175
|
+
});
|
|
233
176
|
}
|
|
234
177
|
registerAll() {
|
|
235
178
|
this.registerBuffer();
|
|
@@ -243,7 +186,7 @@ export class SuperJsonSerde {
|
|
|
243
186
|
this.registerFloat64Array();
|
|
244
187
|
}
|
|
245
188
|
registerClass(class_) {
|
|
246
|
-
this.
|
|
189
|
+
return this.registerCustom({
|
|
247
190
|
isApplicable(value) {
|
|
248
191
|
return (value instanceof class_ &&
|
|
249
192
|
getConstructorName(value) === class_.name);
|
|
@@ -251,11 +194,11 @@ export class SuperJsonSerde {
|
|
|
251
194
|
deserialize(serializedValue) {
|
|
252
195
|
return class_.deserialize(serializedValue);
|
|
253
196
|
},
|
|
254
|
-
serialize(
|
|
255
|
-
return
|
|
197
|
+
serialize(deserializedValue) {
|
|
198
|
+
return deserializedValue.serialize();
|
|
256
199
|
},
|
|
257
|
-
|
|
258
|
-
|
|
200
|
+
name: class_.name,
|
|
201
|
+
});
|
|
259
202
|
}
|
|
260
203
|
serialize(value) {
|
|
261
204
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"super-json-serde.js","sourceRoot":"","sources":["../../../../../src/serde/implementations/super-json-serde/super-json-serde.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"super-json-serde.js","sourceRoot":"","sources":["../../../../../src/serde/implementations/super-json-serde/super-json-serde.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAOzD,OAAO,EACH,oBAAoB,EACpB,kBAAkB,GACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAkC1C,MAAM,OAAO,cAAc;IACN,SAAS,GAAc,IAAI,SAAS,EAAE,CAAC;IAExD;QACI,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED,cAAc,CACV,WAAsE;QAEtE,IAA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K,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,MAAM,IAAI,oBAAoB,CAC1B,0BAA0B,MAAM,CAAC,KAAK,CAAC,WAAW,EAClD,KAAK,CACR,CAAC;QACN,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/utilities/contracts/_module.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC"}
|
|
1
|
+
{"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/utilities/contracts/_module.ts"],"names":[],"mappings":"AAAA,cAAc,iDAAiD,CAAC;AAChE,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=serialized-error.contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialized-error.contract.js","sourceRoot":"","sources":["../../../../src/utilities/contracts/serialized-error.contract.ts"],"names":[],"mappings":""}
|
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
|
+
import type { ISerializable } from "../../serde/contracts/_module";
|
|
5
|
+
import type { ISerializedError } from "../../utilities/_module";
|
|
4
6
|
/**
|
|
5
7
|
* @group Errors
|
|
6
8
|
*/
|
|
7
|
-
export declare class CacheError extends Error {
|
|
9
|
+
export declare class CacheError extends Error implements ISerializable<ISerializedError> {
|
|
10
|
+
static deserialize(deserializedValue: ISerializedError): CacheError;
|
|
8
11
|
constructor(message: string, cause?: unknown);
|
|
12
|
+
serialize(): ISerializedError;
|
|
9
13
|
}
|
|
10
14
|
/**
|
|
11
15
|
* @group Errors
|
|
12
16
|
*/
|
|
13
|
-
export declare class UnexpectedCacheError extends CacheError {
|
|
17
|
+
export declare class UnexpectedCacheError extends CacheError implements ISerializable<ISerializedError> {
|
|
18
|
+
static deserialize(deserializedValue: ISerializedError): CacheError;
|
|
14
19
|
constructor(message: string, cause?: unknown);
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
17
22
|
* @group Errors
|
|
18
23
|
*/
|
|
19
|
-
export declare class TypeCacheError extends CacheError {
|
|
24
|
+
export declare class TypeCacheError extends CacheError implements ISerializable<ISerializedError> {
|
|
25
|
+
static deserialize(deserializedValue: ISerializedError): CacheError;
|
|
20
26
|
constructor(message: string, cause?: unknown);
|
|
21
27
|
}
|
|
22
28
|
/**
|
|
23
29
|
* @group Errors
|
|
24
30
|
*/
|
|
25
|
-
export declare class KeyNotFoundCacheError extends CacheError {
|
|
31
|
+
export declare class KeyNotFoundCacheError extends CacheError implements ISerializable<ISerializedError> {
|
|
32
|
+
static deserialize(deserializedValue: ISerializedError): CacheError;
|
|
26
33
|
constructor(message: string, cause?: unknown);
|
|
27
34
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
4
|
import { BaseEvent } from "../../event-bus/contracts/_module";
|
|
5
|
-
import type { IFlexibleSerde } from "../../serde/contracts/_module";
|
|
6
5
|
import type { TimeSpan } from "../../utilities/_module";
|
|
7
6
|
/**
|
|
8
7
|
* @group Events
|
|
@@ -154,8 +153,3 @@ export declare class KeysClearedCacheEvent extends BaseEvent<KeysClearedCacheEve
|
|
|
154
153
|
* @group Events
|
|
155
154
|
*/
|
|
156
155
|
export type CacheEvents<TType = unknown> = KeyFoundCacheEvent<TType> | KeyNotFoundCacheEvent | KeyAddedCacheEvent<TType> | KeyUpdatedCacheEvent<TType> | KeyRemovedCacheEvent | KeyIncrementedCacheEvent | KeyDecrementedCacheEvent | KeysClearedCacheEvent;
|
|
157
|
-
/**
|
|
158
|
-
* The <i>registerCacheEvents</i> function is used to register all cache events with a <i>{@link IFlexibleSerde}</i>.
|
|
159
|
-
* @group Events
|
|
160
|
-
*/
|
|
161
|
-
export declare function registerCacheEvents<TSerializedValue>(serde: IFlexibleSerde<TSerializedValue>): void;
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { IGroupableEventBus } from "../../../event-bus/contracts/_module";
|
|
5
5
|
import type { ICacheAdapter } from "../../../cache/contracts/_module";
|
|
6
|
-
import type { TimeSpan } from "../../../utilities/_module";
|
|
6
|
+
import type { OneOrMore, TimeSpan } from "../../../utilities/_module";
|
|
7
7
|
import type { BackoffPolicy, RetryPolicy } from "../../../async/_module";
|
|
8
|
+
import type { IFlexibleSerde } from "../../../serde/contracts/_module";
|
|
8
9
|
/**
|
|
9
10
|
* @group Derivables
|
|
10
11
|
*/
|
|
@@ -13,6 +14,23 @@ export type CacheAdapters<TAdapters extends string> = Partial<Record<TAdapters,
|
|
|
13
14
|
* @group Derivables
|
|
14
15
|
*/
|
|
15
16
|
export type CacheFactorySettings<TAdapters extends string = string> = {
|
|
17
|
+
/**
|
|
18
|
+
* You can pass one or more <i>{@link IFlexibleSerde}</i> that will be used to register all <i>{@link IGroupableCache}</i> related errors and events.
|
|
19
|
+
* @default {true}
|
|
20
|
+
*/
|
|
21
|
+
serde: OneOrMore<IFlexibleSerde>;
|
|
22
|
+
/**
|
|
23
|
+
* If set to true, all <i>{@link IGroupableCache}</i> related errors will be registered with the specified <i>IFlexibleSerde</i> during constructor initialization.
|
|
24
|
+
* This ensures that all <i>{@link IGroupableCache}</i> related errors will be serialized correctly.
|
|
25
|
+
* @default {true}
|
|
26
|
+
*/
|
|
27
|
+
shouldRegisterErrors?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* If set to true, all <i>{@link IGroupableCache}</i> related events will be registered with the specified <i>IFlexibleSerde</i> during constructor initialization.
|
|
30
|
+
* This ensures that all <i>{@link IGroupableCache}</i> related events will be serialized correctly.
|
|
31
|
+
* @default {true}
|
|
32
|
+
*/
|
|
33
|
+
shouldRegisterEvents?: boolean;
|
|
16
34
|
adapters: CacheAdapters<TAdapters>;
|
|
17
35
|
defaultAdapter?: NoInfer<TAdapters>;
|
|
18
36
|
/**
|
|
@@ -25,18 +43,22 @@ export type CacheFactorySettings<TAdapters extends string = string> = {
|
|
|
25
43
|
eventBus?: IGroupableEventBus<any>;
|
|
26
44
|
/**
|
|
27
45
|
* The default retry attempt to use in the returned <i>LazyPromise</i>.
|
|
46
|
+
* @default {null}
|
|
28
47
|
*/
|
|
29
48
|
retryAttempts?: number | null;
|
|
30
49
|
/**
|
|
31
50
|
* The default backof policy to use in the returned <i>LazyPromise</i>.
|
|
51
|
+
* @default {null}
|
|
32
52
|
*/
|
|
33
53
|
backoffPolicy?: BackoffPolicy | null;
|
|
34
54
|
/**
|
|
35
55
|
* The default retry policy to use in the returned <i>LazyPromise</i>.
|
|
56
|
+
* @default {null}
|
|
36
57
|
*/
|
|
37
58
|
retryPolicy?: RetryPolicy | null;
|
|
38
59
|
/**
|
|
39
60
|
* The default timeout to use in the returned <i>LazyPromise</i>.
|
|
61
|
+
* @default {null}
|
|
40
62
|
*/
|
|
41
63
|
timeout?: TimeSpan | null;
|
|
42
64
|
};
|
|
@@ -47,6 +69,15 @@ export type CacheFactorySettings<TAdapters extends string = string> = {
|
|
|
47
69
|
export declare class CacheFactorySettingsBuilder<TSettings extends CacheFactorySettings> {
|
|
48
70
|
private readonly settings;
|
|
49
71
|
constructor(settings?: TSettings);
|
|
72
|
+
setShouldRegisterErrors(shouldRegisterErrors: boolean): CacheFactorySettingsBuilder<TSettings & {
|
|
73
|
+
shouldRegisterErrors: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
setShouldRegisterEvents(shouldRegisterEvents: boolean): CacheFactorySettingsBuilder<TSettings & {
|
|
76
|
+
shouldRegisterEvents: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
setSerde(serde: OneOrMore<IFlexibleSerde>): CacheFactorySettingsBuilder<TSettings & {
|
|
79
|
+
serde: OneOrMore<IFlexibleSerde>;
|
|
80
|
+
}>;
|
|
50
81
|
setEventBus(eventBus: IGroupableEventBus<any>): CacheFactorySettingsBuilder<TSettings & {
|
|
51
82
|
eventBus: IGroupableEventBus<any>;
|
|
52
83
|
}>;
|
|
@@ -14,6 +14,7 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
14
14
|
* import { CacheFactory, SuperJsonSerde. MemoryCacheAdapter, RedisCacheAdapter, EventBus, MemoryEventBusAdapter } from "@daiso-tech/core";
|
|
15
15
|
* import Redis from "ioredis";
|
|
16
16
|
*
|
|
17
|
+
* const serde = new SuperJsonSerde();
|
|
17
18
|
* const cacheFactory = new CacheFactory(
|
|
18
19
|
* CacheFactory
|
|
19
20
|
* .settings()
|
|
@@ -23,7 +24,7 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
23
24
|
* }))
|
|
24
25
|
* .setAdapter("redis", new RedisCacheAdapter({
|
|
25
26
|
* client: new Redis("YOUR_REDIS_CONNECTION"),
|
|
26
|
-
* serde
|
|
27
|
+
* serde,
|
|
27
28
|
* rootGroup: "@global"
|
|
28
29
|
* }))
|
|
29
30
|
* .setDefaultAdapter("memory")
|
|
@@ -32,6 +33,7 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
32
33
|
* ```
|
|
33
34
|
*/
|
|
34
35
|
static settings<TAdapters extends string, TSettings extends CacheFactorySettings<TAdapters>>(): CacheFactorySettingsBuilder<TSettings>;
|
|
36
|
+
private readonly caches;
|
|
35
37
|
private readonly adapters;
|
|
36
38
|
private readonly defaultAdapter?;
|
|
37
39
|
private readonly eventBus?;
|
|
@@ -40,6 +42,9 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
40
42
|
private readonly backoffPolicy?;
|
|
41
43
|
private readonly retryPolicy?;
|
|
42
44
|
private readonly timeout?;
|
|
45
|
+
private readonly serde;
|
|
46
|
+
private readonly shouldRegisterErrors?;
|
|
47
|
+
private readonly shouldRegisterEvents?;
|
|
43
48
|
/**
|
|
44
49
|
* @example
|
|
45
50
|
* ```ts
|
|
@@ -49,14 +54,16 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
49
54
|
* const eventBus = new EventBus({
|
|
50
55
|
* adapter: new MemoryEventBusAdapter({ rootGroup: "@global" })
|
|
51
56
|
* });
|
|
57
|
+
* const serde = new SuperJsonSerde();
|
|
52
58
|
* const cacheFactory = new CacheFactory({
|
|
59
|
+
* serde,
|
|
53
60
|
* adapters: {
|
|
54
61
|
* memory: new MemoryCacheAdapter({
|
|
55
62
|
* rootGroup: "@global"
|
|
56
63
|
* }),
|
|
57
64
|
* redis: new RedisCacheAdapter({
|
|
58
65
|
* client: new Redis("YOUR_REDIS_CONNECTION"),
|
|
59
|
-
* serde
|
|
66
|
+
* serde,
|
|
60
67
|
* rootGroup: "@global"
|
|
61
68
|
* }),
|
|
62
69
|
* },
|
|
@@ -66,5 +73,6 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
66
73
|
* ```
|
|
67
74
|
*/
|
|
68
75
|
constructor(settings: CacheFactorySettings<TAdapters>);
|
|
76
|
+
private initCaches;
|
|
69
77
|
use<TType = unknown>(adapterName?: TAdapters | undefined): IGroupableCache<TType>;
|
|
70
78
|
}
|
|
@@ -2,14 +2,32 @@
|
|
|
2
2
|
* @module Cache
|
|
3
3
|
*/
|
|
4
4
|
import type { ICacheAdapter } from "../../../cache/contracts/_module";
|
|
5
|
-
import type { IBuildable } from "../../../utilities/_module";
|
|
5
|
+
import type { IBuildable, OneOrMore } from "../../../utilities/_module";
|
|
6
6
|
import type { TimeSpan } from "../../../utilities/_module";
|
|
7
7
|
import type { BackoffPolicy, RetryPolicy } from "../../../async/_module";
|
|
8
8
|
import type { IGroupableEventBus } from "../../../event-bus/contracts/_module";
|
|
9
|
+
import type { IFlexibleSerde } from "../../../serde/contracts/_module";
|
|
9
10
|
/**
|
|
10
11
|
* @group Derivables
|
|
11
12
|
*/
|
|
12
13
|
export type CacheSettings = {
|
|
14
|
+
/**
|
|
15
|
+
* You can pass one or more <i>{@link IFlexibleSerde}</i> that will be used to register all <i>{@link IGroupableCache}</i> related errors and events.
|
|
16
|
+
* @default {true}
|
|
17
|
+
*/
|
|
18
|
+
serde: OneOrMore<IFlexibleSerde>;
|
|
19
|
+
/**
|
|
20
|
+
* If set to true, all <i>{@link IGroupableCache}</i> related errors will be registered with the specified <i>IFlexibleSerde</i> during constructor initialization.
|
|
21
|
+
* This ensures that all <i>{@link IGroupableCache}</i> related errors will be serialized correctly.
|
|
22
|
+
* @default {true}
|
|
23
|
+
*/
|
|
24
|
+
shouldRegisterErrors?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* If set to true, all <i>{@link IGroupableCache}</i> related events will be registered with the specified <i>IFlexibleSerde</i> during constructor initialization.
|
|
27
|
+
* This ensures that all <i>{@link IGroupableCache}</i> related events will be serialized correctly.
|
|
28
|
+
* @default {true}
|
|
29
|
+
*/
|
|
30
|
+
shouldRegisterEvents?: boolean;
|
|
13
31
|
adapter: ICacheAdapter<any>;
|
|
14
32
|
/**
|
|
15
33
|
* In order to listen to events of <i>{@link Cache}</i> class you must pass in <i>{@link IGroupableEventBus}</i>.
|
|
@@ -17,22 +35,27 @@ export type CacheSettings = {
|
|
|
17
35
|
eventBus?: IGroupableEventBus<any>;
|
|
18
36
|
/**
|
|
19
37
|
* You can decide the default ttl value. If null is passed then no ttl will be used by default.
|
|
38
|
+
* @default {null}
|
|
20
39
|
*/
|
|
21
40
|
defaultTtl?: TimeSpan | null;
|
|
22
41
|
/**
|
|
23
42
|
* The default retry attempt to use in the returned <i>LazyPromise</i>.
|
|
43
|
+
* @default {null}
|
|
24
44
|
*/
|
|
25
45
|
retryAttempts?: number | null;
|
|
26
46
|
/**
|
|
27
47
|
* The default backof policy to use in the returned <i>LazyPromise</i>.
|
|
48
|
+
* @default {null}
|
|
28
49
|
*/
|
|
29
50
|
backoffPolicy?: BackoffPolicy | null;
|
|
30
51
|
/**
|
|
31
52
|
* The default retry policy to use in the returned <i>LazyPromise</i>.
|
|
53
|
+
* @default {null}
|
|
32
54
|
*/
|
|
33
55
|
retryPolicy?: RetryPolicy | null;
|
|
34
56
|
/**
|
|
35
57
|
* The default timeout to use in the returned <i>LazyPromise</i>.
|
|
58
|
+
* @default {null}
|
|
36
59
|
*/
|
|
37
60
|
timeout?: TimeSpan | null;
|
|
38
61
|
};
|
|
@@ -43,6 +66,15 @@ export type CacheSettings = {
|
|
|
43
66
|
export declare class CacheSettingsBuilder<TSettings extends Partial<CacheSettings>> implements IBuildable<CacheSettings> {
|
|
44
67
|
private readonly settings;
|
|
45
68
|
constructor(settings?: TSettings);
|
|
69
|
+
setShouldRegisterErrors(shouldRegisterErrors: boolean): CacheSettingsBuilder<TSettings & {
|
|
70
|
+
shouldRegisterErrors: boolean;
|
|
71
|
+
}>;
|
|
72
|
+
setShouldRegisterEvents(shouldRegisterEvents: boolean): CacheSettingsBuilder<TSettings & {
|
|
73
|
+
shouldRegisterEvents: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
setSerde(serde: OneOrMore<IFlexibleSerde>): CacheSettingsBuilder<TSettings & {
|
|
76
|
+
serde: OneOrMore<IFlexibleSerde>;
|
|
77
|
+
}>;
|
|
46
78
|
setAdapter(adapter: ICacheAdapter<any>): CacheSettingsBuilder<TSettings & {
|
|
47
79
|
adapter: ICacheAdapter<any>;
|
|
48
80
|
}>;
|