Comparing version 0.3.0 to 0.3.1
@@ -5,41 +5,42 @@ /// <reference types="node" /> | ||
export declare type Options = { | ||
/** | ||
* Filename or output stream where the type definitions needs to be written. | ||
*/ | ||
output: Writable | string; | ||
/** | ||
* Name overrides for enums, classes, and fields. | ||
* | ||
* @example | ||
* overrides: { | ||
* "identity_provider.linkedin": "LinkedIn" | ||
* } | ||
*/ | ||
overrides?: Record<string, string>; | ||
prefix?: string; | ||
/** | ||
* Schemas that should be included/excluded when generating types. | ||
* | ||
* By default if this is null/not specified, "public" will be the only schema added, but if this property | ||
* is specified, public will be excluded by default and has to be included in the list to be added to the output. | ||
* If a schema is added by its name, i.e. 'log' all tables from that schema will be added. | ||
* If a schema name is added with an exclamation mark it will be ignored, i.e. "!log". | ||
* | ||
* The table-type will be prefixed by its schema name, the table log.message will become LogMessage. | ||
* | ||
* @example | ||
* // This will include "public" and "log", but exclude the "auth" schema. | ||
* schema: ["public", "log", "!auth"] | ||
* @default | ||
* "public" | ||
*/ | ||
schema?: string[] | string; | ||
/** | ||
* A comma separated list or an array of tables that should be excluded when | ||
* generating types. | ||
* | ||
* @example | ||
* exclude: ["migration", "migration_lock"] | ||
*/ | ||
exclude?: string[] | string; | ||
/** | ||
* Filename or output stream where the type definitions needs to be written. | ||
*/ | ||
output: Writable | string; | ||
/** | ||
* Name overrides for enums, classes, and fields. | ||
* | ||
* @example | ||
* overrides: { | ||
* "identity_provider.linkedin": "LinkedIn" | ||
* } | ||
*/ | ||
overrides?: Record<string, string>; | ||
prefix?: string; | ||
suffix?: string; | ||
/** | ||
* Schemas that should be included/excluded when generating types. | ||
* | ||
* By default if this is null/not specified, "public" will be the only schema added, but if this property | ||
* is specified, public will be excluded by default and has to be included in the list to be added to the output. | ||
* If a schema is added by its name, i.e. 'log' all tables from that schema will be added. | ||
* If a schema name is added with an exclamation mark it will be ignored, i.e. "!log". | ||
* | ||
* The table-type will be prefixed by its schema name, the table log.message will become LogMessage. | ||
* | ||
* @example | ||
* // This will include "public" and "log", but exclude the "auth" schema. | ||
* schema: ["public", "log", "!auth"] | ||
* @default | ||
* "public" | ||
*/ | ||
schema?: string[] | string; | ||
/** | ||
* A comma separated list or an array of tables that should be excluded when | ||
* generating types. | ||
* | ||
* @example | ||
* exclude: ["migration", "migration_lock"] | ||
*/ | ||
exclude?: string[] | string; | ||
}; | ||
@@ -50,2 +51,6 @@ /** | ||
export declare function updateTypes(db: Knex, options: Options): Promise<void>; | ||
export declare function getType(udt: string, customTypes: Map<string, string>, defaultValue: string | null): string; | ||
export declare function getType( | ||
udt: string, | ||
customTypes: Map<string, string>, | ||
defaultValue: string | null | ||
): string; |
@@ -108,2 +108,7 @@ "use strict"; | ||
}); | ||
if (options.suffix) { | ||
output.write(options.suffix); | ||
output.write("\n"); | ||
} | ||
} finally { | ||
@@ -110,0 +115,0 @@ output.end(); |
{ | ||
"name": "knex-types", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Generates TypeScript definitions (types) from a (PostgreSQL) database schema.", | ||
@@ -39,7 +39,7 @@ "keywords": [ | ||
"test": "jest", | ||
"build": "babel --env-name production -x \".ts\" --out-dir . \"*.ts\" && tsc && rm *.test.d.ts" | ||
"build": "babel --env-name production -x \".ts\" --out-dir . \"*.ts\" && tsc && rm *.test.d.ts && prettier --write ." | ||
}, | ||
"dependencies": { | ||
"lodash": "^4.17.21", | ||
"pg": "^8.6.0" | ||
"pg": "^8.7.1" | ||
}, | ||
@@ -50,20 +50,19 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/cli": "^7.13.14", | ||
"@babel/core": "^7.13.15", | ||
"@babel/plugin-proposal-class-properties": "^7.13.0", | ||
"@babel/preset-env": "^7.13.15", | ||
"@babel/preset-typescript": "^7.13.0", | ||
"@types/jest": "^26.0.22", | ||
"@types/lodash": "^4", | ||
"@types/node": "^14.14.37", | ||
"@typescript-eslint/eslint-plugin": "^4.22.0", | ||
"@typescript-eslint/parser": "^4.22.0", | ||
"@yarnpkg/pnpify": "^3.0.0-rc.3", | ||
"@babel/cli": "^7.14.8", | ||
"@babel/core": "^7.15.0", | ||
"@babel/plugin-proposal-class-properties": "^7.14.5", | ||
"@babel/preset-env": "^7.15.0", | ||
"@babel/preset-typescript": "^7.15.0", | ||
"@types/jest": "^27.0.1", | ||
"@types/lodash": "^4.14.172", | ||
"@types/node": "^16.7.10", | ||
"@typescript-eslint/eslint-plugin": "^4.30.0", | ||
"@typescript-eslint/parser": "^4.30.0", | ||
"babel-plugin-import": "^1.13.3", | ||
"eslint": "^7.24.0", | ||
"eslint-config-prettier": "^8.2.0", | ||
"jest": "^26.6.3", | ||
"knex": "^0.95.4", | ||
"prettier": "^2.2.1", | ||
"typescript": "^4.2.4" | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"jest": "^27.1.0", | ||
"knex": "^0.95.10", | ||
"prettier": "^2.3.2", | ||
"typescript": "^4.4.2" | ||
}, | ||
@@ -70,0 +69,0 @@ "jest": { |
13524
17
196
Updatedpg@^8.7.1