Skip to content

Commit

Permalink
chore: dup clz name
Browse files Browse the repository at this point in the history
  • Loading branch information
elrrrrrrr committed Oct 10, 2024
1 parent e6ed221 commit e6c0932
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
22 changes: 11 additions & 11 deletions app/core/event/CacheCleaner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,77 +24,77 @@ class CacheCleanerEvent {
}

@Event(PACKAGE_UNPUBLISHED)
export class PackageUnpublished extends CacheCleanerEvent {
export class PackageUnpublishedCacheCleanEvent extends CacheCleanerEvent {
async handle(fullname: string) {
await this.removeCache(fullname);
}
}

@Event(PACKAGE_BLOCKED)
export class PackageBlocked extends CacheCleanerEvent {
export class PackageBlockedCacheCleanEvent extends CacheCleanerEvent {
async handle(fullname: string) {
await this.removeCache(fullname);
}
}

@Event(PACKAGE_UNBLOCKED)
export class PackageUnblocked extends CacheCleanerEvent {
export class PackageUnblockedCacheCleanEvent extends CacheCleanerEvent {
async handle(fullname: string) {
await this.removeCache(fullname);
}
}

@Event(PACKAGE_VERSION_ADDED)
export class PackageVersionAdded extends CacheCleanerEvent {
export class PackageVersionAddedCacheCleanEvent extends CacheCleanerEvent {
async handle(fullname: string) {
await this.removeCache(fullname);
}
}

@Event(PACKAGE_VERSION_REMOVED)
export class PackageVersionRemoved extends CacheCleanerEvent {
export class PackageVersionRemovedCacheCleanEvent extends CacheCleanerEvent {
async handle(fullname: string) {
await this.removeCache(fullname);
}
}

@Event(PACKAGE_TAG_ADDED)
export class PackageTagAdded extends CacheCleanerEvent {
export class PackageTagAddedCacheCleanEvent extends CacheCleanerEvent {
async handle(fullname: string) {
await this.removeCache(fullname);
}
}

@Event(PACKAGE_TAG_CHANGED)
export class PackageTagChanged extends CacheCleanerEvent {
export class PackageTagChangedCacheCleanEvent extends CacheCleanerEvent {
async handle(fullname: string) {
await this.removeCache(fullname);
}
}

@Event(PACKAGE_TAG_REMOVED)
export class PackageTagRemoved extends CacheCleanerEvent {
export class PackageTagRemovedCacheCleanEvent extends CacheCleanerEvent {
async handle(fullname: string) {
await this.removeCache(fullname);
}
}

@Event(PACKAGE_MAINTAINER_CHANGED)
export class PackageMaintainerChanged extends CacheCleanerEvent {
export class PackageMaintainerChangedCacheCleanEvent extends CacheCleanerEvent {
async handle(fullname: string) {
await this.removeCache(fullname);
}
}

@Event(PACKAGE_MAINTAINER_REMOVED)
export class PackageMaintainerRemoved extends CacheCleanerEvent {
export class PackageMaintainerRemovedCacheCleanEvent extends CacheCleanerEvent {
async handle(fullname: string) {
await this.removeCache(fullname);
}
}

@Event(PACKAGE_META_CHANGED)
export class PackageMetaChanged extends CacheCleanerEvent {
export class PackageMetaChangedCacheCleanEvent extends CacheCleanerEvent {
async handle(fullname: string) {
await this.removeCache(fullname);
}
Expand Down
18 changes: 9 additions & 9 deletions app/core/event/ChangesStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ChangesStreamEvent {
}

@Event(PACKAGE_UNPUBLISHED)
export class PackageUnpublished extends ChangesStreamEvent {
export class PackageUnpublishedChangesStreamEvent extends ChangesStreamEvent {
async handle(fullname: string) {
const change = await this.addChange(PACKAGE_UNPUBLISHED, fullname, {});
if (this.hookEnable) {
Expand All @@ -55,7 +55,7 @@ export class PackageUnpublished extends ChangesStreamEvent {
}

@Event(PACKAGE_VERSION_ADDED)
export class PackageVersionAdded extends ChangesStreamEvent {
export class PackageVersionAddedChangesStreamEvent extends ChangesStreamEvent {
async handle(fullname: string, version: string, tag?: string) {
const change = await this.addChange(PACKAGE_VERSION_ADDED, fullname, { version });
if (this.hookEnable) {
Expand All @@ -66,7 +66,7 @@ export class PackageVersionAdded extends ChangesStreamEvent {
}

@Event(PACKAGE_VERSION_REMOVED)
export class PackageVersionRemoved extends ChangesStreamEvent {
export class PackageVersionRemovedChangesStreamEvent extends ChangesStreamEvent {
async handle(fullname: string, version: string, tag?: string) {
const change = await this.addChange(PACKAGE_VERSION_REMOVED, fullname, { version });
if (this.hookEnable) {
Expand All @@ -77,7 +77,7 @@ export class PackageVersionRemoved extends ChangesStreamEvent {
}

@Event(PACKAGE_TAG_ADDED)
export class PackageTagAdded extends ChangesStreamEvent {
export class PackageTagAddedChangesStreamEvent extends ChangesStreamEvent {
async handle(fullname: string, tag: string) {
const change = await this.addChange(PACKAGE_TAG_ADDED, fullname, { tag });
if (this.hookEnable) {
Expand All @@ -88,7 +88,7 @@ export class PackageTagAdded extends ChangesStreamEvent {
}

@Event(PACKAGE_TAG_CHANGED)
export class PackageTagChanged extends ChangesStreamEvent {
export class PackageTagChangedChangesStreamEvent extends ChangesStreamEvent {
async handle(fullname: string, tag: string) {
const change = await this.addChange(PACKAGE_TAG_CHANGED, fullname, { tag });
if (this.hookEnable) {
Expand All @@ -99,7 +99,7 @@ export class PackageTagChanged extends ChangesStreamEvent {
}

@Event(PACKAGE_TAG_REMOVED)
export class PackageTagRemoved extends ChangesStreamEvent {
export class PackageTagRemovedChangesStreamEvent extends ChangesStreamEvent {
async handle(fullname: string, tag: string) {
const change = await this.addChange(PACKAGE_TAG_REMOVED, fullname, { tag });
if (this.hookEnable) {
Expand All @@ -110,7 +110,7 @@ export class PackageTagRemoved extends ChangesStreamEvent {
}

@Event(PACKAGE_MAINTAINER_CHANGED)
export class PackageMaintainerChanged extends ChangesStreamEvent {
export class PackageMaintainerChangedChangesStreamEvent extends ChangesStreamEvent {
async handle(fullname: string, maintainers: User[]) {
const change = await this.addChange(PACKAGE_MAINTAINER_CHANGED, fullname, {});
// TODO 应该比较差值,而不是全量推送
Expand All @@ -124,7 +124,7 @@ export class PackageMaintainerChanged extends ChangesStreamEvent {
}

@Event(PACKAGE_MAINTAINER_REMOVED)
export class PackageMaintainerRemoved extends ChangesStreamEvent {
export class PackageMaintainerRemovedChangesStreamEvent extends ChangesStreamEvent {
async handle(fullname: string, maintainer: string) {
const change = await this.addChange(PACKAGE_MAINTAINER_REMOVED, fullname, { maintainer });
if (this.hookEnable) {
Expand All @@ -135,7 +135,7 @@ export class PackageMaintainerRemoved extends ChangesStreamEvent {
}

@Event(PACKAGE_META_CHANGED)
export class PackageMetaChanged extends ChangesStreamEvent {
export class PackageMetaChangedChangesStreamEvent extends ChangesStreamEvent {
async handle(fullname: string, meta: PackageMetaChange) {
const change = await this.addChange(PACKAGE_META_CHANGED, fullname, { ...meta });
const { deprecateds } = meta;
Expand Down
2 changes: 1 addition & 1 deletion app/core/event/StoreManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class StoreManifestEvent {
}

@Event(PACKAGE_VERSION_ADDED)
export class PackageVersionAdded extends StoreManifestEvent {
export class PackageVersionAddedStoreManifestEvent extends StoreManifestEvent {
async handle(fullname: string, version: string) {
await this.savePackageVersionManifest(fullname, version);
}
Expand Down
4 changes: 2 additions & 2 deletions app/core/event/SyncESPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SyncESPackage {

@Event(PACKAGE_UNPUBLISHED)
@Event(PACKAGE_BLOCKED)
export class PackageUnpublished extends SyncESPackage {
export class PackageUnpublishedSyncESEvent extends SyncESPackage {
async handle(fullname: string) {
if (!this.config.cnpmcore.enableElasticsearch) return;
await this.packageSearchService.removePackage(fullname);
Expand All @@ -49,7 +49,7 @@ export class PackageUnpublished extends SyncESPackage {
@Event(PACKAGE_MAINTAINER_CHANGED)
@Event(PACKAGE_MAINTAINER_REMOVED)
@Event(PACKAGE_UNBLOCKED)
export class PackageVersionAdded extends SyncESPackage {
export class PackageVersionAddedSyncESEvent extends SyncESPackage {
async handle(fullname: string) {
await this.syncPackage(fullname);
}
Expand Down
4 changes: 2 additions & 2 deletions app/core/event/SyncPackageVersionFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ class SyncPackageVersionFileEvent {
}

@Event(PACKAGE_VERSION_ADDED)
export class PackageVersionAdded extends SyncPackageVersionFileEvent {
export class PackageVersionAddedSyncPackageVersionFileEvent extends SyncPackageVersionFileEvent {
async handle(fullname: string, version: string) {
await this.syncPackageVersionFile(fullname, version);
}
}

@Event(PACKAGE_TAG_ADDED)
export class PackageTagAdded extends SyncPackageVersionFileEvent {
export class PackageTagAddedSyncPackageVersionFileEvent extends SyncPackageVersionFileEvent {
async handle(fullname: string, tag: string) {
if (tag !== 'latest') return;
await this.syncPackageReadmeToLatestVersion(fullname);
Expand Down
4 changes: 2 additions & 2 deletions test/core/event/ChangesStream.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { PackageVersionAdded } from '../../../app/core/event/ChangesStream';
import { PackageVersionAddedChangesStreamEvent } from '../../../app/core/event/ChangesStream';
import { app, mock } from 'egg-mock/bootstrap';

describe('test/core/event/BugVersionFixHandler.test.ts', () => {
let packageVersionAdded: PackageVersionAdded;

before(async () => {
packageVersionAdded = await app.getEggObject(PackageVersionAdded);
packageVersionAdded = await app.getEggObject(PackageVersionAddedChangesStreamEvent);
});

it('should trigger hook', async () => {
Expand Down

0 comments on commit e6c0932

Please sign in to comment.