fql-toolkit
Version:
49 lines • 1.6 kB
TypeScript
import FormsManager from './FormsManager.js';
import FormContext from './FormContext.js';
import type { FQLResult, FQLToken } from './types.js';
import type { FQLRetryConfig } from './client.js';
import type { AuthManager } from './auth/AuthManager.js';
export type FQLExecuteOptions = {
organizationId?: number;
};
export type FQLClientConfig = {
baseURL: string;
token: string;
auth?: never;
organizationId?: number;
retry?: FQLRetryConfig;
} | {
baseURL: string;
auth: AuthManager;
token?: never;
organizationId?: number;
retry?: FQLRetryConfig;
};
/**
* Main entry point for the FQL Toolkit.
*
* @example
* import FQLClient from 'fql-toolkit';
*
* // With a static token
* const client = new FQLClient({ baseURL: 'http://localhost:7645', token: 'your-jwt' });
*
* // With an AuthManager (token read dynamically on each request)
* const client = new FQLClient({ baseURL: 'http://localhost:7645', auth: authManager });
*/
export default class FQLClient {
private readonly _http;
/** Form-level operations: create, show, modify, remove. */
readonly forms: FormsManager;
constructor(config: FQLClientConfig);
/**
* Returns a context for record operations on the given form.
*/
form(formName: string): FormContext;
/**
* Executes a raw FQL string.
* Use this as an escape hatch when the builder API doesn't cover your needs.
*/
execute<T = unknown[]>(fqlString: string, fqlToken?: FQLToken | null, opts?: FQLExecuteOptions): Promise<FQLResult<T>>;
}
//# sourceMappingURL=FQLClient.d.ts.map