@punks/backend-entity-manager 0.0.190 → 0.0.192
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/index.js +38 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/cache.d.ts +13 -1
- package/dist/cjs/types/integrations/cache/typeorm/instance.d.ts +4 -2
- package/dist/esm/index.js +38 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/cache.d.ts +13 -1
- package/dist/esm/types/integrations/cache/typeorm/instance.d.ts +4 -2
- package/dist/index.d.ts +17 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2338,6 +2338,44 @@ class TypeormCacheInstance {
|
|
|
2338
2338
|
this.instanceName = instanceName;
|
|
2339
2339
|
this.logger = backendCore.Log.getLogger(`TypeOrm Cache Instance ${instanceName}`);
|
|
2340
2340
|
}
|
|
2341
|
+
getInstanceName() {
|
|
2342
|
+
return this.instanceName;
|
|
2343
|
+
}
|
|
2344
|
+
async getEntries() {
|
|
2345
|
+
const items = await this.getRepository().find({
|
|
2346
|
+
where: {
|
|
2347
|
+
instance: this.instanceName,
|
|
2348
|
+
expirationTime: typeorm.MoreThanOrEqual(new Date()),
|
|
2349
|
+
},
|
|
2350
|
+
});
|
|
2351
|
+
return items.map((item) => ({
|
|
2352
|
+
instanceName: this.instanceName,
|
|
2353
|
+
key: item.key,
|
|
2354
|
+
expiration: item.expirationTime,
|
|
2355
|
+
createdOn: item.createdOn,
|
|
2356
|
+
updatedOn: item.updatedOn,
|
|
2357
|
+
}));
|
|
2358
|
+
}
|
|
2359
|
+
async getEntry(key) {
|
|
2360
|
+
const item = await this.getRepository().findOne({
|
|
2361
|
+
where: {
|
|
2362
|
+
instance: this.instanceName,
|
|
2363
|
+
key,
|
|
2364
|
+
expirationTime: typeorm.MoreThanOrEqual(new Date()),
|
|
2365
|
+
},
|
|
2366
|
+
});
|
|
2367
|
+
if (!item) {
|
|
2368
|
+
return undefined;
|
|
2369
|
+
}
|
|
2370
|
+
return {
|
|
2371
|
+
instanceName: this.instanceName,
|
|
2372
|
+
key: item.key,
|
|
2373
|
+
expiration: item.expirationTime,
|
|
2374
|
+
createdOn: item.createdOn,
|
|
2375
|
+
updatedOn: item.updatedOn,
|
|
2376
|
+
data: item.data,
|
|
2377
|
+
};
|
|
2378
|
+
}
|
|
2341
2379
|
async retrieve(key, input) {
|
|
2342
2380
|
const item = await this.getRepository().findOne({
|
|
2343
2381
|
where: {
|
|
@@ -2352,15 +2390,6 @@ class TypeormCacheInstance {
|
|
|
2352
2390
|
await this.set(key, { value, ttl: input.ttl });
|
|
2353
2391
|
return value;
|
|
2354
2392
|
}
|
|
2355
|
-
async getAll() {
|
|
2356
|
-
const items = await this.getRepository().find({
|
|
2357
|
-
where: {
|
|
2358
|
-
instance: this.instanceName,
|
|
2359
|
-
expirationTime: typeorm.MoreThanOrEqual(new Date()),
|
|
2360
|
-
},
|
|
2361
|
-
});
|
|
2362
|
-
return items.map((item) => item.data);
|
|
2363
|
-
}
|
|
2364
2393
|
async get(key) {
|
|
2365
2394
|
const item = await this.getRepository().findOne({
|
|
2366
2395
|
where: {
|