Update dependencies & fix misc formatting errors

master
Garrett Mills 2 years ago
parent 52762bd4a1
commit 0484a586bd

1608
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{
"name": "@extollo/lib",
"version": "0.14.6",
"version": "0.14.7",
"description": "The framework library that lifts up your code.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@ -8,50 +8,50 @@
"lib": "lib"
},
"dependencies": {
"@atao60/fse-cli": "^0.1.6",
"@atao60/fse-cli": "^0.1.7",
"@extollo/ui": "^0.1.0",
"@types/bcrypt": "^5.0.0",
"@types/busboy": "^0.2.3",
"@types/cli-table": "^0.3.0",
"@types/cli-table": "^0.3.1",
"@types/ioredis": "^4.26.6",
"@types/jsonwebtoken": "^8.5.8",
"@types/mime-types": "^2.1.0",
"@types/mkdirp": "^1.0.1",
"@types/jsonwebtoken": "^8.5.9",
"@types/mime-types": "^2.1.1",
"@types/mkdirp": "^1.0.2",
"@types/negotiator": "^0.6.1",
"@types/node": "^14.17.4",
"@types/pg": "^8.6.0",
"@types/pg": "^8.6.5",
"@types/pluralize": "^0.0.29",
"@types/pug": "^2.0.4",
"@types/rimraf": "^3.0.0",
"@types/pug": "^2.0.6",
"@types/rimraf": "^3.0.2",
"@types/ssh2": "^0.5.46",
"@types/uuid": "^8.3.0",
"@types/uuid": "^8.3.4",
"@types/ws": "^8.5.3",
"bcrypt": "^5.0.1",
"busboy": "^0.3.1",
"cli-table": "^0.3.6",
"cli-table": "^0.3.11",
"colors": "^1.4.0",
"dotenv": "^8.2.0",
"ioredis": "^4.27.6",
"jsonwebtoken": "^8.5.1",
"mime-types": "^2.1.31",
"mime-types": "^2.1.35",
"mkdirp": "^1.0.4",
"negotiator": "^0.6.2",
"node-fetch": "^3",
"pg": "^8.6.0",
"negotiator": "^0.6.3",
"node-fetch": "^3.2.10",
"pg": "^8.8.0",
"pluralize": "^8.0.0",
"pug": "^3.0.2",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"sqlite": "^4.1.2",
"sqlite3": "^5.1.1",
"ssh2": "^1.1.0",
"ts-node": "^9.1.1",
"typedoc": "^0.20.36",
"ssh2": "^1.11.0",
"ts-node": "^10.9.1",
"typedoc": "^0.23.15",
"typedoc-plugin-pages-fork": "^0.0.1",
"typedoc-plugin-sourcefile-url": "^1.0.6",
"typescript": "^4.7.4",
"typescript": "^4.8.4",
"uuid": "^8.3.2",
"ws": "^8.8.0",
"ws": "^8.9.0",
"zod": "^3.11.6"
},
"scripts": {
@ -76,14 +76,14 @@
"author": "garrettmills <shout@garrettmills.dev>",
"license": "MIT",
"devDependencies": {
"@types/chai": "^4.2.22",
"@types/chai": "^4.3.3",
"@types/mocha": "^9.0.0",
"@types/sinon": "^10.0.6",
"@types/sinon": "^10.0.13",
"@types/wtfnode": "^0.7.0",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"chai": "^4.3.4",
"eslint": "^7.27.0",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"chai": "^4.3.6",
"eslint": "^8.24.0",
"mocha": "^9.1.3",
"sinon": "^12.0.1",
"wtfnode": "^0.9.1"

File diff suppressed because it is too large Load Diff

@ -1,7 +1,7 @@
import {Directive, OptionDefinition} from '../Directive'
import * as colors from 'colors/safe'
import * as repl from 'repl'
import * as tsNode from 'ts-node'
// import * as tsNode from 'ts-node'
import {globalRegistry} from '../../util'
/**

@ -147,7 +147,7 @@ export class Container {
* Collection of callbacks waiting for a dependency key to be resolved.
* @protected
*/
protected waitingResolveCallbacks: Collection<{ key: DependencyKey, callback: (t: unknown) => unknown }> = new Collection<{key: DependencyKey; callback:(t: unknown) => unknown}>();
protected waitingResolveCallbacks: Collection<{ key: DependencyKey, callback: (t: unknown) => unknown }> = new Collection<{key: DependencyKey; callback:(t: unknown) => unknown}>()
/**
* Collection of created objects that should have lifecycle events called on them, if they still exist.

@ -41,7 +41,7 @@ export interface ModuleRegistrationFluency {
@Singleton()
export class HTTPKernel extends AppClass {
@Inject()
protected readonly logging!: Logging;
protected readonly logging!: Logging
/**
* Collection of preflight modules to apply.

@ -12,7 +12,7 @@ export class PoweredByHeaderInjectionHTTPModule extends HTTPKernelModule {
public readonly executeWithBlockingWriteback = true
@Inject()
protected readonly config!: Config;
protected readonly config!: Config
public static register(kernel: HTTPKernel): void {
kernel.register(this).after()

@ -13,7 +13,7 @@ import {ActivatedRoute} from '../routing/ActivatedRoute'
* Enumeration of different HTTP verbs.
* @todo add others?
*/
export type HTTPMethod = 'post' | 'get' | 'patch' | 'put' | 'delete' | 'unknown';
export type HTTPMethod = 'post' | 'get' | 'patch' | 'put' | 'delete' | 'unknown'
/**
* Returns true if the given item is a valid HTTP verb.
@ -36,9 +36,9 @@ export interface HTTPProtocol {
* Interface that describes the origin IP address of a request.
*/
export interface HTTPSourceAddress {
address: string;
family: 'IPv4' | 'IPv6';
port: number;
address: string
family: 'IPv4' | 'IPv6'
port: number
}
/**
@ -55,43 +55,43 @@ export interface DataContainer {
export class Request extends ScopedContainer implements DataContainer {
/** The cookie manager for the request. */
public readonly cookies: HTTPCookieJar;
public readonly cookies: HTTPCookieJar
/** The URL suffix of the request. */
public readonly url: string;
public readonly url: string
/** The fully-qualified URL of the request. */
public readonly fullUrl: string;
public readonly fullUrl: string
/** The HTTP verb of the request. */
public readonly method: HTTPMethod;
public readonly method: HTTPMethod
/** True if the request was made via TLS. */
public readonly secure: boolean;
public readonly secure: boolean
/** The request HTTP protocol version. */
public readonly protocol: HTTPProtocol;
public readonly protocol: HTTPProtocol
/** The URL path, stripped of query params. */
public readonly path: string;
public readonly path: string
/** The raw parsed query data from the request. */
public readonly rawQueryData: {[key: string]: string | string[] | undefined};
public readonly rawQueryData: {[key: string]: string | string[] | undefined}
/** The inferred query data. */
public readonly query: {[key: string]: any};
public readonly query: {[key: string]: any}
/** True if the request was made via XMLHttpRequest. */
public readonly isXHR: boolean;
public readonly isXHR: boolean
/** The origin IP address of the request. */
public readonly address: HTTPSourceAddress;
public readonly address: HTTPSourceAddress
/** The associated response. */
public readonly response: Response;
public readonly response: Response
/** The media types accepted by the client. */
public readonly mediaTypes: string[];
public readonly mediaTypes: string[]
/** Input parsed from the request */
public readonly parsedInput: {[key: string]: any} = {}

@ -45,7 +45,7 @@ export class SocketRouteBuilder {
* @param key
* @param selector
*/
connected<TKey extends any>(
connected<TKey>(
key: TypedDependencyKey<TKey>,
selector: (x: TKey) => (ws: WebSocketBus) => Awaitable<void>,
): this {
@ -68,7 +68,7 @@ export class SocketRouteBuilder {
* @param key
* @param selector
*/
event<TState extends JSONState, TKey extends any>(
event<TState extends JSONState, TKey>(
eventClass: Instantiable<StateEvent<TState>>,
key: TypedDependencyKey<TKey>,
selector: (x: TKey) => (state: TState) => Awaitable<void>,

@ -1,4 +1,4 @@
import {Container, Inject, Injectable} from '../../di'
import {Inject, Injectable} from '../../di'
import {Migrator} from './Migrator'
import {DatabaseService} from '../DatabaseService'
import {FieldType} from '../types'
@ -14,9 +14,6 @@ export class DatabaseMigrator extends Migrator {
@Inject()
protected readonly db!: DatabaseService
@Inject('injector')
protected readonly injector!: Container
/** True if we've initialized the migrator. */
protected initialized = false

@ -1,11 +1,10 @@
import {ModelKey, QueryRow, QuerySource} from '../types'
import {Container, Inject, Instantiable, isInstantiable} from '../../di'
import {Container, Instantiable, isInstantiable} from '../../di'
import {DatabaseService} from '../DatabaseService'
import {ModelBuilder} from './ModelBuilder'
import {getFieldsMeta, ModelField} from './Field'
import {deepCopy, Collection, uuid4, isKeyof, Pipeline, hasOwnProperty} from '../../util'
import {EscapeValueObject, QuerySafeValue} from '../dialect/SQLDialect'
import {Logging} from '../../service/Logging'
import {Connection} from '../connection/Connection'
import {ModelRetrievedEvent} from './events/ModelRetrievedEvent'
import {ModelSavingEvent} from './events/ModelSavingEvent'
@ -26,9 +25,6 @@ import {ModelEvent} from './events/ModelEvent'
* Base for classes that are mapped to tables in a database.
*/
export abstract class Model<T extends Model<T>> extends LocalBus<ModelEvent<T>> {
@Inject()
protected readonly logging!: Logging
/**
* The name of the connection this model should run through.
* @type string

@ -8,18 +8,18 @@ import {ModelBuilder} from '../model/ModelBuilder'
* A model instance which stores records from the ORMCache driver.
*/
export class CacheModel extends Model<CacheModel> {
protected static table = 'caches'; // FIXME allow configuring
protected static table = 'caches' // FIXME allow configuring
protected static key = 'cache_key';
protected static key = 'cache_key'
@Field(FieldType.varchar, 'cache_key')
public cacheKey!: string;
public cacheKey!: string
@Field(FieldType.text, 'cache_value')
public cacheValue!: string;
public cacheValue!: string
@Field(FieldType.timestamp, 'cache_expires')
public cacheExpires?: Date;
public cacheExpires?: Date
public static withCacheKey(key: string): ModelBuilder<CacheModel> {
return this.query<CacheModel>()

@ -35,7 +35,7 @@ export class ORMSession extends Session {
this.data = this.session.json
} else {
this.session = <SessionModel> Container.getContainer().make(SessionModel)
this.session.uuid = this.key
this.session.sessionUuid = this.key
this.data = {} as SessionData
}
}
@ -48,7 +48,7 @@ export class ORMSession extends Session {
throw new SessionNotLoadedError()
}
this.session.uuid = this.key
this.session.sessionUuid = this.key
this.session.json = JSON.stringify(this.data)
await this.session.save()
}

@ -13,8 +13,8 @@ export class SessionModel extends Model<SessionModel> {
protected static populateKeyOnInsert = true
@Field(FieldType.varchar, 'session_uuid')
public uuid!: string;
public sessionUuid!: string
@Field(FieldType.json, 'session_data')
public json!: any;
public json!: any
}

@ -1,15 +1,11 @@
import {Singleton, Inject} from '../di'
import {Singleton} from '../di'
import {CanonicalRecursive} from './CanonicalRecursive'
import {Logging} from './Logging'
/**
* Canonical unit that loads configuration files from `app/configs`.
*/
@Singleton()
export class Config extends CanonicalRecursive {
@Inject()
protected readonly logging!: Logging
protected appPath: string[] = ['configs']
protected suffix = '.config'

@ -26,7 +26,7 @@ export interface BusInternalSubscription {
*/
@Singleton()
export class Bus<TEvent extends Event = Event> extends Unit implements EventBus<TEvent>, AwareOfContainerLifecycle {
awareOfContainerLifecycle: true = true
awareOfContainerLifecycle = true as const
@Inject()
protected readonly logging!: Logging

@ -11,7 +11,7 @@ import {CanonicalItemClass} from '../CanonicalReceiver'
*/
@Injectable()
export class LocalBus<TEvent extends Event = Event> extends CanonicalItemClass implements EventBus<TEvent>, AwareOfContainerLifecycle {
awareOfContainerLifecycle: true = true
awareOfContainerLifecycle = true as const
@Inject()
protected readonly logging!: Logging

@ -12,7 +12,7 @@ import {getEventName} from './getEventName'
*/
@Injectable()
export class RedisBus implements EventBus, AwareOfContainerLifecycle {
awareOfContainerLifecycle: true = true
awareOfContainerLifecycle = true as const
@Inject()
protected readonly redis!: Redis

@ -100,7 +100,7 @@ export class StateEventSerializer extends BaseSerializer<StateEvent<JSONState>,
protected readonly injector!: Container
/** The StateEvent implementation. */
public readonly eventClass: Instantiable<StateEvent<JSONState>>;
public readonly eventClass: Instantiable<StateEvent<JSONState>>
constructor(
eventClass: Instantiable<StateEvent<JSONState>>,

@ -23,7 +23,7 @@ import {Request} from '../../http/lifecycle/Request'
@Injectable()
export class WebSocketBus implements EventBus, AwareOfContainerLifecycle {
awareOfContainerLifecycle: true = true
awareOfContainerLifecycle = true as const
/**
* If true, the session will be loaded when an event is received and

@ -45,7 +45,7 @@ export function deepCopy<T>(target: T): T {
return copy.map((item: any) => deepCopy<any>(item)) as any
}
if ( typeof target === 'object' && target !== {} ) {
if ( typeof target === 'object' ) {
const copy = { ...(target as {[key: string]: any }) } as { [key: string]: any }
Object.keys(copy).forEach(key => {
copy[key] = deepCopy<any>(copy[key])

@ -5,6 +5,7 @@ import * as fs from 'fs'
import {Readable, Writable} from 'stream'
import {Collection} from '../../collection/Collection'
import {UniversalPath} from '../path'
import {Maybe} from '../types'
/**
* A Filesystem implementation that stores files on remote hosts via SFTP/SSH.
@ -190,7 +191,7 @@ export class SSHFilesystem extends Filesystem {
const sftp = await this.getSFTP()
const metaPath = this.metadataPath(storePath)
await new Promise<void>((res, rej) => {
sftp.writeFile(metaPath, JSON.stringify(meta), err => {
sftp.writeFile(metaPath, JSON.stringify(meta), (err: Maybe<Error>) => {
if ( err ) {
rej(err)
} else {

@ -7,6 +7,7 @@
"strict": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipLibCheck": true,
"lib": ["ESNext"]
},
"include": ["src"],

Loading…
Cancel
Save