@substrate/playground-client
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -1,2 +0,2 @@ | ||
import { Playground, Pool, Workspace, WorkspaceConfiguration, WorkspaceUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration } from './types'; | ||
import { Playground, Pool, Workspace, WorkspaceConfiguration, WorkspaceUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration, Repository, RepositoryConfiguration, RepositoryUpdateConfiguration, RepositoryVersion, RepositoryVersionConfiguration } from './types'; | ||
export declare class Client { | ||
@@ -7,3 +7,3 @@ static userResource: string; | ||
static workspacesResource: string; | ||
static templatesResource: string; | ||
static repositoriesResource: string; | ||
static poolsResource: string; | ||
@@ -32,2 +32,11 @@ private readonly base; | ||
deleteWorkspace(id: string, init?: RequestInit): Promise<void>; | ||
getRepository(id: string, init?: RequestInit): Promise<Repository | null>; | ||
listRepositories(init?: RequestInit): Promise<Record<string, Repository>>; | ||
createRepository(id: string, conf: RepositoryConfiguration, init?: RequestInit): Promise<void>; | ||
updateRepository(id: string, conf: RepositoryUpdateConfiguration, init?: RequestInit): Promise<void>; | ||
deleteRepository(id: string, init?: RequestInit): Promise<void>; | ||
getRepositoryVersion(id: string, version: string, init?: RequestInit): Promise<RepositoryVersion | null>; | ||
listRepositoryVersions(id: string, init?: RequestInit): Promise<RepositoryVersion[]>; | ||
createRepositoryVersion(id: string, version: string, conf: RepositoryVersionConfiguration, init?: RequestInit): Promise<void>; | ||
deleteRepositoryVersion(id: string, version: string, init?: RequestInit): Promise<void>; | ||
getPool(id: string, init?: RequestInit): Promise<Pool | null>; | ||
@@ -34,0 +43,0 @@ listPools(init?: RequestInit): Promise<Record<string, Pool>>; |
@@ -107,2 +107,48 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
// Repositories | ||
getRepository(id, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.repositoriesResource, id), init, this.timeout); | ||
}); | ||
} | ||
listRepositories(init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.repositoriesResource), init, this.timeout); | ||
}); | ||
} | ||
createRepository(id, conf, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.repositoriesResource, id), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout); | ||
}); | ||
} | ||
updateRepository(id, conf, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.repositoriesResource, id), Object.assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), this.timeout); | ||
}); | ||
} | ||
deleteRepository(id, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.repositoriesResource, id), Object.assign({ method: 'DELETE' }, init), this.timeout); | ||
}); | ||
} | ||
getRepositoryVersion(id, version, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.repositoriesResource, id, 'versions', version), init, this.timeout); | ||
}); | ||
} | ||
listRepositoryVersions(id, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.repositoriesResource, id, 'versions'), init, this.timeout); | ||
}); | ||
} | ||
createRepositoryVersion(id, version, conf, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.repositoriesResource, id, 'versions', version), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout); | ||
}); | ||
} | ||
deleteRepositoryVersion(id, version, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.repositoriesResource, id, 'versions', version), Object.assign({ method: 'DELETE' }, init), this.timeout); | ||
}); | ||
} | ||
// Pools | ||
@@ -135,3 +181,3 @@ getPool(id, init = this.defaultInit) { | ||
Client.workspacesResource = 'workspaces'; | ||
Client.templatesResource = 'templates'; | ||
Client.repositoriesResource = 'repositories'; | ||
Client.poolsResource = 'pools'; | ||
@@ -138,0 +184,0 @@ export * from "./login"; |
@@ -0,1 +1,7 @@ | ||
export interface IdentifiedResource { | ||
id: string; | ||
} | ||
export interface OwnedResource { | ||
userId: string; | ||
} | ||
export interface Playground { | ||
@@ -21,15 +27,27 @@ env: Environment; | ||
} | ||
export interface IdentifiedResource { | ||
id: string; | ||
export interface Workspace extends OwnedResource { | ||
repositoryDetails: RepositoryDetails; | ||
state: WorkspaceState; | ||
maxDuration: number; | ||
} | ||
export interface OwnedResource { | ||
userId: string; | ||
export interface RepositoryDetails extends IdentifiedResource { | ||
reference: string; | ||
} | ||
export interface LoggedUser extends IdentifiedResource { | ||
admin: boolean; | ||
organizations: string[]; | ||
poolAffinity: string; | ||
canCustomizeDuration: boolean; | ||
canCustomizePoolAffinity: boolean; | ||
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 WorkspaceConfiguration { | ||
repositoryDetails: RepositoryDetails; | ||
duration?: number; | ||
poolAffinity?: string; | ||
} | ||
export interface WorkspaceUpdateConfiguration { | ||
duration?: number; | ||
} | ||
export interface User { | ||
@@ -53,32 +71,33 @@ admin: boolean; | ||
} | ||
export interface Workspace extends IdentifiedResource, OwnedResource { | ||
repositoryVersion: RepositoryVersion; | ||
state: WorkspaceState; | ||
maxDuration: number; | ||
export interface LoggedUser extends IdentifiedResource { | ||
admin: boolean; | ||
organizations: string[]; | ||
poolAffinity: string; | ||
canCustomizeDuration: boolean; | ||
canCustomizePoolAffinity: boolean; | ||
} | ||
export interface WorkspaceStateRunning { | ||
startTime: number; | ||
node: Node; | ||
export interface Repository extends IdentifiedResource { | ||
tags?: Record<string, string>; | ||
url: string; | ||
} | ||
export interface WorkspaceStateFailed { | ||
message: string; | ||
reason: string; | ||
export interface RepositoryConfiguration extends IdentifiedResource { | ||
tags?: Record<string, string>; | ||
url: string; | ||
} | ||
export declare type WorkspaceState = 'WorkspaceStateDeploying' | WorkspaceStateRunning | 'WorkspaceStatePaused' | WorkspaceStateFailed | 'WorkspaceStateUnknown'; | ||
export interface Pool { | ||
name: string; | ||
instanceType?: string; | ||
nodes: Node[]; | ||
export interface RepositoryUpdateConfiguration extends IdentifiedResource { | ||
tags?: Record<string, string>; | ||
} | ||
export interface Node { | ||
hostname: string; | ||
export interface RepositoryVersion { | ||
reference: string; | ||
imageSource?: PrebuildSource; | ||
state: RepositoryVersionState; | ||
} | ||
export interface WorkspaceConfiguration { | ||
repositoryId: string; | ||
repositoryReference: string; | ||
duration?: number; | ||
poolAffinity?: string; | ||
export declare type PrebuildSource = 'DockerFile' | 'Image'; | ||
export interface RepositoryVersionConfiguration { | ||
reference: string; | ||
} | ||
export interface WorkspaceUpdateConfiguration { | ||
duration?: number; | ||
export declare type RepositoryVersionState = 'Cloning' | 'Building' | 'Ready'; | ||
export interface RepositoryRuntimeConfiguration { | ||
env?: NameValuePair[]; | ||
ports?: Port[]; | ||
} | ||
@@ -96,36 +115,9 @@ export interface NameValuePair { | ||
} | ||
export interface RuntimeConfiguration { | ||
env?: NameValuePair[]; | ||
ports?: Port[]; | ||
export interface Pool { | ||
name: string; | ||
instanceType?: string; | ||
nodes: Node[]; | ||
} | ||
export interface Repository { | ||
id?: string; | ||
tags?: Record<string, string>; | ||
url: string; | ||
versions: RepositoryVersion[]; | ||
export interface Node { | ||
hostname: string; | ||
} | ||
export interface RepositoryConfiguration extends IdentifiedResource { | ||
tags?: Record<string, string>; | ||
url: string; | ||
} | ||
export interface RepositoryVersion { | ||
reference: string; | ||
state: RepositoryVersionState; | ||
runtime: Runtime; | ||
} | ||
export interface BUILT { | ||
progress: number; | ||
} | ||
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,2 +0,2 @@ | ||
import { Playground, Pool, Workspace, WorkspaceConfiguration, WorkspaceUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration } from './types'; | ||
import { Playground, Pool, Workspace, WorkspaceConfiguration, WorkspaceUpdateConfiguration, User, UserConfiguration, UserUpdateConfiguration, Repository, RepositoryConfiguration, RepositoryUpdateConfiguration, RepositoryVersion, RepositoryVersionConfiguration } from './types'; | ||
export declare class Client { | ||
@@ -7,3 +7,3 @@ static userResource: string; | ||
static workspacesResource: string; | ||
static templatesResource: string; | ||
static repositoriesResource: string; | ||
static poolsResource: string; | ||
@@ -32,2 +32,11 @@ private readonly base; | ||
deleteWorkspace(id: string, init?: RequestInit): Promise<void>; | ||
getRepository(id: string, init?: RequestInit): Promise<Repository | null>; | ||
listRepositories(init?: RequestInit): Promise<Record<string, Repository>>; | ||
createRepository(id: string, conf: RepositoryConfiguration, init?: RequestInit): Promise<void>; | ||
updateRepository(id: string, conf: RepositoryUpdateConfiguration, init?: RequestInit): Promise<void>; | ||
deleteRepository(id: string, init?: RequestInit): Promise<void>; | ||
getRepositoryVersion(id: string, version: string, init?: RequestInit): Promise<RepositoryVersion | null>; | ||
listRepositoryVersions(id: string, init?: RequestInit): Promise<RepositoryVersion[]>; | ||
createRepositoryVersion(id: string, version: string, conf: RepositoryVersionConfiguration, init?: RequestInit): Promise<void>; | ||
deleteRepositoryVersion(id: string, version: string, init?: RequestInit): Promise<void>; | ||
getPool(id: string, init?: RequestInit): Promise<Pool | null>; | ||
@@ -34,0 +43,0 @@ listPools(init?: RequestInit): Promise<Record<string, Pool>>; |
@@ -217,2 +217,75 @@ "use strict"; | ||
}; | ||
// Repositories | ||
Client.prototype.getRepository = 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.repositoriesResource, id), init, this.timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.listRepositories = 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.repositoriesResource), init, this.timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.createRepository = 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.repositoriesResource, id), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.updateRepository = 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.repositoriesResource, id), __assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), this.timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.deleteRepository = 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.repositoriesResource, id), __assign({ method: 'DELETE' }, init), this.timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.getRepositoryVersion = function (id, version, 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.repositoriesResource, id, 'versions', version), init, this.timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.listRepositoryVersions = 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.repositoriesResource, id, 'versions'), init, this.timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.createRepositoryVersion = function (id, version, 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.repositoriesResource, id, 'versions', version), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), this.timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.deleteRepositoryVersion = function (id, version, 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.repositoriesResource, id, 'versions', version), __assign({ method: 'DELETE' }, init), this.timeout)]; | ||
}); | ||
}); | ||
}; | ||
// Pools | ||
@@ -256,3 +329,3 @@ Client.prototype.getPool = function (id, init) { | ||
Client.workspacesResource = 'workspaces'; | ||
Client.templatesResource = 'templates'; | ||
Client.repositoriesResource = 'repositories'; | ||
Client.poolsResource = 'pools'; | ||
@@ -259,0 +332,0 @@ return Client; |
@@ -0,1 +1,7 @@ | ||
export interface IdentifiedResource { | ||
id: string; | ||
} | ||
export interface OwnedResource { | ||
userId: string; | ||
} | ||
export interface Playground { | ||
@@ -21,15 +27,27 @@ env: Environment; | ||
} | ||
export interface IdentifiedResource { | ||
id: string; | ||
export interface Workspace extends OwnedResource { | ||
repositoryDetails: RepositoryDetails; | ||
state: WorkspaceState; | ||
maxDuration: number; | ||
} | ||
export interface OwnedResource { | ||
userId: string; | ||
export interface RepositoryDetails extends IdentifiedResource { | ||
reference: string; | ||
} | ||
export interface LoggedUser extends IdentifiedResource { | ||
admin: boolean; | ||
organizations: string[]; | ||
poolAffinity: string; | ||
canCustomizeDuration: boolean; | ||
canCustomizePoolAffinity: boolean; | ||
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 WorkspaceConfiguration { | ||
repositoryDetails: RepositoryDetails; | ||
duration?: number; | ||
poolAffinity?: string; | ||
} | ||
export interface WorkspaceUpdateConfiguration { | ||
duration?: number; | ||
} | ||
export interface User { | ||
@@ -53,32 +71,33 @@ admin: boolean; | ||
} | ||
export interface Workspace extends IdentifiedResource, OwnedResource { | ||
repositoryVersion: RepositoryVersion; | ||
state: WorkspaceState; | ||
maxDuration: number; | ||
export interface LoggedUser extends IdentifiedResource { | ||
admin: boolean; | ||
organizations: string[]; | ||
poolAffinity: string; | ||
canCustomizeDuration: boolean; | ||
canCustomizePoolAffinity: boolean; | ||
} | ||
export interface WorkspaceStateRunning { | ||
startTime: number; | ||
node: Node; | ||
export interface Repository extends IdentifiedResource { | ||
tags?: Record<string, string>; | ||
url: string; | ||
} | ||
export interface WorkspaceStateFailed { | ||
message: string; | ||
reason: string; | ||
export interface RepositoryConfiguration extends IdentifiedResource { | ||
tags?: Record<string, string>; | ||
url: string; | ||
} | ||
export declare type WorkspaceState = 'WorkspaceStateDeploying' | WorkspaceStateRunning | 'WorkspaceStatePaused' | WorkspaceStateFailed | 'WorkspaceStateUnknown'; | ||
export interface Pool { | ||
name: string; | ||
instanceType?: string; | ||
nodes: Node[]; | ||
export interface RepositoryUpdateConfiguration extends IdentifiedResource { | ||
tags?: Record<string, string>; | ||
} | ||
export interface Node { | ||
hostname: string; | ||
export interface RepositoryVersion { | ||
reference: string; | ||
imageSource?: PrebuildSource; | ||
state: RepositoryVersionState; | ||
} | ||
export interface WorkspaceConfiguration { | ||
repositoryId: string; | ||
repositoryReference: string; | ||
duration?: number; | ||
poolAffinity?: string; | ||
export declare type PrebuildSource = 'DockerFile' | 'Image'; | ||
export interface RepositoryVersionConfiguration { | ||
reference: string; | ||
} | ||
export interface WorkspaceUpdateConfiguration { | ||
duration?: number; | ||
export declare type RepositoryVersionState = 'Cloning' | 'Building' | 'Ready'; | ||
export interface RepositoryRuntimeConfiguration { | ||
env?: NameValuePair[]; | ||
ports?: Port[]; | ||
} | ||
@@ -96,36 +115,9 @@ export interface NameValuePair { | ||
} | ||
export interface RuntimeConfiguration { | ||
env?: NameValuePair[]; | ||
ports?: Port[]; | ||
export interface Pool { | ||
name: string; | ||
instanceType?: string; | ||
nodes: Node[]; | ||
} | ||
export interface Repository { | ||
id?: string; | ||
tags?: Record<string, string>; | ||
url: string; | ||
versions: RepositoryVersion[]; | ||
export interface Node { | ||
hostname: string; | ||
} | ||
export interface RepositoryConfiguration extends IdentifiedResource { | ||
tags?: Record<string, string>; | ||
url: string; | ||
} | ||
export interface RepositoryVersion { | ||
reference: string; | ||
state: RepositoryVersionState; | ||
runtime: Runtime; | ||
} | ||
export interface BUILT { | ||
progress: number; | ||
} | ||
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.6.0", | ||
"version": "1.6.1", | ||
"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
71951
1535