web4-oasis-api
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -12,2 +12,14 @@ import axios from "axios"; | ||
} | ||
_returnState(config) { | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
} | ||
async callLogin(obj = this) { | ||
@@ -42,14 +54,3 @@ if (JSON.parse(localStorage.getItem("login"))) { | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) { | ||
return { error: true, data: response.data }; | ||
} | ||
return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
console.log(error); | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} | ||
@@ -74,12 +75,3 @@ | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) { | ||
return { error: true, data: res.data }; | ||
} | ||
return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} | ||
@@ -106,14 +98,3 @@ | ||
return axios(config) | ||
.then(function (response) { | ||
if (res.data.isError) { | ||
return { error: true, data: res.data }; | ||
} | ||
return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
console.log(error); | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} | ||
@@ -135,14 +116,3 @@ | ||
return axios(config) | ||
.then(function (response) { | ||
if (res.data.isError) { | ||
return { error: true, data: res.data }; | ||
} | ||
return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
console.log(error); | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} | ||
@@ -173,14 +143,3 @@ | ||
}; | ||
return axios(config) | ||
.then(function (response) { | ||
if (res.data.isError) { | ||
return { error: true, data: res.data }; | ||
} | ||
return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
console.log(error); | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} | ||
@@ -212,14 +171,3 @@ | ||
}; | ||
return axios(config) | ||
.then(function (response) { | ||
if (res.data.isError) { | ||
return { error: true, data: res.data }; | ||
} | ||
return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
console.log(error); | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} | ||
@@ -226,0 +174,0 @@ } |
262
data/data.js
@@ -9,20 +9,31 @@ import axios from "axios"; | ||
_returnState(config) { | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
} | ||
async loadHolon( | ||
data = { | ||
id: "188e0e27-3af2-478f-af86-030c56a42edb", | ||
LoadChildren: false, | ||
Recursive: false, | ||
MaxChildDepth: 1, | ||
ContinueOnError: false, | ||
Version: 1, | ||
ProviderType: "HoloOASIS", | ||
SetGlobally: false, | ||
ShowDetailedSettings: true, | ||
AutoFailOverEnabled: "true", | ||
AutoReplicationEnabled: "false", | ||
AutoLoadBalanceEnabled: "false", | ||
AutoFailOverProviders: "MongoDBOASIS, HoloOASIS", | ||
AutoReplicationProviders: "MongoDBOASIS, HoloOASIS", | ||
AutoLoadBalanceProviders: "MongoDBOASIS, HoloOASIS", | ||
WaitForAutoReplicationResult: false, | ||
providerType: "Default", | ||
setGlobally: true, | ||
autoFailOverMode: "DEFAULT", | ||
autoReplicationMode: "DEFAULT", | ||
autoLoadBalanceMode: "DEFAULT", | ||
autoFailOverProviders: "DEFAULT", | ||
autoReplicationProviders: "DEFAULT", | ||
autoLoadBalanceProviders: "DEFAULT", | ||
waitForAutoReplicationResult: false, | ||
showDetailedSettings: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
loadChildren: true, | ||
id: null, | ||
} | ||
@@ -42,29 +53,15 @@ ) { | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) | ||
return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} else if (typeof data === "object") { | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/load-holon`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
data: JSON.stringify(data), | ||
}; | ||
return this._returnState(config); | ||
} | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/load-holon`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
data: JSON.stringify(data), | ||
}; | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
} | ||
@@ -74,18 +71,18 @@ | ||
data = { | ||
HolonType: "Moon", | ||
LoadChildren: true, | ||
Recursive: true, | ||
MaxChildDepth: 0, | ||
ContinueOnError: false, | ||
Version: 0, | ||
ProviderType: "HoloOASIS", | ||
SetGlobally: false, | ||
ShowDetailedSettings: true, | ||
AutoFailOverEnabled: "true", | ||
AutoReplicationEnabled: "true", | ||
AutoLoadBalanceEnabled: "true", | ||
AutoFailOverProviders: "MongoDBOASIS, HoloOASOS", | ||
AutoReplicationProviders: "MongoDBOASIS, HoloOASOS", | ||
AutoLoadBalanceProviders: "MongoDBOASIS, HoloOASOS", | ||
WaitForAutoReplicationResult: false, | ||
providerType: "Default", | ||
setGlobally: true, | ||
autoFailOverMode: "DEFAULT", | ||
autoReplicationMode: "DEFAULT", | ||
autoLoadBalanceMode: "DEFAULT", | ||
autoFailOverProviders: "DEFAULT", | ||
autoReplicationProviders: "DEFAULT", | ||
autoLoadBalanceProviders: "DEFAULT", | ||
waitForAutoReplicationResult: false, | ||
showDetailedSettings: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
loadChildren: true, | ||
id: null, | ||
} | ||
@@ -106,51 +103,45 @@ ) { | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) | ||
return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
} | ||
return this._returnState(config); | ||
} else if (typeof data === "object") { | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/load-all-holons`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
data: JSON.stringify(data), | ||
}; | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/load-all-holons/${holonType}`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
data: JSON.stringify(data), | ||
}; | ||
return this._returnState(config); | ||
} else if (typeof data === "string") { | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-all-holons/${data}`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
}; | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} | ||
} | ||
async loadHolonParent( | ||
async loadHolonsForParent( | ||
data = { | ||
Id: "89a935f4-d0ad-44af-b954-558041a76c18", | ||
HolonType: "Moon", | ||
LoadChildren: true, | ||
Recursive: true, | ||
MaxChildDepth: 0, | ||
ContinueOnError: false, | ||
Version: 0, | ||
ProviderType: "HoloOASIS", | ||
SetGlobally: false, | ||
ShowDetailedSettings: true, | ||
AutoFailOverEnabled: "true", | ||
AutoReplicationEnabled: "true", | ||
AutoLoadBalanceEnabled: "true", | ||
AutoFailOverProviders: "MongoDBOASIS, HoloOASOS", | ||
AutoReplicationProviders: "MongoDBOASIS, HoloOASOS", | ||
AutoLoadBalanceProviders: "MongoDBOASIS, HoloOASOS", | ||
WaitForAutoReplicationResult: false, | ||
providerType: "Default", | ||
setGlobally: true, | ||
autoFailOverMode: "DEFAULT", | ||
autoReplicationMode: "DEFAULT", | ||
autoLoadBalanceMode: "DEFAULT", | ||
autoFailOverProviders: "DEFAULT", | ||
autoReplicationProviders: "DEFAULT", | ||
autoLoadBalanceProviders: "DEFAULT", | ||
waitForAutoReplicationResult: false, | ||
showDetailedSettings: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
loadChildren: true, | ||
id: null, | ||
} | ||
@@ -164,3 +155,3 @@ ) { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-holons-for-parent/${data}/all`, | ||
url: `https://api.oasisplatform.world/api/data/load-holons-for-parent/${data}`, | ||
headers: { | ||
@@ -171,29 +162,15 @@ Authorization: `Bearer ${this.token.jwtToken}`, | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) | ||
return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} else if (typeof data === "object") { | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/load-holons-for-parent`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
data: JSON.stringify(data), | ||
}; | ||
return this._returnState(config); | ||
} | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/load-holons-for-parent`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
data: JSON.stringify(data), | ||
}; | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
} | ||
@@ -215,10 +192,3 @@ | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} | ||
@@ -240,10 +210,3 @@ | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} | ||
@@ -268,10 +231,3 @@ | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config); | ||
} | ||
@@ -278,0 +234,0 @@ } |
@@ -9,2 +9,13 @@ import axios from "axios"; | ||
_returnState(config) { | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
} | ||
async getKarmaForAvatar(id) { | ||
@@ -23,10 +34,3 @@ this.token = await this.avatar.callLogin(); | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config) | ||
} | ||
@@ -57,10 +61,3 @@ | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config) | ||
} | ||
@@ -81,10 +78,3 @@ | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config) | ||
} | ||
@@ -91,0 +81,0 @@ } |
@@ -9,2 +9,13 @@ import axios from "axios"; | ||
_returnState(config) { | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
} | ||
async createPurchase( | ||
@@ -46,12 +57,3 @@ data = { | ||
return axios(config) | ||
.then((response) => { | ||
if (response.data.isError) { | ||
return { error: true, data: response.data }; | ||
} | ||
return { error: false, data: response.data }; | ||
}) | ||
.catch((err) => { | ||
return { error: true, data: err }; | ||
}); | ||
return this._returnState(config) | ||
} | ||
@@ -73,12 +75,3 @@ | ||
return axios(config) | ||
.then((response) => { | ||
if (response.data.isError) { | ||
return { error: true, data: response.data }; | ||
} | ||
return { error: false, data: response.data }; | ||
}) | ||
.catch((err) => { | ||
return { error: true, data: err }; | ||
}); | ||
return this._returnState(config) | ||
} | ||
@@ -107,12 +100,3 @@ | ||
return axios(config) | ||
.then((response) => { | ||
if (response.data.isError) { | ||
return { error: true, data: response.data }; | ||
} | ||
return { error: false, data: response.data }; | ||
}) | ||
.catch((err) => { | ||
return { error: true, data: err }; | ||
}); | ||
return this._returnState(config) | ||
} | ||
@@ -119,0 +103,0 @@ } |
{ | ||
"name": "web4-oasis-api", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A JavaScript proxy for the WEB4 OASIS API. To be used only in the browser.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -57,3 +57,3 @@ # WEB4 OASIS API Javascript Package | ||
- [loadAllHolons](#loadallholons) | ||
- [loadHolonParent](#loadholonparent) | ||
- [loadHolonsForParent](#loadholonsforparent) | ||
- [saveHolon](#saveholon) | ||
@@ -81,2 +81,9 @@ - [saveHolonOffChain](#saveholonoffchain) | ||
## Previous Version | ||
The previous version (package) can be found here: | ||
https://www.npmjs.com/package/oasis-api | ||
This previous version has now been deprecated (unfortunaltey npm will not let you rename an existing package so when we renamed oasis-api to web4-oasis-api it has forced us to create this new version of the package). We are currently keeping the older version to preserve the version history, download stats, etc. | ||
## Introduction | ||
@@ -667,3 +674,3 @@ | ||
__the parameter for these function can either be either left undefined or an object__ | ||
__the parameter for these function can either be either left undefined, a string or an object__ | ||
```js | ||
@@ -705,6 +712,9 @@ const data = new oasis.Data() | ||
``` | ||
*OR* | ||
```js | ||
data.loadAllHolons(holonType) | ||
``` | ||
### loadHolonsForParent | ||
### loadHolonParent | ||
Load's all holons for the given parent and the given HolonType. Use 'All' to load all holons. Set the loadChildren flag to true to load all the holon's child holon's. This defaults to true. If loadChildren is set to true, you can set the Recursive flag to true to load all the child's holon's recursively, or false to only load the first level of child holon's. This defaults to true. If loadChildren is set to true, you can set the maxChildDepth value to a custom int of how many levels down you wish to load, it defaults to 0, which means it will load to infinite depth. Set the continueOnError flag to true if you wish it to continue loading child holon's even if an error has occured, this defaults to true. Set the Version int to the version of the holon you wish to load (defaults to 0) which means the latest version. Pass in the provider you wish to use. Set the autoFailOverMode to 'ON' if you wish this call to work through the the providers in the auto-failover list until it succeeds. Set it to OFF if you do not or to 'DEFAULT' to default to the global OASISDNA setting. Set the autoReplicationMode to 'ON' if you wish this call to auto-replicate to the providers in the auto-replication list. Set it to OFF if you do not or to UseGlobalDefaultInOASISDNA to 'DEFAULT' to the global OASISDNA setting. Set the autoLoadBalanceMode to 'ON' if you wish this call to use the fastest provider in your area from the auto-loadbalance list. Set it to OFF if you do not or to UseGlobalDefaultInOASISDNA to 'DEFAULT' to the global OASISDNA setting. Set the waitForAutoReplicationResult flag to true if you wish for the API to wait for the auto-replication to complete before returning the results. Set the setglobally flag to false to use these settings only for this request or true for it to be used for all future requests. Set the showDetailedSettings flag to true to view detailed settings such as the list of providers in the auto-failover, auto-replication & auto-load balance lists. | ||
@@ -718,20 +728,19 @@ | ||
{ | ||
"providerType: "string", | ||
"setGlobally": true, | ||
"autoFailOverMode": "string", | ||
"autoReplicationMode": "string", | ||
"autoLoadBalanceMode": "string", | ||
"autoFailOverProviders": "string", | ||
"autoReplicationProviders": "string", | ||
"autoLoadBalanceProviders": "string", | ||
"waitForAutoReplicationResult": true, | ||
"showDetailedSettings": true, | ||
"recursive": true, | ||
"maxChildDepth": 0, | ||
"continueOnError": true, | ||
"version": 0, | ||
"loadChildren": true, | ||
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", | ||
"holonType": "string" | ||
} || "3fa85f64-5717-4562-b3fc-2c963f66afa6" | ||
providerType: "Default", | ||
setGlobally: true, | ||
autoFailOverMode: "DEFAULT", | ||
autoReplicationMode: "DEFAULT", | ||
autoLoadBalanceMode: "DEFAULT", | ||
autoFailOverProviders: "DEFAULT", | ||
autoReplicationProviders: "DEFAULT", | ||
autoLoadBalanceProviders: "DEFAULT", | ||
waitForAutoReplicationResult: false, | ||
showDetailedSettings: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
loadChildren: true, | ||
id: null, | ||
} || "3fa85f64-5717-4562-b3fc-2c963f66afa6" | ||
).then(()=>{ | ||
@@ -738,0 +747,0 @@ //pass |
@@ -9,2 +9,13 @@ import axios from "axios"; | ||
_returnState(config) { | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
} | ||
async mint(data) { | ||
@@ -24,10 +35,3 @@ data = JSON.stringify(data); | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config) | ||
} | ||
@@ -63,10 +67,3 @@ | ||
return axios(config) | ||
.then(function (response) { | ||
if (response.data.isError) return { error: true, data: response.data }; | ||
else return { error: false, data: response.data }; | ||
}) | ||
.catch(function (error) { | ||
return { error: true, data: error }; | ||
}); | ||
return this._returnState(config) | ||
} | ||
@@ -73,0 +70,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
272392
18
958
1052
2