Skip to content

Commit b510f49

Browse files
committed
Add ArangoError and CollectionType to exports
1 parent bc8425f commit b510f49

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313

1414
### Added
1515

16+
- Added `ArangoError` and `CollectionType` to public exports
17+
1618
- Added `database.close` method
1719

1820
- Added `opts` parameter to `EdgeCollection#save`

src/arangojs.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
import { aql } from "./aql-query";
2+
import { CollectionType } from "./collection";
13
import { Config } from "./connection";
24
import { Database } from "./database";
3-
import { aql } from "./aql-query";
5+
import { ArangoError } from "./error";
46

57
export default function arangojs(config: Config) {
68
return new Database(config);
79
}
810

9-
Object.assign(arangojs, { Database, aql });
11+
Object.assign(arangojs, { CollectionType, ArangoError, Database, aql });
12+
export { DocumentCollection, EdgeCollection } from "./collection";
13+
export { Graph } from "./graph";
1014
export { Database, aql };
11-
12-
export { DocumentCollection, EdgeCollection } from './collection';
13-
export { Graph } from './graph';

src/collection.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Connection } from "./connection";
22
import { ArrayCursor } from "./cursor";
33

4-
export enum Types {
4+
export enum CollectionType {
55
DOCUMENT_COLLECTION = 2,
66
EDGE_COLLECTION = 3
77
}
@@ -643,7 +643,7 @@ export interface DocumentSaveOptions {
643643
}
644644

645645
export class DocumentCollection extends BaseCollection {
646-
type = Types.DOCUMENT_COLLECTION;
646+
type = CollectionType.DOCUMENT_COLLECTION;
647647
constructor(connection: Connection, name: string) {
648648
super(connection, name);
649649
}
@@ -692,7 +692,7 @@ export class DocumentCollection extends BaseCollection {
692692
}
693693

694694
export class EdgeCollection extends BaseCollection {
695-
type = Types.EDGE_COLLECTION;
695+
type = CollectionType.EDGE_COLLECTION;
696696

697697
constructor(connection: Connection, name: string) {
698698
super(connection, name);
@@ -805,6 +805,8 @@ export class EdgeCollection extends BaseCollection {
805805

806806
export function constructCollection(connection: Connection, data: any) {
807807
const Collection =
808-
data.type === Types.EDGE_COLLECTION ? EdgeCollection : DocumentCollection;
808+
data.type === CollectionType.EDGE_COLLECTION
809+
? EdgeCollection
810+
: DocumentCollection;
809811
return new Collection(connection, data.name);
810812
}

src/graph.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import {
44
DocumentHandle,
55
EdgeCollection,
66
isArangoCollection,
7-
Types
7+
CollectionType
88
} from "./collection";
99
import { Connection } from "./connection";
1010

1111
export class GraphVertexCollection extends BaseCollection {
12-
type = Types.DOCUMENT_COLLECTION;
12+
type = CollectionType.DOCUMENT_COLLECTION;
1313

1414
graph: Graph;
1515

@@ -118,13 +118,13 @@ export class GraphVertexCollection extends BaseCollection {
118118
}
119119

120120
export class GraphEdgeCollection extends EdgeCollection {
121-
type = Types.EDGE_COLLECTION;
121+
type = CollectionType.EDGE_COLLECTION;
122122

123123
graph: Graph;
124124

125125
constructor(connection: Connection, name: string, graph: Graph) {
126126
super(connection, name);
127-
this.type = Types.EDGE_COLLECTION;
127+
this.type = CollectionType.EDGE_COLLECTION;
128128
this.graph = graph;
129129
}
130130

0 commit comments

Comments
 (0)