@clevercloud/client
Advanced tools
Comparing version 8.1.0 to 8.1.1
@@ -6,4 +6,4 @@ "use strict"; | ||
}); | ||
exports.getApplicationDeploymentInstances = getApplicationDeploymentInstances; | ||
exports.getApplicationInstances = getApplicationInstances; | ||
exports.getInstance = getInstance; | ||
@@ -13,7 +13,6 @@ var _pickNonNull = require("../../pick-non-null.js"); | ||
/** | ||
* GET /orchestration/organisations/{ownerId}/applications/{applicationId}/deployments/{deploymentId}/instances | ||
* GET /orchestration/organisations/{ownerId}/applications/{applicationId}/instances | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
* @param {String} params.since | ||
@@ -27,7 +26,7 @@ * @param {String} params.until | ||
*/ | ||
function getApplicationDeploymentInstances(params) { | ||
function getApplicationInstances(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v4/orchestration/organisations/${params.ownerId}/applications/${params.applicationId}/deployments/${params.deploymentId}/instances`, | ||
url: `/v4/orchestration/organisations/${params.ownerId}/applications/${params.applicationId}/instances`, | ||
headers: { | ||
@@ -41,27 +40,21 @@ Accept: 'application/json' | ||
/** | ||
* GET /orchestration/organisations/{ownerId}/applications/{applicationId}/instances | ||
* GET /orchestration/organisations/{ownerId}/applications/{applicationId}/instances/{instanceId} | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
* @param {String} params.since | ||
* @param {String} params.until | ||
* @param {String} params.excludeDeleted | ||
* @param {String} params.includeState | ||
* @param {String} params.excludeState | ||
* @param {String} params.limit | ||
* @param {String} params.order | ||
* @param {String} params.undefined | ||
*/ | ||
function getApplicationInstances(params) { | ||
function getInstance(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v4/orchestration/organisations/${params.ownerId}/applications/${params.applicationId}/instances`, | ||
url: `/v4/orchestration/organisations/${params.ownerId}/applications/${params.applicationId}/instances/${params.instanceId}`, | ||
headers: { | ||
Accept: 'application/json' | ||
}, | ||
queryParams: (0, _pickNonNull.pickNonNull)(params, ['since', 'until', 'excludeDeleted', 'includeState', 'excludeState', 'limit', 'order']) // no body | ||
} // no query params | ||
// no body | ||
}); | ||
} |
@@ -63,3 +63,3 @@ "use strict"; | ||
* compute full URL with query params | ||
* @returns {string} | ||
* @returns {URL} | ||
*/ | ||
@@ -69,3 +69,3 @@ | ||
getUrl() { | ||
const url = this.buildUrl(`/v4/logs/organisations/${this._ownerId}/applications/${this._appId}/logs`, { ...this._options, | ||
return this.buildUrl(`/v4/logs/organisations/${this._ownerId}/applications/${this._appId}/logs`, { ...this._options, | ||
// in case of pause() then resume(): | ||
@@ -75,3 +75,2 @@ // we don' t want N another logs, we want the initial passed number less the events count already received | ||
}); | ||
return url; | ||
} // compute the number of events to retrieve, based on elements already received | ||
@@ -78,0 +77,0 @@ |
@@ -81,7 +81,7 @@ "use strict"; | ||
}); | ||
return url.toString(); | ||
return url; | ||
} | ||
/** | ||
* ABSTRACT compute full URL with query params | ||
* @returns {string} | ||
* @returns {URL} | ||
*/ | ||
@@ -115,5 +115,7 @@ | ||
try { | ||
const url = this.getUrl(); | ||
let requestParams = { | ||
method: 'get', | ||
url: this.getUrl() | ||
url: url.origin + url.pathname, | ||
queryParams: Object.entries(url.searchParams) | ||
}; | ||
@@ -120,0 +122,0 @@ |
import { pickNonNull } from '../../pick-non-null.js'; | ||
/** | ||
* GET /orchestration/organisations/{ownerId}/applications/{applicationId}/deployments/{deploymentId}/instances | ||
* GET /orchestration/organisations/{ownerId}/applications/{applicationId}/instances | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
* @param {String} params.since | ||
@@ -17,7 +16,7 @@ * @param {String} params.until | ||
*/ | ||
export function getApplicationDeploymentInstances(params) { | ||
export function getApplicationInstances(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v4/orchestration/organisations/${params.ownerId}/applications/${params.applicationId}/deployments/${params.deploymentId}/instances`, | ||
url: `/v4/orchestration/organisations/${params.ownerId}/applications/${params.applicationId}/instances`, | ||
headers: { Accept: 'application/json' }, | ||
@@ -30,23 +29,17 @@ queryParams: pickNonNull(params, ['since', 'until', 'excludeDeleted', 'includeState', 'excludeState', 'limit', 'order']), | ||
/** | ||
* GET /orchestration/organisations/{ownerId}/applications/{applicationId}/instances | ||
* GET /orchestration/organisations/{ownerId}/applications/{applicationId}/instances/{instanceId} | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
* @param {String} params.since | ||
* @param {String} params.until | ||
* @param {String} params.excludeDeleted | ||
* @param {String} params.includeState | ||
* @param {String} params.excludeState | ||
* @param {String} params.limit | ||
* @param {String} params.order | ||
* @param {String} params.undefined | ||
*/ | ||
export function getApplicationInstances(params) { | ||
export function getInstance(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v4/orchestration/organisations/${params.ownerId}/applications/${params.applicationId}/instances`, | ||
url: `/v4/orchestration/organisations/${params.ownerId}/applications/${params.applicationId}/instances/${params.instanceId}`, | ||
headers: { Accept: 'application/json' }, | ||
queryParams: pickNonNull(params, ['since', 'until', 'excludeDeleted', 'includeState', 'excludeState', 'limit', 'order']), | ||
// no query params | ||
// no body | ||
}); | ||
} |
@@ -48,6 +48,6 @@ import CleverCloudSse from './clever-cloud-sse.js'; | ||
* compute full URL with query params | ||
* @returns {string} | ||
* @returns {URL} | ||
*/ | ||
getUrl () { | ||
const url = this.buildUrl( | ||
return this.buildUrl( | ||
`/v4/logs/organisations/${this._ownerId}/applications/${this._appId}/logs`, | ||
@@ -61,4 +61,2 @@ { | ||
); | ||
return url; | ||
} | ||
@@ -65,0 +63,0 @@ |
@@ -76,3 +76,3 @@ import { CustomEventTarget } from './custom-event-target.js'; | ||
return url.toString(); | ||
return url; | ||
} | ||
@@ -82,3 +82,3 @@ | ||
* ABSTRACT compute full URL with query params | ||
* @returns {string} | ||
* @returns {URL} | ||
*/ | ||
@@ -109,3 +109,8 @@ getUrl () { | ||
let requestParams = { method: 'get', url: this.getUrl() }; | ||
const url = this.getUrl(); | ||
let requestParams = { | ||
method: 'get', | ||
url: url.origin + url.pathname, | ||
queryParams: Object.entries(url.searchParams), | ||
}; | ||
if (this._tokens != null) { | ||
@@ -112,0 +117,0 @@ requestParams = await addOauthHeader(this._tokens)(requestParams); |
{ | ||
"name": "@clevercloud/client", | ||
"version": "8.1.0", | ||
"version": "8.1.1", | ||
"description": "JavaScript REST client and utils for Clever Cloud's API", | ||
@@ -29,3 +29,3 @@ "homepage": "https://github.com/CleverCloud/clever-client.js", | ||
"lint:fix": "eslint --fix esm tasks/*.cjs test", | ||
"prepack": "npm run lint && npm run test-wtr && npm run generate-client", | ||
"prepack": "npm run lint && npm run generate-client", | ||
"test-wtr": "web-test-runner", | ||
@@ -32,0 +32,0 @@ "test-wtr:watch": "web-test-runner --watch", |
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
600525
18469
5