File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ This driver uses semantic versioning:
3838
3939- Added support for ` fillBlockCache ` query option
4040
41+ - Added support for passing ` Graph ` objects in AQL queries [ #740 ] ( https://github.com/arangodb/arangojs/issues/740 )
42+
43+ This also adds the ` isArangoGraph ` helper function for type checking.
44+
4145- Added User Management API [ #664 ] ( https://github.com/arangodb/arangojs/issues/664 )
4246
4347 This implements the endpoints of the
Original file line number Diff line number Diff line change 1111 * @packageDocumentation
1212 */
1313import { ArangoCollection , isArangoCollection } from "./collection" ;
14+ import { Graph , isArangoGraph } from "./graph" ;
1415import { isArangoView , View } from "./view" ;
1516
1617/**
@@ -70,6 +71,7 @@ export interface AqlLiteral {
7071export type AqlValue =
7172 | ArangoCollection
7273 | View
74+ | Graph
7375 | GeneratedAqlQuery
7476 | AqlLiteral
7577 | string
@@ -241,7 +243,11 @@ export function aql(
241243 const index = bindValues . indexOf ( rawValue ) ;
242244 const isKnown = index !== - 1 ;
243245 let name = `value${ isKnown ? index : bindValues . length } ` ;
244- if ( isArangoCollection ( rawValue ) || isArangoView ( rawValue ) ) {
246+ if (
247+ isArangoCollection ( rawValue ) ||
248+ isArangoGraph ( rawValue ) ||
249+ isArangoView ( rawValue )
250+ ) {
245251 name = `@${ name } ` ;
246252 value = rawValue . name ;
247253 }
Original file line number Diff line number Diff line change @@ -35,6 +35,15 @@ import {
3535import { isArangoError } from "./error" ;
3636import { DOCUMENT_NOT_FOUND , GRAPH_NOT_FOUND } from "./lib/codes" ;
3737
38+ /**
39+ * Indicates whether the given value represents a {@link Graph}.
40+ *
41+ * @param graph - A value that might be a Graph.
42+ */
43+ export function isArangoGraph ( graph : any ) : graph is Graph {
44+ return Boolean ( graph && graph . isArangoGraph ) ;
45+ }
46+
3847/**
3948 * @internal
4049 * @hidden
@@ -1200,6 +1209,15 @@ export class Graph {
12001209 this . _db = db ;
12011210 }
12021211
1212+ /**
1213+ * @internal
1214+ *
1215+ * Indicates that this object represents an ArangoDB Graph.
1216+ */
1217+ get isArangoGraph ( ) : true {
1218+ return true ;
1219+ }
1220+
12031221 /**
12041222 * Name of the graph.
12051223 */
You can’t perform that action at this time.
0 commit comments