@substrate/playground-client
Advanced tools
Comparing version 1.9.24 to 1.9.25
@@ -1,2 +0,2 @@ | ||
import { Playground, Pool, User, UserConfiguration, UserUpdateConfiguration, Repository, RepositoryConfiguration, RepositoryUpdateConfiguration, RepositoryVersion, SessionConfiguration, Session, SessionUpdateConfiguration, SessionExecutionConfiguration, SessionExecution, Role, RoleConfiguration, RoleUpdateConfiguration, Profile, ProfileUpdateConfiguration, ProfileConfiguration, Preference, PreferenceConfiguration, PreferenceUpdateConfiguration } from './types'; | ||
import { Playground, Pool, User, UserConfiguration, UserUpdateConfiguration, Repository, RepositoryConfiguration, RepositoryUpdateConfiguration, RepositoryVersion, SessionConfiguration, Session, SessionUpdateConfiguration, SessionExecutionConfiguration, SessionExecution, Role, RoleConfiguration, RoleUpdateConfiguration, Profile, ProfileUpdateConfiguration, ProfileConfiguration, Preference, PreferenceConfiguration, PreferenceUpdateConfiguration, Editor, EditorConfiguration, EditorUpdateConfiguration } from './types'; | ||
export declare class Client { | ||
@@ -12,2 +12,3 @@ static preferencesResource: string; | ||
static poolsResource: string; | ||
static editorsResource: string; | ||
private readonly base; | ||
@@ -25,2 +26,7 @@ private readonly defaultTimeout; | ||
get(timeout?: number, init?: RequestInit): Promise<Playground>; | ||
getEditor(id: Editor['id'], timeout?: number, init?: RequestInit): Promise<Editor | null>; | ||
listEditors(timeout?: number, init?: RequestInit): Promise<Editor[]>; | ||
createEditor(id: Editor['id'], conf: EditorConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
updateEditor(id: Editor['id'], conf: EditorUpdateConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
deleteEditor(id: Editor['id'], timeout?: number, init?: RequestInit): Promise<void>; | ||
getPool(id: Pool['id'], timeout?: number, init?: RequestInit): Promise<Pool | null>; | ||
@@ -57,3 +63,3 @@ listPools(timeout?: number, init?: RequestInit): Promise<Pool[]>; | ||
deleteSession(userId: User['id'], timeout?: number, init?: RequestInit): Promise<void>; | ||
createSessionExecution(userId: User['id'], id: Session['id'], conf: SessionExecutionConfiguration, timeout?: number, init?: RequestInit): Promise<SessionExecution>; | ||
createSessionExecution(userId: User['id'], conf: SessionExecutionConfiguration, timeout?: number, init?: RequestInit): Promise<SessionExecution>; | ||
getUser(id: User['id'], timeout?: number, init?: RequestInit): Promise<User | null>; | ||
@@ -60,0 +66,0 @@ listUsers(timeout?: number, init?: RequestInit): Promise<User[]>; |
@@ -58,2 +58,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
// Editors | ||
getEditor(id, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.editorsResource, id), init, timeout); | ||
}); | ||
} | ||
listEditors(timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.editorsResource), init, timeout); | ||
}); | ||
} | ||
createEditor(id, conf, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.editorsResource, id), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout); | ||
}); | ||
} | ||
updateEditor(id, conf, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.editorsResource, id), Object.assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), timeout); | ||
}); | ||
} | ||
deleteEditor(id, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.editorsResource, id), Object.assign({ method: 'DELETE' }, init), timeout); | ||
}); | ||
} | ||
// Pools | ||
@@ -223,5 +249,5 @@ getPool(id, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
// Session executions | ||
createSessionExecution(userId, id, conf, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
createSessionExecution(userId, conf, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionResourcePath, id, Client.sessionExecutionResourcePath), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout); | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionResourcePath, Client.sessionExecutionResourcePath), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout); | ||
}); | ||
@@ -265,2 +291,3 @@ } | ||
Client.poolsResource = 'pools'; | ||
Client.editorsResource = 'editors'; | ||
export * from "./auth"; | ||
@@ -267,0 +294,0 @@ export * from "./rpc"; |
@@ -22,2 +22,3 @@ export interface IdentifiedResource { | ||
export declare enum Preferences { | ||
DefaultEditor = "DefaultEditor", | ||
SessionDefaultDuration = "SessionDefaultDuration", | ||
@@ -113,6 +114,2 @@ SessionMaxDuration = "SessionMaxDuration", | ||
}; | ||
export interface NameValuePair { | ||
name: string; | ||
value: string; | ||
} | ||
export interface Port { | ||
@@ -124,3 +121,3 @@ name: string; | ||
} | ||
export interface Session extends IdentifiedResource, OwnedResource { | ||
export interface Session extends OwnedResource { | ||
state: SessionState; | ||
@@ -130,3 +127,3 @@ maxDuration: number; | ||
export interface SessionRuntimeConfiguration { | ||
env: NameValuePair[]; | ||
env: Record<string, string>; | ||
ports: Port[]; | ||
@@ -166,2 +163,14 @@ } | ||
} | ||
export interface Editor extends IdentifiedResource { | ||
image: string; | ||
env: Record<string, string>; | ||
} | ||
export interface EditorConfiguration { | ||
image: string; | ||
env: Record<string, string>; | ||
} | ||
export interface EditorUpdateConfiguration { | ||
image?: string; | ||
env?: Record<string, string>; | ||
} | ||
export interface User extends IdentifiedResource { | ||
@@ -168,0 +177,0 @@ role: string; |
export var Preferences; | ||
(function (Preferences) { | ||
Preferences["DefaultEditor"] = "DefaultEditor"; | ||
Preferences["SessionDefaultDuration"] = "SessionDefaultDuration"; | ||
@@ -4,0 +5,0 @@ Preferences["SessionMaxDuration"] = "SessionMaxDuration"; |
@@ -1,2 +0,2 @@ | ||
import { Playground, Pool, User, UserConfiguration, UserUpdateConfiguration, Repository, RepositoryConfiguration, RepositoryUpdateConfiguration, RepositoryVersion, SessionConfiguration, Session, SessionUpdateConfiguration, SessionExecutionConfiguration, SessionExecution, Role, RoleConfiguration, RoleUpdateConfiguration, Profile, ProfileUpdateConfiguration, ProfileConfiguration, Preference, PreferenceConfiguration, PreferenceUpdateConfiguration } from './types'; | ||
import { Playground, Pool, User, UserConfiguration, UserUpdateConfiguration, Repository, RepositoryConfiguration, RepositoryUpdateConfiguration, RepositoryVersion, SessionConfiguration, Session, SessionUpdateConfiguration, SessionExecutionConfiguration, SessionExecution, Role, RoleConfiguration, RoleUpdateConfiguration, Profile, ProfileUpdateConfiguration, ProfileConfiguration, Preference, PreferenceConfiguration, PreferenceUpdateConfiguration, Editor, EditorConfiguration, EditorUpdateConfiguration } from './types'; | ||
export declare class Client { | ||
@@ -12,2 +12,3 @@ static preferencesResource: string; | ||
static poolsResource: string; | ||
static editorsResource: string; | ||
private readonly base; | ||
@@ -25,2 +26,7 @@ private readonly defaultTimeout; | ||
get(timeout?: number, init?: RequestInit): Promise<Playground>; | ||
getEditor(id: Editor['id'], timeout?: number, init?: RequestInit): Promise<Editor | null>; | ||
listEditors(timeout?: number, init?: RequestInit): Promise<Editor[]>; | ||
createEditor(id: Editor['id'], conf: EditorConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
updateEditor(id: Editor['id'], conf: EditorUpdateConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
deleteEditor(id: Editor['id'], timeout?: number, init?: RequestInit): Promise<void>; | ||
getPool(id: Pool['id'], timeout?: number, init?: RequestInit): Promise<Pool | null>; | ||
@@ -57,3 +63,3 @@ listPools(timeout?: number, init?: RequestInit): Promise<Pool[]>; | ||
deleteSession(userId: User['id'], timeout?: number, init?: RequestInit): Promise<void>; | ||
createSessionExecution(userId: User['id'], id: Session['id'], conf: SessionExecutionConfiguration, timeout?: number, init?: RequestInit): Promise<SessionExecution>; | ||
createSessionExecution(userId: User['id'], conf: SessionExecutionConfiguration, timeout?: number, init?: RequestInit): Promise<SessionExecution>; | ||
getUser(id: User['id'], timeout?: number, init?: RequestInit): Promise<User | null>; | ||
@@ -60,0 +66,0 @@ listUsers(timeout?: number, init?: RequestInit): Promise<User[]>; |
@@ -157,2 +157,48 @@ "use strict"; | ||
}; | ||
// Editors | ||
Client.prototype.getEditor = function (id, 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.editorsResource, id), init, timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.listEditors = function (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.editorsResource), init, timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.createEditor = 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.editorsResource, id), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.updateEditor = 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.editorsResource, id), __assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.deleteEditor = function (id, 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.editorsResource, id), __assign({ method: 'DELETE' }, init), timeout)]; | ||
}); | ||
}); | ||
}; | ||
// Pools | ||
@@ -446,3 +492,3 @@ Client.prototype.getPool = function (id, timeout, init) { | ||
// Session executions | ||
Client.prototype.createSessionExecution = function (userId, id, conf, timeout, init) { | ||
Client.prototype.createSessionExecution = function (userId, conf, timeout, init) { | ||
if (timeout === void 0) { timeout = this.defaultTimeout; } | ||
@@ -452,3 +498,3 @@ if (init === void 0) { init = this.defaultInit; } | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, (0, rpc_1.rpc)(this.path(Client.usersResource, userId, Client.sessionResourcePath, id, Client.sessionExecutionResourcePath), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout)]; | ||
return [2 /*return*/, (0, rpc_1.rpc)(this.path(Client.usersResource, userId, Client.sessionResourcePath, Client.sessionExecutionResourcePath), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout)]; | ||
}); | ||
@@ -512,2 +558,3 @@ }); | ||
Client.poolsResource = 'pools'; | ||
Client.editorsResource = 'editors'; | ||
return Client; | ||
@@ -514,0 +561,0 @@ }()); |
@@ -22,2 +22,3 @@ export interface IdentifiedResource { | ||
export declare enum Preferences { | ||
DefaultEditor = "DefaultEditor", | ||
SessionDefaultDuration = "SessionDefaultDuration", | ||
@@ -113,6 +114,2 @@ SessionMaxDuration = "SessionMaxDuration", | ||
}; | ||
export interface NameValuePair { | ||
name: string; | ||
value: string; | ||
} | ||
export interface Port { | ||
@@ -124,3 +121,3 @@ name: string; | ||
} | ||
export interface Session extends IdentifiedResource, OwnedResource { | ||
export interface Session extends OwnedResource { | ||
state: SessionState; | ||
@@ -130,3 +127,3 @@ maxDuration: number; | ||
export interface SessionRuntimeConfiguration { | ||
env: NameValuePair[]; | ||
env: Record<string, string>; | ||
ports: Port[]; | ||
@@ -166,2 +163,14 @@ } | ||
} | ||
export interface Editor extends IdentifiedResource { | ||
image: string; | ||
env: Record<string, string>; | ||
} | ||
export interface EditorConfiguration { | ||
image: string; | ||
env: Record<string, string>; | ||
} | ||
export interface EditorUpdateConfiguration { | ||
image?: string; | ||
env?: Record<string, string>; | ||
} | ||
export interface User extends IdentifiedResource { | ||
@@ -168,0 +177,0 @@ role: string; |
@@ -6,2 +6,3 @@ "use strict"; | ||
(function (Preferences) { | ||
Preferences["DefaultEditor"] = "DefaultEditor"; | ||
Preferences["SessionDefaultDuration"] = "SessionDefaultDuration"; | ||
@@ -8,0 +9,0 @@ Preferences["SessionMaxDuration"] = "SessionMaxDuration"; |
{ | ||
"name": "@substrate/playground-client", | ||
"version": "1.9.24", | ||
"version": "1.9.25", | ||
"description": "An isomorphic client for Substrate Playground", | ||
@@ -37,4 +37,4 @@ "main": "dist/main/index.js", | ||
"devDependencies": { | ||
"typescript": "4.8.3" | ||
"typescript": "4.8.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
106917
2195