import { IbGib_V1, IbGibRel8ns_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs'; import { AppData_V1, AppRel8ns_V1, AppIbGib_V1, AppCmdData, AppCmdRel8ns, AppCmdIbGib, AppResultData, AppResultRel8ns, AppResultIbGib } from './app-types.mjs'; import { CommentIbGib_V1 } from '../../common/comment/comment-types.mjs'; import { PicIbGib_V1 } from '../../common/pic/pic-types.mjs'; import { ErrorIbGib_V1 } from '../../common/error/error-types.mjs'; import { WitnessWithContextBase_V1 } from '../witness-with-context/witness-with-context-base-v1.mjs'; /** * ## distinguishing characteristics of apps * * So for example, one of the simplest apps is one which * ... * * ## architecture * * ... */ export declare abstract class AppBase_V1 = IbGib_V1, TResultData extends any = any, TResultRel8ns extends IbGibRel8ns_V1 = IbGibRel8ns_V1, TResultIbGib extends IbGib_V1 | ErrorIbGib_V1 = IbGib_V1, TData extends AppData_V1 = AppData_V1, TRel8ns extends AppRel8ns_V1 = AppRel8ns_V1> extends WitnessWithContextBase_V1 implements AppIbGib_V1 { /** * Log context for convenience with logging. (Ignore if you don't want to use this.) */ protected lc: string; constructor(initialData?: TData, initialRel8ns?: TRel8ns); /** * At this point in time, the arg has already been intrinsically validated, * as well as the internal state of this app. so whatever this app's * function is, it should be good to go. * * In the base class, this just returns {@link routeAndDoArg}. If you don't * want to route, then override this. */ protected witnessImpl(arg: TOptionsIbGib): Promise; /** * Base routing executes different if incoming is a cmd options arg, i.e., * if the `data.cmd` is truthy (atow). {@link isArg} is expected to be true * at this point. If not, logs an error, **but does not throw**, and returns * undefined. * * Default routing checks arg for command, or if not, checks if comment/pic. * If neither of those, then returns undefined atow. * * Override this function to create more advanced custom routing. * * ## notes * * In general, an app ibgib acts more like a normal application in that it * accepts commands and not requests. Robbots are more geared to requests, * handled semantically. * * @see {@link isArg} * @see {@link doCmdArg} * @see {@link doDefault}. */ protected routeAndDoArg({ arg, }: { arg: TOptionsIbGib; }): Promise; /** * By default, this routes to {@link doCmdIb}, {@link doCmdGib} & {@link * doCmdIbgib}. This is largely to limit scope of responsibility of app to * basic functions. But this is not a concrete rule written in stone. * * You can always override this and route to other commands before calling * this with `super.doCmdArg` as a fallback (if you still want to use this * function.) * * Note that this @throws an error if the data.cmd is not recognized. In this * implementation, this occurs if it isn't an ib/gib/ibgib _command_. */ protected doCmdArg({ arg, }: { arg: AppCmdIbGib, AppCmdRel8ns>; }): Promise; protected doCmdIb({ arg, }: { arg: IbGib_V1; }): Promise; protected doCmdGib({ arg, }: { arg: IbGib_V1; }): Promise; protected doCmdIbgib({ arg, }: { arg: IbGib_V1; }): Promise; /** * Stubbed in base class for convenience. Doesn't have to be implemented. */ protected doPic({ ibGib, }: { ibGib: PicIbGib_V1; }): Promise; /** * Stubbed in base class for convenience. Doesn't have to be implemented. */ protected doComment({ ibGib, }: { ibGib: CommentIbGib_V1; }): Promise; protected doNonArg({ ibGib, }: { ibGib: IbGib_V1; }): Promise; /** * Stubbed in base class for convenience. Doesn't have to be implemented. */ protected doDefault({ ibGib, }: { ibGib: IbGib_V1; }): Promise; /** * validates against common app qualities. * * Override this with a call to `super.validateThis` for custom validation * for descending app classes. * * @returns validation errors common to all apps, if any errors exist. */ protected validateThis(): Promise; /** * builds an arg ibGib. * * wrapper convenience to avoid long generic calls. */ argy = AppCmdData, TCmdOptionsRel8ns extends AppCmdRel8ns = AppCmdRel8ns, TCmdOptionsIbGib extends AppCmdIbGib = AppCmdIbGib>({ argData, ibMetadata, noTimestamp, ibGibs, }: { argData: TCmdOptionsData; ibMetadata?: string; noTimestamp?: boolean; ibGibs?: IbGib_V1[]; }): Promise; /** * builds a result ibGib, if indeed a result ibgib is required. * * This is only useful in apps that have more structured inputs/outputs. * For those that simply accept any ibgib incoming and return a * primitive like ib^gib or whatever, then this is unnecessary. * * wrapper convenience to avoid long generic calls. */ resulty = AppResultIbGib>({ resultData, ibGibs, }: { resultData: TResultData; ibGibs?: IbGib_V1[]; }): Promise; } export interface IbGibAppAny extends AppBase_V1 { } //# sourceMappingURL=app-base-v1.d.mts.map