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

@substrate/playground-client

Package Overview
Dependencies
Maintainers
12
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@substrate/playground-client - npm Package Compare versions

Comparing version 1.5.4 to 1.6.0

dist/browser/workspace.d.ts

27

dist/browser/index.d.ts

@@ -1,7 +0,7 @@

import { Playground, Pool, Session, SessionConfiguration, SessionUpdateConfiguration, Template, User, UserConfiguration, UserUpdateConfiguration } from './types';
import { Playground, Pool, Workspace, WorkspaceConfiguration, WorkspaceUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration } from './types';
export declare class Client {
static userResource: string;
static usersResource: string;
static sessionResource: string;
static sessionsResource: string;
static workspaceResource: string;
static workspacesResource: string;
static templatesResource: string;

@@ -22,12 +22,11 @@ static poolsResource: string;

deleteUser(id: string, init?: RequestInit): Promise<void>;
getCurrentSession(init?: RequestInit): Promise<Session | null>;
createCurrentSession(conf: SessionConfiguration, init?: RequestInit): Promise<void>;
updateCurrentSession(conf: SessionUpdateConfiguration, init?: RequestInit): Promise<void>;
deleteCurrentSession(init?: RequestInit): Promise<void>;
getSession(id: string, init?: RequestInit): Promise<Session | null>;
listSessions(init?: RequestInit): Promise<Record<string, Session>>;
createSession(id: string, conf: SessionConfiguration, init?: RequestInit): Promise<void>;
updateSession(id: string, conf: SessionUpdateConfiguration, init?: RequestInit): Promise<void>;
deleteSession(id: string, init?: RequestInit): Promise<void>;
listTemplates(init?: RequestInit): Promise<Record<string, Template>>;
getCurrentWorkspace(init?: RequestInit): Promise<Workspace | null>;
createCurrentWorkspace(conf: WorkspaceConfiguration, init?: RequestInit): Promise<void>;
updateCurrentWorkspace(conf: WorkspaceUpdateConfiguration, init?: RequestInit): Promise<void>;
deleteCurrentWorkspace(init?: RequestInit): Promise<void>;
getWorkspace(id: string, init?: RequestInit): Promise<Workspace | null>;
listWorkspaces(init?: RequestInit): Promise<Record<string, Workspace>>;
createWorkspace(id: string, conf: WorkspaceConfiguration, init?: RequestInit): Promise<void>;
updateWorkspace(id: string, conf: WorkspaceUpdateConfiguration, init?: RequestInit): Promise<void>;
deleteWorkspace(id: string, init?: RequestInit): Promise<void>;
getPool(id: string, init?: RequestInit): Promise<Pool | null>;

@@ -40,4 +39,4 @@ listPools(init?: RequestInit): Promise<Record<string, Pool>>;

export * from "./rpc";
export * from "./session";
export * from "./workspace";
export * from "./types";
export * from "./utils";

@@ -60,55 +60,49 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
// Current Session
getCurrentSession(init = this.defaultInit) {
// Current Workspace
getCurrentWorkspace(init = this.defaultInit) {
return __awaiter(this, void 0, void 0, function* () {
return rpc(this.path(Client.sessionResource), init, this.timeout);
return rpc(this.path(Client.workspaceResource), init, this.timeout);
});
}
createCurrentSession(conf, init = this.defaultInit) {
createCurrentWorkspace(conf, init = this.defaultInit) {
return __awaiter(this, void 0, void 0, function* () {
return rpc(this.path(Client.sessionResource), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout);
return rpc(this.path(Client.workspaceResource), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout);
});
}
updateCurrentSession(conf, init = this.defaultInit) {
updateCurrentWorkspace(conf, init = this.defaultInit) {
return __awaiter(this, void 0, void 0, function* () {
return rpc(this.path(Client.sessionResource), Object.assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), this.timeout);
return rpc(this.path(Client.workspaceResource), Object.assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), this.timeout);
});
}
deleteCurrentSession(init = this.defaultInit) {
deleteCurrentWorkspace(init = this.defaultInit) {
return __awaiter(this, void 0, void 0, function* () {
return rpc(this.path(Client.sessionResource), Object.assign({ method: 'DELETE' }, init), this.timeout);
return rpc(this.path(Client.workspaceResource), Object.assign({ method: 'DELETE' }, init), this.timeout);
});
}
// Sessions
getSession(id, init = this.defaultInit) {
// Workspaces
getWorkspace(id, init = this.defaultInit) {
return __awaiter(this, void 0, void 0, function* () {
return rpc(this.path(Client.sessionsResource, id), init, this.timeout);
return rpc(this.path(Client.workspacesResource, id), init, this.timeout);
});
}
listSessions(init = this.defaultInit) {
listWorkspaces(init = this.defaultInit) {
return __awaiter(this, void 0, void 0, function* () {
return rpc(this.path(Client.sessionsResource), init, this.timeout);
return rpc(this.path(Client.workspacesResource), init, this.timeout);
});
}
createSession(id, conf, init = this.defaultInit) {
createWorkspace(id, conf, init = this.defaultInit) {
return __awaiter(this, void 0, void 0, function* () {
return rpc(this.path(Client.sessionsResource, id), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout);
return rpc(this.path(Client.workspacesResource, id), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout);
});
}
updateSession(id, conf, init = this.defaultInit) {
updateWorkspace(id, conf, init = this.defaultInit) {
return __awaiter(this, void 0, void 0, function* () {
return rpc(this.path(Client.sessionsResource, id), Object.assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), this.timeout);
return rpc(this.path(Client.workspacesResource, id), Object.assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), this.timeout);
});
}
deleteSession(id, init = this.defaultInit) {
deleteWorkspace(id, init = this.defaultInit) {
return __awaiter(this, void 0, void 0, function* () {
return rpc(this.path(Client.sessionsResource, id), Object.assign({ method: 'DELETE' }, init), this.timeout);
return rpc(this.path(Client.workspacesResource, id), Object.assign({ method: 'DELETE' }, init), this.timeout);
});
}
// Templates
listTemplates(init = this.defaultInit) {
return __awaiter(this, void 0, void 0, function* () {
return rpc(this.path(Client.templatesResource), init, this.timeout);
});
}
// Pools

@@ -139,4 +133,4 @@ getPool(id, init = this.defaultInit) {

Client.usersResource = 'users';
Client.sessionResource = 'session';
Client.sessionsResource = 'sessions';
Client.workspaceResource = 'workspace';
Client.workspacesResource = 'workspaces';
Client.templatesResource = 'templates';

@@ -146,4 +140,4 @@ Client.poolsResource = 'pools';

export * from "./rpc";
export * from "./session";
export * from "./workspace";
export * from "./types";
export * from "./utils";

@@ -13,12 +13,17 @@ export interface Playground {

githubClientId: string;
session: SessionDefaults;
workspace: WorkspaceDefaults;
}
export interface SessionDefaults {
export interface WorkspaceDefaults {
duration: number;
maxDuration: number;
poolAffinity: string;
maxSessionsPerPod: string;
maxWorkspacesPerPod: string;
}
export interface LoggedUser {
export interface IdentifiedResource {
id: string;
}
export interface OwnedResource {
userId: string;
}
export interface LoggedUser extends IdentifiedResource {
admin: boolean;

@@ -48,11 +53,16 @@ organizations: string[];

}
export interface Session {
userId: string;
url: string;
template: Template;
pod: Pod;
duration: number;
export interface Workspace extends IdentifiedResource, OwnedResource {
repositoryVersion: RepositoryVersion;
state: WorkspaceState;
maxDuration: number;
node: string;
}
export interface WorkspaceStateRunning {
startTime: number;
node: Node;
}
export interface WorkspaceStateFailed {
message: string;
reason: string;
}
export declare type WorkspaceState = 'WorkspaceStateDeploying' | WorkspaceStateRunning | 'WorkspaceStatePaused' | WorkspaceStateFailed | 'WorkspaceStateUnknown';
export interface Pool {

@@ -66,8 +76,9 @@ name: string;

}
export interface SessionConfiguration {
template: string;
export interface WorkspaceConfiguration {
repositoryId: string;
repositoryReference: string;
duration?: number;
poolAffinity?: string;
}
export interface SessionUpdateConfiguration {
export interface WorkspaceUpdateConfiguration {
duration?: number;

@@ -90,31 +101,32 @@ }

}
export interface Template {
name: string;
image: string;
description: string;
export interface Repository {
id?: string;
tags?: Record<string, string>;
runtime?: RuntimeConfiguration;
url: string;
versions: RepositoryVersion[];
}
export declare type Phase = 'Pending' | 'Running' | 'Succeeded' | 'Failed' | 'Unknown';
export interface Pod {
phase: Phase;
reason: string;
message: string;
startTime?: number;
conditions?: PodCondition[];
container?: ContainerStatus;
export interface RepositoryConfiguration extends IdentifiedResource {
tags?: Record<string, string>;
url: string;
}
export declare type ContainerPhase = 'Running' | 'Terminated' | 'Waiting' | 'Unknown';
export interface ContainerStatus {
phase: ContainerPhase;
reason?: string;
message?: string;
export interface RepositoryVersion {
reference: string;
state: RepositoryVersionState;
runtime: Runtime;
}
export interface PodCondition {
type_: ConditionType;
status: Status;
reason?: string;
message?: string;
export interface BUILT {
progress: number;
}
export declare type ConditionType = 'PodScheduled' | 'ContainersReady' | 'Initialized' | 'Ready' | 'Unknown';
export declare type Status = 'True' | 'False' | 'Unknown';
export declare type RepositoryVersionState = 'BUILDING' | BUILT;
export interface Runtime {
containerConfiguration: ContainerConfiguration;
env?: NameValuePair[];
ports?: Port[];
}
export declare type ContainerConfiguration = IMAGE | DOCKERFILE;
export interface IMAGE {
value: string;
}
export interface DOCKERFILE {
value: string;
}

@@ -1,7 +0,7 @@

import { Playground, Pool, Session, SessionConfiguration, SessionUpdateConfiguration, Template, User, UserConfiguration, UserUpdateConfiguration } from './types';
import { Playground, Pool, Workspace, WorkspaceConfiguration, WorkspaceUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration } from './types';
export declare class Client {
static userResource: string;
static usersResource: string;
static sessionResource: string;
static sessionsResource: string;
static workspaceResource: string;
static workspacesResource: string;
static templatesResource: string;

@@ -22,12 +22,11 @@ static poolsResource: string;

deleteUser(id: string, init?: RequestInit): Promise<void>;
getCurrentSession(init?: RequestInit): Promise<Session | null>;
createCurrentSession(conf: SessionConfiguration, init?: RequestInit): Promise<void>;
updateCurrentSession(conf: SessionUpdateConfiguration, init?: RequestInit): Promise<void>;
deleteCurrentSession(init?: RequestInit): Promise<void>;
getSession(id: string, init?: RequestInit): Promise<Session | null>;
listSessions(init?: RequestInit): Promise<Record<string, Session>>;
createSession(id: string, conf: SessionConfiguration, init?: RequestInit): Promise<void>;
updateSession(id: string, conf: SessionUpdateConfiguration, init?: RequestInit): Promise<void>;
deleteSession(id: string, init?: RequestInit): Promise<void>;
listTemplates(init?: RequestInit): Promise<Record<string, Template>>;
getCurrentWorkspace(init?: RequestInit): Promise<Workspace | null>;
createCurrentWorkspace(conf: WorkspaceConfiguration, init?: RequestInit): Promise<void>;
updateCurrentWorkspace(conf: WorkspaceUpdateConfiguration, init?: RequestInit): Promise<void>;
deleteCurrentWorkspace(init?: RequestInit): Promise<void>;
getWorkspace(id: string, init?: RequestInit): Promise<Workspace | null>;
listWorkspaces(init?: RequestInit): Promise<Record<string, Workspace>>;
createWorkspace(id: string, conf: WorkspaceConfiguration, init?: RequestInit): Promise<void>;
updateWorkspace(id: string, conf: WorkspaceUpdateConfiguration, init?: RequestInit): Promise<void>;
deleteWorkspace(id: string, init?: RequestInit): Promise<void>;
getPool(id: string, init?: RequestInit): Promise<Pool | null>;

@@ -40,4 +39,4 @@ listPools(init?: RequestInit): Promise<Record<string, Pool>>;

export * from "./rpc";
export * from "./session";
export * from "./workspace";
export * from "./types";
export * from "./utils";

@@ -143,85 +143,76 @@ "use strict";

};
// Current Session
Client.prototype.getCurrentSession = function (init) {
// Current Workspace
Client.prototype.getCurrentWorkspace = function (init) {
if (init === void 0) { init = this.defaultInit; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, rpc_1.rpc(this.path(Client.sessionResource), init, this.timeout)];
return [2 /*return*/, rpc_1.rpc(this.path(Client.workspaceResource), init, this.timeout)];
});
});
};
Client.prototype.createCurrentSession = function (conf, init) {
Client.prototype.createCurrentWorkspace = function (conf, init) {
if (init === void 0) { init = this.defaultInit; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, rpc_1.rpc(this.path(Client.sessionResource), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout)];
return [2 /*return*/, rpc_1.rpc(this.path(Client.workspaceResource), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout)];
});
});
};
Client.prototype.updateCurrentSession = function (conf, init) {
Client.prototype.updateCurrentWorkspace = function (conf, init) {
if (init === void 0) { init = this.defaultInit; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, rpc_1.rpc(this.path(Client.sessionResource), __assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), this.timeout)];
return [2 /*return*/, rpc_1.rpc(this.path(Client.workspaceResource), __assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), this.timeout)];
});
});
};
Client.prototype.deleteCurrentSession = function (init) {
Client.prototype.deleteCurrentWorkspace = function (init) {
if (init === void 0) { init = this.defaultInit; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, rpc_1.rpc(this.path(Client.sessionResource), __assign({ method: 'DELETE' }, init), this.timeout)];
return [2 /*return*/, rpc_1.rpc(this.path(Client.workspaceResource), __assign({ method: 'DELETE' }, init), this.timeout)];
});
});
};
// Sessions
Client.prototype.getSession = function (id, init) {
// Workspaces
Client.prototype.getWorkspace = function (id, init) {
if (init === void 0) { init = this.defaultInit; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, rpc_1.rpc(this.path(Client.sessionsResource, id), init, this.timeout)];
return [2 /*return*/, rpc_1.rpc(this.path(Client.workspacesResource, id), init, this.timeout)];
});
});
};
Client.prototype.listSessions = function (init) {
Client.prototype.listWorkspaces = function (init) {
if (init === void 0) { init = this.defaultInit; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, rpc_1.rpc(this.path(Client.sessionsResource), init, this.timeout)];
return [2 /*return*/, rpc_1.rpc(this.path(Client.workspacesResource), init, this.timeout)];
});
});
};
Client.prototype.createSession = function (id, conf, init) {
Client.prototype.createWorkspace = function (id, conf, init) {
if (init === void 0) { init = this.defaultInit; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, rpc_1.rpc(this.path(Client.sessionsResource, id), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout)];
return [2 /*return*/, rpc_1.rpc(this.path(Client.workspacesResource, id), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout)];
});
});
};
Client.prototype.updateSession = function (id, conf, init) {
Client.prototype.updateWorkspace = function (id, conf, init) {
if (init === void 0) { init = this.defaultInit; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, rpc_1.rpc(this.path(Client.sessionsResource, id), __assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), this.timeout)];
return [2 /*return*/, rpc_1.rpc(this.path(Client.workspacesResource, id), __assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), this.timeout)];
});
});
};
Client.prototype.deleteSession = function (id, init) {
Client.prototype.deleteWorkspace = function (id, init) {
if (init === void 0) { init = this.defaultInit; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, rpc_1.rpc(this.path(Client.sessionsResource, id), __assign({ method: 'DELETE' }, init), this.timeout)];
return [2 /*return*/, rpc_1.rpc(this.path(Client.workspacesResource, id), __assign({ method: 'DELETE' }, init), this.timeout)];
});
});
};
// Templates
Client.prototype.listTemplates = function (init) {
if (init === void 0) { init = this.defaultInit; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, rpc_1.rpc(this.path(Client.templatesResource), init, this.timeout)];
});
});
};
// Pools

@@ -263,4 +254,4 @@ Client.prototype.getPool = function (id, init) {

Client.usersResource = 'users';
Client.sessionResource = 'session';
Client.sessionsResource = 'sessions';
Client.workspaceResource = 'workspace';
Client.workspacesResource = 'workspaces';
Client.templatesResource = 'templates';

@@ -273,4 +264,4 @@ Client.poolsResource = 'pools';

__exportStar(require("./rpc"), exports);
__exportStar(require("./session"), exports);
__exportStar(require("./workspace"), exports);
__exportStar(require("./types"), exports);
__exportStar(require("./utils"), exports);

@@ -13,12 +13,17 @@ export interface Playground {

githubClientId: string;
session: SessionDefaults;
workspace: WorkspaceDefaults;
}
export interface SessionDefaults {
export interface WorkspaceDefaults {
duration: number;
maxDuration: number;
poolAffinity: string;
maxSessionsPerPod: string;
maxWorkspacesPerPod: string;
}
export interface LoggedUser {
export interface IdentifiedResource {
id: string;
}
export interface OwnedResource {
userId: string;
}
export interface LoggedUser extends IdentifiedResource {
admin: boolean;

@@ -48,11 +53,16 @@ organizations: string[];

}
export interface Session {
userId: string;
url: string;
template: Template;
pod: Pod;
duration: number;
export interface Workspace extends IdentifiedResource, OwnedResource {
repositoryVersion: RepositoryVersion;
state: WorkspaceState;
maxDuration: number;
node: string;
}
export interface WorkspaceStateRunning {
startTime: number;
node: Node;
}
export interface WorkspaceStateFailed {
message: string;
reason: string;
}
export declare type WorkspaceState = 'WorkspaceStateDeploying' | WorkspaceStateRunning | 'WorkspaceStatePaused' | WorkspaceStateFailed | 'WorkspaceStateUnknown';
export interface Pool {

@@ -66,8 +76,9 @@ name: string;

}
export interface SessionConfiguration {
template: string;
export interface WorkspaceConfiguration {
repositoryId: string;
repositoryReference: string;
duration?: number;
poolAffinity?: string;
}
export interface SessionUpdateConfiguration {
export interface WorkspaceUpdateConfiguration {
duration?: number;

@@ -90,31 +101,32 @@ }

}
export interface Template {
name: string;
image: string;
description: string;
export interface Repository {
id?: string;
tags?: Record<string, string>;
runtime?: RuntimeConfiguration;
url: string;
versions: RepositoryVersion[];
}
export declare type Phase = 'Pending' | 'Running' | 'Succeeded' | 'Failed' | 'Unknown';
export interface Pod {
phase: Phase;
reason: string;
message: string;
startTime?: number;
conditions?: PodCondition[];
container?: ContainerStatus;
export interface RepositoryConfiguration extends IdentifiedResource {
tags?: Record<string, string>;
url: string;
}
export declare type ContainerPhase = 'Running' | 'Terminated' | 'Waiting' | 'Unknown';
export interface ContainerStatus {
phase: ContainerPhase;
reason?: string;
message?: string;
export interface RepositoryVersion {
reference: string;
state: RepositoryVersionState;
runtime: Runtime;
}
export interface PodCondition {
type_: ConditionType;
status: Status;
reason?: string;
message?: string;
export interface BUILT {
progress: number;
}
export declare type ConditionType = 'PodScheduled' | 'ContainersReady' | 'Initialized' | 'Ready' | 'Unknown';
export declare type Status = 'True' | 'False' | 'Unknown';
export declare type RepositoryVersionState = 'BUILDING' | BUILT;
export interface Runtime {
containerConfiguration: ContainerConfiguration;
env?: NameValuePair[];
ports?: Port[];
}
export declare type ContainerConfiguration = IMAGE | DOCKERFILE;
export interface IMAGE {
value: string;
}
export interface DOCKERFILE {
value: string;
}
{
"name": "@substrate/playground-client",
"version": "1.5.4",
"version": "1.6.0",
"description": "An isomorphic client for Substrate Playground",

@@ -5,0 +5,0 @@ "main": "dist/main/index.js",

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