@foxiko/client
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -0,0 +0,0 @@ class Address { |
@@ -13,5 +13,4 @@ const {PDFController} = require("./PDFController") | ||
} | ||
module.exports.FoxikoCommunication = FoxikoCommunication; |
@@ -0,0 +0,0 @@ # Communication API |
@@ -9,7 +9,8 @@ const {COMMUNICATION} = require("../Networking"); | ||
async getPDFByURI(uri) { | ||
async getPDFByURI(uri, size = "A4") { | ||
const data = this.client.request() | ||
.url(COMMUNICATION.PDF.CREATE_PDF) | ||
.url() | ||
.params({ | ||
uri: uri | ||
uri, | ||
size | ||
}) | ||
@@ -25,5 +26,8 @@ .responseType().raw("application/pdf") | ||
async getPDFByBody(body) { | ||
async getPDFByBody(body, size = "A4") { | ||
const data = await this.client.request(await this.client.getAccessToken(['identity_security'])) | ||
.url(COMMUNICATION.PDF.CREATE_PDF) | ||
.params({ | ||
size | ||
}) | ||
.body({ | ||
@@ -30,0 +34,0 @@ data: body |
@@ -0,0 +0,0 @@ const {Invoice} = require("../entities/Invoice"); |
@@ -0,0 +0,0 @@ const {Stock} = require("../entities/Stock"); |
@@ -0,0 +0,0 @@ const {Address} = require("../../Address"); |
@@ -0,0 +0,0 @@ class Stock { |
@@ -0,0 +0,0 @@ const {StockController} = require("./controllers/StockController"); |
@@ -0,4 +1,4 @@ | ||
const {FoxikoCloud} = require("./cloud/FoxikoCloud"); | ||
const {FoxikoIdentity} = require("./identity/FoxikoIdentity"); | ||
const {FoxikoCommunication} = require("./communication/FoxikoCommunication"); | ||
const {OAuthRateLimitRequest} = require("foxiko-oauth"); | ||
const {OAuthClient} = require("@foxiko/oauth"); | ||
@@ -14,2 +14,3 @@ const {FoxikoPay} = require("./pay/FoxikoPay"); | ||
identity; | ||
cloud; | ||
@@ -25,3 +26,3 @@ #client; | ||
clientSecret: secret, | ||
tokenUrl: "https://api.foxiko.com/v1/authorization" | ||
tokenUrl: "http://localhost/v1//token" | ||
}); | ||
@@ -38,2 +39,6 @@ } | ||
} | ||
initializeCloud() { | ||
this.cloud = new FoxikoCloud(this.#client) | ||
return this; | ||
} | ||
initializeFinance(accountId) { | ||
@@ -40,0 +45,0 @@ this.finance = new FoxikoFinance(accountId, this.#client); |
@@ -0,0 +0,0 @@ const {IdentityServer} = require("./IdentityServer"); |
@@ -54,29 +54,32 @@ const {IDENTITY} = require("../Networking"); | ||
} | ||
async _registerAccessToken(credentials) { | ||
const data = await this.client.request() | ||
.url(`${IDENTITY.SECURITY.TOKEN.REGISTER}`) | ||
.body({ | ||
client_id: credentials.clientId, | ||
scope: credentials.scope, | ||
access_token: credentials.token, | ||
refresh_token: credentials.refreshToken, | ||
token_type: credentials.tokenType, | ||
expires: credentials.getExpiration(), | ||
data: credentials.data, | ||
}) | ||
.responseType().json() | ||
.send(); | ||
if(data['valid'] === undefined) { | ||
throw data['error']; | ||
} | ||
if(!data['valid']) { | ||
return false; | ||
} | ||
return data['scope'].join(" "); | ||
async _registerToken(credentials) { | ||
return null; | ||
// const data = await this.client.request() | ||
// .url(`${IDENTITY.SECURITY.TOKEN.REGISTER}`) | ||
// .body({ | ||
// client_id: credentials.clientId, | ||
// scope: credentials.scope, | ||
// access_token: credentials.token, | ||
// refresh_token: credentials.refreshToken, | ||
// token_type: credentials.tokenType, | ||
// expires: credentials.getExpiration(), | ||
// data: credentials.data, | ||
// }) | ||
// .responseType().json() | ||
// .send(); | ||
// if(data['valid'] === undefined) { | ||
// throw data['error']; | ||
// } | ||
// if(!data['valid']) { | ||
// return false; | ||
// } | ||
// return data['scope'].join(" "); | ||
} | ||
async _getAccessToken(accessToken) { | ||
async _findToken(accessToken) { | ||
} | ||
async _getAccessTokenCache(accessToken) { | ||
async _findRefreshToken(refreshToken) { | ||
} | ||
@@ -104,15 +107,11 @@ | ||
authorizeCallback, | ||
validateClientId: async clientId => { | ||
return this._validateClientId(clientId); | ||
}, | ||
validateCredentialsCallback: async (clientId, clientSecret) => { | ||
return this._validateCredentials(clientId, clientSecret); | ||
}, | ||
validateCredentialsScopeCallback: (clientId, scope) => { | ||
return this._validateCredentialsScope(clientId, scope); | ||
} | ||
validateClientId: async clientId => this._validateClientId(clientId), | ||
validateCredentialsCallback: async (clientId, clientSecret) => this._validateCredentials(clientId, clientSecret), | ||
validateCredentialsScopeCallback: (clientId, scope) => this._validateCredentialsScope(clientId, scope), | ||
findToken: (tokenType, token) => this._findToken(tokenType, token), | ||
findRefreshToken: (token) => this._findRefreshToken(token), | ||
}); | ||
this.client = client; | ||
this.on("new_access_token", this._registerAccessToken) | ||
this.on("new_access_token", credentials => this._registerToken(credentials)); | ||
} | ||
@@ -119,0 +118,0 @@ |
@@ -0,0 +0,0 @@ const {FoxikoAPI} = require("./FoxikoAPI"); |
@@ -17,2 +17,14 @@ const schema = process.env['LOCAL'] === "true" ? "http" : "https"; | ||
const cloud = { | ||
CONTAINER: { | ||
ALL: `${schema}://${domain}/${version}/cloud/container/all`, | ||
GET: (id) => `${schema}://${domain}/${version}/cloud/container/${id}/get`, | ||
CREATE: `${schema}://${domain}/${version}/cloud/container/create`, | ||
BUILD: { | ||
ALL: (container_id) => `${schema}://${domain}/${version}/cloud/container/${container_id}/build/all`, | ||
GET: (container_id, id) => `${schema}://${domain}/${version}/cloud/container/${container_id}/build/${id}`, | ||
} | ||
} | ||
} | ||
const communication = { | ||
@@ -19,0 +31,0 @@ PDF: { |
{ | ||
"name": "@foxiko/client", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "", | ||
@@ -12,3 +12,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@foxiko/oauth": "^1.0.1", | ||
"@foxiko/oauth": "^1.0.0", | ||
"foxiko-request-handler": "^0.1.1", | ||
@@ -15,0 +15,0 @@ "foxiko-oauth": "^1.0.7" |
@@ -0,0 +0,0 @@ const {Payment} = require("./Payment"); |
@@ -0,0 +0,0 @@ class Payment { |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ const crypto = require('crypto'); |
@@ -0,0 +0,0 @@ const {IdentityServer} = require("../identity/IdentityServer"); |
@@ -0,0 +0,0 @@ const {FoxikoAPI} = require("../index"); |
@@ -0,0 +0,0 @@ const {FoxikoAPI} = require("../FoxikoAPI"); |
Sorry, the diff of this file is not supported yet
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
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
53038
26
1305
+ Addedpsl@1.14.0(transitive)
- Removedpsl@1.13.0(transitive)
Updated@foxiko/oauth@^1.0.0