From 625ff7aab4f8e48fff5fba3ccd3a690becbccadd Mon Sep 17 00:00:00 2001 From: Igor Savin Date: Sat, 11 Mar 2023 15:32:42 +0200 Subject: [PATCH] Update to support newer TS and knex (#241) --- .github/workflows/coverage.yml | 6 ++--- .github/workflows/integration-tests.yml | 4 +-- .github/workflows/linting.yml | 8 +++--- lib/objectUtils.ts | 9 ++++--- package.json | 34 ++++++++++++------------- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f4ff614..4612e68 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -15,16 +15,16 @@ jobs: strategy: fail-fast: false matrix: - node-version: [16.x] + node-version: [18.x] steps: - name: Checkout Repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@v3 with: fetch-depth: 1 - name: Setup Node ${{ matrix.node-version }} - uses: actions/setup-node@v3.6.0 + uses: actions/setup-node@v3 with: always-auth: false node-version: ${{ matrix.node-version }} diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 1b09b6a..b1ba675 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -23,12 +23,12 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@v3 with: fetch-depth: 1 - name: Setup Node ${{ matrix.node-version }} - uses: actions/setup-node@v3.6.0 + uses: actions/setup-node@v3 with: always-auth: false node-version: ${{ matrix.node-version }} diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 9cab90f..a024ae7 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -16,16 +16,16 @@ jobs: strategy: matrix: - node-version: [16.x] + node-version: [18.x] steps: - name: Checkout Repository - uses: actions/checkout@v3.3.0 + uses: actions/checkout@v3 with: fetch-depth: 1 - name: Setup Node ${{ matrix.node-version }} - uses: actions/setup-node@v3.6.0 + uses: actions/setup-node@v3 with: always-auth: false node-version: ${{ matrix.node-version }} @@ -35,5 +35,3 @@ jobs: - name: Run lint:everything run: npm run lint - env: - CI: true diff --git a/lib/objectUtils.ts b/lib/objectUtils.ts index 61495e0..c2ee5f6 100644 --- a/lib/objectUtils.ts +++ b/lib/objectUtils.ts @@ -11,7 +11,7 @@ export function copyWithoutUndefined, K extends string | }, {} as Record) as T } -export function pick( +export function pick( source: T, propNames: readonly K[] ): Pick>> { @@ -44,7 +44,10 @@ export function pickWithoutUndefined( return result } -export function validateOnlyWhitelistedFields(source: T, propNames: readonly string[]) { +export function validateOnlyWhitelistedFields( + source: T, + propNames: readonly string[] +) { const keys = Object.keys(source) for (var x = 0; x < keys.length; x++) { if (propNames.indexOf(keys[x]) === -1) { @@ -65,7 +68,7 @@ export function validateOnlyWhitelistedFieldsSet( } } -export function strictPickWithoutUndefined( +export function strictPickWithoutUndefined( source: T, propNames: readonly string[] ): Pick>> { diff --git a/package.json b/package.json index 0318b8d..4e9126d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "knex-utils", - "version": "5.5.1", + "version": "6.0.0", "license": "MIT", "maintainers": [ { @@ -24,29 +24,29 @@ "prepublishOnly": "npm run build" }, "peerDependencies": { - "knex": ">=0.95.4" + "knex": ">=2.0.0" }, "devDependencies": { - "@types/jest": "^27.0.3", - "@types/node": "^18.14.6", - "@typescript-eslint/eslint-plugin": "^5.5.0", - "@typescript-eslint/parser": "^5.5.0", - "eslint": "^8.4.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-prettier": "^4.0.0", - "jest": "^27.4.3", - "knex": "^2.1.0", + "@types/jest": "^27.5.2", + "@types/node": "^18.15.0", + "@typescript-eslint/eslint-plugin": "^5.54.1", + "@typescript-eslint/parser": "^5.54.1", + "eslint": "^8.36.0", + "eslint-config-prettier": "^8.7.0", + "eslint-plugin-prettier": "^4.2.1", + "jest": "^27.5.1", + "knex": "^2.4.2", "mysql": "^2.18.1", "mysql2": "^3.2.0", - "pg": "^8.7.1", - "prettier": "^2.5.1", - "sqlite3": "^5.0.2", - "tedious": "^14.5.0", - "ts-jest": "^27.1.0", + "pg": "^8.10.0", + "prettier": "^2.8.4", + "sqlite3": "^5.1.4", + "tedious": "^14.7.0", + "ts-jest": "^27.1.5", "typescript": "4.9.5" }, "engines": { - "node": ">=10" + "node": ">=12" }, "homepage": "http://github.com/knex/knex-utils", "repository": {