web4-oasis-api
Advanced tools
Comparing version 1.0.1 to 1.0.2
604
data/data.js
@@ -9,3 +9,3 @@ import axios from "axios"; | ||
async loadHolon(id = "") { | ||
async loadHolon(data) { | ||
this.token = await this.avatar.callLogin(); | ||
@@ -15,4 +15,27 @@ if (this.token === -1) | ||
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 }; | ||
}); | ||
} | ||
async getLoadHolonById(id = "") { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/LoadHolon/${id}`, | ||
url: `https://api.oasisplatform.world/api/data/load-holon/${id}`, | ||
headers: { | ||
@@ -33,3 +56,12 @@ Authorization: `Bearer ${this.token.jwtToken}`, | ||
async loadAllHolons() { | ||
async getHolonChildById( | ||
data = { | ||
id: "", | ||
loadChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
} | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
@@ -40,3 +72,3 @@ if (this.token === -1) | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/LoadAllHolons`, | ||
url: `https://api.oasisplatform.world/api/data/load-holon/${data.id}/${data.loadChildren}/${data.recursive}/${data.maxChildDepth}/${data.continueOnError}/${data.version}`, | ||
headers: { | ||
@@ -57,2 +89,404 @@ Authorization: `Bearer ${this.token.jwtToken}`, | ||
async getHolonChildByIdAndSetGlobally( | ||
data = { | ||
id: "", | ||
loadChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
providerType: "", | ||
setGlobally: true, | ||
} | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-holon/${data.id}/${data.loadChildren}/${data.recursive}/${data.maxChildDepth}/${data.continueOnError}/${data.version}/${data.providerType}/${data.setGlobally}`, | ||
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 }; | ||
}); | ||
} | ||
async getHolonChildByIdAndSetGloballyWithMoreOptions( | ||
data = { | ||
id: "", | ||
loadChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
providerType: "", | ||
setGlobally: true, | ||
autoReplicationMode: "", | ||
autoFailOverMode: "", | ||
autoLoadBalanceMode: "", | ||
autoReplicationProviders: "", | ||
autoFailOverProviders: "", | ||
autoLoadBalanceProviders: "", | ||
waitForAutoReplicationResult: "", | ||
showDetailedSetting: "", | ||
} | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-holon/${data.id}/${data.loadChildren}/${data.recursive}/${data.maxChildDepth}/${data.continueOnError}/${data.version}/${data.providerType}/${data.setGlobally}/${data.autoReplicationMode}/${data.autoFailOverMode}/${data.autoLoadBalanceMode}/${data.autoReplicationProviders}/${data.autoFailOverProviders}/${data.autoLoadBalanceProviders}/${data.waitForAutoReplicationResult}/${data.showDetailedSetting}`, | ||
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 }; | ||
}); | ||
} | ||
async getLoadHolonById(id = "") { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-holon/${id}`, | ||
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 }; | ||
}); | ||
} | ||
async loadAllHolons(data) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/load-all-holons`, | ||
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 }; | ||
}); | ||
} | ||
async loadAllHolonsForGivenType(holonType) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-all-holons/${holonType}`, | ||
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 }; | ||
}); | ||
} | ||
async getHolonChildByHolonType( | ||
data = { | ||
holonType: "", | ||
loadChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
} | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-holon/${data.holonType}/${data.loadChildren}/${data.recursive}/${data.maxChildDepth}/${data.continueOnError}/${data.version}`, | ||
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 }; | ||
}); | ||
} | ||
async getHolonChildByHolonTypeAndSetGlobally( | ||
data = { | ||
holonType: "", | ||
loadChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
providerType: "", | ||
setGlobally: true, | ||
} | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-holon/${data.holonType}/${data.loadChildren}/${data.recursive}/${data.maxChildDepth}/${data.continueOnError}/${data.version}/${data.providerType}/${data.setGlobally}`, | ||
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 }; | ||
}); | ||
} | ||
async getHolonChildByHolonTypeAndSetGloballyWithMoreOptions( | ||
data = { | ||
holonType: "", | ||
loadChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
providerType: "", | ||
setGlobally: true, | ||
autoReplicationMode: "", | ||
autoFailOverMode: "", | ||
autoLoadBalanceMode: "", | ||
autoReplicationProviders: "", | ||
autoFailOverProviders: "", | ||
autoLoadBalanceProviders: "", | ||
waitForAutoReplicationResult: "", | ||
showDetailedSetting: "", | ||
} | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-holon/${data.holonType}/${data.loadChildren}/${data.recursive}/${data.maxChildDepth}/${data.continueOnError}/${data.version}/${data.providerType}/${data.setGlobally}/${data.autoReplicationMode}/${data.autoFailOverMode}/${data.autoLoadBalanceMode}/${data.autoReplicationProviders}/${data.autoFailOverProviders}/${data.autoLoadBalanceProviders}/${data.waitForAutoReplicationResult}/${data.showDetailedSetting}`, | ||
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 }; | ||
}); | ||
} | ||
async loadHolonForParent(data) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
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 }; | ||
}); | ||
} | ||
async getLoadHolonParentByIdAndType(data={ | ||
id: "", | ||
holonType: "" | ||
}) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-holons-for-parent/${data.id}/${data.holonType}`, | ||
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 }; | ||
}); | ||
} | ||
async getHolonParent( | ||
data = { | ||
id: "", | ||
holonType: "", | ||
loadChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
} | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-holons-for-parent/${data.id}/${data.holonType}/${data.loadChildren}/${data.recursive}/${data.maxChildDepth}/${data.continueOnError}/${data.version}`, | ||
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 }; | ||
}); | ||
} | ||
async getHolonParentAndSetGlobally( | ||
data = { | ||
id: "", | ||
holonType: "", | ||
loadChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
providerType: "", | ||
setGlobally: true, | ||
} | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-holons-for-parent/${data.id}/${data.holonType}/${data.loadChildren}/${data.recursive}/${data.maxChildDepth}/${data.continueOnError}/${data.version}/${data.providerType}/${data.setGlobally}`, | ||
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 }; | ||
}); | ||
} | ||
async getHolonParenteAndSetGloballyWithMoreOptions( | ||
data = { | ||
id: "", | ||
holonType: "", | ||
loadChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
version: 0, | ||
providerType: "", | ||
setGlobally: true, | ||
autoReplicationMode: "", | ||
autoFailOverMode: "", | ||
autoLoadBalanceMode: "", | ||
autoReplicationProviders: "", | ||
autoFailOverProviders: "", | ||
autoLoadBalanceProviders: "", | ||
waitForAutoReplicationResult: "", | ||
showDetailedSetting: "", | ||
} | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "get", | ||
url: `https://api.oasisplatform.world/api/data/load-holons-for-parent/${data.id}/${data.holonType}/${data.loadChildren}/${data.recursive}/${data.maxChildDepth}/${data.continueOnError}/${data.version}/${data.providerType}/${data.setGlobally}/${data.autoReplicationMode}/${data.autoFailOverMode}/${data.autoLoadBalanceMode}/${data.autoReplicationProviders}/${data.autoFailOverProviders}/${data.autoLoadBalanceProviders}/${data.waitForAutoReplicationResult}/${data.showDetailedSetting}`, | ||
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 }; | ||
}); | ||
} | ||
async saveHolon(data) { | ||
@@ -65,3 +499,3 @@ data = JSON.stringify(data); | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/SaveHolon`, | ||
url: `https://api.oasisplatform.world/api/data/save-holon`, | ||
headers: { | ||
@@ -83,3 +517,4 @@ Authorization: `Bearer ${this.token.jwtToken}`, | ||
async deleteHolon(id) { | ||
async saveHolonByObj(holon="", data) { | ||
data = JSON.stringify(data); | ||
this.token = await this.avatar.callLogin(); | ||
@@ -89,4 +524,159 @@ if (this.token === -1) | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/save-holon/${holon}`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
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 }; | ||
}); | ||
} | ||
async saveHolonWithParams( | ||
params = { | ||
saveChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
}, data | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
data = JSON.stringify(data); | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/save-holon/${params.saveChildren}/${params.recursive}/${params.maxChildDepth}/${params.continueOnError}`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
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 }; | ||
}); | ||
} | ||
async saveHolonAndSetGlobally( | ||
params = { | ||
saveChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
providerType: "", | ||
setGlobally: true, | ||
}, data | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
data = JSON.stringify(data); | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/save-holon/${params.saveChildren}/${params.recursive}/${params.maxChildDepth}/${params.continueOnError}/${params.providerType}/${params.setGlobally}`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
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 }; | ||
}); | ||
} | ||
async saveHolonAndSetGloballyWithMoreOptions( | ||
params = { | ||
saveChildren: true, | ||
recursive: true, | ||
maxChildDepth: 0, | ||
continueOnError: true, | ||
providerType: "", | ||
setGlobally: true, | ||
autoReplicationMode: "", | ||
autoFailOverMode: "", | ||
autoLoadBalanceMode: "", | ||
autoReplicationProviders: "", | ||
autoFailOverProviders: "", | ||
autoLoadBalanceProviders: "", | ||
waitForAutoReplicationResult: "", | ||
showDetailedSetting: "", | ||
}, data | ||
) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
data = JSON.stringify(data); | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/save-holon/${params.loadChildren}/${params.recursive}/${params.maxChildDepth}/${params.continueOnError}/${params.providerType}/${params.setGlobally}/${params.autoReplicationMode}/${params.autoFailOverMode}/${params.autoLoadBalanceMode}/${params.autoReplicationProviders}/${params.autoFailOverProviders}/${params.autoLoadBalanceProviders}/${params.waitForAutoReplicationResult}/${params.showDetailedSetting}`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
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 }; | ||
}); | ||
} | ||
async saveHolonOffChain(data) { | ||
data = JSON.stringify(data); | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "post", | ||
url: `https://api.oasisplatform.world/api/data/save-holon-off-chain`, | ||
headers: { | ||
Authorization: `Bearer ${this.token.jwtToken}`, | ||
}, | ||
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 }; | ||
}); | ||
} | ||
async deleteHolon(data={ | ||
id: "", | ||
softDelete: true | ||
}) { | ||
this.token = await this.avatar.callLogin(); | ||
if (this.token === -1) | ||
return { error: true, data: { message: "You are not logged in!" } }; | ||
const config = { | ||
method: "delete", | ||
url: `https://api.oasisplatform.world/api/data/DeleteHolon/${id}`, | ||
url: `https://api.oasisplatform.world/api/data/delete-holon/${data.id}/${data.softDelete}`, | ||
headers: { | ||
@@ -93,0 +683,0 @@ Authorization: `Bearer ${this.token.jwtToken}`, |
{ | ||
"name": "web4-oasis-api", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A JavaScript proxy for the WEB4 OASIS API. To be used only in the browser.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance 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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
1554
1276
121888
13