diff --git a/CHANGELOG.md b/CHANGELOG.md index fc35a3f06..739dfec32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `@aws-sdk/types` from 3.257.0 to 3.341.0 - Bumps `semver` from 7.3.8 to 7.5.1 - Bumps `node-fetch` from 3.2.10 to 3.3.1 +- Bumps `proxy` from 1.0.2 to 2.1.1 ### Changed - Implemented Docker Image caching for `integration-unreleased` workflow ([#387](https://github.com/opensearch-project/opensearch-js/issues/387)) - Add upgrading NPM to all workflows running older Node.js versions ([#545](https://github.com/opensearch-project/opensearch-js/issues/545)) diff --git a/package.json b/package.json index c37a477d0..d99275273 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,8 @@ "lint": "eslint .", "lint:fix": "eslint . --fix", "license-checker": "license-checker --production --onlyAllow='MIT;Apache-2.0;Apache1.1;ISC;BSD-3-Clause;BSD-2-Clause'", - "build-esm": "npx gen-esm-wrapper . index.mjs && eslint --fix index.mjs" + "build-esm": "npx gen-esm-wrapper . index.mjs && eslint --fix index.mjs", + "build": "tsc" }, "author": "opensearch-project", "original-author": { @@ -78,7 +79,7 @@ "ora": "^6.1.2", "prettier": "^2.6.2", "pretty-hrtime": "^1.0.3", - "proxy": "^1.0.2", + "proxy": "^2.1.1", "rimraf": "^5.0.0", "semver": "^7.3.5", "simple-git": "^3.15.0", diff --git a/test/acceptance/proxy.test.js b/test/acceptance/proxy.test.js index dc2cf1b06..3c893c654 100644 --- a/test/acceptance/proxy.test.js +++ b/test/acceptance/proxy.test.js @@ -112,12 +112,9 @@ test('http basic authentication', async (t) => { res.end(JSON.stringify({ hello: 'world' })); }); - proxy.authenticate = function (req, fn) { - fn( - null, - req.headers['proxy-authorization'] === - `Basic ${Buffer.from('hello:world').toString('base64')}` - ); + proxy.authenticate = (req) => { + const basic = `Basic ${Buffer.from('hello:world').toString('base64')}`; + return req.headers['proxy-authorization'] === basic; }; const client = new Client({ @@ -141,12 +138,9 @@ test('https basic authentication', async (t) => { res.end(JSON.stringify({ hello: 'world' })); }); - proxy.authenticate = function (req, fn) { - fn( - null, - req.headers['proxy-authorization'] === - `Basic ${Buffer.from('hello:world').toString('base64')}` - ); + proxy.authenticate = (req) => { + const basic = `Basic ${Buffer.from('hello:world').toString('base64')}`; + return req.headers['proxy-authorization'] === basic; }; const client = new Client({ diff --git a/test/utils/buildProxy.js b/test/utils/buildProxy.js index 5b0dfdfec..5b3e89743 100644 --- a/test/utils/buildProxy.js +++ b/test/utils/buildProxy.js @@ -14,7 +14,7 @@ 'use strict'; -const proxy = require('proxy'); +const { createProxy: proxy } = require('proxy'); const { readFileSync } = require('fs'); const { join } = require('path'); const http = require('http'); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..874010b91 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "outDir": "dist", + "allowJs": true, + "downlevelIteration": true, + "esModuleInterop": true, + "incremental": true, + "lib": ["ES2015"], + "module": "commonjs", + "moduleResolution": "node", + "noFallthroughCasesInSwitch": true, + "preserveConstEnums": true, + "removeComments": true, + "resolveJsonModule": true, + "target": "es5" + }, + "exclude": ["node_modules/", "**/*.test.ts"], + "include": ["lib/**/*", "api/**/*", "index.js"] +} diff --git a/yarn.lock b/yarn.lock index 3620f3318..668402c7c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -626,10 +626,10 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -args@5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/args/-/args-5.0.1.tgz#4bf298df90a4799a09521362c579278cc2fdd761" - integrity sha512-1kqmFCFsPffavQFGt8OxJdIcETti99kySRUPMpOhaGjL6mRJn8HFU1OxKY5bMqfZKUwTQc1mZkAjmGYaVOHFtQ== +args@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/args/-/args-5.0.3.tgz#943256db85021a85684be2f0882f25d796278702" + integrity sha512-h6k/zfFgusnv3i5TU08KQkVKuCPBtL/PWQbWkHUxvJrZ2nAyeaUupneemcrgn1xmqxPQsPIzwkUhOpoqPDRZuA== dependencies: camelcase "5.0.0" chalk "2.4.2" @@ -686,10 +686,10 @@ base64-js@^1.3.1: resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -basic-auth-parser@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/basic-auth-parser/-/basic-auth-parser-0.0.2.tgz#ce9e71a77f23c1279eecd2659b2a46244c156e41" - integrity sha1-zp5xp38jwSee7NJlmypGJEwVbkE= +basic-auth-parser@0.0.2-1: + version "0.0.2-1" + resolved "https://registry.yarnpkg.com/basic-auth-parser/-/basic-auth-parser-0.0.2-1.tgz#f1ea575979b27af6a411921d6ff8793d9117347f" + integrity sha512-GFj8iVxo9onSU6BnnQvVwqvxh60UcSHJEDnIk3z4B6iOjsKSmqe+ibW0Rsz7YO7IE1HG3D3tqCNIidP46SZVdQ== binary-extensions@^2.0.0: version "2.2.0" @@ -2585,14 +2585,14 @@ process-on-spawn@^1.0.0: dependencies: fromentries "^1.2.0" -proxy@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/proxy/-/proxy-1.0.2.tgz#e0cfbe11c0a7a8b238fd2d7134de4e2867578e7f" - integrity sha512-KNac2ueWRpjbUh77OAFPZuNdfEqNynm9DD4xHT14CccGpW8wKZwEkN0yjlb7X9G9Z9F55N0Q+1z+WfgAhwYdzQ== +proxy@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/proxy/-/proxy-2.1.1.tgz#45f9b307508ffcae12bdc71678d44a4ab79cbf8b" + integrity sha512-nLgd7zdUAOpB3ZO/xCkU8gy74UER7P0aihU8DkUsDS5ZoFwVCX7u8dy+cv5tVK8UaB/yminU1GiLWE26TKPYpg== dependencies: - args "5.0.1" - basic-auth-parser "0.0.2" - debug "^4.1.1" + args "^5.0.3" + basic-auth-parser "0.0.2-1" + debug "^4.3.4" punycode@^2.0.0, punycode@^2.1.0: version "2.1.1"