UNPKG

@lcap/nasl

Version:

NetEase Application Specific Language

83 lines 2.33 kB
import type { App } from '@lcap/nasl-concepts'; import type { NaslServer } from '../../server/naslServer'; import type { InstructAction, InstructStatus } from '../storage/types'; export { Instruct, Operation, InstructAction, } from '../storage/types'; /** 规则判定状态 */ export declare enum InstructState { /** * 初始化 * * @description 初始状态,刚打开的新应用,此时无论如何首次发布都会发后端。 */ Initial = 0, /** * 刚发布 * * @description 刚进行了发布,未做任何修改,此时发布将会完全跳过。 */ DeploymentRightNow = 1, /** * 只有纯前端修改 * * @description 到目前为止,只有纯前端修改,允许跳过后端 */ PureFrontendModify = 2, /** * 包含后端修改 * * @description 修改中包括后端修改,下次发布将会包括后端 */ HasBackendModify = 3 } /** 发布状态 */ export declare enum DeploymentState { /** 未发布 */ NotDeployment = 0, /** 普通发布中 */ NormalDeploying = 1, /** 单页面发布中 */ PreviewDeploying = 2 } export interface RuleContext { app: App; naslServer: NaslServer; } export interface RuleContextWithStatus extends RuleContext { instructStatus: InstructStatus; } export interface RuleContextWithAction extends RuleContextWithStatus { actions: InstructAction[]; } export declare enum RuleResult { /** 前端修改 */ Frontend = 0, /** 后端修改 */ Backend = 1, /** 不匹配当前规则 */ UnMatch = 2 } export interface Rule { /** 规则名称 */ name: string; /** * IDE 初始化时 */ afterInit?(context: Omit<RuleContextWithStatus, 'naslServer'>): void | Promise<void>; /** * Nasl 变更时的判定规则 */ afterInstruct?(action: InstructAction, context: RuleContextWithStatus): RuleResult | Promise<RuleResult>; /** * 发布前 */ beforeDeploy?(context: RuleContext): RuleResult | Promise<RuleResult>; /** * 发布成功 */ afterSuccessDeploy?(context: RuleContext): void | Promise<void>; /** * 发布失败 */ afterFailDeploy?(context: RuleContext): void | Promise<void>; } //# sourceMappingURL=types.d.ts.map