Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
uasan committed Feb 18, 2024
1 parent 803ee7e commit 84bc895
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"dependencies": {
"typescript": "next",
"@types/node": "latest",
"uWebSockets.js": "uNetworking/uWebSockets.js#v20.41.0",
"uWebSockets.js": "uNetworking/uWebSockets.js#v20.42.0",
"@uah/postgres": "file:../../Postgres"
},
"devDependencies": {
Expand Down
13 changes: 13 additions & 0 deletions src/compiler/entities/api/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { makePayloadFromBody, makePayloadFromQuery } from './payload.js';

import { factoryRouteFunction } from '../../helpers/function.js';
import {
factoryCall,
factoryCallMethod,
factoryCallThisMethod,
} from '../../helpers/call.js';
Expand All @@ -13,6 +14,7 @@ import {
factoryIdentifier,
factoryAwait,
factoryAwaitStatement,
factoryPropertyParenthesized,
} from '../../helpers/expression.js';
import {
factoryStatement,
Expand All @@ -25,6 +27,7 @@ import {
isVoidLikeType,
isNotThisParameter,
isStringType,
isBigIntType,
} from '../../helpers/checker.js';
import { methods } from './constants.js';
import { makePayloadValidator } from '../../helpers/validator.js';
Expand Down Expand Up @@ -82,6 +85,16 @@ export function makeRouteMethod(name, node) {
statements.push(internals.respondFile(res, ast));
} else if (BinaryData.isAssignable(returnType) || isStringType(returnType)) {
statements.push(internals.respondBinary(res, ast));
} else if (isBigIntType(returnType)) {
statements.push(
internals.respondBinary(
res,
factoryPropertyParenthesized(
ast,
factoryCall(factoryIdentifier('toString'))
)
)
);
} else {
statements.push(internals.respondJson(res, ast));
}
Expand Down
1 change: 1 addition & 0 deletions src/runtime/types/File.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class File {
.pipeThrough(hash.stream)
.pipeTo(IO.createFileWriteStream(path));

this.path = path;
this.hash = hash.digest(this.hashEncoding);
} catch (error) {
await unlink(path).catch(noop);
Expand Down

0 comments on commit 84bc895

Please sign in to comment.