@hank.chat/types
Version:
87 lines (86 loc) • 3.17 kB
TypeScript
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { AccessCheckChain } from "../access_check/access_check";
import { Argument } from "./argument";
import { Command } from "./command";
import { EscalatedPrivilege } from "./escalated_privilege";
/** Metadata for a plugin. */
export interface Metadata {
/** The plguins name. */
name: string;
/** A short description of the plugin. */
description: string;
/**
* A version string for the plugin. Should follow semver.
*
* @see: https://semver.org/
*/
version: string;
/**
* When true, a SQLite3 database will be created for the plugin.
* @deprecated All plugins get a database by default now.
*/
database: boolean;
/**
* Access checks
*
* All functionality of this plugin can optionally be gated by accses checks.
*/
accessChecks?: AccessCheckChain | undefined;
/**
* A secret escalation key that grants this plugin specific escalated
* privileges.
*/
escalationKey?: string | undefined;
/** A list of escalated privileges that this plugin requests to use. */
escalatedPrivileges: EscalatedPrivilege[];
/** The author of the plugin. */
author: string;
/** Whether or not this plugin handles commands. */
handlesCommands: boolean;
/** Whether or not this plugin handles messages. */
handlesMessages: boolean;
/** Optionally override the plugin command name. */
commandName?: string | undefined;
/** Optional aliases for the plugin command. */
aliases: string[];
/** Arguments for the plugin command. */
arguments: Argument[];
/** Plugin subcommands. */
subcommands: Command[];
/** Hosts that this plugin requests permissions to access via HTTP. */
allowedHosts: string[];
/** Pool size this plugin requests. */
poolSize?: number | undefined;
/**
* Show help if no args are passed to the plugin command.
*
* NOTE: Subcommands count as arguments.
*/
argRequiredElseHelp: boolean;
}
export declare const Metadata: MessageFns<Metadata>;
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
$case: string;
value: unknown;
} ? {
$case: T["$case"];
value?: DeepPartial<T["value"]>;
} : T extends {} ? {
[K in keyof T]?: DeepPartial<T[K]>;
} : Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
type Exact<P, I extends P> = P extends Builtin ? P : P & {
[K in keyof P]: Exact<P[K], I[K]>;
} & {
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
};
interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
export {};