Skip to content

Commit

Permalink
Import order
Browse files Browse the repository at this point in the history
  • Loading branch information
ilovepixelart committed May 9, 2024
1 parent 5e95320 commit 42dd7a4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/cache/Cache.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import ms from 'ms'

import MemoryCacheEngine from './engine/MemoryCacheEngine'
import RedisCacheEngine from './engine/RedisCacheEngine'

import type IData from '../interfaces/IData'
import type ICacheEngine from '../interfaces/ICacheEngine'
import type ICacheOptions from '../interfaces/ICacheOptions'

import MemoryCacheEngine from './engine/MemoryCacheEngine'
import RedisCacheEngine from './engine/RedisCacheEngine'

class CacheEngine {
#engine!: ICacheEngine
#defaultTTL: number
Expand Down
3 changes: 2 additions & 1 deletion src/cache/engine/RedisCacheEngine.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import IORedis from 'ioredis'
import { EJSON } from 'bson'

import { convertToObject } from '../../version'

import type { Redis, RedisOptions } from 'ioredis'
import type IData from '../../interfaces/IData'
import type ICacheEngine from '../../interfaces/ICacheEngine'
import { convertToObject } from '../../version'

class RedisCacheEngine implements ICacheEngine {
#client: Redis
Expand Down
4 changes: 2 additions & 2 deletions src/extend/aggregate.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getKey } from '../key'

import type { Mongoose } from 'mongoose'
import type Cache from '../cache/Cache'

import { getKey } from '../key'

export default function extendQuery(mongoose: Mongoose, cache: Cache): void {
// eslint-disable-next-line @typescript-eslint/unbound-method
const mongooseExec = mongoose.Aggregate.prototype.exec
Expand Down
4 changes: 2 additions & 2 deletions src/extend/query.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getKey } from '../key'

import type { Mongoose } from 'mongoose'
import type Cache from '../cache/Cache'

import { getKey } from '../key'

export default function extendQuery(mongoose: Mongoose, cache: Cache): void {
// eslint-disable-next-line @typescript-eslint/unbound-method
const mongooseExec = mongoose.Query.prototype.exec
Expand Down
5 changes: 2 additions & 3 deletions src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import Cache from './cache/Cache'
import extendQuery from './extend/query'
import extendAggregate from './extend/aggregate'

import type { Mongoose } from 'mongoose'
import type ICacheOptions from './interfaces/ICacheOptions'

import extendQuery from './extend/query'
import extendAggregate from './extend/aggregate'

declare module 'mongoose' {
interface Query<ResultType, DocType, THelpers, RawDocType> {
cache: (this: Query<ResultType, DocType, THelpers, RawDocType>, ttl?: string, customKey?: string) => this
Expand Down
1 change: 1 addition & 0 deletions src/version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { satisfies } from 'semver'
import mongoose from 'mongoose'

import type IData from './interfaces/IData'

export const isMongooseLessThan7 = satisfies(mongoose.version, '<7')
Expand Down

0 comments on commit 42dd7a4

Please sign in to comment.