@@ -50,13 +50,7 @@ import { toForm } from "./lib/multipart";
5050import { ArangojsResponse } from "./lib/request" ;
5151import { Route } from "./route" ;
5252import { Transaction } from "./transaction" ;
53- import {
54- ArangoSearchView ,
55- ArangoSearchViewPropertiesOptions ,
56- View ,
57- ViewDescription ,
58- ViewType ,
59- } from "./view" ;
53+ import { CreateViewOptions , View , ViewDescription } from "./view" ;
6054
6155/**
6256 * Indicates whether the given value represents a {@link Database}.
@@ -1428,7 +1422,7 @@ export class Database {
14281422 protected _analyzers = new Map < string , Analyzer > ( ) ;
14291423 protected _collections = new Map < string , Collection > ( ) ;
14301424 protected _graphs = new Map < string , Graph > ( ) ;
1431- protected _views = new Map < string , ArangoSearchView > ( ) ;
1425+ protected _views = new Map < string , View > ( ) ;
14321426
14331427 /**
14341428 * Creates a new `Database` instance with its own connection pool.
@@ -2344,17 +2338,17 @@ export class Database {
23442338
23452339 //#region views
23462340 /**
2347- * Returns an {@link view.ArangoSearchView } instance for the given `viewName`.
2341+ * Returns a {@link view.View } instance for the given `viewName`.
23482342 *
2349- * @param viewName - Name of the ArangoSearch View.
2343+ * @param viewName - Name of the ArangoSearch or SearchAlias View.
23502344 *
23512345 * @example
23522346 * ```js
23532347 * const db = new Database();
23542348 * const view = db.view("potatoes");
23552349 * ```
23562350 */
2357- view ( viewName : string ) : ArangoSearchView {
2351+ view ( viewName : string ) : View {
23582352 viewName = viewName . normalize ( "NFC" ) ;
23592353 if ( ! this . _views . has ( viewName ) ) {
23602354 this . _views . set ( viewName , new View ( this , viewName ) ) ;
@@ -2363,25 +2357,25 @@ export class Database {
23632357 }
23642358
23652359 /**
2366- * Creates a new ArangoSearch View with the given `viewName` and `options`
2367- * and returns an {@link view.ArangoSearchView } instance for the created View.
2360+ * Creates a new View with the given `viewName` and `options`, then returns a
2361+ * {@link view.View } instance for the new View.
23682362 *
2369- * @param viewName - Name of the ArangoSearch View.
2363+ * @param viewName - Name of the View.
23702364 * @param options - An object defining the properties of the View.
23712365 *
23722366 * @example
23732367 * ```js
23742368 * const db = new Database();
2375- * const view = await db.createView("potatoes");
2369+ * const view = await db.createView("potatoes", { type: "arangosearch" } );
23762370 * // the ArangoSearch View "potatoes" now exists
23772371 * ```
23782372 */
23792373 async createView (
23802374 viewName : string ,
2381- options ?: ArangoSearchViewPropertiesOptions
2382- ) : Promise < ArangoSearchView > {
2375+ options : CreateViewOptions
2376+ ) : Promise < View > {
23832377 const view = this . view ( viewName . normalize ( "NFC" ) ) ;
2384- await view . create ( { ... options , type : ViewType . ARANGOSEARCH_VIEW } ) ;
2378+ await view . create ( options ) ;
23852379 return view ;
23862380 }
23872381
@@ -2431,7 +2425,8 @@ export class Database {
24312425
24322426 /**
24332427 * Fetches all Views from the database and returns an array of
2434- * {@link view.ArangoSearchView} instances for the Views.
2428+ * {@link view.View} instances
2429+ * for the Views.
24352430 *
24362431 * See also {@link Database#listViews}.
24372432 *
@@ -2442,7 +2437,7 @@ export class Database {
24422437 * // views is an array of ArangoSearch View instances
24432438 * ```
24442439 */
2445- async views ( ) : Promise < ArangoSearchView [ ] > {
2440+ async views ( ) : Promise < View [ ] > {
24462441 const views = await this . listViews ( ) ;
24472442 return views . map ( ( data ) => this . view ( data . name ) ) ;
24482443 }
0 commit comments