This commit is contained in:
syuilo
2021-12-09 23:58:30 +09:00
parent 0abe2dfee0
commit c69b72e199
573 changed files with 3318 additions and 3318 deletions

View File

@ -37,11 +37,11 @@ export default class ActiveUsersChart extends Chart<ActiveUsersLog> {
@autobind
public async update(user: { id: User['id'], host: User['host'] }) {
const update: Obj = {
users: [user.id]
users: [user.id],
};
await this.inc({
[Users.isLocalUser(user) ? 'local' : 'remote']: update
[Users.isLocalUser(user) ? 'local' : 'remote']: update,
});
}
}

View File

@ -23,7 +23,7 @@ export default class DriveChart extends Chart<DriveLog> {
remote: {
totalCount: latest.remote.totalCount,
totalSize: latest.remote.totalSize,
}
},
};
}
@ -55,7 +55,7 @@ export default class DriveChart extends Chart<DriveLog> {
DriveFiles.count({ userHost: null }),
DriveFiles.count({ userHost: Not(IsNull()) }),
DriveFiles.calcDriveUsageOfLocal(),
DriveFiles.calcDriveUsageOfRemote()
DriveFiles.calcDriveUsageOfRemote(),
]);
return {
@ -66,7 +66,7 @@ export default class DriveChart extends Chart<DriveLog> {
remote: {
totalCount: remoteCount,
totalSize: remoteSize,
}
},
};
}
@ -85,7 +85,7 @@ export default class DriveChart extends Chart<DriveLog> {
}
await this.inc({
[file.userHost === null ? 'local' : 'remote']: update
[file.userHost === null ? 'local' : 'remote']: update,
});
}
}

View File

@ -16,7 +16,7 @@ export default class FederationChart extends Chart<FederationLog> {
return {
instance: {
total: latest.instance.total,
}
},
};
}
@ -34,13 +34,13 @@ export default class FederationChart extends Chart<FederationLog> {
@autobind
protected async fetchActual(): Promise<DeepPartial<FederationLog>> {
const [total] = await Promise.all([
Instances.count({})
Instances.count({}),
]);
return {
instance: {
total: total,
}
},
};
}
@ -56,7 +56,7 @@ export default class FederationChart extends Chart<FederationLog> {
}
await this.inc({
instance: update
instance: update,
});
}
}

View File

@ -37,11 +37,11 @@ export default class HashtagChart extends Chart<HashtagLog> {
@autobind
public async update(hashtag: string, user: { id: User['id'], host: User['host'] }) {
const update: Obj = {
users: [user.id]
users: [user.id],
};
await this.inc({
[Users.isLocalUser(user) ? 'local' : 'remote']: update
[Users.isLocalUser(user) ? 'local' : 'remote']: update,
}, hashtag);
}
}

View File

@ -32,7 +32,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
drive: {
totalFiles: latest.drive.totalFiles,
totalUsage: latest.drive.totalUsage,
}
},
};
}
@ -114,7 +114,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
drive: {
totalFiles: driveFiles,
totalUsage: driveUsage,
}
},
};
}
@ -122,8 +122,8 @@ export default class InstanceChart extends Chart<InstanceLog> {
public async requestReceived(host: string) {
await this.inc({
requests: {
received: 1
}
received: 1,
},
}, toPuny(host));
}
@ -138,7 +138,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
}
await this.inc({
requests: update
requests: update,
}, toPuny(host));
}
@ -147,8 +147,8 @@ export default class InstanceChart extends Chart<InstanceLog> {
await this.inc({
users: {
total: 1,
inc: 1
}
inc: 1,
},
}, toPuny(host));
}
@ -169,8 +169,8 @@ export default class InstanceChart extends Chart<InstanceLog> {
total: isAdditional ? 1 : -1,
inc: isAdditional ? 1 : 0,
dec: isAdditional ? 0 : 1,
diffs: diffs
}
diffs: diffs,
},
}, toPuny(host));
}
@ -181,7 +181,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
total: isAdditional ? 1 : -1,
inc: isAdditional ? 1 : 0,
dec: isAdditional ? 0 : 1,
}
},
}, toPuny(host));
}
@ -192,7 +192,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
total: isAdditional ? 1 : -1,
inc: isAdditional ? 1 : 0,
dec: isAdditional ? 0 : 1,
}
},
}, toPuny(host));
}
@ -211,7 +211,7 @@ export default class InstanceChart extends Chart<InstanceLog> {
}
await this.inc({
drive: update
drive: update,
}, file.userHost);
}
}

View File

@ -37,7 +37,7 @@ export default class NetworkChart extends Chart<NetworkLog> {
incomingRequests: incomingRequests,
totalTime: time,
incomingBytes: incomingBytes,
outgoingBytes: outgoingBytes
outgoingBytes: outgoingBytes,
};
await this.inc(inc);

View File

@ -21,7 +21,7 @@ export default class NotesChart extends Chart<NotesLog> {
},
remote: {
total: latest.remote.total,
}
},
};
}
@ -55,7 +55,7 @@ export default class NotesChart extends Chart<NotesLog> {
protected async fetchActual(): Promise<DeepPartial<NotesLog>> {
const [localCount, remoteCount] = await Promise.all([
Notes.count({ userHost: null }),
Notes.count({ userHost: Not(IsNull()) })
Notes.count({ userHost: Not(IsNull()) }),
]);
return {
@ -64,14 +64,14 @@ export default class NotesChart extends Chart<NotesLog> {
},
remote: {
total: remoteCount,
}
},
};
}
@autobind
public async update(note: Note, isAdditional: boolean) {
const update: Obj = {
diffs: {}
diffs: {},
};
update.total = isAdditional ? 1 : -1;
@ -91,7 +91,7 @@ export default class NotesChart extends Chart<NotesLog> {
}
await this.inc({
[note.userHost === null ? 'local' : 'remote']: update
[note.userHost === null ? 'local' : 'remote']: update,
});
}
}

View File

@ -36,7 +36,7 @@ export default class PerUserDriveChart extends Chart<PerUserDriveLog> {
protected async fetchActual(group: string): Promise<DeepPartial<PerUserDriveLog>> {
const [count, size] = await Promise.all([
DriveFiles.count({ userId: group }),
DriveFiles.calcDriveUsageOf(group)
DriveFiles.calcDriveUsageOf(group),
]);
return {

View File

@ -22,7 +22,7 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
},
followers: {
total: latest.local.followers.total,
}
},
},
remote: {
followings: {
@ -30,8 +30,8 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
},
followers: {
total: latest.remote.followers.total,
}
}
},
},
};
}
@ -71,12 +71,12 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
localFollowingsCount,
localFollowersCount,
remoteFollowingsCount,
remoteFollowersCount
remoteFollowersCount,
] = await Promise.all([
Followings.count({ followerId: group, followeeHost: null }),
Followings.count({ followeeId: group, followerHost: null }),
Followings.count({ followerId: group, followeeHost: Not(IsNull()) }),
Followings.count({ followeeId: group, followerHost: Not(IsNull()) })
Followings.count({ followeeId: group, followerHost: Not(IsNull()) }),
]);
return {
@ -86,7 +86,7 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
},
followers: {
total: localFollowersCount,
}
},
},
remote: {
followings: {
@ -94,8 +94,8 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
},
followers: {
total: remoteFollowersCount,
}
}
},
},
};
}
@ -112,10 +112,10 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
}
this.inc({
[Users.isLocalUser(follower) ? 'local' : 'remote']: { followings: update }
[Users.isLocalUser(follower) ? 'local' : 'remote']: { followings: update },
}, follower.id);
this.inc({
[Users.isLocalUser(followee) ? 'local' : 'remote']: { followers: update }
[Users.isLocalUser(followee) ? 'local' : 'remote']: { followers: update },
}, followee.id);
}
}

View File

@ -48,7 +48,7 @@ export default class PerUserNotesChart extends Chart<PerUserNotesLog> {
@autobind
public async update(user: { id: User['id'] }, note: Note, isAdditional: boolean) {
const update: Obj = {
diffs: {}
diffs: {},
};
update.total = isAdditional ? 1 : -1;

View File

@ -38,7 +38,7 @@ export default class PerUserReactionsChart extends Chart<PerUserReactionsLog> {
@autobind
public async update(user: { id: User['id'], host: User['host'] }, note: Note) {
this.inc({
[Users.isLocalUser(user) ? 'local' : 'remote']: { count: 1 }
[Users.isLocalUser(user) ? 'local' : 'remote']: { count: 1 },
}, note.userId);
}
}

View File

@ -52,7 +52,7 @@ export default class TestGroupedChart extends Chart<TestGroupedLog> {
this.total[group]++;
await this.inc({
foo: update
foo: update,
}, group);
}
}

View File

@ -30,7 +30,7 @@ export default class TestUniqueChart extends Chart<TestUniqueLog> {
@autobind
public async uniqueIncrement(key: string) {
await this.inc({
foo: [key]
foo: [key],
});
}
}

View File

@ -50,7 +50,7 @@ export default class TestChart extends Chart<TestLog> {
this.total++;
await this.inc({
foo: update
foo: update,
});
}
@ -63,7 +63,7 @@ export default class TestChart extends Chart<TestLog> {
this.total--;
await this.inc({
foo: update
foo: update,
});
}
}

View File

@ -21,7 +21,7 @@ export default class UsersChart extends Chart<UsersLog> {
},
remote: {
total: latest.remote.total,
}
},
};
}
@ -45,7 +45,7 @@ export default class UsersChart extends Chart<UsersLog> {
protected async fetchActual(): Promise<DeepPartial<UsersLog>> {
const [localCount, remoteCount] = await Promise.all([
Users.count({ host: null }),
Users.count({ host: Not(IsNull()) })
Users.count({ host: Not(IsNull()) }),
]);
return {
@ -54,7 +54,7 @@ export default class UsersChart extends Chart<UsersLog> {
},
remote: {
total: remoteCount,
}
},
};
}
@ -70,7 +70,7 @@ export default class UsersChart extends Chart<UsersLog> {
}
await this.inc({
[Users.isLocalUser(user) ? 'local' : 'remote']: update
[Users.isLocalUser(user) ? 'local' : 'remote']: update,
});
}
}

View File

@ -8,7 +8,7 @@ export const logSchema = {
items: {
type: 'string' as const,
optional: false as const, nullable: false as const,
}
},
},
};
@ -22,14 +22,14 @@ export const schema = {
local: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
remote: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
}
},
};
export const name = 'activeUsers';

View File

@ -55,14 +55,14 @@ export const schema = {
local: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
remote: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
}
},
};
export const name = 'drive';

View File

@ -21,9 +21,9 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
}
}
},
},
},
};
export const name = 'federation';

View File

@ -8,7 +8,7 @@ export const logSchema = {
items: {
type: 'string' as const,
optional: false as const, nullable: false as const,
}
},
},
};
@ -22,14 +22,14 @@ export const schema = {
local: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
remote: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
}
},
};
export const name = 'hashtag';

View File

@ -21,7 +21,7 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
},
notes: {
@ -59,9 +59,9 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
},
}
},
},
users: {
@ -80,7 +80,7 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
},
following: {
@ -99,7 +99,7 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
},
followers: {
@ -118,7 +118,7 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
},
drive: {
@ -149,9 +149,9 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
},
}
},
};
export const name = 'instance';

View File

@ -25,7 +25,7 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
};
export const name = 'network';

View File

@ -32,7 +32,7 @@ const logSchema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
},
};
@ -43,14 +43,14 @@ export const schema = {
local: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
remote: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
}
},
};
export const name = 'notes';

View File

@ -49,7 +49,7 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
};
export const name = 'perUserDrive';

View File

@ -29,7 +29,7 @@ export const logSchema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
},
/**
@ -62,7 +62,7 @@ export const logSchema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
},
};
@ -73,14 +73,14 @@ export const schema = {
local: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
remote: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
}
},
};
export const name = 'perUserFollowing';

View File

@ -35,9 +35,9 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
},
},
}
},
};
export const name = 'perUserNotes';

View File

@ -18,14 +18,14 @@ export const schema = {
local: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
remote: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
}
},
};
export const name = 'perUserReaction';

View File

@ -20,9 +20,9 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
}
}
},
},
},
};
export const name = 'testGrouped';

View File

@ -8,9 +8,9 @@ export const schema = {
items: {
type: 'string' as const,
optional: false as const, nullable: false as const,
}
},
},
}
},
};
export const name = 'testUnique';

View File

@ -20,9 +20,9 @@ export const schema = {
type: 'number' as const,
optional: false as const, nullable: false as const,
},
}
}
}
},
},
},
};
export const name = 'test';

View File

@ -31,14 +31,14 @@ export const schema = {
local: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
remote: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: logSchema
properties: logSchema,
},
}
},
};
export const name = 'users';