mirror of
https://github.com/seejohnrun/haste-server.git
synced 2024-11-01 03:21:21 +00:00
fix lint issues of not added packages
This commit is contained in:
parent
f8d61db716
commit
1698bfe0ec
8 changed files with 41 additions and 25 deletions
|
@ -27,6 +27,7 @@
|
|||
"@types/aws-sdk": "^2.7.0",
|
||||
"@types/busboy": "^1.5.0",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/google-cloud__datastore": "^1.3.6",
|
||||
"@types/jest": "^27.5.1",
|
||||
"@types/memcached": "^2.2.7",
|
||||
"@types/mongodb": "^4.0.7",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as winston from 'winston'
|
||||
import AWS from 'aws-sdk'
|
||||
import AWS = require('aws-sdk')
|
||||
import type { AmazonStoreConfig } from 'src/types/config'
|
||||
import { Callback } from 'src/types/callback'
|
||||
import { Store } from '.'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Datastore, PathType } from '@google-cloud/datastore'
|
||||
import Datastore = require('@google-cloud/datastore')
|
||||
import * as winston from 'winston'
|
||||
|
||||
import type { Callback } from 'src/types/callback'
|
||||
|
@ -19,7 +19,7 @@ class GoogleDatastoreDocumentStore extends Store {
|
|||
|
||||
// Save file in a key
|
||||
set = (
|
||||
key: PathType,
|
||||
key: string,
|
||||
data: string,
|
||||
callback: Callback,
|
||||
skipExpire?: boolean
|
||||
|
@ -56,13 +56,13 @@ class GoogleDatastoreDocumentStore extends Store {
|
|||
}
|
||||
|
||||
// Get a file from a key
|
||||
get = (key: PathType, callback: Callback, skipExpire?: boolean): void => {
|
||||
get = (key: string, callback: Callback, skipExpire?: boolean): void => {
|
||||
const taskKey = this.datastore.key([this.kind, key])
|
||||
|
||||
this.datastore
|
||||
.get(taskKey)
|
||||
.then(entity => {
|
||||
if (skipExpire || entity[0].expiration == null) {
|
||||
if (skipExpire || entity[0]?.expiration == null) {
|
||||
callback(entity[0].value)
|
||||
} else if (entity[0].expiration < new Date()) {
|
||||
winston.info('document expired', {
|
||||
|
@ -78,7 +78,7 @@ class GoogleDatastoreDocumentStore extends Store {
|
|||
data: [
|
||||
{
|
||||
name: 'value',
|
||||
value: entity[0].value,
|
||||
value: entity[0]?.value,
|
||||
excludeFromIndexes: true
|
||||
},
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ class GoogleDatastoreDocumentStore extends Store {
|
|||
.catch(err => {
|
||||
winston.error('failed to update expiration', { error: err })
|
||||
})
|
||||
callback(entity[0].value)
|
||||
callback(entity[0]?.value)
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import * as winston from 'winston'
|
||||
import { MongoClient } from 'mongodb'
|
||||
import mongodb = require('mongodb')
|
||||
|
||||
import type { Callback } from 'src/types/callback'
|
||||
import type { MongoStoreConfig } from 'src/types/config'
|
||||
import { Store } from '.'
|
||||
|
||||
type ConnectCallback = (error?: Error, db?: MongoClient) => void
|
||||
const { MongoClient } = mongodb
|
||||
|
||||
type ConnectCallback = (error?: Error, db?: mongodb.MongoClient) => void
|
||||
|
||||
class MongoDocumentStore extends Store {
|
||||
connectionUrl: string
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
import * as winston from 'winston'
|
||||
import { Pool, PoolClient } from 'pg'
|
||||
import Pg = require('pg')
|
||||
|
||||
import type { Callback } from 'src/types/callback'
|
||||
import type { PostgresStoreConfig } from 'src/types/config'
|
||||
import { Store } from '.'
|
||||
|
||||
const { Pool } = Pg
|
||||
|
||||
type ConnectCallback = (
|
||||
error?: Error,
|
||||
client?: PoolClient,
|
||||
client?: Pg.PoolClient,
|
||||
done?: () => void
|
||||
) => void
|
||||
|
||||
// A postgres document store
|
||||
class PostgresDocumentStore extends Store {
|
||||
pool: Pool
|
||||
pool: Pg.Pool
|
||||
|
||||
constructor(options: PostgresStoreConfig) {
|
||||
super(options)
|
||||
|
@ -23,14 +25,16 @@ class PostgresDocumentStore extends Store {
|
|||
|
||||
// A connection wrapper
|
||||
safeConnect = (callback: ConnectCallback) => {
|
||||
this.pool.connect((error: Error, client: PoolClient, done: () => void) => {
|
||||
this.pool.connect(
|
||||
(error: Error, client: Pg.PoolClient, done: () => void) => {
|
||||
if (error) {
|
||||
winston.error('error connecting to postgres', { error })
|
||||
callback(error)
|
||||
} else {
|
||||
callback(undefined, client, done)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// Get a given key's data
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import * as winston from 'winston'
|
||||
import { createClient } from 'redis'
|
||||
import { bool } from 'aws-sdk/clients/redshiftdata'
|
||||
import redis = require('redis')
|
||||
|
||||
import type { Callback } from 'src/types/callback'
|
||||
import { RedisStoreConfig } from 'src/types/config'
|
||||
import { Store } from '.'
|
||||
|
||||
export type RedisClientType = ReturnType<typeof createClient>
|
||||
const { createClient } = redis
|
||||
|
||||
export type RedisClientType = ReturnType<typeof redis.createClient>
|
||||
|
||||
// For storing in redis
|
||||
// options[type] = redis
|
||||
|
@ -68,7 +70,7 @@ class RedisDocumentStore extends Store {
|
|||
})
|
||||
}
|
||||
|
||||
getExpire = (skipExpire?: bool) => (!skipExpire ? { EX: this.expire } : {})
|
||||
getExpire = (skipExpire?: boolean) => (!skipExpire ? { EX: this.expire } : {})
|
||||
|
||||
get = (key: string, callback: Callback): void => {
|
||||
this.client
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as winston from 'winston'
|
||||
import * as crypto from 'crypto'
|
||||
|
||||
import rethink, { RethinkClient } from 'rethinkdbdash'
|
||||
import rethink = require('rethinkdbdash')
|
||||
|
||||
import type { RethinkDbStoreConfig } from 'src/types/config'
|
||||
import type { Callback } from 'src/types/callback'
|
||||
|
@ -14,7 +14,7 @@ const md5 = (str: string) => {
|
|||
}
|
||||
|
||||
class RethinkDBStore extends Store {
|
||||
client: RethinkClient
|
||||
client: rethink.RethinkClient
|
||||
|
||||
constructor(options: RethinkDbStoreConfig) {
|
||||
super(options)
|
||||
|
|
|
@ -763,6 +763,13 @@
|
|||
"@types/minimatch" "*"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/google-cloud__datastore@^1.3.6":
|
||||
version "1.3.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/google-cloud__datastore/-/google-cloud__datastore-1.3.6.tgz#33b2c65c1b797279e57ed5ac96966bebb9c6500b"
|
||||
integrity sha512-92yEN/b5tkdNT+9l0BscP5uUQLk9h+aHH21TkHi7ITbXnRIPBs2lmV5dbmDVKkQRXHLiCdLv0zfk8xgfYqSGpg==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/graceful-fs@^4.1.3":
|
||||
version "4.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15"
|
||||
|
|
Loading…
Reference in a new issue