* feat: pnpm new * Refactor build and release workflows, update dependencies Switch build scripts and workflows from npm to pnpm, update build and artifact paths, and simplify release workflow by removing version detection and changelog steps. Add new dependencies (silk-wasm, express, ws, node-pty-prebuilt-multiarch), update exports in package.json files, and add vite config for napcat-framework. Also, rename manifest.json for framework package and fix static asset copying in shell build config.
26 lines
682 B
TypeScript
26 lines
682 B
TypeScript
import { NapProtoDecodeStructType } from '@napneko/nap-proto-core';
|
|
import { PacketMsgBuilder } from '@/napcat-core/packet/message/builder';
|
|
|
|
export type PacketBuf = Buffer & { readonly hexNya: unique symbol; };
|
|
|
|
export const PacketBufBuilder = (str: Uint8Array): PacketBuf => {
|
|
return Buffer.from(str) as PacketBuf;
|
|
};
|
|
|
|
export interface OidbPacket {
|
|
cmd: string;
|
|
data: PacketBuf;
|
|
}
|
|
|
|
export abstract class PacketTransformer<T> {
|
|
protected msgBuilder: PacketMsgBuilder;
|
|
|
|
constructor () {
|
|
this.msgBuilder = new PacketMsgBuilder();
|
|
}
|
|
|
|
abstract build (...args: any[]): OidbPacket | Promise<OidbPacket>;
|
|
|
|
abstract parse (data: Buffer): NapProtoDecodeStructType<T>;
|
|
}
|