mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
refactor: 🏷️ Update tsconfig.json and fix resulting errors
Some checks failed
Build Docker Images / build (server, Dockerfile, ${{ github.repository_owner }}/server) (push) Has been skipped
Build Docker Images / build (worker, Worker.Dockerfile, ${{ github.repository_owner }}/worker) (push) Has been skipped
Deploy Docs to GitHub Pages / build (push) Failing after 1s
Deploy Docs to GitHub Pages / Deploy (push) Has been skipped
Mirror to Codeberg / Mirror (push) Failing after 0s
Nix Build / check (push) Failing after 0s
CodeQL Scan / Analyze (javascript-typescript) (push) Failing after 0s
Build Docker Images / lint (push) Failing after 8s
Build Docker Images / check (push) Failing after 8s
Build Docker Images / tests (push) Failing after 8s
Test Publish / build (client) (push) Failing after 0s
Test Publish / build (sdk) (push) Failing after 0s
Some checks failed
Build Docker Images / build (server, Dockerfile, ${{ github.repository_owner }}/server) (push) Has been skipped
Build Docker Images / build (worker, Worker.Dockerfile, ${{ github.repository_owner }}/worker) (push) Has been skipped
Deploy Docs to GitHub Pages / build (push) Failing after 1s
Deploy Docs to GitHub Pages / Deploy (push) Has been skipped
Mirror to Codeberg / Mirror (push) Failing after 0s
Nix Build / check (push) Failing after 0s
CodeQL Scan / Analyze (javascript-typescript) (push) Failing after 0s
Build Docker Images / lint (push) Failing after 8s
Build Docker Images / check (push) Failing after 8s
Build Docker Images / tests (push) Failing after 8s
Test Publish / build (client) (push) Failing after 0s
Test Publish / build (sdk) (push) Failing after 0s
This commit is contained in:
parent
64068f9d23
commit
99a7658956
|
|
@ -18,7 +18,7 @@ export class ApiError extends Error {
|
|||
*/
|
||||
public constructor(
|
||||
public status: ContentfulStatusCode,
|
||||
public message: string,
|
||||
public override message: string,
|
||||
public details?: string | JSONObject,
|
||||
) {
|
||||
super(message);
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@ export class PluginLoader {
|
|||
if (manifestFile.endsWith(".jsonc")) {
|
||||
return parseJSONC(manifestText);
|
||||
}
|
||||
|
||||
throw new Error(`Unsupported manifest file type: ${manifestFile}`);
|
||||
} catch (e) {
|
||||
this.logger
|
||||
.fatal`Could not parse plugin manifest ${chalk.blue(manifestPath)} as ${manifestFile.split(".").pop()?.toUpperCase()}.`;
|
||||
|
|
|
|||
|
|
@ -36,4 +36,5 @@ export const ipBans = createMiddleware(async (context, next) => {
|
|||
}
|
||||
|
||||
await next();
|
||||
return;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,4 +15,5 @@ export const urlCheck = createMiddleware(async (context, next) => {
|
|||
}
|
||||
|
||||
await next();
|
||||
return;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,21 +7,23 @@ import type { JSONObject } from "../types.ts";
|
|||
import { Entity } from "./entity.ts";
|
||||
|
||||
export class Collection extends Entity {
|
||||
public constructor(public data: z.infer<typeof CollectionSchema>) {
|
||||
public constructor(public override data: z.infer<typeof CollectionSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Collection> {
|
||||
public static override fromJSON(json: JSONObject): Promise<Collection> {
|
||||
return CollectionSchema.parseAsync(json).then((u) => new Collection(u));
|
||||
}
|
||||
}
|
||||
|
||||
export class URICollection extends Entity {
|
||||
public constructor(public data: z.infer<typeof URICollectionSchema>) {
|
||||
public constructor(
|
||||
public override data: z.infer<typeof URICollectionSchema>,
|
||||
) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<URICollection> {
|
||||
public static override fromJSON(json: JSONObject): Promise<URICollection> {
|
||||
return URICollectionSchema.parseAsync(json).then(
|
||||
(u) => new URICollection(u),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -20,63 +20,81 @@ export class ContentFormat {
|
|||
}
|
||||
|
||||
export class TextContentFormat extends ContentFormat {
|
||||
public static fromJSON(data: JSONObject): Promise<TextContentFormat> {
|
||||
public static override fromJSON(
|
||||
data: JSONObject,
|
||||
): Promise<TextContentFormat> {
|
||||
return TextContentFormatSchema.parseAsync(data).then(
|
||||
(d) => new TextContentFormat(d),
|
||||
);
|
||||
}
|
||||
|
||||
public constructor(public data: z.infer<typeof TextContentFormatSchema>) {
|
||||
public constructor(
|
||||
public override data: z.infer<typeof TextContentFormatSchema>,
|
||||
) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export class NonTextContentFormat extends ContentFormat {
|
||||
public static fromJSON(data: JSONObject): Promise<NonTextContentFormat> {
|
||||
public static override fromJSON(
|
||||
data: JSONObject,
|
||||
): Promise<NonTextContentFormat> {
|
||||
return NonTextContentFormatSchema.parseAsync(data).then(
|
||||
(d) => new NonTextContentFormat(d),
|
||||
);
|
||||
}
|
||||
|
||||
public constructor(
|
||||
public data: z.infer<typeof NonTextContentFormatSchema>,
|
||||
public override data: z.infer<typeof NonTextContentFormatSchema>,
|
||||
) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export class ImageContentFormat extends ContentFormat {
|
||||
public static fromJSON(data: JSONObject): Promise<ImageContentFormat> {
|
||||
public static override fromJSON(
|
||||
data: JSONObject,
|
||||
): Promise<ImageContentFormat> {
|
||||
return ImageContentFormatSchema.parseAsync(data).then(
|
||||
(d) => new ImageContentFormat(d),
|
||||
);
|
||||
}
|
||||
|
||||
public constructor(public data: z.infer<typeof ImageContentFormatSchema>) {
|
||||
public constructor(
|
||||
public override data: z.infer<typeof ImageContentFormatSchema>,
|
||||
) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export class VideoContentFormat extends ContentFormat {
|
||||
public static fromJSON(data: JSONObject): Promise<VideoContentFormat> {
|
||||
public static override fromJSON(
|
||||
data: JSONObject,
|
||||
): Promise<VideoContentFormat> {
|
||||
return VideoContentFormatSchema.parseAsync(data).then(
|
||||
(d) => new VideoContentFormat(d),
|
||||
);
|
||||
}
|
||||
|
||||
public constructor(public data: z.infer<typeof VideoContentFormatSchema>) {
|
||||
public constructor(
|
||||
public override data: z.infer<typeof VideoContentFormatSchema>,
|
||||
) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export class AudioContentFormat extends ContentFormat {
|
||||
public static fromJSON(data: JSONObject): Promise<AudioContentFormat> {
|
||||
public static override fromJSON(
|
||||
data: JSONObject,
|
||||
): Promise<AudioContentFormat> {
|
||||
return AudioContentFormatSchema.parseAsync(data).then(
|
||||
(d) => new AudioContentFormat(d),
|
||||
);
|
||||
}
|
||||
|
||||
public constructor(public data: z.infer<typeof AudioContentFormatSchema>) {
|
||||
public constructor(
|
||||
public override data: z.infer<typeof AudioContentFormatSchema>,
|
||||
) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ import type { JSONObject } from "../types.ts";
|
|||
import { Entity } from "./entity.ts";
|
||||
|
||||
export class Delete extends Entity {
|
||||
public static name = "Delete";
|
||||
public static override name = "Delete";
|
||||
|
||||
public constructor(public data: z.infer<typeof DeleteSchema>) {
|
||||
public constructor(public override data: z.infer<typeof DeleteSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Delete> {
|
||||
public static override fromJSON(json: JSONObject): Promise<Delete> {
|
||||
return DeleteSchema.parseAsync(json).then((u) => new Delete(u));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,25 +4,25 @@ import type { JSONObject } from "../../types.ts";
|
|||
import { Entity } from "../entity.ts";
|
||||
|
||||
export class Like extends Entity {
|
||||
public static name = "pub.versia:likes/Like";
|
||||
public static override name = "pub.versia:likes/Like";
|
||||
|
||||
public constructor(public data: z.infer<typeof LikeSchema>) {
|
||||
public constructor(public override data: z.infer<typeof LikeSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Like> {
|
||||
public static override fromJSON(json: JSONObject): Promise<Like> {
|
||||
return LikeSchema.parseAsync(json).then((u) => new Like(u));
|
||||
}
|
||||
}
|
||||
|
||||
export class Dislike extends Entity {
|
||||
public static name = "pub.versia:likes/Dislike";
|
||||
public static override name = "pub.versia:likes/Dislike";
|
||||
|
||||
public constructor(public data: z.infer<typeof DislikeSchema>) {
|
||||
public constructor(public override data: z.infer<typeof DislikeSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Dislike> {
|
||||
public static override fromJSON(json: JSONObject): Promise<Dislike> {
|
||||
return DislikeSchema.parseAsync(json).then((u) => new Dislike(u));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ import type { JSONObject } from "../../types.ts";
|
|||
import { Entity } from "../entity.ts";
|
||||
|
||||
export class Vote extends Entity {
|
||||
public static name = "pub.versia:polls/Vote";
|
||||
public static override name = "pub.versia:polls/Vote";
|
||||
|
||||
public constructor(public data: z.infer<typeof VoteSchema>) {
|
||||
public constructor(public override data: z.infer<typeof VoteSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Vote> {
|
||||
public static override fromJSON(json: JSONObject): Promise<Vote> {
|
||||
return VoteSchema.parseAsync(json).then((u) => new Vote(u));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ import type { JSONObject } from "../../types.ts";
|
|||
import { Entity } from "../entity.ts";
|
||||
|
||||
export class Reaction extends Entity {
|
||||
public static name = "pub.versia:reactions/Reaction";
|
||||
public static override name = "pub.versia:reactions/Reaction";
|
||||
|
||||
public constructor(public data: z.infer<typeof ReactionSchema>) {
|
||||
public constructor(public override data: z.infer<typeof ReactionSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Reaction> {
|
||||
public static override fromJSON(json: JSONObject): Promise<Reaction> {
|
||||
return ReactionSchema.parseAsync(json).then((u) => new Reaction(u));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ import type { JSONObject } from "../../types.ts";
|
|||
import { Entity } from "../entity.ts";
|
||||
|
||||
export class Report extends Entity {
|
||||
public static name = "pub.versia:reports/Report";
|
||||
public static override name = "pub.versia:reports/Report";
|
||||
|
||||
public constructor(public data: z.infer<typeof ReportSchema>) {
|
||||
public constructor(public override data: z.infer<typeof ReportSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Report> {
|
||||
public static override fromJSON(json: JSONObject): Promise<Report> {
|
||||
return ReportSchema.parseAsync(json).then((u) => new Report(u));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ import type { JSONObject } from "../../types.ts";
|
|||
import { Entity } from "../entity.ts";
|
||||
|
||||
export class Share extends Entity {
|
||||
public static name = "pub.versia:share/Share";
|
||||
public static override name = "pub.versia:share/Share";
|
||||
|
||||
public constructor(public data: z.infer<typeof ShareSchema>) {
|
||||
public constructor(public override data: z.infer<typeof ShareSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Share> {
|
||||
public static override fromJSON(json: JSONObject): Promise<Share> {
|
||||
return ShareSchema.parseAsync(json).then((u) => new Share(u));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,25 +9,27 @@ import type { JSONObject } from "../types.ts";
|
|||
import { Entity } from "./entity.ts";
|
||||
|
||||
export class Follow extends Entity {
|
||||
public static name = "Follow";
|
||||
public static override name = "Follow";
|
||||
|
||||
public constructor(public data: z.infer<typeof FollowSchema>) {
|
||||
public constructor(public override data: z.infer<typeof FollowSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Follow> {
|
||||
public static override fromJSON(json: JSONObject): Promise<Follow> {
|
||||
return FollowSchema.parseAsync(json).then((u) => new Follow(u));
|
||||
}
|
||||
}
|
||||
|
||||
export class FollowAccept extends Entity {
|
||||
public static name = "FollowAccept";
|
||||
public static override name = "FollowAccept";
|
||||
|
||||
public constructor(public data: z.infer<typeof FollowAcceptSchema>) {
|
||||
public constructor(
|
||||
public override data: z.infer<typeof FollowAcceptSchema>,
|
||||
) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<FollowAccept> {
|
||||
public static override fromJSON(json: JSONObject): Promise<FollowAccept> {
|
||||
return FollowAcceptSchema.parseAsync(json).then(
|
||||
(u) => new FollowAccept(u),
|
||||
);
|
||||
|
|
@ -35,13 +37,15 @@ export class FollowAccept extends Entity {
|
|||
}
|
||||
|
||||
export class FollowReject extends Entity {
|
||||
public static name = "FollowReject";
|
||||
public static override name = "FollowReject";
|
||||
|
||||
public constructor(public data: z.infer<typeof FollowRejectSchema>) {
|
||||
public constructor(
|
||||
public override data: z.infer<typeof FollowRejectSchema>,
|
||||
) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<FollowReject> {
|
||||
public static override fromJSON(json: JSONObject): Promise<FollowReject> {
|
||||
return FollowRejectSchema.parseAsync(json).then(
|
||||
(u) => new FollowReject(u),
|
||||
);
|
||||
|
|
@ -49,13 +53,13 @@ export class FollowReject extends Entity {
|
|||
}
|
||||
|
||||
export class Unfollow extends Entity {
|
||||
public static name = "Unfollow";
|
||||
public static override name = "Unfollow";
|
||||
|
||||
public constructor(public data: z.infer<typeof UnfollowSchema>) {
|
||||
public constructor(public override data: z.infer<typeof UnfollowSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Unfollow> {
|
||||
public static override fromJSON(json: JSONObject): Promise<Unfollow> {
|
||||
return UnfollowSchema.parseAsync(json).then((u) => new Unfollow(u));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@ import { ImageContentFormat } from "./contentformat.ts";
|
|||
import { Entity } from "./entity.ts";
|
||||
|
||||
export class InstanceMetadata extends Entity {
|
||||
public static name = "InstanceMetadata";
|
||||
public static override name = "InstanceMetadata";
|
||||
|
||||
public constructor(public data: z.infer<typeof InstanceMetadataSchema>) {
|
||||
public constructor(
|
||||
public override data: z.infer<typeof InstanceMetadataSchema>,
|
||||
) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
|
@ -23,7 +25,9 @@ export class InstanceMetadata extends Entity {
|
|||
: undefined;
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<InstanceMetadata> {
|
||||
public static override fromJSON(
|
||||
json: JSONObject,
|
||||
): Promise<InstanceMetadata> {
|
||||
return InstanceMetadataSchema.parseAsync(json).then(
|
||||
(u) => new InstanceMetadata(u),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import { NonTextContentFormat, TextContentFormat } from "./contentformat.ts";
|
|||
import { Entity } from "./entity.ts";
|
||||
|
||||
export class Note extends Entity {
|
||||
public static name = "Note";
|
||||
public static override name = "Note";
|
||||
|
||||
public constructor(public data: z.infer<typeof NoteSchema>) {
|
||||
public constructor(public override data: z.infer<typeof NoteSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<Note> {
|
||||
public static override fromJSON(json: JSONObject): Promise<Note> {
|
||||
return NoteSchema.parseAsync(json).then((n) => new Note(n));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import { ImageContentFormat, TextContentFormat } from "./contentformat.ts";
|
|||
import { Entity } from "./entity.ts";
|
||||
|
||||
export class User extends Entity {
|
||||
public static name = "User";
|
||||
public static override name = "User";
|
||||
|
||||
public constructor(public data: z.infer<typeof UserSchema>) {
|
||||
public constructor(public override data: z.infer<typeof UserSchema>) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public static fromJSON(json: JSONObject): Promise<User> {
|
||||
public static override fromJSON(json: JSONObject): Promise<User> {
|
||||
return UserSchema.parseAsync(json).then((u) => new User(u));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,40 +1,45 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"moduleDetection": "force",
|
||||
"allowImportingTsExtensions": true,
|
||||
"noEmit": true,
|
||||
"composite": true,
|
||||
"strict": true,
|
||||
"downlevelIteration": true,
|
||||
"skipLibCheck": true,
|
||||
"alwaysStrict": true,
|
||||
"exactOptionalPropertyTypes": false,
|
||||
"noImplicitAny": true,
|
||||
"jsx": "preserve",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noPropertyAccessFromIndexSignature": false,
|
||||
"noUncheckedIndexedAccess": false,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"strict": true,
|
||||
"useUnknownInCatchVariables": true,
|
||||
|
||||
"allowImportingTsExtensions": true,
|
||||
"module": "preserve",
|
||||
"moduleResolution": "bundler",
|
||||
"noUncheckedSideEffectImports": true,
|
||||
"resolveJsonModule": true,
|
||||
"noEmit": true,
|
||||
"allowJs": false,
|
||||
// Soon...
|
||||
//"erasableSyntaxOnly": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"allowJs": true,
|
||||
"emitDecoratorMetadata": false,
|
||||
"experimentalDecorators": true,
|
||||
//"isolatedDeclarations": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"target": "esnext",
|
||||
"jsx": "preserve",
|
||||
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
||||
"composite": true,
|
||||
"incremental": true,
|
||||
"skipLibCheck": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": false,
|
||||
"paths": {
|
||||
"@/*": ["./utils/*"],
|
||||
"~/*": ["./*"],
|
||||
"+/*": ["./api/*"]
|
||||
},
|
||||
"noUnusedLocals": true
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules"],
|
||||
"include": [
|
||||
"*.ts",
|
||||
"*.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.d.ts",
|
||||
"api/well-known/**/*.ts",
|
||||
"packages/cli/index.mts"
|
||||
]
|
||||
"include": ["*.ts", "*.d.ts", "**/*.ts", "**/*.d.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,8 @@ export const handleZodError = (
|
|||
422,
|
||||
);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const checkPermissions = (
|
||||
|
|
|
|||
Loading…
Reference in a new issue