@substrate/playground-client
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -1,2 +0,2 @@ | ||
import { Playground, Session, SessionConfiguration, SessionUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration } from './types'; | ||
import { Playground, Pool, Session, SessionConfiguration, SessionUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration } from './types'; | ||
export declare class Client { | ||
@@ -7,2 +7,3 @@ static userResource: string; | ||
static sessionsResource: string; | ||
static poolsResource: string; | ||
private readonly base; | ||
@@ -27,2 +28,4 @@ private readonly defaultInit; | ||
deleteSession(id: string, init?: RequestInit): Promise<void>; | ||
getPool(id: string, init?: RequestInit): Promise<Pool | null>; | ||
listPools(init?: RequestInit): Promise<Record<string, Pool>>; | ||
login(token: string, init?: RequestInit): Promise<void>; | ||
@@ -29,0 +32,0 @@ logout(init?: RequestInit): Promise<void>; |
@@ -98,2 +98,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
// Pools | ||
getPool(id, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.poolsResource, id), init); | ||
}); | ||
} | ||
listPools(init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.poolsResource), init); | ||
}); | ||
} | ||
// Login | ||
@@ -115,3 +126,4 @@ login(token, init = this.defaultInit) { | ||
Client.sessionsResource = 'sessions'; | ||
Client.poolsResource = 'pools'; | ||
export * from "./types"; | ||
export * from "./utils"; |
@@ -18,2 +18,3 @@ export interface Playground { | ||
duration: number; | ||
poolAffinity: string; | ||
} | ||
@@ -29,2 +30,3 @@ export interface PlaygroundUser { | ||
canCustomizeDuration: boolean; | ||
poolAffinity: string; | ||
} | ||
@@ -34,2 +36,3 @@ export interface UserConfiguration { | ||
canCustomizeDuration: boolean; | ||
poolAffinity: string; | ||
} | ||
@@ -41,3 +44,3 @@ export interface UserUpdateConfiguration { | ||
export interface Session { | ||
user: String; | ||
userId: string; | ||
url: string; | ||
@@ -48,5 +51,11 @@ template: Template; | ||
} | ||
export interface Pool { | ||
name: string; | ||
instanceType?: string; | ||
sessionIds: string[]; | ||
} | ||
export interface SessionConfiguration { | ||
template: string; | ||
duration?: number; | ||
poolAffinity?: string; | ||
} | ||
@@ -81,5 +90,5 @@ export interface SessionUpdateConfiguration { | ||
phase: Phase; | ||
reason: String; | ||
message: String; | ||
reason: string; | ||
message: string; | ||
startTime?: number; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Playground, Session, SessionConfiguration, SessionUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration } from './types'; | ||
import { Playground, Pool, Session, SessionConfiguration, SessionUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration } from './types'; | ||
export declare class Client { | ||
@@ -7,2 +7,3 @@ static userResource: string; | ||
static sessionsResource: string; | ||
static poolsResource: string; | ||
private readonly base; | ||
@@ -27,2 +28,4 @@ private readonly defaultInit; | ||
deleteSession(id: string, init?: RequestInit): Promise<void>; | ||
getPool(id: string, init?: RequestInit): Promise<Pool | null>; | ||
listPools(init?: RequestInit): Promise<Record<string, Pool>>; | ||
login(token: string, init?: RequestInit): Promise<void>; | ||
@@ -29,0 +32,0 @@ logout(init?: RequestInit): Promise<void>; |
@@ -205,2 +205,19 @@ "use strict"; | ||
}; | ||
// Pools | ||
Client.prototype.getPool = 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.poolsResource, id), init)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.listPools = 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.poolsResource), init)]; | ||
}); | ||
}); | ||
}; | ||
// Login | ||
@@ -227,2 +244,3 @@ Client.prototype.login = function (token, init) { | ||
Client.sessionsResource = 'sessions'; | ||
Client.poolsResource = 'pools'; | ||
return Client; | ||
@@ -229,0 +247,0 @@ }()); |
@@ -18,2 +18,3 @@ export interface Playground { | ||
duration: number; | ||
poolAffinity: string; | ||
} | ||
@@ -29,2 +30,3 @@ export interface PlaygroundUser { | ||
canCustomizeDuration: boolean; | ||
poolAffinity: string; | ||
} | ||
@@ -34,2 +36,3 @@ export interface UserConfiguration { | ||
canCustomizeDuration: boolean; | ||
poolAffinity: string; | ||
} | ||
@@ -41,3 +44,3 @@ export interface UserUpdateConfiguration { | ||
export interface Session { | ||
user: String; | ||
userId: string; | ||
url: string; | ||
@@ -48,5 +51,11 @@ template: Template; | ||
} | ||
export interface Pool { | ||
name: string; | ||
instanceType?: string; | ||
sessionIds: string[]; | ||
} | ||
export interface SessionConfiguration { | ||
template: string; | ||
duration?: number; | ||
poolAffinity?: string; | ||
} | ||
@@ -81,5 +90,5 @@ export interface SessionUpdateConfiguration { | ||
phase: Phase; | ||
reason: String; | ||
message: String; | ||
reason: string; | ||
message: string; | ||
startTime?: number; | ||
} |
{ | ||
"name": "@substrate/playground-client", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "An isomorphic client for Substrate Playground", | ||
@@ -5,0 +5,0 @@ "main": "dist/main/index.js", |
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
39494
886