import type { Cookie } from './cookies.ts'; import type { ClientStateNotFoundResponse, VersionNotSupportedResponse } from './error-responses.ts'; import type { HTTPRequestInfo } from './http-request-info.ts'; import type { PatchOperation, PatchOperationInternal } from './patch-operation.ts'; import type { ClientID } from './sync/ids.ts'; import type { PullRequest } from './sync/pull.ts'; export type PullerResultV1 = { response?: PullResponseV1 | undefined; httpRequestInfo: HTTPRequestInfo; }; export type PullerResult = PullerResultV1; /** * Puller is the function type used to do the fetch part of a pull. * * Puller needs to support dealing with pull request of version 0 and 1. Version * 0 is used when doing mutation recovery of old clients. If a * {@link PullRequestV1} is passed in the n a {@link PullerResultV1} should * be returned. We do a runtime assert to make this is the case. * * If you do not support old clients you can just throw if `pullVersion` is `0`, */ export type Puller = (requestBody: PullRequest, requestID: string) => Promise; /** * The shape of a pull response under normal circumstances. */ export type PullResponseOKV1 = { cookie: Cookie; lastMutationIDChanges: Record; patch: PatchOperation[]; }; export type PullResponseOKV1Internal = { cookie: Cookie; lastMutationIDChanges: Record; patch: PatchOperationInternal[]; }; /** * PullResponse defines the shape and type of the response of a pull. This is * the JSON you should return from your pull server endpoint. */ export type PullResponseV1 = PullResponseOKV1 | ClientStateNotFoundResponse | VersionNotSupportedResponse; export type PullResponseV1Internal = PullResponseOKV1Internal | ClientStateNotFoundResponse | VersionNotSupportedResponse; export type PullResponse = PullResponseV1; //# sourceMappingURL=puller.d.ts.map