@punks/backend-entity-manager 0.0.191 → 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 CHANGED
@@ -2341,6 +2341,41 @@ class TypeormCacheInstance {
2341
2341
  getInstanceName() {
2342
2342
  return this.instanceName;
2343
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
+ }
2344
2379
  async retrieve(key, input) {
2345
2380
  const item = await this.getRepository().findOne({
2346
2381
  where: {
@@ -2355,15 +2390,6 @@ class TypeormCacheInstance {
2355
2390
  await this.set(key, { value, ttl: input.ttl });
2356
2391
  return value;
2357
2392
  }
2358
- async getAll() {
2359
- const items = await this.getRepository().find({
2360
- where: {
2361
- instance: this.instanceName,
2362
- expirationTime: typeorm.MoreThanOrEqual(new Date()),
2363
- },
2364
- });
2365
- return items.map((item) => item.data);
2366
- }
2367
2393
  async get(key) {
2368
2394
  const item = await this.getRepository().findOne({
2369
2395
  where: {