Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: koa support #1792

Merged
merged 6 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: koa support
  • Loading branch information
alexander-akait committed Mar 26, 2024
commit af652a7f495fbb3cf8a00ca0f48c8ecfd47e9b27
224 changes: 224 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"husky": "^9.0.10",
"jest": "^29.3.1",
"joi": "^17.12.2",
"koa": "^2.15.2",
"lint-staged": "^15.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.4",
Expand Down
25 changes: 23 additions & 2 deletions src/utils/compatibleAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,19 @@
return;
}

/** @type {import("fs").ReadStream} */
(bufferOrStream).pipe(res);
// Pseudo API
if (
typeof (/** @type {Response & ExpectedResponse} */ (res).sendStream) ===

Check failure on line 308 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Lint - ubuntu-latest - Node vlts/*

Property 'sendStream' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 308 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v18.x, Webpack latest

Property 'sendStream' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 308 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v20.x, Webpack latest

Property 'sendStream' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 308 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v21.x, Webpack latest

Property 'sendStream' does not exist on type 'Response & ExpectedResponse'.
"function"
) {
/** @type {Response & ExpectedResponse} */
(res).sendStream(bufferOrStream);

Check failure on line 312 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Lint - ubuntu-latest - Node vlts/*

Property 'sendStream' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 312 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v18.x, Webpack latest

Property 'sendStream' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 312 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v20.x, Webpack latest

Property 'sendStream' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 312 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v21.x, Webpack latest

Property 'sendStream' does not exist on type 'Response & ExpectedResponse'.
}
// Node.js API
else {
/** @type {import("fs").ReadStream} */
(bufferOrStream).pipe(res);
}

// Cleanup
const cleanup = () => {
Expand Down Expand Up @@ -339,6 +350,16 @@
return;
}

// Pseudo API
if (
typeof (/** @type {Response & ExpectedResponse} */ (res).sendFine) ===

Check failure on line 355 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Lint - ubuntu-latest - Node vlts/*

Property 'sendFine' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 355 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v18.x, Webpack latest

Property 'sendFine' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 355 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v20.x, Webpack latest

Property 'sendFine' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 355 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v21.x, Webpack latest

Property 'sendFine' does not exist on type 'Response & ExpectedResponse'.
"function"
) {
/** @type {Response & ExpectedResponse} */
(res).sendFine(bufferOrStream);

Check failure on line 359 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Lint - ubuntu-latest - Node vlts/*

Property 'sendFine' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 359 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v18.x, Webpack latest

Property 'sendFine' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 359 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v20.x, Webpack latest

Property 'sendFine' does not exist on type 'Response & ExpectedResponse'.

Check failure on line 359 in src/utils/compatibleAPI.js

View workflow job for this annotation

GitHub Actions / Test - ubuntu-latest - Node v21.x, Webpack latest

Property 'sendFine' does not exist on type 'Response & ExpectedResponse'.
return;
}

// Express API
if (
typeof (/** @type {Response & ExpectedResponse} */ (res).send) ===
Expand Down
Loading
Loading