Skip to content

Commit b20f3cd

Browse files
committed
Implement missing HTTP API methods
Fixes DE-148. Fixes DE-149. Fixes DE-150. Fixes DE-151. Fixes DE-906. Fixes DE-932. Fixes DE-939. Fixes DE-949.
1 parent 6b96db5 commit b20f3cd

File tree

3 files changed

+446
-71
lines changed

3 files changed

+446
-71
lines changed

CHANGELOG.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ This driver uses semantic versioning:
1818

1919
### Added
2020

21+
- Added `db.compact` method (DE-906)
22+
23+
- Added `db.engineStats` method (DE-932)
24+
25+
- Added `db.getLicense` and `db.setLicense` methods (DE-949)
26+
27+
- Added `db.listQueryCacheEntries` method (DE-149)
28+
29+
- Added `db.clearQueryCache` method (DE-148)
30+
31+
- Added `db.getQueryCacheProperties` method (DE-150)
32+
33+
- Added `db.setQueryCacheProperties` method (DE-151)
34+
35+
- Added `collection.shards` method (DE-939)
36+
2137
- Added support for `mdi-prefixed` indexes (DE-956)
2238

2339
- Restored `fulltext` index type support (DE-957)
@@ -33,13 +49,13 @@ This driver uses semantic versioning:
3349

3450
### Added
3551

36-
- Added `database.availability` method
52+
- Added `db.availability` method
3753

38-
- Added `database.engine` method (DE-931)
54+
- Added `db.engine` method (DE-931)
3955

40-
- Added `database.status` method ([#811](https://github.com/arangodb/arangojs/issues/811))
56+
- Added `db.status` method ([#811](https://github.com/arangodb/arangojs/issues/811))
4157

42-
- Added `database.supportInfo` method
58+
- Added `db.supportInfo` method
4359

4460
- Added `keepNull` option to `CollectionInsertOptions` type (DE-946)
4561

@@ -1132,7 +1148,7 @@ For a detailed list of changes between pre-release versions of v7 see the
11321148

11331149
- Changed `db.createDatabase` return type to `Database`
11341150

1135-
- Renamed `database.setQueryTracking` to `database.queryTracking`
1151+
- Renamed `db.setQueryTracking` to `db.queryTracking`
11361152

11371153
The method will now return the existing query tracking properties or set the
11381154
new query tracking properties depending on whether an argument is provided.
@@ -1528,7 +1544,7 @@ For a detailed list of changes between pre-release versions of v7 see the
15281544

15291545
- Added support for ArangoDB 3.5 Analyzers API
15301546

1531-
See the documentation of the `database.analyzer` method and the `Analyzer`
1547+
See the documentation of the `db.analyzer` method and the `Analyzer`
15321548
instances for information on using this API.
15331549

15341550
- Added `collection.getResponsibleShard` method
@@ -1702,7 +1718,7 @@ For a detailed list of changes between pre-release versions of v7 see the
17021718

17031719
- Fixed `edgeCollection.save` not respecting options ([#554](https://github.com/arangodb/arangojs/issues/554))
17041720

1705-
- Fixed `database.createDatabase` TypeScript signature ([#561](https://github.com/arangodb/arangojs/issues/561))
1721+
- Fixed `db.createDatabase` TypeScript signature ([#561](https://github.com/arangodb/arangojs/issues/561))
17061722

17071723
## [6.5.0] - 2018-08-03
17081724

@@ -1743,19 +1759,19 @@ For a detailed list of changes between pre-release versions of v7 see the
17431759

17441760
- Added `ArangoError` and `CollectionType` to public exports
17451761

1746-
- Added `database.close` method
1762+
- Added `db.close` method
17471763

17481764
- Added `opts` parameter to `EdgeCollection#save`
17491765

17501766
## [6.3.0] - 2018-06-20
17511767

17521768
### Added
17531769

1754-
- Added `database.version` method
1770+
- Added `db.version` method
17551771

1756-
- Added `database.login` method
1772+
- Added `db.login` method
17571773

1758-
- Added `database.exists` method
1774+
- Added `db.exists` method
17591775

17601776
- Added `collection.exists` method
17611777

src/collection.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,34 @@ export interface DocumentCollection<
13081308
* ```
13091309
*/
13101310
loadIndexes(): Promise<boolean>;
1311+
/**
1312+
* Retrieves the collection's shard IDs.
1313+
*
1314+
* @param details - If set to `true`, the response will include the responsible
1315+
* servers for each shard.
1316+
*/
1317+
shards(
1318+
details?: false
1319+
): Promise<
1320+
ArangoApiResponse<
1321+
CollectionMetadata & CollectionProperties & { shards: string[] }
1322+
>
1323+
>;
1324+
/**
1325+
* Retrieves the collection's shard IDs and the responsible servers for each
1326+
* shard.
1327+
*
1328+
* @param details - If set to `false`, the response will only include the
1329+
* shard IDs without the responsible servers for each shard.
1330+
*/
1331+
shards(
1332+
details: true
1333+
): Promise<
1334+
ArangoApiResponse<
1335+
CollectionMetadata &
1336+
CollectionProperties & { shards: Record<string, string[]> }
1337+
>
1338+
>;
13111339
/**
13121340
* Renames the collection and updates the instance's `name` to `newName`.
13131341
*
@@ -2952,6 +2980,19 @@ export class Collection<
29522980
);
29532981
}
29542982

2983+
shards(
2984+
details?: boolean
2985+
): Promise<
2986+
ArangoApiResponse<
2987+
CollectionMetadata & CollectionProperties & { shards: any }
2988+
>
2989+
> {
2990+
return this._db.request({
2991+
path: `/_api/collection/${encodeURIComponent(this._name)}/shards`,
2992+
search: { details },
2993+
});
2994+
}
2995+
29552996
async rename(newName: string) {
29562997
const result = await this._db.renameCollection(this._name, newName);
29572998
this._name = newName;

0 commit comments

Comments
 (0)