typescript common lib

This commit is contained in:
Jan Prochazka
2020-02-01 19:57:07 +01:00
parent 8291885d56
commit d22058382f
15 changed files with 3434 additions and 94 deletions

1
lib/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
lib

17
lib/package.json Normal file
View File

@@ -0,0 +1,17 @@
{
"version": "0.1.0",
"name": "@dbgate/lib",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"scripts": {
"prepare": "yarn build",
"build": "tsc"
},
"files": [
"lib"
],
"devDependencies": {
"@types/node": "^13.7.0",
"typescript": "^3.7.5"
}
}

36
lib/src/index.ts Normal file
View File

@@ -0,0 +1,36 @@
import { ChildProcess } from "child_process";
export interface QueryResult {
rows: any[];
}
export interface EngineDriver {
connect({ server, port, user, password });
query(pool, sql: string): Promise<QueryResult>;
getVersion(pool): Promise<string>;
listDatabases(pool): Promise<{ name: string }[]>;
analyseFull(pool): Promise<void>;
analyseIncremental(pool): Promise<void>;
}
export interface NamedObjectInfo {
pureName: string;
schemaName: string;
}
export interface TableInfo extends NamedObjectInfo {}
export interface DatabaseInfo {
tables: TableInfo[];
}
export interface OpenedDatabaseConnection {
conid: string;
database: string;
structure: DatabaseInfo;
subprocess: ChildProcess;
}
export function sum(a: number, b: number) {
return a + b;
}

11
lib/tsconfig.json Normal file
View File

@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "ES2015",
"module": "commonjs",
"declaration": true,
"outDir": "lib"
},
"include": [
"src/**/*"
]
}

13
lib/yarn.lock Normal file
View File

@@ -0,0 +1,13 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@types/node@^13.7.0":
version "13.7.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.0.tgz#b417deda18cf8400f278733499ad5547ed1abec4"
integrity sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ==
typescript@^3.7.5:
version "3.7.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae"
integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==