Comparing version 1.4.0 to 1.4.2
{ | ||
"name": "pg-mem", | ||
"version": "1.4.0", | ||
"version": "1.4.2", | ||
"description": "A memory version of postgres", | ||
@@ -47,3 +47,3 @@ "main": "index.js", | ||
"object-hash": "^2.0.3", | ||
"pgsql-ast-parser": "^1.3.5" | ||
"pgsql-ast-parser": "^1.3.7" | ||
}, | ||
@@ -62,2 +62,3 @@ "devDependencies": { | ||
"@types/react": "^16.9.43", | ||
"@types/uuid": "^8.3.0", | ||
"babel": "^6.23.0", | ||
@@ -93,4 +94,5 @@ "babel-loader": "^8.1.0", | ||
"ts-node": "^8.10.2", | ||
"typeorm": "^0.2.25", | ||
"typeorm": "^0.2.29", | ||
"typescript": "^3.9.6", | ||
"uuid": "^8.3.2", | ||
"vscode-mocha-hmr": "^1.0.0", | ||
@@ -97,0 +99,0 @@ "webpack": "^4.43.0", |
@@ -14,2 +14,3 @@ > `pg-mem` is an experimental in-memory emulation of a postgres database. | ||
* [Inspection](#inspection) | ||
* [FAQ](#-faq) | ||
* [Supported features](#-supported-features) | ||
@@ -188,4 +189,4 @@ * [Development](#-development) | ||
- [How to import my production schema in pg-mem ?](https://github.com/oguimbal/pg-mem/wiki/FAQ#-how-to-import-my-production-schema-in-pg-mem-) _TLDR: pg\_dump with the right args_ | ||
- [Does pg-mem support sql migrations ?](https://github.com/oguimbal/pg-mem/wiki/FAQ#-does-pg-mem-support-sql-migrations-scripts-) _TLDR: yes._ | ||
Detailed answers [in the wiki](https://github.com/oguimbal/pg-mem/wiki/FAQ) | ||
@@ -192,0 +193,0 @@ |
@@ -47,2 +47,14 @@ import { IValue, _IType, RegClass } from './interfaces-private'; | ||
export declare function isInteger(t: IType): boolean; | ||
declare class TextType extends TypeBase<string> { | ||
readonly len: number | null; | ||
private citext?; | ||
get regTypeName(): string; | ||
get primary(): DataType; | ||
constructor(len: number | null, citext?: boolean | undefined); | ||
doPrefer(to: _IType): _IType<any> | null; | ||
doCanConvertImplicit(to: _IType): boolean; | ||
doCanCast(to: _IType): boolean | nil; | ||
doCast(value: Evaluator<string>, to: _IType): Evaluator<string> | undefined; | ||
doEquals(a: string, b: string): boolean; | ||
} | ||
export declare class ArrayType extends TypeBase<any[]> { | ||
@@ -64,2 +76,3 @@ readonly of: _IType; | ||
text: (len?: number | nil) => _IType<any>; | ||
citext: TextType; | ||
timestamp: _IType<any>; | ||
@@ -66,0 +79,0 @@ uuid: _IType<any>; |
@@ -285,3 +285,9 @@ import { IMemoryDb, IMemoryTable, DataType, IType, TableEvent, GlobalEvent, ISchema, SchemaField, MemoryDbOptions, nil, Schema, ISubscription } from './interfaces'; | ||
onIndex(sub: IndexHandler): ISubscription; | ||
onTruncate(sub: DropHandler): ISubscription; | ||
truncate(t: _Transaction): void; | ||
} | ||
export interface _IConstraint { | ||
readonly name: string; | ||
uninstall(t: _Transaction): void; | ||
} | ||
export declare type ChangeHandler<T> = (old: T | null, neu: T | null, t: _Transaction) => void; | ||
@@ -288,0 +294,0 @@ export interface _Column { |
@@ -0,1 +1,2 @@ | ||
import { IMigrate } from './migrate/migrate-interfaces'; | ||
import { TableConstraint, CreateColumnDef, StatementLocation } from 'pgsql-ast-parser'; | ||
@@ -20,2 +21,3 @@ export declare type nil = undefined | null; | ||
text = "text", | ||
citext = "citext", | ||
array = "array", | ||
@@ -39,2 +41,7 @@ long = "long", | ||
/** | ||
* If set to true, pg-mem will stop embbeding info about the SQL statement | ||
* that has failed in exception messages. | ||
*/ | ||
noErrorDiagnostic?: boolean; | ||
/** | ||
* If set to true, then the query runner will not check that no AST part | ||
@@ -155,2 +162,7 @@ * has been left behind when parsing the request. | ||
registerFunction(fn: FunctionDefinition): this; | ||
/** | ||
* Database migration, node-sqlite flavor | ||
* ⚠ Only working when runnin nodejs ! | ||
*/ | ||
migrate(config?: IMigrate.MigrationParams): Promise<void>; | ||
} | ||
@@ -202,26 +214,34 @@ export interface FunctionDefinition { | ||
} | ||
export declare class CastError extends Error { | ||
export declare class NotSupported extends Error { | ||
constructor(what?: string); | ||
static never(value: never, msg?: string): NotSupported; | ||
} | ||
interface ErrorData { | ||
readonly error: string; | ||
readonly details?: string; | ||
readonly hint?: string; | ||
} | ||
export declare class QueryError extends Error { | ||
readonly data: ErrorData; | ||
constructor(err: string | ErrorData); | ||
} | ||
export declare class CastError extends QueryError { | ||
constructor(from: DataType, to: DataType, inWhat?: string); | ||
} | ||
export declare class ColumnNotFound extends Error { | ||
export declare class ColumnNotFound extends QueryError { | ||
constructor(columnName: string); | ||
} | ||
export declare class AmbiguousColumn extends Error { | ||
export declare class AmbiguousColumn extends QueryError { | ||
constructor(columnName: string); | ||
} | ||
export declare class RelationNotFound extends Error { | ||
export declare class RelationNotFound extends QueryError { | ||
constructor(tableName: string); | ||
} | ||
export declare class QueryError extends Error { | ||
} | ||
export declare class RecordExists extends Error { | ||
export declare class RecordExists extends QueryError { | ||
constructor(); | ||
} | ||
export declare class NotSupported extends Error { | ||
export declare class PermissionDeniedError extends QueryError { | ||
constructor(what?: string); | ||
static never(value: never, msg?: string): NotSupported; | ||
} | ||
export declare class PermissionDeniedError extends Error { | ||
constructor(what?: string); | ||
} | ||
export {}; | ||
//# sourceMappingURL=interfaces.d.ts.map |
import { ISchema, Schema, QueryResult, FunctionDefinition } from './interfaces'; | ||
import { _IDb, _ISelection, _ISchema, _Transaction, _ITable, _SelectExplanation, _FunctionDefinition, _IRelation, QueryObjOpts, RegClass, Reg } from './interfaces-private'; | ||
import { CreateTableStatement, SelectStatement, InsertStatement, CreateIndexStatement, UpdateStatement, AlterTableStatement, DeleteStatement, CreateExtensionStatement, CreateSequenceStatement, AlterSequenceStatement, QName, DropIndexStatement, DropTableStatement, DropSequenceStatement } from 'pgsql-ast-parser'; | ||
import { CreateTableStatement, SelectStatement, InsertStatement, CreateIndexStatement, UpdateStatement, AlterTableStatement, DeleteStatement, CreateExtensionStatement, CreateSequenceStatement, AlterSequenceStatement, QName, DropIndexStatement, DropTableStatement, DropSequenceStatement, TruncateTableStatement } from 'pgsql-ast-parser'; | ||
import { MemoryTable } from './table'; | ||
import { IMigrate } from './migrate/migrate-interfaces'; | ||
export declare class DbSchema implements _ISchema, ISchema { | ||
@@ -50,2 +51,3 @@ readonly name: string; | ||
executeDelete(t: _Transaction, p: DeleteStatement): QueryResult; | ||
executeTruncateTable(t: _Transaction, p: TruncateTableStatement): QueryResult; | ||
buildSelect(p: SelectStatement): _ISelection; | ||
@@ -65,3 +67,4 @@ executeUpdate(t: _Transaction, p: UpdateStatement): QueryResult; | ||
getFunctions(name: string, arrity: number, forceOwn?: boolean): Iterable<_FunctionDefinition>; | ||
migrate(config?: IMigrate.MigrationParams): Promise<void>; | ||
} | ||
//# sourceMappingURL=schema.d.ts.map |
@@ -36,2 +36,3 @@ import { _ITable, _ISelection, _ISchema, _Transaction, _IIndex, IValue, _Column, SchemaField, IndexDef, _Explainer, _SelectExplanation, ChangeHandler, Stats, DropHandler, IndexHandler, Reg } from '../interfaces-private'; | ||
delete(t: _Transaction, toDelete: T): void; | ||
truncate(t: _Transaction): void; | ||
createIndex(): this; | ||
@@ -47,2 +48,3 @@ dropIndex(t: _Transaction, name: string): void; | ||
}; | ||
onTruncate(sub: DropHandler): ISubscription; | ||
onDrop(sub: DropHandler): ISubscription; | ||
@@ -49,0 +51,0 @@ onIndex(sub: IndexHandler): ISubscription; |
@@ -26,2 +26,3 @@ import { IMemoryTable, Schema, TableEvent, IndexDef, ISubscription, nil } from './interfaces'; | ||
private changeHandlers; | ||
private truncateHandlers; | ||
private drophandlers; | ||
@@ -53,2 +54,3 @@ private indexHandlers; | ||
delete(t: _Transaction, toDelete: T): T; | ||
truncate(t: _Transaction): void; | ||
private indexElt; | ||
@@ -61,6 +63,7 @@ hasItem(item: T, t: _Transaction): boolean; | ||
createIndex(t: _Transaction, expressions: string[], type: 'primary' | 'unique', indexName?: string): this; | ||
private determineIndexRelName; | ||
dropIndex(t: _Transaction, uName: string): void; | ||
onIndex(sub: IndexHandler): ISubscription; | ||
listIndices(): IndexDef[]; | ||
addForeignKey(cst: TableConstraintForeignKey, t: _Transaction, constraintName?: string): void; | ||
addForeignKey(cst: TableConstraintForeignKey, t: _Transaction, constraintName: string | nil): this; | ||
addConstraint(cst: TableConstraint, t: _Transaction): void | this; | ||
@@ -70,4 +73,5 @@ onChange(columns: string[], check: ChangeHandler<T>): ISubscription; | ||
onDrop(sub: DropHandler): ISubscription; | ||
onTruncate(sub: DropHandler): ISubscription; | ||
} | ||
export {}; | ||
//# sourceMappingURL=table.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { _ISchema, _Transaction } from './interfaces-private'; | ||
import { IValue, _ISchema, _Transaction } from './interfaces-private'; | ||
import { Expr } from 'pgsql-ast-parser'; | ||
@@ -36,3 +36,4 @@ import { ISubscription } from './interfaces'; | ||
export declare function pushContext<T>(ctx: Ctx, act: () => T): T; | ||
export declare function indexHash(this: void, vals: (IValue | string)[]): string; | ||
export {}; | ||
//# sourceMappingURL=utils.d.ts.map |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1032025
67
10884
231
50
2
Updatedpgsql-ast-parser@^1.3.7