Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
090fb668cd | |||
a1c807261c | |||
a2ccf15f69 | |||
84d48f1914 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@push.rocks/smartdata",
|
||||
"version": "5.0.34",
|
||||
"version": "5.0.36",
|
||||
"private": false,
|
||||
"description": "do more with data",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartdata',
|
||||
version: '5.0.34',
|
||||
version: '5.0.36',
|
||||
description: 'do more with data'
|
||||
}
|
||||
|
@ -127,6 +127,13 @@ export class SmartDataDbDoc<T extends TImplements, TImplements, TManager extends
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get a unique id prefixed with the class name
|
||||
*/
|
||||
public static async getUniqueId<T = any>(this: plugins.tsclass.typeFest.Class<T>) {
|
||||
return `${this.name}:${plugins.smartunique.shortId(20)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* get cursor
|
||||
* @returns
|
||||
|
@ -70,7 +70,7 @@ export class EasyStore<T> {
|
||||
/**
|
||||
* writes a specific key to the keyValueStore
|
||||
*/
|
||||
public async writeKey(keyArg: keyof T, valueArg: any) {
|
||||
public async writeKey<TKey extends keyof T>(keyArg: TKey, valueArg: T[TKey]) {
|
||||
const easyStore = await this.getEasyStore();
|
||||
easyStore.data[keyArg] = valueArg;
|
||||
await easyStore.save();
|
||||
|
Reference in New Issue
Block a user