import { CoValueUniqueness } from "cojson"; import { Account, AnyZodOrCoValueSchema, BranchDefinition, CoFeed, Group, Settled, RefsToResolve, RefsToResolveStrict, Resolved, SubscribeCallback, SubscribeListenerOptions, type Schema, CoValueCreateOptions, LoadCoValueCursorOption } from "../../../internal.js"; import { AnonymousJazzAgent } from "../../anonymousJazzAgent.js"; import { CoFeedSchemaInit } from "../typeConverters/CoFieldSchemaInit.js"; import { InstanceOrPrimitiveOfSchema } from "../typeConverters/InstanceOrPrimitiveOfSchema.js"; import { InstanceOrPrimitiveOfSchemaCoValuesMaybeLoaded } from "../typeConverters/InstanceOrPrimitiveOfSchemaCoValuesMaybeLoaded.js"; import { CoOptionalSchema } from "./CoOptionalSchema.js"; import { CoreCoValueSchema, CoreResolveQuery } from "./CoValueSchema.js"; import { SchemaPermissions } from "../schemaPermissions.js"; import { z } from "../zodReExport.js"; export declare class CoFeedSchema implements CoreCoFeedSchema { #private; element: T; private coValueClass; collaborative: true; builtin: "CoFeed"; /** * Default resolve query to be used when loading instances of this schema. * This resolve query will be used when no resolve query is provided to the load method. * @default true */ resolveQuery: DefaultResolveQuery; /** * Permissions to be used when creating or composing CoValues * @internal */ get permissions(): SchemaPermissions; getValidationSchema: () => z.ZodType>; constructor(element: T, coValueClass: typeof CoFeed); getDescriptorsSchema: () => Schema; create(init: CoFeedSchemaInit, options?: CoValueCreateOptions): CoFeedInstance; /** @deprecated Creating CoValues with an Account as owner is deprecated. Use a Group instead. */ create(init: CoFeedSchemaInit, options: CoValueCreateOptions<{}, Account | Group>): CoFeedInstance; load> = DefaultResolveQuery>(id: string, options?: { resolve?: RefsToResolveStrict, R>; loadAs?: Account | AnonymousJazzAgent; unstable_branch?: BranchDefinition; cursor?: LoadCoValueCursorOption; }): Promise, R>>>; unstable_merge> = DefaultResolveQuery>(id: string, options: { resolve?: RefsToResolveStrict, R>; loadAs?: Account | AnonymousJazzAgent; branch: BranchDefinition; }): Promise; subscribe> = DefaultResolveQuery>(id: string, listener: SubscribeCallback, R>>): () => void; subscribe> = DefaultResolveQuery>(id: string, options: SubscribeListenerOptions, R>, listener: SubscribeCallback, R>>): () => void; getCoValueClass(): typeof CoFeed; /** * Get an existing unique CoFeed or create a new one if it doesn't exist. * * The provided value is only used when creating a new CoFeed. * * @example * ```ts * const feed = await MessageFeed.getOrCreateUnique({ * value: [], * unique: ["messages", conversationId], * owner: group, * }); * ``` * * @param options The options for creating or loading the CoFeed. * @returns Either an existing CoFeed (unchanged), or a new initialised CoFeed if none exists. * @category Subscription & Loading */ getOrCreateUnique> = DefaultResolveQuery>(options: { value: CoFeedSchemaInit; unique: CoValueUniqueness["uniqueness"]; owner: Account | Group; resolve?: RefsToResolveStrict, R>; }): Promise, R>>>; optional(): CoOptionalSchema; /** * Adds a default resolve query to be used when loading instances of this schema. * This resolve query will be used when no resolve query is provided to the load method. */ resolved> = true>(resolveQuery: RefsToResolveStrict, R>): CoFeedSchema; /** * Configure permissions to be used when creating or composing CoValues */ withPermissions(permissions: SchemaPermissions): CoFeedSchema; private copy; } export declare function createCoreCoFeedSchema(element: T): CoreCoFeedSchema; export interface CoreCoFeedSchema extends CoreCoValueSchema { builtin: "CoFeed"; element: T; getDescriptorsSchema: () => Schema; } export type CoFeedInstance = CoFeed>; export type CoFeedInstanceCoValuesMaybeLoaded = CoFeed>; //# sourceMappingURL=CoFeedSchema.d.ts.map