@oada/client
Version:
A lightweight client tool to interact with an OADA-compliant server
43 lines (42 loc) • 1.99 kB
TypeScript
/**
* @license
* Copyright 2021 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 type ChangeArray from "@oada/types/oada/change/v2.js";
import { type Config, OADAClient } from "./client.js";
/** Create a new instance of OADAClient */
export declare function createInstance(config: Config): OADAClient;
export declare function normalizeDomain(domain: string): string;
/** Create a new instance and wrap it with Promise */
export declare function connect({ connection: proto, concurrency, userAgent, timeouts: t, ...config }: Config & {
token: string;
}): Promise<OADAClient>;
export { type Config, type Connection, type ConnectionChange, type ConnectionRequest, type ConnectionResponse, type GETRequest, type HEADRequest, OADAClient, type PUTRequest, type WatchRequest, } from "./client.js";
export type JsonPrimitive = string | number | boolean | null;
export type JsonArray = Json[] | readonly Json[];
export type JsonObject = {
[property in string]?: Json;
};
export type Json = JsonPrimitive | JsonObject | JsonArray;
export type JsonCompatible<T> = {
[P in keyof T]: T[P] extends Json ? T[P] : Pick<T, P> extends Required<Pick<T, P>> ? never : T[P] extends (() => unknown) | undefined ? never : JsonCompatible<T[P]>;
};
declare global {
interface ArrayConstructor {
isArray(value: unknown): value is unknown[] | readonly unknown[];
}
}
export type Change = ChangeArray[0];
export { TimeoutError } from "./utils.js";