@tusent.io/tusentio-cms
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -30,2 +30,4 @@ declare type TusentioCMSOptions = { | ||
setValue<T>(type: string, id: string, data: T): Promise<void>; | ||
getSingle<T>(type: string): Promise<T>; | ||
setSingle<T>(type: string, data: any): Promise<void>; | ||
deleteValue(type: string, id: string): Promise<void>; | ||
@@ -32,0 +34,0 @@ findValues(type: string, selector: any): Promise<string[]>; |
@@ -12,3 +12,3 @@ export default class TusentioCMS { | ||
async getValue(type, id) { | ||
return rest("GET", assembleUrl(this.#url, "value", type, id), { session: this.#session }); | ||
return rest("GET", assembleUrl(this.#url, "value", type, id ?? ""), { session: this.#session }); | ||
} | ||
@@ -19,4 +19,10 @@ async newValue(type, data) { | ||
async setValue(type, id, data) { | ||
await rest("PUT", assembleUrl(this.#url, "value", type, id), { session: this.#session }, data); | ||
await rest("PUT", assembleUrl(this.#url, "value", type, id ?? ""), { session: this.#session }, data); | ||
} | ||
async getSingle(type) { | ||
return this.getValue(type, undefined); | ||
} | ||
async setSingle(type, data) { | ||
return this.setValue(type, undefined, data); | ||
} | ||
async deleteValue(type, id) { | ||
@@ -23,0 +29,0 @@ await rest("DELETE", assembleUrl(this.#url, "value", type, id), { session: this.#session }); |
{ | ||
"name": "@tusent.io/tusentio-cms", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
5757
134