diff --git a/overview.md b/overview.md index b9652a52..b9773888 100644 --- a/overview.md +++ b/overview.md @@ -9,8 +9,8 @@ docs](https://docs.fauna.com/fauna/current/build/drivers/js-client/). ## Important classes and methods -- [Client](classes/Client.html): Use instances of this class to send requests to Fauna. -- [query()](classes/Client.html#query): Use this method to run queries. +- {@link Client}: Use instances of this class to send requests to Fauna. +- {@link Client.query}: Use this method to run queries. ## All modules diff --git a/src/client-configuration.ts b/src/client-configuration.ts index e237d931..e99bdf1c 100644 --- a/src/client-configuration.ts +++ b/src/client-configuration.ts @@ -17,7 +17,7 @@ export interface ClientConfiguration { client_timeout_buffer_ms?: number; /** - * The {@link URL} of Fauna to call. See {@link endpoints} for some default options. + * The {@link https://developer.mozilla.org/en-US/docs/Web/API/URL|URL} of Fauna to call. See {@link endpoints} for some default options. */ endpoint?: URL; diff --git a/src/client.ts b/src/client.ts index e4c9d3a1..c54ebca0 100644 --- a/src/client.ts +++ b/src/client.ts @@ -286,7 +286,7 @@ export class Client { * Initialize a streaming request to Fauna * @typeParam T - The expected type of the response from Fauna. T can be inferred * if the provided query used a type parameter. - * @param query - A string-encoded streaming token, or a {@link Query} + * @param tokenOrQuery - A string-encoded token for an {@link EventSource}, or a {@link Query} * @returns A {@link StreamClient} that which can be used to listen to a stream * of events * @@ -383,7 +383,7 @@ export class Client { * feed events. * @typeParam T - The expected type of the response from Fauna. T can be inferred * if the provided query used a type parameter. - * @param query - A string-encoded streaming token, or a {@link Query} + * @param tokenOrQuery - A string-encoded token for an {@link EventSource}, or a {@link Query} * @returns A {@link FeedClient} that which can be used to listen to a feed * of events * @@ -741,10 +741,8 @@ export class StreamClient { /** * - * @param query - A lambda that returns a promise for a {@link EventSource} + * @param token - A lambda that returns a promise for a {@link EventSource} * @param clientConfiguration - The {@link ClientConfiguration} to apply - * @param httpStreamClient - The underlying {@link HTTPStreamClient} that will - * execute the actual HTTP calls * @example * ```typescript * const streamClient = client.stream(eventSource); @@ -958,7 +956,7 @@ export class FeedClient { /** * - * @param query - A lambda that returns a promise for a {@link EventSource} + * @param token - A lambda that returns a promise for a {@link EventSource} * @param clientConfiguration - The {@link FeedClientConfiguration} to apply * @example * ```typescript diff --git a/src/http-client/node-http2-client.ts b/src/http-client/node-http2-client.ts index 54ae7836..c412afd0 100644 --- a/src/http-client/node-http2-client.ts +++ b/src/http-client/node-http2-client.ts @@ -55,9 +55,9 @@ export class NodeHTTP2Client implements HTTPClient, HTTPStreamClient { } /** - * Gets a {@link NodeHTTP2Client} matching the {@link HTTTPClientOptions} - * @param httpClientOptions - the {@link HTTTPClientOptions} - * @returns a {@link NodeHTTP2Client} matching the {@link HTTTPClientOptions} + * Gets a {@link NodeHTTP2Client} matching the {@link HTTPClientOptions} + * @param httpClientOptions - the {@link HTTPClientOptions} + * @returns a {@link NodeHTTP2Client} matching the {@link HTTPClientOptions} */ static getClient(httpClientOptions: HTTPClientOptions): NodeHTTP2Client { const clientKey = NodeHTTP2Client.#getClientKey(httpClientOptions); diff --git a/src/index.ts b/src/index.ts index cb13de4e..8f680428 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,11 +25,27 @@ export { ServiceInternalError, ThrottlingError, } from "./errors"; -export { type Query, type QueryArgument, fql } from "./query-builder"; -export { LONG_MAX, LONG_MIN, TaggedTypeFormat } from "./tagged-type"; export { - type QueryValueObject, - type QueryValue, + fql, + type Query, + type QueryArgument, + type QueryArgumentObject, +} from "./query-builder"; +export { + DecodeOptions, + LONG_MAX, + LONG_MIN, + TaggedTypeFormat, +} from "./tagged-type"; +export { + type ArrayFragment, + type ConstraintFailure, + type EncodedObject, + type FeedError, + type FeedRequest, + type FeedSuccess, + type FQLFragment, + type ObjectFragment, type QueryFailure, type QueryInfo, type QueryInterpolation, @@ -37,17 +53,32 @@ export { type QueryRequest, type QueryStats, type QuerySuccess, + type QueryValue, + type QueryValueObject, type Span, + type StreamEventData, + type StreamEventError, + type StreamEventStatus, + type StreamRequest, + type TaggedBytes, + type TaggedDate, + type TaggedDouble, + type TaggedInt, + type TaggedLong, + type TaggedMod, + type TaggedObject, + type TaggedRef, + type TaggedTime, + type TaggedType, + type ValueFormat, type ValueFragment, - type FeedRequest, - type FeedSuccess, - type FeedError, } from "./wire-protocol"; export { DateStub, Document, DocumentReference, EmbeddedSet, + FlattenedSetIterator, Module, NamedDocument, NamedDocumentReference, @@ -61,11 +92,15 @@ export { type DocumentT, } from "./values"; export { + FaunaAPIPaths, FetchClient, getDefaultHTTPClient, + HTTPClientOptions, + HTTPStreamRequest, isHTTPResponse, isStreamClient, NodeHTTP2Client, + SupportedFaunaAPIPaths, type HTTPClient, type HTTPRequest, type HTTPResponse, diff --git a/src/query-builder.ts b/src/query-builder.ts index 8ae0e553..4a6cc86d 100644 --- a/src/query-builder.ts +++ b/src/query-builder.ts @@ -32,7 +32,7 @@ export type QueryArgument = /** * Creates a new Query. Accepts template literal inputs. * @typeParam T - The expected type of the response from Fauna when evaluated. - * @param queryFragments - a {@link TemplateStringsArray} that constitute + * @param queryFragments - An array that constitutes * the strings that are the basis of the query. * @param queryArgs - an Array\ that * constitute the arguments to inject between the queryFragments. diff --git a/src/values/set.ts b/src/values/set.ts index 087bc3e4..170ca0ee 100644 --- a/src/values/set.ts +++ b/src/values/set.ts @@ -68,7 +68,7 @@ export class SetIterator constructor( client: Client, initial: Page | EmbeddedSet | (() => Promise | EmbeddedSet>), - options?: QueryOptions + options?: QueryOptions, ) { options = options ?? {}; if (initial instanceof Function) { @@ -78,8 +78,8 @@ export class SetIterator } else { throw new TypeError( `Expected 'Page | EmbeddedSet | (() => Promise | EmbeddedSet>)', but received ${JSON.stringify( - initial - )}` + initial, + )}`, ); } } @@ -93,18 +93,18 @@ export class SetIterator static fromQuery( client: Client, query: Query, - options?: QueryOptions + options?: QueryOptions, ): SetIterator { return new SetIterator( client, async () => { const response = await client.query | EmbeddedSet>( query, - options + options, ); return response.data; }, - options + options, ); } @@ -118,7 +118,7 @@ export class SetIterator static fromPageable( client: Client, pageable: Page | EmbeddedSet, - options?: QueryOptions + options?: QueryOptions, ): SetIterator { return new SetIterator(client, pageable, options); } @@ -132,22 +132,30 @@ export class SetIterator return new FlattenedSetIterator(this); } - /** Implement {@link AsyncGenerator.next} */ + /** Implement + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator/next| AsyncGenerator.next} + * */ async next(): Promise> { return this.#generator.next(); } - /** Implement {@link AsyncGenerator.return} */ + /** Implement + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator/return| AsyncGenerator.return} + * */ async return(): Promise> { return this.#generator.return(); } - /** Implement {@link AsyncGenerator.throw} */ + /** Implement + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator/throw| AsyncGenerator.throw} + * */ async throw(e: any): Promise> { return this.#generator.throw(e); } - /** Implement {@link AsyncGenerator} */ + /** Implement + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator| AsyncGenerator} + * */ [Symbol.asyncIterator]() { return this; } @@ -178,22 +186,30 @@ export class FlattenedSetIterator this.#generator = generateItems(setIterator); } - /** Implement {@link AsyncGenerator.next} */ + /** Implement + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator/next| AsyncGenerator.next} + * */ async next(): Promise> { return this.#generator.next(); } - /** Implement {@link AsyncGenerator.return} */ + /** Implement + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator/return| AsyncGenerator.return} + * */ async return(): Promise> { return this.#generator.return(); } - /** Implement {@link AsyncGenerator.throw} */ + /** Implement + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator/throw| AsyncGenerator.throw} + * */ async throw(e: any): Promise> { return this.#generator.throw(e); } - /** Implement {@link AsyncGenerator} */ + /** Implement + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator| AsyncGenerator} + * */ [Symbol.asyncIterator]() { return this; } @@ -206,7 +222,7 @@ export class FlattenedSetIterator async function* generatePages( client: Client, initial: Page | EmbeddedSet, - options: QueryOptions + options: QueryOptions, ): AsyncGenerator { let currentPage = initial; @@ -233,7 +249,7 @@ async function* generatePages( async function* generateFromThunk( client: Client, thunk: () => Promise | EmbeddedSet>, - options: QueryOptions + options: QueryOptions, ): AsyncGenerator { const result = await thunk(); @@ -241,7 +257,7 @@ async function* generateFromThunk( for await (const page of generatePages( client, result as Page | EmbeddedSet, - options + options, )) { yield page; } @@ -255,7 +271,7 @@ async function* generateFromThunk( * Internal async generator function that flattens a {@link SetIterator} */ async function* generateItems( - setIterator: SetIterator + setIterator: SetIterator, ) { for await (const page of setIterator) { for (const item of page) {