cnpmcore
Version:
37 lines (36 loc) • 1.78 kB
TypeScript
import { HookEventType } from '../../common/enum/Hook';
export interface PublishChangePayload {
'dist-tag'?: string;
version: string;
}
export interface UnpublishChangePayload {
'dist-tag'?: string;
version?: string;
}
export interface DistTagChangePayload {
'dist-tag': string;
}
export interface PackageOwnerPayload {
maintainer: string;
}
export interface DeprecatedChangePayload {
deprecated: string;
}
export declare class HookEvent<T = object> {
readonly changeId: string;
readonly event: HookEventType;
readonly fullname: string;
readonly type: 'package';
readonly version: '1.0.0';
readonly change: T;
readonly time: number;
constructor(event: HookEventType, changeId: string, fullname: string, change: T);
static createPublishEvent(fullname: string, changeId: string, version: string, distTag?: string): HookEvent<PublishChangePayload>;
static createUnpublishEvent(fullname: string, changeId: string, version?: string, distTag?: string): HookEvent<UnpublishChangePayload>;
static createOwnerEvent(fullname: string, changeId: string, maintainer: string): HookEvent<PackageOwnerPayload>;
static createOwnerRmEvent(fullname: string, changeId: string, maintainer: string): HookEvent<PackageOwnerPayload>;
static createDistTagEvent(fullname: string, changeId: string, distTag: string): HookEvent<DistTagChangePayload>;
static createDistTagRmEvent(fullname: string, changeId: string, distTag: string): HookEvent<DistTagChangePayload>;
static createDeprecatedEvent(fullname: string, changeId: string, deprecated: string): HookEvent<DeprecatedChangePayload>;
static createUndeprecatedEvent(fullname: string, changeId: string, deprecated: string): HookEvent<DeprecatedChangePayload>;
}