import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs'; import { WitnessBase_V1 } from '../witness-base-v1.mjs'; import { IbGibSpace, IbGibSpaceData, IbGibSpaceOptionsCmd, IbGibSpaceOptionsCmdModifier, IbGibSpaceOptionsData, IbGibSpaceOptionsIbGib, IbGibSpaceOptionsRel8ns, IbGibSpaceRel8ns, IbGibSpaceResultData, IbGibSpaceResultIbGib, IbGibSpaceResultRel8ns } from './space-types.mjs'; import { IbGibCacheService } from '../../common/cache/cache-types.mjs'; export interface IbGibSpaceAny extends SpaceBase_V1 { } export declare abstract class SpaceBase_V1 = IbGibSpaceOptionsIbGib, TResultData extends IbGibSpaceResultData = IbGibSpaceResultData, TResultRel8ns extends IbGibSpaceResultRel8ns = IbGibSpaceResultRel8ns, TResultIbGib extends IbGibSpaceResultIbGib = IbGibSpaceResultIbGib, TData extends IbGibSpaceData = IbGibSpaceData, TRel8ns extends IbGibSpaceRel8ns = IbGibSpaceRel8ns> extends WitnessBase_V1 implements IbGibSpace { /** * Log context for convenience with logging. (Ignore if you don't want to use this.) */ protected lc: string; /** * Optional cache service. hmm... */ cacheSvc: IbGibCacheService | undefined; constructor(initialData?: TData, initialRel8ns?: TRel8ns); /** * In a Space, we are concerned with getting ibGibs out of and putting ibGibs into a "space". * * So in this base, we take the incoming arg and divert it multiple ways, depending on our settings. */ protected witnessImpl(arg: TOptionsIbGib): Promise; protected abstract persistOptsAndResultIbGibs({ arg, result }: { arg: TOptionsIbGib; result: TResultIbGib; }): Promise; /** * Routes the given `cmd` to the correct handling function in the space, * and executes that function. * * Override this if you have custom commands to handle. * Check for those first, and if not among them, call this * via `super.doCommand(...)`. If cmd is still not found, * this will throw. */ protected routeAndDoCommand({ cmd, cmdModifiers, arg, }: { cmd: IbGibSpaceOptionsCmd | string; cmdModifiers: (TCmdModifier | string)[]; arg: TOptionsIbGib; }): Promise; protected get(arg: TOptionsIbGib): Promise; protected abstract getImpl(arg: TOptionsIbGib): Promise; protected put(arg: TOptionsIbGib): Promise; protected abstract putImpl(arg: TOptionsIbGib): Promise; protected delete(arg: TOptionsIbGib): Promise; protected deleteImpl(arg: TOptionsIbGib): Promise; /** * Get all (public?) addrs in space. * * @optional method for space. * * @returns all addresses in space (that it wants to reveal). */ protected getAddrs(arg: TOptionsIbGib): Promise; protected getAddrsImpl(arg: TOptionsIbGib): Promise; /** * Get latest ibGibs for given ibGib addresses. * * Usually I pass in the tjp address(es) if I have them. * * @optional method for space. * * @returns latest ibGibs in timelines for each given ibgib address. */ protected getLatestIbGibs(arg: TOptionsIbGib): Promise; protected getLatestIbGibsImpl(arg: TOptionsIbGib): Promise; /** * Get latest addrs for given ibGib(s)/address(es). * * Usually I pass in the tjp address(es) if I have them. * * @optional method for space. * * @returns latest addrs in timelines for each given ibgib address. */ protected getLatestAddrs(arg: TOptionsIbGib): Promise; protected getLatestAddrsImpl(arg: TOptionsIbGib): Promise; /** * Get temporal junction point ibgibs for given ibgib(s) or address(es). * * @optional method for space. * * @returns tjp ibgib for each given ibgib/address. */ protected getTjpIbGibs(arg: TOptionsIbGib): Promise; protected getTjpIbGibsImpl(arg: TOptionsIbGib): Promise; /** * Get temporal junction point addr(s) for given ibgib(s) or address(es). * * @optional method for space. * * @returns tjp addrs in timelines for each given ibgib/address. */ protected getTjpAddrs(arg: TOptionsIbGib): Promise; protected getTjpAddrsImpl(arg: TOptionsIbGib): Promise; /** * Supposed to be a check on either authorization, accessibility, existence... * * @notimplementedyet */ protected canGet(arg: TOptionsIbGib): Promise; protected canGetImpl(arg: TOptionsIbGib): Promise; /** * Supposed to be a check on either authorization, accessibility, existence... * * @notimplementedyet */ protected canPut(arg: TOptionsIbGib): Promise; protected canPutImpl(arg: TOptionsIbGib): Promise; /** * Supposed to be a check on either authorization, accessibility, existence... * * @notimplementedyet */ protected canDelete(arg: TOptionsIbGib): Promise; protected canDeleteImpl(arg: TOptionsIbGib): Promise; /** * gets the entire dependency graph(s) of incoming addr(s). * * NOTE: Caller will have to manually convert the result.ibGibs to a flag * ibgib graph to match the existing {@link getDependencyGraph} return if * desired. This should be a trivial conversion though, as the keys to the * flat graph are just the {@link getIbGibAddr} on the ibGib itself. * * @returns resulty ibgib with {@link GetDependencyGraphResultData} */ protected getDependencyGraph(arg: TOptionsIbGib): Promise; /** * Default implementation of getDependencyGraph uses the helper function * {@link getDependencyGraph} in space-helpers.mts. * * Override this in subclasses for optimized behavior (e.g. Postgres). */ protected getDependencyGraphImpl(arg: TOptionsIbGib): Promise; /** * Centralized location for general argument validation for a given witness. * * In the case of spaces, this is where I usually put my common validation * for various cases on cmd+modifier combinations. * * @returns validation error string, empty if no errors. */ protected validateWitnessArg(arg: TOptionsIbGib): Promise; /** * builds an arg ibGib. * * wrapper convenience to avoid long generic calls. */ argy({ argData, ibMetadata, noTimestamp, ibGibs, }: { argData: TOptionsData; ibMetadata?: string; noTimestamp?: boolean; ibGibs?: TIbGib[]; }): Promise; /** * builds a result ibGib. * * wrapper convenience to avoid long generic calls. */ resulty({ resultData, ibGibs, }: { resultData: TResultData; ibGibs?: TIbGib[]; }): Promise; } //# sourceMappingURL=space-base-v1.d.mts.map