vyze
Advanced tools
Comparing version 0.1.9 to 0.1.11
@@ -9,2 +9,3 @@ import { Id } from '../shared'; | ||
name: string; | ||
title: string; | ||
description: string; | ||
@@ -31,2 +32,3 @@ author: Id; | ||
name: string; | ||
title: string; | ||
path: string; | ||
@@ -33,0 +35,0 @@ icon: Id; |
@@ -30,5 +30,11 @@ export * from './node'; | ||
else { | ||
// Treat it as universe name | ||
_name = universe; | ||
const universeId = await this.service.resolveUniverse(_name); | ||
// Treat it as universe name or id | ||
let universeId; | ||
if (/^#[0-9A-F]{6}$/i.test(universe)) { | ||
universeId = universe; | ||
} | ||
else { | ||
_name = universe; | ||
universeId = await this.service.resolveUniverse(_name); | ||
} | ||
if (!universeId) { | ||
@@ -38,2 +44,6 @@ return undefined; | ||
_universe = await this.service.loadUniverse(universeId); | ||
if (!_universe) { | ||
return; | ||
} | ||
_name = _universe.name; | ||
} | ||
@@ -40,0 +50,0 @@ } |
@@ -52,4 +52,5 @@ import { Id, RequestOptions, Response } from '../shared'; | ||
getComponent(componentId: Id): Promise<Component | undefined>; | ||
getComponentByName(componentName: string): Promise<Component | undefined>; | ||
createComponent(name: string, universeId: Id, type: ComponentType, subType: string): Promise<Component | undefined>; | ||
updateComponent(componentId: Id, name?: string, description?: string, isPublic?: boolean, listed?: boolean): Promise<Component | undefined>; | ||
updateComponent(componentId: Id, name?: string, description?: string, isPublic?: boolean, listed?: boolean, title?: string): Promise<Component | undefined>; | ||
deleteComponent(componentId: Id): Promise<void>; | ||
@@ -65,3 +66,4 @@ getView(componentId: Id): Promise<ViewComponent | undefined>; | ||
getApp(appId: Id): Promise<VyzeApp | ServiceError>; | ||
updateApp(appId: Id, isPublic?: boolean, name?: string, description?: string, path?: string): Promise<VyzeApp | ServiceError>; | ||
getAppByName(appName: string): Promise<VyzeApp | ServiceError>; | ||
updateApp(appId: Id, isPublic?: boolean, name?: string, description?: string, path?: string, title?: string): Promise<VyzeApp | ServiceError>; | ||
createAppRoute(appId: Id, route: string, viewId: Id): Promise<AppRoute | ServiceError>; | ||
@@ -68,0 +70,0 @@ getAppRoutes(appId: Id): Promise<AppRoute[] | ServiceError>; |
@@ -255,2 +255,10 @@ import { request } from '../shared'; | ||
} | ||
async getComponentByName(componentName) { | ||
const endpoint = this.buildUrl(`component/name/${componentName}`); | ||
const comp = await this.get(endpoint, defaultRequestOptions); | ||
if (comp instanceof ServiceError) { | ||
return undefined; | ||
} | ||
return comp; | ||
} | ||
async createComponent(name, universeId, type, subType) { | ||
@@ -269,3 +277,3 @@ const endpoint = this.buildUrl(`component`); | ||
} | ||
async updateComponent(componentId, name, description, isPublic, listed) { | ||
async updateComponent(componentId, name, description, isPublic, listed, title) { | ||
const endpoint = this.buildUrl(`component/${componentId}`); | ||
@@ -285,2 +293,5 @@ const params = {}; | ||
} | ||
if (typeof title !== 'undefined') { | ||
params['title'] = title; | ||
} | ||
const comp = await this.put(endpoint, params, defaultRequestOptions); | ||
@@ -376,3 +387,7 @@ if (comp instanceof ServiceError) { | ||
} | ||
async updateApp(appId, isPublic, name, description, path) { | ||
async getAppByName(appName) { | ||
const endpoint = this.buildUrl(`app/name/${appName}`); | ||
return await this.get(endpoint, defaultRequestOptions); | ||
} | ||
async updateApp(appId, isPublic, name, description, path, title) { | ||
const endpoint = this.buildUrl(`app/${appId}`); | ||
@@ -392,2 +407,5 @@ const params = {}; | ||
} | ||
if (typeof title !== 'undefined') { | ||
params['title'] = title; | ||
} | ||
return await this.put(endpoint, params, defaultRequestOptions); | ||
@@ -394,0 +412,0 @@ } |
{ | ||
"name": "vyze", | ||
"version": "0.1.9", | ||
"version": "0.1.11", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "JavaScript client for VYZE", |
@@ -11,2 +11,3 @@ import {Id} from '../shared'; | ||
name: string; | ||
title: string; | ||
description: string; | ||
@@ -37,2 +38,3 @@ author: Id; | ||
name: string; | ||
title: string; | ||
path: string; | ||
@@ -39,0 +41,0 @@ icon: Id; |
@@ -50,5 +50,10 @@ import {Id} from "../shared"; | ||
} else { | ||
// Treat it as universe name | ||
_name = universe; | ||
const universeId = await this.service.resolveUniverse(_name); | ||
// Treat it as universe name or id | ||
let universeId: string | undefined; | ||
if (/^#[0-9A-F]{6}$/i.test(universe)) { | ||
universeId = universe; | ||
} else { | ||
_name = universe; | ||
universeId = await this.service.resolveUniverse(_name); | ||
} | ||
if (!universeId) { | ||
@@ -58,2 +63,6 @@ return undefined; | ||
_universe = await this.service.loadUniverse(universeId); | ||
if (!_universe) { | ||
return; | ||
} | ||
_name = _universe.name; | ||
} | ||
@@ -60,0 +69,0 @@ } else { |
@@ -313,2 +313,11 @@ import {Id, request, RequestBody, RequestOptions, Response} from '../shared'; | ||
public async getComponentByName(componentName: string): Promise<Component | undefined> { | ||
const endpoint = this.buildUrl(`component/name/${componentName}`); | ||
const comp = await this.get<Component | undefined>(endpoint, defaultRequestOptions); | ||
if (comp instanceof ServiceError) { | ||
return undefined; | ||
} | ||
return comp; | ||
} | ||
public async createComponent(name: string, universeId: Id, type: ComponentType, subType: string): Promise<Component | undefined> { | ||
@@ -328,3 +337,3 @@ const endpoint = this.buildUrl(`component`); | ||
public async updateComponent(componentId: Id, name?: string, description?: string, isPublic?: boolean, listed?: boolean): Promise<Component | undefined> { | ||
public async updateComponent(componentId: Id, name?: string, description?: string, isPublic?: boolean, listed?: boolean, title?: string): Promise<Component | undefined> { | ||
const endpoint = this.buildUrl(`component/${componentId}`); | ||
@@ -344,2 +353,5 @@ const params: {[_: string]: any} = {}; | ||
} | ||
if (typeof title !== 'undefined') { | ||
params['title'] = title; | ||
} | ||
const comp = await this.put<Component>(endpoint, params, defaultRequestOptions); | ||
@@ -447,3 +459,8 @@ if (comp instanceof ServiceError) { | ||
public async updateApp(appId: Id, isPublic?: boolean, name?: string, description?: string, path?: string): Promise<VyzeApp | ServiceError> { | ||
public async getAppByName(appName: string): Promise<VyzeApp | ServiceError> { | ||
const endpoint = this.buildUrl(`app/name/${appName}`); | ||
return await this.get<VyzeApp>(endpoint, defaultRequestOptions); | ||
} | ||
public async updateApp(appId: Id, isPublic?: boolean, name?: string, description?: string, path?: string, title?: string): Promise<VyzeApp | ServiceError> { | ||
const endpoint = this.buildUrl(`app/${appId}`); | ||
@@ -463,2 +480,5 @@ const params: {[_: string]: any} = {}; | ||
} | ||
if (typeof title !== 'undefined') { | ||
params['title'] = title; | ||
} | ||
return await this.put<VyzeApp>(endpoint, params, defaultRequestOptions); | ||
@@ -465,0 +485,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
941683
15033