diff --git a/jest.config.js b/jest.config.js index 170133e..97292b4 100755 --- a/jest.config.js +++ b/jest.config.js @@ -2,14 +2,12 @@ module.exports = { preset: 'ts-jest', collectCoverageFrom: [ 'src/**/*.ts', - '!src/vendor-typings/**' ], testResultsProcessor: './node_modules/jest-junit-reporter', testEnvironment: 'node', testPathIgnorePatterns: [ '/build', '/node_modules/', - '/vendor-typings' ], coverageThreshold: { global: { diff --git a/package-lock.json b/package-lock.json index 1a0c227..040afc8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,12 +8,14 @@ "name": "sqlite", "version": "5.0.1", "license": "MIT", + "dependencies": { + "@types/sqlite3": "^3.1.8" + }, "devDependencies": { "@theo.gravity/changelog-version": "2.1.11", "@theo.gravity/version-bump": "2.0.14", "@types/jest": "27.4.1", "@types/node": "^17.0.25", - "@types/sqlite3": "^3.1.8", "@typescript-eslint/eslint-plugin": "^5.20.0", "@typescript-eslint/parser": "^5.20.0", "eslint": "8.14.0", @@ -1600,7 +1602,6 @@ "version": "3.1.8", "resolved": "https://registry.npmjs.org/@types/sqlite3/-/sqlite3-3.1.8.tgz", "integrity": "sha512-sQMt/qnyUWnqiTcJXm5ZfNPIBeJ/DVvJDwxw+0tAxPJvadzfiP1QhryO1JOR6t1yfb8NpzQb/Rud06mob5laIA==", - "dev": true, "dependencies": { "@types/node": "*" } @@ -13324,8 +13325,7 @@ "@types/node": { "version": "17.0.25", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.25.tgz", - "integrity": "sha512-wANk6fBrUwdpY4isjWrKTufkrXdu1D2YHCot2fD/DfWxF5sMrVSA+KN7ydckvaTCh0HiqX9IVl0L5/ZoXg5M7w==", - "dev": true + "integrity": "sha512-wANk6fBrUwdpY4isjWrKTufkrXdu1D2YHCot2fD/DfWxF5sMrVSA+KN7ydckvaTCh0HiqX9IVl0L5/ZoXg5M7w==" }, "@types/prettier": { "version": "2.4.4", @@ -13343,7 +13343,6 @@ "version": "3.1.8", "resolved": "https://registry.npmjs.org/@types/sqlite3/-/sqlite3-3.1.8.tgz", "integrity": "sha512-sQMt/qnyUWnqiTcJXm5ZfNPIBeJ/DVvJDwxw+0tAxPJvadzfiP1QhryO1JOR6t1yfb8NpzQb/Rud06mob5laIA==", - "dev": true, "requires": { "@types/node": "*" } diff --git a/package.json b/package.json index 3dd1a06..640d64e 100755 --- a/package.json +++ b/package.json @@ -11,9 +11,9 @@ "import": "./build/index.mjs" }, "scripts": { - "build": "npm run build:clean && npm run compile && cp -R src/index.mjs src/vendor-typings build", + "build": "npm run build:clean && npm run compile && cp -R src/index.mjs build", "build:docs": "typedoc --options typedoc.js --plugin typedoc-plugin-markdown src/ --out docs", - "build:clean": "rm -rf build/*", + "build:clean": "rm -rf 'build/*'", "compile": "tsc", "debug": "ts-node-dev --inspect -- src/index.ts", "debug:break": "ts-node-dev --inspect-brk -- src/index.ts", @@ -25,6 +25,7 @@ "toc": "toc-md README.md README.md", "lint-staged": "lint-staged", "prepare-publish": "npm run changelog:prepare && version-bump && npm run changelog:release && npm run changelog:stamp", + "prepare": "npm run build", "add-readme": "git add README.md", "version-bump": "version-bump", "changelog:help": "changelog-version", @@ -70,12 +71,14 @@ "url": "https://github.com/kriasoft/node-sqlite/issues" }, "homepage": "https://github.com/kriasoft/node-sqlite#readme", + "dependencies": { + "@types/sqlite3": "^3.1.8" + }, "devDependencies": { "@theo.gravity/changelog-version": "2.1.11", "@theo.gravity/version-bump": "2.0.14", "@types/jest": "27.4.1", "@types/node": "^17.0.25", - "@types/sqlite3": "^3.1.8", "@typescript-eslint/eslint-plugin": "^5.20.0", "@typescript-eslint/parser": "^5.20.0", "eslint": "8.14.0", diff --git a/src/index.ts b/src/index.ts index be5b5a5..d2b6700 100755 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,3 @@ -/// - import * as sqlite3 from 'sqlite3' import { Statement } from './Statement' import { Database } from './Database' diff --git a/src/interfaces.ts b/src/interfaces.ts index 7b3635e..642c8f1 100755 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -1,5 +1,3 @@ -/// - import * as sqlite3 from 'sqlite3' import { Statement } from './Statement' diff --git a/src/vendor-typings/sqlite3/index.d.ts b/src/vendor-typings/sqlite3/index.d.ts deleted file mode 100644 index 7978d45..0000000 --- a/src/vendor-typings/sqlite3/index.d.ts +++ /dev/null @@ -1,280 +0,0 @@ -// Type definitions for sqlite3 -// Project: http://github.com/tryghost/node-sqlite3 - -/// - -import events = require('events') - -export const OPEN_READONLY: number -export const OPEN_READWRITE: number -export const OPEN_CREATE: number -export const OPEN_FULLMUTEX: number -export const OPEN_SHAREDCACHE: number -export const OPEN_PRIVATECACHE: number -export const OPEN_URI: number - -export const VERSION: string -export const SOURCE_ID: string -export const VERSION_NUMBER: number - -export const OK: number -export const ERROR: number -export const INTERNAL: number -export const PERM: number -export const ABORT: number -export const BUSY: number -export const LOCKED: number -export const NOMEM: number -export const READONLY: number -export const INTERRUPT: number -export const IOERR: number -export const CORRUPT: number -export const NOTFOUND: number -export const FULL: number -export const CANTOPEN: number -export const PROTOCOL: number -export const EMPTY: number -export const SCHEMA: number -export const TOOBIG: number -export const CONSTRAINT: number -export const MISMATCH: number -export const MISUSE: number -export const NOLFS: number -export const AUTH: number -export const FORMAT: number -export const RANGE: number -export const NOTADB: number - -export const LIMIT_LENGTH: number -export const LIMIT_SQL_LENGTH: number -export const LIMIT_COLUMN: number -export const LIMIT_EXPR_DEPTH: number -export const LIMIT_COMPOUND_SELECT: number -export const LIMIT_VDBE_OP: number -export const LIMIT_FUNCTION_ARG: number -export const LIMIT_ATTACHED: number -export const LIMIT_LIKE_PATTERN_LENGTH: number -export const LIMIT_VARIABLE_NUMBER: number -export const LIMIT_TRIGGER_DEPTH: number -export const LIMIT_WORKER_THREADS: number - -export const cached: { - Database( - filename: string, - callback?: (this: Database, err: Error | null) => void - ): Database - Database( - filename: string, - mode?: number, - callback?: (this: Database, err: Error | null) => void - ): Database -} - -export interface RunResult extends Statement { - lastID: number - changes: number -} - -export class Statement extends events.EventEmitter { - bind (callback?: (err: Error | null) => void): this - bind (...params: any[]): this - - reset (callback?: (err: null) => void): this - - finalize (callback?: (err: Error) => void): Database - - run (callback?: (err: Error | null) => void): this - run ( - params: any, - callback?: (this: RunResult, err: Error | null) => void - ): this - run (...params: any[]): this - - get (callback?: (err: Error | null, row?: T) => void): this - get ( - params: any, - callback?: (this: RunResult, err: Error | null, row?: T) => void - ): this - get (...params: any[]): this - - all (callback?: (err: Error | null, rows: T[]) => void): this - all ( - params: any, - callback?: (this: RunResult, err: Error | null, rows: T[]) => void - ): this - all (...params: any[]): this - - each ( - callback?: (err: Error | null, row: T) => void, - complete?: (err: Error | null, count: number) => void - ): this - each ( - params: any, - callback?: (this: RunResult, err: Error | null, row: T) => void, - complete?: (err: Error | null, count: number) => void - ): this - each (...params: any[]): this -} - -export class Database extends events.EventEmitter { - constructor (filename: string, callback?: (err: Error | null) => void) - constructor ( - filename: string, - mode?: number, - callback?: (err: Error | null) => void - ) - - close (callback?: (err: Error | null) => void): void - - run ( - sql: string, - callback?: (this: RunResult, err: Error | null) => void - ): this - run ( - sql: string, - params: any, - callback?: (this: RunResult, err: Error | null) => void - ): this - run (sql: string, ...params: any[]): this - - get ( - sql: string, - callback?: (this: Statement, err: Error | null, row: T) => void - ): this - get ( - sql: string, - params: any, - callback?: (this: Statement, err: Error | null, row: T) => void - ): this - get (sql: string, ...params: any[]): this - - all ( - sql: string, - callback?: (this: Statement, err: Error | null, rows: T[]) => void - ): this - all ( - sql: string, - params: any, - callback?: (this: Statement, err: Error | null, rows: T[]) => void - ): this - all (sql: string, ...params: any[]): this - - each ( - sql: string, - callback?: (this: Statement, err: Error | null, row: T) => void, - complete?: (err: Error | null, count: number) => void - ): this - each ( - sql: string, - params: any, - callback?: (this: Statement, err: Error | null, row: T) => void, - complete?: (err: Error | null, count: number) => void - ): this - each (sql: string, ...params: any[]): this - - exec ( - sql: string, - callback?: (this: Statement, err: Error | null) => void - ): this - - prepare ( - sql: string, - callback?: (this: Statement, err: Error | null) => void - ): Statement - prepare ( - sql: string, - params: any, - callback?: (this: Statement, err: Error | null) => void - ): Statement - prepare (sql: string, ...params: any[]): Statement - - serialize (callback?: () => void): void - parallelize (callback?: () => void): void - - on (event: 'trace', listener: (sql: string) => void): this - on (event: 'profile', listener: (sql: string, time: number) => void): this - on ( - event: 'change', - listener: ( - type: string, - database: string, - table: string, - rowid: number - ) => void - ): this - on (event: 'error', listener: (err: Error) => void): this - on (event: 'open' | 'close', listener: () => void): this - on (event: string, listener: (...args: any[]) => void): this - - configure (option: 'busyTimeout', value: number): void - configure (option: 'limit', id: number, value: number): void - - loadExtension (filename: string, callback?: (err: Error | null) => void): this - - wait (callback?: (param: null) => void): this - - interrupt (): void -} - -export function verbose (): sqlite3 - -export interface sqlite3 { - OPEN_READONLY: number - OPEN_READWRITE: number - OPEN_CREATE: number - OPEN_FULLMUTEX: number - OPEN_SHAREDCACHE: number - OPEN_PRIVATECACHE: number - OPEN_URI: number - - VERSION: string - SOURCE_ID: string - VERSION_NUMBER: number - - OK: number - ERROR: number - INTERNAL: number - PERM: number - ABORT: number - BUSY: number - LOCKED: number - NOMEM: number - READONLY: number - INTERRUPT: number - IOERR: number - CORRUPT: number - NOTFOUND: number - FULL: number - CANTOPEN: number - PROTOCOL: number - EMPTY: number - SCHEMA: number - TOOBIG: number - CONSTRAINT: number - MISMATCH: number - MISUSE: number - NOLFS: number - AUTH: number - FORMAT: number - RANGE: number - NOTADB: number - - LIMIT_LENGTH: number - LIMIT_SQL_LENGTH: number - LIMIT_COLUMN: number - LIMIT_EXPR_DEPTH: number - LIMIT_COMPOUND_SELECT: number - LIMIT_VDBE_OP: number - LIMIT_FUNCTION_ARG: number - LIMIT_ATTACHED: number - LIMIT_LIKE_PATTERN_LENGTH: number - LIMIT_VARIABLE_NUMBER: number - LIMIT_TRIGGER_DEPTH: number - LIMIT_WORKER_THREADS: number - - cached: typeof cached - RunResult: RunResult - Statement: typeof Statement - Database: typeof Database - verbose(): this -}