@substrate/playground-client
Advanced tools
Comparing version 1.8.5 to 1.8.6
@@ -1,2 +0,2 @@ | ||
import { Playground, Pool, Workspace, WorkspaceConfiguration, WorkspaceUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration, Repository, RepositoryConfiguration, RepositoryUpdateConfiguration, RepositoryVersion, RepositoryVersionConfiguration, SessionConfiguration, Session, SessionUpdateConfiguration, Template } from './types'; | ||
import { Playground, Pool, Workspace, WorkspaceConfiguration, WorkspaceUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration, Repository, RepositoryConfiguration, RepositoryUpdateConfiguration, RepositoryVersion, RepositoryVersionConfiguration, SessionConfiguration, Session, SessionUpdateConfiguration, Template, SessionExecutionConfiguration, SessionExecution } from './types'; | ||
export declare class Client { | ||
@@ -9,2 +9,3 @@ static userResource: string; | ||
static sessionsResource: string; | ||
static sessionExecutionResourcePath: string; | ||
static repositoriesResource: string; | ||
@@ -46,2 +47,3 @@ static templatesResource: string; | ||
deleteSession(id: string, timeout?: number, init?: RequestInit): Promise<void>; | ||
createSessionExecution(id: string, conf: SessionExecutionConfiguration, timeout?: number, init?: RequestInit): Promise<SessionExecution>; | ||
getRepository(id: Repository['id'], timeout?: number, init?: RequestInit): Promise<Repository | null>; | ||
@@ -48,0 +50,0 @@ listRepositories(timeout?: number, init?: RequestInit): Promise<Repository[]>; |
@@ -176,2 +176,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
// Session executions | ||
createSessionExecution(id, conf, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.sessionsResource, id, Client.sessionExecutionResourcePath), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout); | ||
}); | ||
} | ||
// Repositories | ||
@@ -247,2 +253,3 @@ getRepository(id, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
Client.sessionsResource = 'sessions'; | ||
Client.sessionExecutionResourcePath = 'execution'; | ||
Client.repositoriesResource = 'repositories'; | ||
@@ -249,0 +256,0 @@ Client.templatesResource = 'templates'; |
@@ -8,10 +8,5 @@ export interface IdentifiedResource { | ||
export interface Playground { | ||
env: Environment; | ||
configuration: Configuration; | ||
user?: LoggedUser; | ||
} | ||
export interface Environment { | ||
host: string; | ||
namespace: string; | ||
} | ||
export interface Configuration { | ||
@@ -166,2 +161,8 @@ githubClientId: string; | ||
} | ||
export interface SessionExecution { | ||
stdout: string; | ||
} | ||
export interface SessionExecutionConfiguration { | ||
command: Array<string>; | ||
} | ||
export interface ContainerStatus { | ||
@@ -168,0 +169,0 @@ phase: ContainerPhase; |
@@ -41,2 +41,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const callback = (event) => { | ||
// TODO filter origin: if (event.origin !== 'https://video.example.com') return; | ||
// See https://developer.chrome.com/blog/immutable-document-domain/ | ||
if (event.data.id == id) { | ||
@@ -43,0 +45,0 @@ window.removeEventListener('message', callback, false); |
@@ -1,2 +0,2 @@ | ||
import { Playground, Pool, Workspace, WorkspaceConfiguration, WorkspaceUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration, Repository, RepositoryConfiguration, RepositoryUpdateConfiguration, RepositoryVersion, RepositoryVersionConfiguration, SessionConfiguration, Session, SessionUpdateConfiguration, Template } from './types'; | ||
import { Playground, Pool, Workspace, WorkspaceConfiguration, WorkspaceUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration, Repository, RepositoryConfiguration, RepositoryUpdateConfiguration, RepositoryVersion, RepositoryVersionConfiguration, SessionConfiguration, Session, SessionUpdateConfiguration, Template, SessionExecutionConfiguration, SessionExecution } from './types'; | ||
export declare class Client { | ||
@@ -9,2 +9,3 @@ static userResource: string; | ||
static sessionsResource: string; | ||
static sessionExecutionResourcePath: string; | ||
static repositoriesResource: string; | ||
@@ -46,2 +47,3 @@ static templatesResource: string; | ||
deleteSession(id: string, timeout?: number, init?: RequestInit): Promise<void>; | ||
createSessionExecution(id: string, conf: SessionExecutionConfiguration, timeout?: number, init?: RequestInit): Promise<SessionExecution>; | ||
getRepository(id: Repository['id'], timeout?: number, init?: RequestInit): Promise<Repository | null>; | ||
@@ -48,0 +50,0 @@ listRepositories(timeout?: number, init?: RequestInit): Promise<Repository[]>; |
@@ -367,2 +367,12 @@ "use strict"; | ||
}; | ||
// Session executions | ||
Client.prototype.createSessionExecution = function (id, conf, timeout, init) { | ||
if (timeout === void 0) { timeout = this.defaultTimeout; } | ||
if (init === void 0) { init = this.defaultInit; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, (0, rpc_1.rpc)(this.path(Client.sessionsResource, id, Client.sessionExecutionResourcePath), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout)]; | ||
}); | ||
}); | ||
}; | ||
// Repositories | ||
@@ -485,2 +495,3 @@ Client.prototype.getRepository = function (id, timeout, init) { | ||
Client.sessionsResource = 'sessions'; | ||
Client.sessionExecutionResourcePath = 'execution'; | ||
Client.repositoriesResource = 'repositories'; | ||
@@ -487,0 +498,0 @@ Client.templatesResource = 'templates'; |
@@ -8,10 +8,5 @@ export interface IdentifiedResource { | ||
export interface Playground { | ||
env: Environment; | ||
configuration: Configuration; | ||
user?: LoggedUser; | ||
} | ||
export interface Environment { | ||
host: string; | ||
namespace: string; | ||
} | ||
export interface Configuration { | ||
@@ -166,2 +161,8 @@ githubClientId: string; | ||
} | ||
export interface SessionExecution { | ||
stdout: string; | ||
} | ||
export interface SessionExecutionConfiguration { | ||
command: Array<string>; | ||
} | ||
export interface ContainerStatus { | ||
@@ -168,0 +169,0 @@ phase: ContainerPhase; |
@@ -86,2 +86,4 @@ "use strict"; | ||
var callback = function (event) { | ||
// TODO filter origin: if (event.origin !== 'https://video.example.com') return; | ||
// See https://developer.chrome.com/blog/immutable-document-domain/ | ||
if (event.data.id == id) { | ||
@@ -88,0 +90,0 @@ window.removeEventListener('message', callback, false); |
{ | ||
"name": "@substrate/playground-client", | ||
"version": "1.8.5", | ||
"version": "1.8.6", | ||
"description": "An isomorphic client for Substrate Playground", | ||
@@ -37,4 +37,4 @@ "main": "dist/main/index.js", | ||
"devDependencies": { | ||
"typescript": "4.6.3" | ||
"typescript": "4.6.4" | ||
} | ||
} |
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
96267
2002