Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const bankerSchema = [
"@type":"Class",
"@id":"Person",
"@key":{
"@type":"Hash",
"@type":"Lexical",
"@fields":[
"name"
]
Expand Down
6 changes: 3 additions & 3 deletions docs/api/woqlclient.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,14 @@ user has fields: [id, name, notes, author]
**Desription**: Gets the user's organization id

## databaseInfo
##### woqlClient.databaseInfo([dbId]) ⇒ <code>object</code>
##### woqlClient.databaseInfo([dbName]) ⇒ <code>object</code>
Gets the database's details

**Returns**: <code>object</code> - the database description object //getDatabaseInfo
**Returns**: <code>object</code> - the database description object

| Param | Type | Description |
| --- | --- | --- |
| [dbId] | <code>string</code> | the datbase id |
| [dbName] | <code>string</code> | the datbase name |


## db
Expand Down
16 changes: 7 additions & 9 deletions lib/woqlClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ WOQLClient.prototype.userOrganization = function () {

/**
* Gets the database's details
* @param {string} [dbId] - the datbase id
* @returns {object} the database description object //getDatabaseInfo
* @param {string} [dbName] - the datbase name
* @returns {object} the database description object
*/
WOQLClient.prototype.databaseInfo = function (dbId) {
WOQLClient.prototype.databaseInfo = function (dbName) {
// const dbIdVal = dbId || this.db();
// const orgIdVal = orgId || this.organization()
const database = this.databases().find((element) => element.name === dbId);
const database = this.databases().find((element) => element.name === dbName);
return database || {};
};

Expand Down Expand Up @@ -1518,8 +1518,8 @@ WOQLClient.prototype.getJSONDiff = function (before, after, options) {
* })
*/
WOQLClient.prototype.getVersionObjectDiff = function (dataVersion, jsonObject, id, options) {
if (typeof jsonObject !== 'object' || typeof dataVersion !== 'string') {
const errmsg = 'Parameters error - you must specify a valid jsonObject document and valid branch or commit';
if (typeof jsonObject !== 'object' || typeof dataVersion !== 'string' || typeof id !== 'string') {
const errmsg = 'Parameters error - you must specify a valid jsonObject document, a valid branch or commit and a valid id';

return Promise.reject(
new Error(ErrorMessage.getInvalidParameterMessage(CONST.GET_DIFF, errmsg)),
Expand All @@ -1529,11 +1529,9 @@ WOQLClient.prototype.getVersionObjectDiff = function (dataVersion, jsonObject, i
const payload = {
after: jsonObject,
before_data_version: dataVersion,
id,
...opt,
};
if (id) {
payload.id = id;
}
return this.dispatch(
CONST.POST,
this.connectionConfig.diffURL(),
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.