Skip to content

Commit 8595c01

Browse files
committed
Hide Collection class
1 parent c7ea238 commit 8595c01

File tree

2 files changed

+44
-29
lines changed

2 files changed

+44
-29
lines changed

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ This driver uses semantic versioning:
5757

5858
- Moved `Patch` type into `documents` module
5959

60-
- Moved `Errback` type into library internals
60+
- Removed `Errback` type from public API
6161

6262
- Renamed `util/foxx-manifest` module to `foxx-manifest`
6363

64+
- Removed `Collection` type from public API
65+
66+
All public APIs reference `DocumentCollection` and `EdgeCollection` directly.
67+
6468
### Added
6569

6670
- Added `precaptureStackTraces` configuration option ([#599](https://github.com/arangodb/arangojs/issues/599))
@@ -1027,13 +1031,13 @@ This is a major release and breaks backwards compatibility.
10271031
Before:
10281032

10291033
```js
1030-
import { Collection } from "arangojs/lib/collection";
1034+
import { DocumentCollection } from "arangojs/lib/collection";
10311035
```
10321036

10331037
After:
10341038

10351039
```js
1036-
import { Collection } from "arangojs/collection";
1040+
import { DocumentCollection } from "arangojs/collection";
10371041
```
10381042

10391043
- The `url` config can now also be an array of URLs.

src/collection.ts

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export type ShardingStrategy =
127127
/**
128128
* Type of document reference.
129129
*
130-
* See {@link Collection.list}.
130+
* See {@link DocumentCollection.list} and {@link EdgeCollection.list}.
131131
*
132132
* @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be
133133
* replaced with AQL queries.
@@ -325,7 +325,7 @@ export type ValidationOptions = {
325325
/**
326326
* Options for setting a collection's properties.
327327
*
328-
* See {@link Collection.properties}.
328+
* See {@link DocumentCollection.properties} and {@link EdgeCollection.properties}.
329329
*/
330330
export type CollectionPropertiesOptions = {
331331
/**
@@ -1184,7 +1184,7 @@ export type CollectionEdgesResult<T extends object = any> = {
11841184
/**
11851185
* Result of removing documents by an example.
11861186
*
1187-
* See {@link Collection.removeByExample}.
1187+
* See {@link DocumentCollection.removeByExample} and {@link EdgeCollection.removeByExample}.
11881188
*
11891189
* @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be
11901190
* replaced with AQL queries.
@@ -1199,7 +1199,7 @@ export type SimpleQueryRemoveByExampleResult = {
11991199
/**
12001200
* Result of replacing documents by an example.
12011201
*
1202-
* See {@link Collection.replaceByExample}.
1202+
* See {@link DocumentCollection.replaceByExample} and {@link EdgeCollection.replaceByExample}.
12031203
*
12041204
* @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be
12051205
* replaced with AQL queries.
@@ -1214,7 +1214,7 @@ export type SimpleQueryReplaceByExampleResult = {
12141214
/**
12151215
* Result of updating documents by an example.
12161216
*
1217-
* See {@link Collection.updateByExample}.
1217+
* See {@link DocumentCollection.updateByExample} and {@link EdgeCollection.updateByExample}.
12181218
*
12191219
* @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be
12201220
* replaced with AQL queries.
@@ -1229,7 +1229,7 @@ export type SimpleQueryUpdateByExampleResult = {
12291229
/**
12301230
* Result of removing documents by keys.
12311231
*
1232-
* See {@link Collection.removeByKeys}.
1232+
* See {@link DocumentCollection.removeByKeys} and {@link EdgeCollection.removeByKeys}.
12331233
*
12341234
* @deprecated Simple Queries have been deprecated in ArangoDB 3.4 and can be
12351235
* replaced with AQL queries.
@@ -1256,6 +1256,20 @@ export type SimpleQueryRemoveByKeysResult<T extends object = any> = {
12561256
*
12571257
* See {@link EdgeCollection} for a variant of this interface more suited for
12581258
* edge collections.
1259+
*
1260+
* When using TypeScript, collections can be cast to a specific document data
1261+
* type to increase type safety.
1262+
*
1263+
* @param T - Type to use for document data. Defaults to `any`.
1264+
*
1265+
* @example
1266+
* ```ts
1267+
* interface Person {
1268+
* name: string;
1269+
* }
1270+
* const db = new Database();
1271+
* const documents = db.collection("persons") as DocumentCollection<Person>;
1272+
* ```
12591273
*/
12601274
export interface DocumentCollection<T extends object = any>
12611275
extends ArangoCollection {
@@ -2335,6 +2349,21 @@ export interface DocumentCollection<T extends object = any>
23352349
*
23362350
* See {@link DocumentCollection} for a more generic variant of this interface
23372351
* more suited for regular document collections.
2352+
*
2353+
* When using TypeScript, collections can be cast to a specific edge document
2354+
* data type to increase type safety.
2355+
*
2356+
* @param T - Type to use for edge document data. Defaults to `any`.
2357+
*
2358+
* @example
2359+
* ```ts
2360+
* interface Friend {
2361+
* startDate: number;
2362+
* endDate?: number;
2363+
* }
2364+
* const db = new Database();
2365+
* const edges = db.collection("friends") as EdgeCollection<Friend>;
2366+
* ```
23382367
*/
23392368
export interface EdgeCollection<T extends object = any>
23402369
extends DocumentCollection<T> {
@@ -2965,26 +2994,8 @@ export interface EdgeCollection<T extends object = any>
29652994
}
29662995

29672996
/**
2968-
* The `Collection` type represents a collection in a {@link Database}.
2969-
*
2970-
* When using TypeScript, collections can be cast to {@link DocumentCollection}
2971-
* or {@link EdgeCollection} in order to increase type safety.
2972-
*
2973-
* @param T - Type to use for document data. Defaults to `any`.
2974-
*
2975-
* @example
2976-
* ```ts
2977-
* interface Person {
2978-
* name: string;
2979-
* }
2980-
* interface Friend {
2981-
* startDate: number;
2982-
* endDate?: number;
2983-
* }
2984-
* const db = new Database();
2985-
* const documents = db.collection("persons") as DocumentCollection<Person>;
2986-
* const edges = db.collection("friends") as EdgeCollection<Friend>;
2987-
* ```
2997+
* @internal
2998+
* @hidden
29882999
*/
29893000
export class Collection<T extends object = any>
29903001
implements EdgeCollection<T>, DocumentCollection<T> {

0 commit comments

Comments
 (0)