Skip to content

Commit

Permalink
Implement missing HTTP API methods
Browse files Browse the repository at this point in the history
Fixes DE-148. Fixes DE-149. Fixes DE-150. Fixes DE-151. Fixes DE-906. Fixes DE-932. Fixes DE-939. Fixes DE-949.
  • Loading branch information
pluma4345 committed Jan 6, 2025
1 parent 6b96db5 commit b20f3cd
Show file tree
Hide file tree
Showing 3 changed files with 446 additions and 71 deletions.
38 changes: 27 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ This driver uses semantic versioning:

### Added

- Added `db.compact` method (DE-906)

- Added `db.engineStats` method (DE-932)

- Added `db.getLicense` and `db.setLicense` methods (DE-949)

- Added `db.listQueryCacheEntries` method (DE-149)

- Added `db.clearQueryCache` method (DE-148)

- Added `db.getQueryCacheProperties` method (DE-150)

- Added `db.setQueryCacheProperties` method (DE-151)

- Added `collection.shards` method (DE-939)

- Added support for `mdi-prefixed` indexes (DE-956)

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

### Added

- Added `database.availability` method
- Added `db.availability` method

- Added `database.engine` method (DE-931)
- Added `db.engine` method (DE-931)

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

- Added `database.supportInfo` method
- Added `db.supportInfo` method

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

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

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

- Renamed `database.setQueryTracking` to `database.queryTracking`
- Renamed `db.setQueryTracking` to `db.queryTracking`

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

- Added support for ArangoDB 3.5 Analyzers API

See the documentation of the `database.analyzer` method and the `Analyzer`
See the documentation of the `db.analyzer` method and the `Analyzer`
instances for information on using this API.

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

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

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

## [6.5.0] - 2018-08-03

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

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

- Added `database.close` method
- Added `db.close` method

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

## [6.3.0] - 2018-06-20

### Added

- Added `database.version` method
- Added `db.version` method

- Added `database.login` method
- Added `db.login` method

- Added `database.exists` method
- Added `db.exists` method

- Added `collection.exists` method

Expand Down
41 changes: 41 additions & 0 deletions src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,34 @@ export interface DocumentCollection<
* ```
*/
loadIndexes(): Promise<boolean>;
/**
* Retrieves the collection's shard IDs.
*
* @param details - If set to `true`, the response will include the responsible
* servers for each shard.
*/
shards(
details?: false
): Promise<
ArangoApiResponse<
CollectionMetadata & CollectionProperties & { shards: string[] }
>
>;
/**
* Retrieves the collection's shard IDs and the responsible servers for each
* shard.
*
* @param details - If set to `false`, the response will only include the
* shard IDs without the responsible servers for each shard.
*/
shards(
details: true
): Promise<
ArangoApiResponse<
CollectionMetadata &
CollectionProperties & { shards: Record<string, string[]> }
>
>;
/**
* Renames the collection and updates the instance's `name` to `newName`.
*
Expand Down Expand Up @@ -2952,6 +2980,19 @@ export class Collection<
);
}

shards(
details?: boolean
): Promise<
ArangoApiResponse<
CollectionMetadata & CollectionProperties & { shards: any }
>
> {
return this._db.request({
path: `/_api/collection/${encodeURIComponent(this._name)}/shards`,
search: { details },
});
}

async rename(newName: string) {
const result = await this._db.renameCollection(this._name, newName);
this._name = newName;
Expand Down
Loading

0 comments on commit b20f3cd

Please sign in to comment.