Skip to content

Commit 5ff8c7e

Browse files
authored
feat: rawBody parser, user metadata column + other misc fixes (#1904)
1 parent cc7369d commit 5ff8c7e

29 files changed

+319
-416
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
rm package-lock.json
2828
npm install -g npm@latest
2929
npm install
30+
npm run build
3031
npm run test
3132
3233
api-test:

eslint.config.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const rules = {
3333
'@stylistic/quotes': ['error', 'single', { 'avoidEscape': true }],
3434
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
3535
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
36-
'@stylistic/space-before-function-paren': ['error', { 'anonymous': 'never', 'named': 'never', 'asyncArrow': 'always', 'catch': 'always' }],
36+
'@stylistic/space-before-function-paren': 'error',
3737
'@stylistic/key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }],
3838
'@stylistic/keyword-spacing': ['error', { 'before': true, 'after': true }],
3939
'@stylistic/no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
@@ -46,13 +46,17 @@ const rules = {
4646
'custom/control-structure-spacing': 'error',
4747
'@stylistic/no-trailing-spaces': 'error',
4848
'@stylistic/space-before-blocks': ['error', 'always'],
49+
'prefer-template': 'error',
50+
'@stylistic/no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
51+
'@stylistic/space-unary-ops': ['error', { words: true, nonwords: false }],
52+
'@stylistic/no-multi-spaces': ['error', { exceptions: { 'VariableDeclarator': true } }],
4953
};
5054

5155
export default defineConfig([
5256
// TypeScript support block
5357
{
5458
files: ['**/*.ts'],
55-
ignores: ['tests/**/*.ts'],
59+
ignores: ['tests/**/*.ts', 'extensions'],
5660
languageOptions: {
5761
parser: tseslintParser,
5862
parserOptions: {
@@ -72,6 +76,28 @@ export default defineConfig([
7276
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
7377
},
7478
},
79+
// TypeScript support for extensions
80+
{
81+
files: ['extensions/**/*.ts'],
82+
languageOptions: {
83+
parser: tseslintParser,
84+
parserOptions: {
85+
ecmaVersion: 'latest',
86+
sourceType: 'module',
87+
project: 'extensions/tsconfig.json',
88+
},
89+
},
90+
plugins: {
91+
'@typescript-eslint': tseslintPlugin,
92+
},
93+
rules: {
94+
// Recommended rules for TypeScript
95+
'@typescript-eslint/no-explicit-any': 'warn',
96+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
97+
'@typescript-eslint/ban-ts-comment': 'warn',
98+
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
99+
},
100+
},
75101
// TypeScript support for tests
76102
{
77103
files: ['tests/**/*.ts'],

extensions/ExtensionController/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

extensions/ExtensionController/index.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

extensions/ExtensionController/index.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

extensions/ExtensionController/package.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

extensions/ExtensionController/src/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

extensions/ExtensionController/src/ExtensionController.ts

Lines changed: 0 additions & 71 deletions
This file was deleted.

extensions/ExtensionController/tsconfig.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

extensions/api.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { WebServerService } from '@heyputer/backend/src/modules/web/WebServerService.js';
12
import type { Actor } from '@heyputer/backend/src/services/auth/Actor.js';
23
import type { BaseDatabaseAccessService } from '@heyputer/backend/src/services/database/BaseDatabaseAccessService.d.ts';
34
import type { MeteringService } from '@heyputer/backend/src/services/MeteringService/MeteringService.ts';
@@ -10,12 +11,12 @@ import type { RequestHandler } from 'express';
1011
import type FSNodeContext from '../src/backend/src/filesystem/FSNodeContext.js';
1112
import type helpers from '../src/backend/src/helpers.js';
1213
import type * as ExtensionControllerExports from './ExtensionController/src/ExtensionController.ts';
13-
1414
declare global {
1515
namespace Express {
1616
interface Request {
1717
services: { get: <T extends (keyof ServiceNameMap ) | (string & {})>(string: T)=> T extends keyof ServiceNameMap ? ServiceNameMap[T] : unknown }
1818
actor: Actor,
19+
rawBody: Buffer,
1920
/** @deprecated use actor instead */
2021
user: IUser
2122
}
@@ -37,7 +38,7 @@ type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch';
3738

3839
export type AddRouteFunction = (path: string, options: EndpointOptions, handler: RequestHandler) => void;
3940

40-
type RouterMethods = {
41+
export type RouterMethods = {
4142
[K in HttpMethod]: {
4243
(path: string, options: EndpointOptions, handler: RequestHandler): void;
4344
(path: string, handler: RequestHandler, options?: EndpointOptions): void;
@@ -63,6 +64,7 @@ interface ServiceNameMap {
6364
'su': SUService
6465
'database': BaseDatabaseAccessService
6566
'user': UserService
67+
'web-server': WebServerService
6668
}
6769
interface Extension extends RouterMethods {
6870
exports: Record<string, unknown>,

0 commit comments

Comments
 (0)