@substrate/playground-client
Advanced tools
Comparing version 1.9.23 to 1.9.24
@@ -5,3 +5,3 @@ 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'; | ||
static usersResource: string; | ||
static sessionsResourcePath: string; | ||
static sessionResourcePath: string; | ||
static sessionExecutionResourcePath: string; | ||
@@ -51,9 +51,8 @@ static sessionsResource: string; | ||
deleteRole(id: Role['id'], timeout?: number, init?: RequestInit): Promise<void>; | ||
listSessions(timeout?: number, init?: RequestInit): Promise<Session[]>; | ||
getUserSession(userId: User['id'], id: Session['id'], timeout?: number, init?: RequestInit): Promise<Session | null>; | ||
listUserSessions(userId: User['id'], timeout?: number, init?: RequestInit): Promise<Session[]>; | ||
createUserSession(userId: User['id'], id: Session['id'], conf: SessionConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
updateUserSession(userId: User['id'], id: Session['id'], conf: SessionUpdateConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
deleteUserSession(userId: User['id'], id: Session['id'], timeout?: number, init?: RequestInit): Promise<void>; | ||
createUserSessionExecution(userId: User['id'], id: Session['id'], conf: SessionExecutionConfiguration, timeout?: number, init?: RequestInit): Promise<SessionExecution>; | ||
listAllSessions(timeout?: number, init?: RequestInit): Promise<Session[]>; | ||
getSession(userId: User['id'], timeout?: number, init?: RequestInit): Promise<Session | null>; | ||
createSession(userId: User['id'], conf: SessionConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
updateSession(userId: User['id'], conf: SessionUpdateConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
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>; | ||
getUser(id: User['id'], timeout?: number, init?: RequestInit): Promise<User | null>; | ||
@@ -60,0 +59,0 @@ listUsers(timeout?: number, init?: RequestInit): Promise<User[]>; |
@@ -195,3 +195,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
// Sessions | ||
listSessions(timeout = this.defaultTimeout, init = this.defaultInit) { | ||
listAllSessions(timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -202,31 +202,26 @@ return rpc(this.path(Client.sessionsResource), init, timeout); | ||
// Sessions | ||
getUserSession(userId, id, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
getSession(userId, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionsResourcePath, id), init, timeout); | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionResourcePath), init, timeout); | ||
}); | ||
} | ||
listUserSessions(userId, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
createSession(userId, conf, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionsResourcePath), init, timeout); | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionResourcePath), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout); | ||
}); | ||
} | ||
createUserSession(userId, id, conf, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
updateSession(userId, conf, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionsResourcePath, id), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout); | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionResourcePath), Object.assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), timeout); | ||
}); | ||
} | ||
updateUserSession(userId, id, conf, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
deleteSession(userId, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionsResourcePath, id), Object.assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), timeout); | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionResourcePath), Object.assign({ method: 'DELETE' }, init), timeout); | ||
}); | ||
} | ||
deleteUserSession(userId, id, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionsResourcePath, id), Object.assign({ method: 'DELETE' }, init), timeout); | ||
}); | ||
} | ||
// Session executions | ||
createUserSessionExecution(userId, id, conf, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
createSessionExecution(userId, id, conf, timeout = this.defaultTimeout, init = this.defaultInit) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionsResourcePath, id, Client.sessionExecutionResourcePath), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout); | ||
return rpc(this.path(Client.usersResource, userId, Client.sessionResourcePath, id, Client.sessionExecutionResourcePath), Object.assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout); | ||
}); | ||
@@ -263,3 +258,3 @@ } | ||
Client.usersResource = 'users'; | ||
Client.sessionsResourcePath = 'sessions'; | ||
Client.sessionResourcePath = 'session'; | ||
Client.sessionExecutionResourcePath = 'executions'; | ||
@@ -266,0 +261,0 @@ Client.sessionsResource = 'sessions'; |
@@ -1,2 +0,1 @@ | ||
import { User } from "./types"; | ||
export declare enum EnvironmentType { | ||
@@ -11,3 +10,2 @@ dev = 0, | ||
export declare function playgroundBaseAPIURL(env: EnvironmentType): string; | ||
export declare function normalizeSessionId(sessionId: string): string; | ||
export declare function mainSessionId(user: User): string; | ||
export declare function userSubDomain(userId: string): string; |
@@ -32,3 +32,3 @@ export var EnvironmentType; | ||
export function playgroundUserBaseURL(env, userId) { | ||
const subdomain = userId.toLowerCase(); | ||
const subdomain = userSubDomain(userId); | ||
switch (env) { | ||
@@ -48,9 +48,5 @@ case EnvironmentType.dev: | ||
} | ||
// Return a normalized session ID that is valid with regards to Playground constraints | ||
export function normalizeSessionId(sessionId) { | ||
return sessionId.toLocaleLowerCase(); | ||
// Return a normalized user sub-domain that is valid with regards to Playground constraints | ||
export function userSubDomain(userId) { | ||
return userId.toLocaleLowerCase(); | ||
} | ||
// Return the main session ID for a considered user | ||
export function mainSessionId(user) { | ||
return normalizeSessionId(user.id); | ||
} |
@@ -5,3 +5,3 @@ 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'; | ||
static usersResource: string; | ||
static sessionsResourcePath: string; | ||
static sessionResourcePath: string; | ||
static sessionExecutionResourcePath: string; | ||
@@ -51,9 +51,8 @@ static sessionsResource: string; | ||
deleteRole(id: Role['id'], timeout?: number, init?: RequestInit): Promise<void>; | ||
listSessions(timeout?: number, init?: RequestInit): Promise<Session[]>; | ||
getUserSession(userId: User['id'], id: Session['id'], timeout?: number, init?: RequestInit): Promise<Session | null>; | ||
listUserSessions(userId: User['id'], timeout?: number, init?: RequestInit): Promise<Session[]>; | ||
createUserSession(userId: User['id'], id: Session['id'], conf: SessionConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
updateUserSession(userId: User['id'], id: Session['id'], conf: SessionUpdateConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
deleteUserSession(userId: User['id'], id: Session['id'], timeout?: number, init?: RequestInit): Promise<void>; | ||
createUserSessionExecution(userId: User['id'], id: Session['id'], conf: SessionExecutionConfiguration, timeout?: number, init?: RequestInit): Promise<SessionExecution>; | ||
listAllSessions(timeout?: number, init?: RequestInit): Promise<Session[]>; | ||
getSession(userId: User['id'], timeout?: number, init?: RequestInit): Promise<Session | null>; | ||
createSession(userId: User['id'], conf: SessionConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
updateSession(userId: User['id'], conf: SessionUpdateConfiguration, timeout?: number, init?: RequestInit): Promise<void>; | ||
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>; | ||
getUser(id: User['id'], timeout?: number, init?: RequestInit): Promise<User | null>; | ||
@@ -60,0 +59,0 @@ listUsers(timeout?: number, init?: RequestInit): Promise<User[]>; |
@@ -398,3 +398,3 @@ "use strict"; | ||
// Sessions | ||
Client.prototype.listSessions = function (timeout, init) { | ||
Client.prototype.listAllSessions = function (timeout, init) { | ||
if (timeout === void 0) { timeout = this.defaultTimeout; } | ||
@@ -409,3 +409,3 @@ if (init === void 0) { init = this.defaultInit; } | ||
// Sessions | ||
Client.prototype.getUserSession = function (userId, id, timeout, init) { | ||
Client.prototype.getSession = function (userId, timeout, init) { | ||
if (timeout === void 0) { timeout = this.defaultTimeout; } | ||
@@ -415,7 +415,7 @@ 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.sessionsResourcePath, id), init, timeout)]; | ||
return [2 /*return*/, (0, rpc_1.rpc)(this.path(Client.usersResource, userId, Client.sessionResourcePath), init, timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.listUserSessions = function (userId, timeout, init) { | ||
Client.prototype.createSession = function (userId, conf, timeout, init) { | ||
if (timeout === void 0) { timeout = this.defaultTimeout; } | ||
@@ -425,7 +425,7 @@ 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.sessionsResourcePath), init, timeout)]; | ||
return [2 /*return*/, (0, rpc_1.rpc)(this.path(Client.usersResource, userId, Client.sessionResourcePath), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.createUserSession = function (userId, id, conf, timeout, init) { | ||
Client.prototype.updateSession = function (userId, conf, timeout, init) { | ||
if (timeout === void 0) { timeout = this.defaultTimeout; } | ||
@@ -435,7 +435,7 @@ 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.sessionsResourcePath, id), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout)]; | ||
return [2 /*return*/, (0, rpc_1.rpc)(this.path(Client.usersResource, userId, Client.sessionResourcePath), __assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.updateUserSession = function (userId, id, conf, timeout, init) { | ||
Client.prototype.deleteSession = function (userId, timeout, init) { | ||
if (timeout === void 0) { timeout = this.defaultTimeout; } | ||
@@ -445,17 +445,8 @@ 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.sessionsResourcePath, id), __assign({ method: 'PATCH', body: JSON.stringify(conf) }, init), timeout)]; | ||
return [2 /*return*/, (0, rpc_1.rpc)(this.path(Client.usersResource, userId, Client.sessionResourcePath), __assign({ method: 'DELETE' }, init), timeout)]; | ||
}); | ||
}); | ||
}; | ||
Client.prototype.deleteUserSession = function (userId, 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.usersResource, userId, Client.sessionsResourcePath, id), __assign({ method: 'DELETE' }, init), timeout)]; | ||
}); | ||
}); | ||
}; | ||
// Session executions | ||
Client.prototype.createUserSessionExecution = function (userId, id, conf, timeout, init) { | ||
Client.prototype.createSessionExecution = function (userId, id, conf, timeout, init) { | ||
if (timeout === void 0) { timeout = this.defaultTimeout; } | ||
@@ -465,3 +456,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.sessionsResourcePath, 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, id, Client.sessionExecutionResourcePath), __assign({ method: 'PUT', body: JSON.stringify(conf) }, init), timeout)]; | ||
}); | ||
@@ -518,3 +509,3 @@ }); | ||
Client.usersResource = 'users'; | ||
Client.sessionsResourcePath = 'sessions'; | ||
Client.sessionResourcePath = 'session'; | ||
Client.sessionExecutionResourcePath = 'executions'; | ||
@@ -521,0 +512,0 @@ Client.sessionsResource = 'sessions'; |
@@ -1,2 +0,1 @@ | ||
import { User } from "./types"; | ||
export declare enum EnvironmentType { | ||
@@ -11,3 +10,2 @@ dev = 0, | ||
export declare function playgroundBaseAPIURL(env: EnvironmentType): string; | ||
export declare function normalizeSessionId(sessionId: string): string; | ||
export declare function mainSessionId(user: User): string; | ||
export declare function userSubDomain(userId: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mainSessionId = exports.normalizeSessionId = exports.playgroundBaseAPIURL = exports.playgroundUserBaseURL = exports.playgroundBaseURL = exports.environmentTypeFromString = exports.EnvironmentType = void 0; | ||
exports.userSubDomain = exports.playgroundBaseAPIURL = exports.playgroundUserBaseURL = exports.playgroundBaseURL = exports.environmentTypeFromString = exports.EnvironmentType = void 0; | ||
var EnvironmentType; | ||
@@ -37,3 +37,3 @@ (function (EnvironmentType) { | ||
function playgroundUserBaseURL(env, userId) { | ||
var subdomain = userId.toLowerCase(); | ||
var subdomain = userSubDomain(userId); | ||
switch (env) { | ||
@@ -55,11 +55,6 @@ case EnvironmentType.dev: | ||
exports.playgroundBaseAPIURL = playgroundBaseAPIURL; | ||
// Return a normalized session ID that is valid with regards to Playground constraints | ||
function normalizeSessionId(sessionId) { | ||
return sessionId.toLocaleLowerCase(); | ||
// Return a normalized user sub-domain that is valid with regards to Playground constraints | ||
function userSubDomain(userId) { | ||
return userId.toLocaleLowerCase(); | ||
} | ||
exports.normalizeSessionId = normalizeSessionId; | ||
// Return the main session ID for a considered user | ||
function mainSessionId(user) { | ||
return normalizeSessionId(user.id); | ||
} | ||
exports.mainSessionId = mainSessionId; | ||
exports.userSubDomain = userSubDomain; |
{ | ||
"name": "@substrate/playground-client", | ||
"version": "1.9.23", | ||
"version": "1.9.24", | ||
"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
101333
2089