refactor: Use ESM (#8358)

* wip

* wip

* fix

* clean up

* Update tsconfig.json

* Update activitypub.ts

* wip
This commit is contained in:
syuilo 2022-02-27 11:07:39 +09:00 committed by GitHub
parent 0a882471f3
commit d071d18dd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
737 changed files with 4135 additions and 3678 deletions

View file

@ -1,10 +1,9 @@
import autobind from 'autobind-decorator';
import Chart, { KVs } from '../core';
import { DriveFiles, Followings, Users, Notes } from '@/models/index';
import { DriveFile } from '@/models/entities/drive-file';
import { Note } from '@/models/entities/note';
import { toPuny } from '@/misc/convert-host';
import { name, schema } from './entities/instance';
import Chart, { KVs } from '../core.js';
import { DriveFiles, Followings, Users, Notes } from '@/models/index.js';
import { DriveFile } from '@/models/entities/drive-file.js';
import { Note } from '@/models/entities/note.js';
import { toPuny } from '@/misc/convert-host.js';
import { name, schema } from './entities/instance.js';
/**
*
@ -15,7 +14,6 @@ export default class InstanceChart extends Chart<typeof schema> {
super(name, schema, true);
}
@autobind
protected async tickMajor(group: string): Promise<Partial<KVs<typeof schema>>> {
const [
notesCount,
@ -42,19 +40,16 @@ export default class InstanceChart extends Chart<typeof schema> {
};
}
@autobind
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
return {};
}
@autobind
public async requestReceived(host: string): Promise<void> {
await this.commit({
'requests.received': 1,
}, toPuny(host));
}
@autobind
public async requestSent(host: string, isSucceeded: boolean): Promise<void> {
await this.commit({
'requests.succeeded': isSucceeded ? 1 : 0,
@ -62,7 +57,6 @@ export default class InstanceChart extends Chart<typeof schema> {
}, toPuny(host));
}
@autobind
public async newUser(host: string): Promise<void> {
await this.commit({
'users.total': 1,
@ -70,7 +64,6 @@ export default class InstanceChart extends Chart<typeof schema> {
}, toPuny(host));
}
@autobind
public async updateNote(host: string, note: Note, isAdditional: boolean): Promise<void> {
await this.commit({
'notes.total': isAdditional ? 1 : -1,
@ -83,7 +76,6 @@ export default class InstanceChart extends Chart<typeof schema> {
}, toPuny(host));
}
@autobind
public async updateFollowing(host: string, isAdditional: boolean): Promise<void> {
await this.commit({
'following.total': isAdditional ? 1 : -1,
@ -92,7 +84,6 @@ export default class InstanceChart extends Chart<typeof schema> {
}, toPuny(host));
}
@autobind
public async updateFollowers(host: string, isAdditional: boolean): Promise<void> {
await this.commit({
'followers.total': isAdditional ? 1 : -1,
@ -101,7 +92,6 @@ export default class InstanceChart extends Chart<typeof schema> {
}, toPuny(host));
}
@autobind
public async updateDrive(file: DriveFile, isAdditional: boolean): Promise<void> {
const fileSizeKb = file.size / 1000;
await this.commit({