/** * @license * Copyright 2021-2022 Open Ag Data Alliance * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { ChangeType, type ItemEvent, type ItemType } from './index.js'; import type { Options, OptionsDeprecated } from './Options.js'; export declare enum AssumeState { New = 0, Handled = 1 } /** * The main class of this library. * Watches an OADA list and calls various callbacks when appropriate. * * @public * @typeParam Item The type of the items linked in the list * @see Options */ export declare class ListWatch { #private; /** * Make ListWatch consider every unknown `Item` new * @deprecated */ static readonly AssumeNew = AssumeState.New; /** * Make ListWatch consider every unknown `Item` handled * @deprecated */ static readonly AssumeHandled = AssumeState.Handled; /** * The OADA path of the List being watched */ readonly path: string; /** * The OADA tree of the List being watched */ readonly tree: import("@oada/types/oada/tree/v1.js").default; /** * The JSON Path for the list items */ readonly itemsPath: string; /** * The unique name of this service/watch */ readonly name: string; /** * The unique name of this service/watch */ readonly timeout: number | undefined; constructor(options: Options); /** * @deprecated * see {@link Options} for the non-deprecated options * and {@link OptionsDeprecated} for alternatives to deprecated options */ constructor(options: Options & OptionsDeprecated); /** * Clean up metadata and unwatch list */ stop(): Promise; on(event: E): AsyncGenerator<[ItemType]>; on(event: E, listener: (itemChange: ItemType) => void | PromiseLike): this; once(event: E): Promise<[ItemType]>; once(event: E, listener: (itemChange: ItemEvent) => void | PromiseLike): this; }