Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
uasan committed Jun 13, 2024
1 parent 5145399 commit 1b92032
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"#compiler/*": "./src/compiler/*"
},
"dependencies": {
"typescript": "next",
"typescript": "5.5.1-rc",
"@types/node": "latest",
"uWebSockets.js": "uNetworking/uWebSockets.js#v20.42.0",
"@uah/postgres": "file:../../Postgres"
Expand Down
5 changes: 1 addition & 4 deletions src/compiler/entities/api/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import {
factoryAwaitStatement,
factoryPropertyParenthesized,
} from '../../helpers/expression.js';
import {
factoryStatement,
factoryTryStatement,
} from '../../helpers/statements.js';
import { factoryTryStatement } from '../../helpers/statements.js';
import {
getAwaitedType,
getReturnType,
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/worker/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const compilerOptions = {
jsx: ts.JsxEmit.Preserve,
module: ts.ModuleKind.ESNext,
target: ts.ScriptTarget.ESNext,
moduleDetection: 'force',
moduleDetection: ts.ModuleDetectionKind.Force,
useDefineForClassFields: true,
exactOptionalPropertyTypes: false,
forceConsistentCasingInFileNames: true,
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/postgres/sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface SQL {
asObject(): this;
asValue(): this;
asBlob(): this;
asValues(): this;

sql(strings: TemplateStringsArray, ...params: unknown[]): this;
sql(
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/security/decorators.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ServerContext } from '../server/context.ts';

export declare function Permission(
rule: (context: ServerContext, payload?: any) => Promise<boolean>
rule: (context: ServerContext, payload?: any) => boolean | Promise<boolean>
): (target: unknown, context: ClassMethodDecoratorContext) => void;
6 changes: 6 additions & 0 deletions src/runtime/postgres/query/sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
FETCH_ONE_VALUE,
TYPE_BLOB,
TYPE_NATIVE,
FETCH_VALUES,
} from '@uah/postgres/src/constants.js';

import { concat } from './utils.js';
Expand Down Expand Up @@ -43,6 +44,11 @@ export class SQL {
return this;
}

asValues() {
this.mode = FETCH_VALUES | TYPE_NATIVE;
return this;
}

asBlob() {
this.mode = FETCH_ONE_VALUE | TYPE_BLOB;
return this;
Expand Down
8 changes: 7 additions & 1 deletion src/runtime/security/decorators.js
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
export function Permission() {}
import { Forbidden } from '../exceptions/Forbidden.js';

export async function Permission(context, rule, payload) {
if ((await rule(context, payload)) !== true) {
throw new Forbidden();
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"lib": [
"ESNext"
],
"types": [
"typeRoots": [
"@types/node",
"@uah/server"
],
Expand Down

0 comments on commit 1b92032

Please sign in to comment.