Skip to content

Commit b6275f3

Browse files
committed
remove async
1 parent aed2b96 commit b6275f3

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

lib/connectionConfig.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ ConnectionConfig.prototype.apiURL = function() {
119119
* @returns {string | boolean}
120120
*/
121121
ConnectionConfig.prototype.db = function() {
122+
if(!this.dbid) throw new Error('Invalid database name');
122123
return this.dbid
123124
}
124125

lib/woqlClient.js

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ WOQLClient.prototype.db = function(dbId) {
166166
if (typeof dbId !== 'undefined') {
167167
this.connectionConfig.setDB(dbId)
168168
}
169-
return this.connectionConfig.db()
169+
return this.connectionConfig.dbid
170+
171+
//this.connectionConfig.db()
170172
}
171173

172174
/**
@@ -859,7 +861,7 @@ WOQLClient.prototype.clonedb = function(cloneSource, newDbId, orgId) {
859861
* @property {object} [payload] - the post body
860862
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.
861863
*/
862-
WOQLClient.prototype.dispatch = async function(action, apiUrl, payload) {
864+
WOQLClient.prototype.dispatch = function(action, apiUrl, payload) {
863865
if (!apiUrl) {
864866
return Promise.reject(
865867
new Error(
@@ -870,15 +872,15 @@ WOQLClient.prototype.dispatch = async function(action, apiUrl, payload) {
870872
),
871873
)
872874
}//I have to do a call to get the jwt token
873-
if(this.connectionConfig.tokenParameter){
875+
/*if(this.connectionConfig.tokenParameter){
874876
const param = this.connectionConfig.tokenParameter
875877
await axios.post(param.url,param.options).then(result=>result.data).then(data=>{
876878
if(data.access_token){
877879
console.log("ACCESS_TOKEN",data.access_token)
878880
this.localAuth({"key":data.access_token,"type":"jwt"})
879881
}
880882
})
881-
}
883+
}*/
882884
return DispatchRequest(
883885
apiUrl,
884886
action,
@@ -1282,7 +1284,7 @@ WOQLClient.prototype.deleteDocument = function(params,dbId,message="delete docum
12821284
* @returns
12831285
*/
12841286

1285-
WOQLClient.prototype.schema = function(type,dbId){
1287+
WOQLClient.prototype.getSchemaFrame = function(type,dbId){
12861288
let params
12871289
if(type) params = {type:type}
12881290
if (dbId) {
@@ -1291,22 +1293,47 @@ WOQLClient.prototype.schema = function(type,dbId){
12911293
return this.dispatch(CONST.GET, this.connectionConfig.jsonSchemaURL(params))
12921294
}
12931295

1294-
WOQLClient.prototype.classes = function(dbId){
1296+
/**
1297+
* get all the schema classes (documents,subdocuments,abstracts)
1298+
* @param {string} [dbId]
1299+
* @returns
1300+
*/
1301+
WOQLClient.prototype.getClasses = function(dbId){
12951302
const params = {'graph_type':"schema","as_list":true,"type":"sys:Class"}
12961303
return this.getDocument(params,dbId)
12971304
}
12981305

1299-
WOQLClient.prototype.getDocuments = async function(dbId){
1306+
/**
1307+
* get all the Enum Objects
1308+
* @param {string} [dbId]
1309+
* @returns
1310+
*/
1311+
WOQLClient.prototype.getEnums = function(dbId){
1312+
const params = {'graph_type':"schema","as_list":true,"type":"sys:Enum"}
1313+
return this.getDocument(params,dbId)
1314+
}
1315+
1316+
/**
1317+
* get all the Document Classes (no abstract)
1318+
* @param {string} [dbId]
1319+
* @returns
1320+
*/
1321+
/*WOQLClient.prototype.getClassDocuments = async function(dbId){
13001322
const params = {'graph_type':"schema","as_list":true,"type":"sys:Class"}
13011323
const result = await this.getDocument(params,dbId)
13021324
let documents=[]
13031325
if(result){
13041326
documents = result.filter(item => !item['@subdocument'] && !item['@abstract'])
13051327
}
13061328
return documents
1307-
}
1329+
}*/
13081330

1309-
WOQLClient.prototype.branches = async function(dbId){
1331+
/**
1332+
*
1333+
* @param {*} dbId
1334+
* @returns
1335+
*/
1336+
/*WOQLClient.prototype.getBranches = async function(dbId){
13101337
const params={type:'Branch','as_list':true}
13111338
const branch = this.checkout()
13121339
const result = await this.getDocument(params,dbId,"_commits")
@@ -1319,6 +1346,6 @@ WOQLClient.prototype.branches = async function(dbId){
13191346
}
13201347
this.checkout(branch)
13211348
return branchesObj
1322-
}
1349+
}*/
13231350

13241351
module.exports = WOQLClient

0 commit comments

Comments
 (0)