/** * @module Subscription_V1 witness class * * this is where you will find the witness class that contains behavior * for the Subscription ibgib. * * A subscription can do two things from the caller's side: * * 1. unsubscribe * 2. give a boolean on whether it has been unsubscribed or not * * A subscription is created from a call to subscribe on an observable. Since * the observable is also a witness, we can have this subscription visit the * observable via `observable.witness(subscription)`. IOW, the subscription * witness ibgib is the argument to `witness` function. * * The observable will know that if a subscription visits it, then the * observable needs to release/unsubscribe that subscription. * * So since this is a light witness, we can just have two primitives be the * incoming argument ibgibs: unsubscribe^gib and unsubscribed^gib. */ import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs'; import { TransformResult } from '@ibgib/ts-gib/dist/types.mjs'; import { MetaspaceService } from '../../../witness/space/metaspace/metaspace-types.mjs'; import { DynamicFormFactoryBase } from '../../../witness/factory/dynamic-form-factory-base.mjs'; import { DynamicForm } from '../../form/form-items.mjs'; import { SubscriptionData_V1, SubscriptionRel8ns_V1, SubscriptionIbGib_V1, SubscriptionCmdData, SubscriptionCmdIbGib, SubscriptionResultData, SubscriptionResultIbGib, SubscriptionWitness } from './subscription-types.mjs'; import { LightWitnessBase_V1 } from '../../../witness/light-witness-base-v1.mjs'; /** * sketching... * under construction... */ export declare class Subscription_V1 extends LightWitnessBase_V1 implements SubscriptionIbGib_V1, SubscriptionWitness { /** * Log context for convenience with logging. (Ignore if you don't want to use this.) */ protected lc: string; /** * Reference to the local ibgibs service, which is one way at getting at the * local user space. */ metaspace: MetaspaceService | undefined; /** * this is UNDEFINED if we have not yet subscribed. * * this is only true AFTER we have subscribed. * * this is FALSE after we have subscribed AND THEN UNSUBSCRIBED. */ private _subscribed; /** * this is not !this._subscribed!!! * * this is only true AFTER we have subscribed and then unsubscribed. */ private _unsubscribed; /** * this is the observable */ private _srcObservable; constructor(initialData?: SubscriptionData_V1, initialRel8ns?: SubscriptionRel8ns_V1); protected initialize(): Promise; /** * * @param arg * @returns */ witness(arg: IbGib_V1): Promise; private witness_unsubscribe; private witness_observable; private witness_unsubscribed; /** * unsubscribe a subscriber of an observable via this subscription. */ unsubscribe(): Promise; /** * (async) flag to indicate if a subscription is still active or not. * * @returns `true` if we have unsubscribed/deactivated this subscription, `false` if this subscription is still active */ unsubscribed(): Promise; /** * validates against common witness qualities. * * Override this with a call to `super.validateThis` for custom validation * for descending witness classes. * * @returns validation errors common to all subscription witnesses, if any errors exist. */ protected validateThis(): Promise; /** * builds an arg ibGib. * * wrapper convenience to avoid long generic calls. */ argy({ argData, ibMetadata, noTimestamp, ibGibs, }: { argData: SubscriptionCmdData; ibMetadata?: string; noTimestamp?: boolean; ibGibs?: IbGib_V1[]; }): Promise; /** * builds a result ibGib, if indeed a result ibgib is required. * * This is only useful in witnesses 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({ resultData, ibGibs, }: { resultData: SubscriptionResultData; ibGibs?: IbGib_V1[]; }): Promise; } /** * factory for random Subscription witness. * * @see {@link DynamicFormFactoryBase} */ export declare class Subscription_V1_Factory extends DynamicFormFactoryBase { protected lc: string; getName(): string; newUp({ data, rel8ns, }: { data?: SubscriptionData_V1; rel8ns?: SubscriptionRel8ns_V1; }): Promise>; witnessToForm({ witness }: { witness: Subscription_V1; }): Promise; formToWitness({ form }: { form: DynamicForm; }): Promise>; } //# sourceMappingURL=subscription-v1.d.mts.map