Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eclipse-theiacloud/common

Package Overview
Dependencies
Maintainers
5
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eclipse-theiacloud/common - npm Package Compare versions

Comparing version 0.8.0-alpha.21 to 0.8.0-alpha.22

8

lib/client.d.ts

@@ -1,2 +0,2 @@

import { LaunchRequest as ClientLaunchRequest, PingRequest as ClientPingRequest, SessionActivityRequest as ClientSessionActivityRequest, SessionListRequest as ClientSessionListRequest, SessionSpec, SessionStartRequest as ClientSessionStartRequest, SessionStopRequest as ClientSessionStopRequest, UserWorkspace, WorkspaceCreationRequest as ClientWorkspaceCreationRequest, WorkspaceDeletionRequest as ClientWorkspaceDeletionRequest, WorkspaceListRequest as ClientWorkspaceListRequest } from './client/api';
import { LaunchRequest as ClientLaunchRequest, PingRequest as ClientPingRequest, SessionActivityRequest as ClientSessionActivityRequest, SessionListRequest as ClientSessionListRequest, SessionPerformance, SessionPerformanceRequest as ClientSessionPerformanceRequest, SessionSpec, SessionStartRequest as ClientSessionStartRequest, SessionStopRequest as ClientSessionStopRequest, UserWorkspace, WorkspaceCreationRequest as ClientWorkspaceCreationRequest, WorkspaceDeletionRequest as ClientWorkspaceDeletionRequest, WorkspaceListRequest as ClientWorkspaceListRequest } from './client/api';
export declare const DEFAULT_CALL_TIMEOUT = 30000;

@@ -10,2 +10,3 @@ export declare const DEFAULT_CALL_RETRIES = 0;

export interface ServiceRequest {
/** The root URL of the service. */
serviceUrl: string;

@@ -45,2 +46,6 @@ kind?: string;

}
export declare type SessionPerformanceRequest = ClientSessionPerformanceRequest & ServiceRequest;
export declare namespace SessionPerformanceRequest {
const KIND = "sessionPerformanceRequest";
}
export declare type WorkspaceListRequest = ClientWorkspaceListRequest & ServiceRequest;

@@ -67,2 +72,3 @@ export declare namespace WorkspaceListRequest {

function reportSessionActivity(request: SessionActivityRequest, options?: RequestOptions): Promise<boolean>;
function getSessionPerformance(request: SessionPerformanceRequest, options?: RequestOptions): Promise<SessionPerformance>;
}

@@ -69,0 +75,0 @@ namespace Workspace {

28

lib/client.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TheiaCloudError = exports.TheiaCloudErrorResponse = exports.TheiaCloud = exports.WorkspaceDeletionRequest = exports.WorkspaceCreationRequest = exports.WorkspaceListRequest = exports.SessionActivityRequest = exports.SessionStopRequest = exports.SessionStartRequest = exports.SessionListRequest = exports.LaunchRequest = exports.PingRequest = exports.ServiceRequest = exports.DEFAULT_CALL_RETRIES = exports.DEFAULT_CALL_TIMEOUT = void 0;
exports.TheiaCloudError = exports.TheiaCloudErrorResponse = exports.TheiaCloud = exports.WorkspaceDeletionRequest = exports.WorkspaceCreationRequest = exports.WorkspaceListRequest = exports.SessionPerformanceRequest = exports.SessionActivityRequest = exports.SessionStopRequest = exports.SessionStartRequest = exports.SessionListRequest = exports.LaunchRequest = exports.PingRequest = exports.ServiceRequest = exports.DEFAULT_CALL_RETRIES = exports.DEFAULT_CALL_TIMEOUT = void 0;
const axios_1 = require("axios");

@@ -58,2 +58,6 @@ const uuid_1 = require("uuid");

})(SessionActivityRequest = exports.SessionActivityRequest || (exports.SessionActivityRequest = {}));
var SessionPerformanceRequest;
(function (SessionPerformanceRequest) {
SessionPerformanceRequest.KIND = 'sessionPerformanceRequest';
})(SessionPerformanceRequest = exports.SessionPerformanceRequest || (exports.SessionPerformanceRequest = {}));
var WorkspaceListRequest;

@@ -73,16 +77,11 @@ (function (WorkspaceListRequest) {

(function (TheiaCloud) {
function basePath(url) {
// remove any path names as they are provided by the APIs
const pathName = new URL(url).pathname;
return url.endsWith(pathName) ? url.substring(0, url.length - new URL(url).pathname.length) : url;
function rootApi(serviceUrl, accessToken) {
return new api_1.RootResourceApi(new configuration_1.Configuration({ basePath: serviceUrl, accessToken }));
}
function rootApi(url, accessToken) {
return new api_1.RootResourceApi(new configuration_1.Configuration({ basePath: basePath(url), accessToken }));
function sessionApi(serviceUrl, accessToken) {
return new api_1.SessionResourceApi(new configuration_1.Configuration({ basePath: serviceUrl, accessToken }));
}
function sessionApi(url, accessToken) {
return new api_1.SessionResourceApi(new configuration_1.Configuration({ basePath: basePath(url), accessToken }));
function workspaceApi(serviceUrl, accessToken) {
return new api_1.WorkspaceResourceApi(new configuration_1.Configuration({ basePath: serviceUrl, accessToken }));
}
function workspaceApi(url, accessToken) {
return new api_1.WorkspaceResourceApi(new configuration_1.Configuration({ basePath: basePath(url), accessToken }));
}
async function ping(request, options = {}) {

@@ -131,2 +130,7 @@ const { accessToken, retries, timeout } = options;

Session.reportSessionActivity = reportSessionActivity;
async function getSessionPerformance(request, options = {}) {
const { accessToken, retries, timeout } = options;
return call(() => sessionApi(request.serviceUrl, accessToken).serviceSessionPerformanceAppIdSessionNameGet(request.appId, request.sessionName, createConfig(timeout)), retries);
}
Session.getSessionPerformance = getSessionPerformance;
})(Session = TheiaCloud.Session || (TheiaCloud.Session = {}));

@@ -133,0 +137,0 @@ let Workspace;

@@ -116,2 +116,52 @@ /**

/**
* Description of the performance of a session
* @export
* @interface SessionPerformance
*/
export interface SessionPerformance {
/**
* Used CPU amount of the workspace
* @type {string}
* @memberof SessionPerformance
*/
'cpuAmount': string;
/**
* Used CPU format of the workspace
* @type {string}
* @memberof SessionPerformance
*/
'cpuFormat': string;
/**
* Used memory amount of the workspace
* @type {string}
* @memberof SessionPerformance
*/
'memoryAmount': string;
/**
* Used memory format of the workspace
* @type {string}
* @memberof SessionPerformance
*/
'memoryFormat': string;
}
/**
* A request to list the sessions of a user.
* @export
* @interface SessionPerformanceRequest
*/
export interface SessionPerformanceRequest {
/**
* The App Id of this Theia.cloud instance. Request without a matching Id will be denied.
* @type {string}
* @memberof SessionPerformanceRequest
*/
'appId': string;
/**
* The name of the session
* @type {string}
* @memberof SessionPerformanceRequest
*/
'sessionName': string;
}
/**
*

@@ -462,2 +512,11 @@ * @export

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
serviceSessionPerformanceAppIdSessionNameGet: (appId: string, sessionName: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -502,2 +561,11 @@ * @summary Start a new session

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
serviceSessionPerformanceAppIdSessionNameGet(appId: string, sessionName: string, options?: AxiosRequestConfig<any> | undefined): Promise<(axios?: AxiosInstance | undefined, basePath?: string | undefined) => AxiosPromise<SessionPerformance>>;
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -542,2 +610,11 @@ * @summary Start a new session

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
serviceSessionPerformanceAppIdSessionNameGet(appId: string, sessionName: string, options?: any): AxiosPromise<SessionPerformance>;
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -587,2 +664,12 @@ * @summary Start a new session

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SessionResourceApi
*/
serviceSessionPerformanceAppIdSessionNameGet(appId: string, sessionName: string, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<SessionPerformance, any>>;
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -589,0 +676,0 @@ * @summary Start a new session

@@ -296,2 +296,38 @@ "use strict";

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
serviceSessionPerformanceAppIdSessionNameGet: async (appId, sessionName, options = {}) => {
// verify required parameter 'appId' is not null or undefined
(0, common_1.assertParamExists)('serviceSessionPerformanceAppIdSessionNameGet', 'appId', appId);
// verify required parameter 'sessionName' is not null or undefined
(0, common_1.assertParamExists)('serviceSessionPerformanceAppIdSessionNameGet', 'sessionName', sessionName);
const localVarPath = `/service/session/performance/{appId}/{sessionName}`
.replace(`{${"appId"}}`, encodeURIComponent(String(appId)))
.replace(`{${"sessionName"}}`, encodeURIComponent(String(sessionName)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication SecurityScheme required
// oauth required
await (0, common_1.setOAuthToObject)(localVarHeaderParameter, "SecurityScheme", [], configuration);
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -372,2 +408,14 @@ * @summary Start a new session

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async serviceSessionPerformanceAppIdSessionNameGet(appId, sessionName, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.serviceSessionPerformanceAppIdSessionNameGet(appId, sessionName, options);
return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
},
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -425,2 +473,13 @@ * @summary Start a new session

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
serviceSessionPerformanceAppIdSessionNameGet(appId, sessionName, options) {
return localVarFp.serviceSessionPerformanceAppIdSessionNameGet(appId, sessionName, options).then((request) => request(axios, basePath));
},
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -480,2 +539,14 @@ * @summary Start a new session

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SessionResourceApi
*/
serviceSessionPerformanceAppIdSessionNameGet(appId, sessionName, options) {
return (0, exports.SessionResourceApiFp)(this.configuration).serviceSessionPerformanceAppIdSessionNameGet(appId, sessionName, options).then((request) => request(this.axios, this.basePath));
}
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -482,0 +553,0 @@ * @summary Start a new session

@@ -139,3 +139,3 @@ "use strict";

return (axios = globalAxios, basePath = BASE_PATH) => {
const axiosRequestArgs = { ...axiosArgs.options, url: (configuration ? configuration.basePath : basePath) + axiosArgs.url };
const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url };
return axios.request(axiosRequestArgs);

@@ -142,0 +142,0 @@ };

{
"name": "@eclipse-theiacloud/common",
"version": "0.8.0-alpha.21",
"version": "0.8.0-alpha.22",
"description": "Common functionality for Theia.cloud",

@@ -5,0 +5,0 @@ "license": "EPL-2.0",

@@ -7,7 +7,7 @@ import { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';

PingRequest as ClientPingRequest, RootResourceApi, SessionActivityRequest as ClientSessionActivityRequest, SessionListRequest as ClientSessionListRequest,
SessionPerformance, SessionPerformanceRequest as ClientSessionPerformanceRequest,
SessionResourceApi, SessionSpec, SessionStartRequest as ClientSessionStartRequest, SessionStopRequest as ClientSessionStopRequest,
UserWorkspace, WorkspaceCreationRequest as ClientWorkspaceCreationRequest,
WorkspaceDeletionRequest as ClientWorkspaceDeletionRequest, WorkspaceListRequest as ClientWorkspaceListRequest,
WorkspaceResourceApi
} from './client/api';
WorkspaceResourceApi } from './client/api';
import { Configuration } from './client/configuration';

@@ -25,2 +25,3 @@

export interface ServiceRequest {
/** The root URL of the service. */
serviceUrl: string;

@@ -83,2 +84,7 @@ kind?: string;

export type SessionPerformanceRequest = ClientSessionPerformanceRequest & ServiceRequest;
export namespace SessionPerformanceRequest {
export const KIND = 'sessionPerformanceRequest';
}
export type WorkspaceListRequest = ClientWorkspaceListRequest & ServiceRequest;

@@ -100,20 +106,14 @@ export namespace WorkspaceListRequest {

export namespace TheiaCloud {
function basePath(url: string): string {
// remove any path names as they are provided by the APIs
const pathName = new URL(url).pathname;
return url.endsWith(pathName) ? url.substring(0, url.length - new URL(url).pathname.length) : url;
function rootApi(serviceUrl: string, accessToken: string | undefined): RootResourceApi {
return new RootResourceApi(new Configuration({ basePath: serviceUrl, accessToken }));
}
function rootApi(url: string, accessToken: string | undefined): RootResourceApi {
return new RootResourceApi(new Configuration({ basePath: basePath(url), accessToken }));
function sessionApi(serviceUrl: string, accessToken: string | undefined): SessionResourceApi {
return new SessionResourceApi(new Configuration({ basePath: serviceUrl, accessToken }));
}
function sessionApi(url: string, accessToken: string | undefined): SessionResourceApi {
return new SessionResourceApi(new Configuration({ basePath: basePath(url), accessToken }));
function workspaceApi(serviceUrl: string, accessToken: string | undefined): WorkspaceResourceApi {
return new WorkspaceResourceApi(new Configuration({ basePath: serviceUrl, accessToken }));
}
function workspaceApi(url: string, accessToken: string | undefined): WorkspaceResourceApi {
return new WorkspaceResourceApi(new Configuration({ basePath: basePath(url), accessToken }));
}
export async function ping(request: PingRequest, options: RequestOptions = {}): Promise<boolean> {

@@ -160,2 +160,10 @@ const { accessToken, retries, timeout } = options;

}
export async function getSessionPerformance(request: SessionPerformanceRequest, options: RequestOptions = {}): Promise<SessionPerformance> {
const { accessToken, retries, timeout } = options;
return call(
() => sessionApi(request.serviceUrl, accessToken).serviceSessionPerformanceAppIdSessionNameGet(request.appId, request.sessionName, createConfig(timeout)),
retries
);
}
}

@@ -162,0 +170,0 @@

@@ -125,2 +125,52 @@ /* tslint:disable */

/**
* Description of the performance of a session
* @export
* @interface SessionPerformance
*/
export interface SessionPerformance {
/**
* Used CPU amount of the workspace
* @type {string}
* @memberof SessionPerformance
*/
'cpuAmount': string;
/**
* Used CPU format of the workspace
* @type {string}
* @memberof SessionPerformance
*/
'cpuFormat': string;
/**
* Used memory amount of the workspace
* @type {string}
* @memberof SessionPerformance
*/
'memoryAmount': string;
/**
* Used memory format of the workspace
* @type {string}
* @memberof SessionPerformance
*/
'memoryFormat': string;
}
/**
* A request to list the sessions of a user.
* @export
* @interface SessionPerformanceRequest
*/
export interface SessionPerformanceRequest {
/**
* The App Id of this Theia.cloud instance. Request without a matching Id will be denied.
* @type {string}
* @memberof SessionPerformanceRequest
*/
'appId': string;
/**
* The name of the session
* @type {string}
* @memberof SessionPerformanceRequest
*/
'sessionName': string;
}
/**
*

@@ -654,2 +704,44 @@ * @export

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
serviceSessionPerformanceAppIdSessionNameGet: async (appId: string, sessionName: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'appId' is not null or undefined
assertParamExists('serviceSessionPerformanceAppIdSessionNameGet', 'appId', appId)
// verify required parameter 'sessionName' is not null or undefined
assertParamExists('serviceSessionPerformanceAppIdSessionNameGet', 'sessionName', sessionName)
const localVarPath = `/service/session/performance/{appId}/{sessionName}`
.replace(`{${"appId"}}`, encodeURIComponent(String(appId)))
.replace(`{${"sessionName"}}`, encodeURIComponent(String(sessionName)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication SecurityScheme required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "SecurityScheme", [], configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -737,2 +829,14 @@ * @summary Start a new session

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async serviceSessionPerformanceAppIdSessionNameGet(appId: string, sessionName: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SessionPerformance>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.serviceSessionPerformanceAppIdSessionNameGet(appId, sessionName, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -790,2 +894,13 @@ * @summary Start a new session

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
serviceSessionPerformanceAppIdSessionNameGet(appId: string, sessionName: string, options?: any): AxiosPromise<SessionPerformance> {
return localVarFp.serviceSessionPerformanceAppIdSessionNameGet(appId, sessionName, options).then((request) => request(axios, basePath));
},
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -848,2 +963,15 @@ * @summary Start a new session

/**
* Returns the current CPU and memory usage of the session\'s pod.
* @summary Get performance metrics
* @param {string} appId
* @param {string} sessionName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SessionResourceApi
*/
public serviceSessionPerformanceAppIdSessionNameGet(appId: string, sessionName: string, options?: AxiosRequestConfig) {
return SessionResourceApiFp(this.configuration).serviceSessionPerformanceAppIdSessionNameGet(appId, sessionName, options).then((request) => request(this.axios, this.basePath));
}
/**
* Starts a new session for an existing workspace and responds with the URL of the started session.

@@ -850,0 +978,0 @@ * @summary Start a new session

@@ -145,5 +145,5 @@ /* tslint:disable */

return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...axiosArgs.options, url: (configuration ? configuration.basePath : basePath) + axiosArgs.url};
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
return axios.request<T, R>(axiosRequestArgs);
};
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc