@nu-art/ts-common 0.202.2 → 0.202.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/db/types.d.ts CHANGED
@@ -33,7 +33,7 @@ export type Proto_DB_Object<T extends DB_Object, GeneratedKeys extends keyof T |
33
33
  export type DBProto<P extends Proto_DB_Object<any, any, any, any, any>, ModifiableSubType = Omit<P['type'], P['generatedKeys'] | keyof DB_Object>, GeneratedSubType = SubsetObjectByKeys<P['type'], P['generatedKeys']>> = {
34
34
  uiType: ModifiableSubType & Partial<GeneratedSubType> & Partial<DB_Object>;
35
35
  dbType: P['type'];
36
- generatedPropsValidator: ValidatorTypeResolver<GeneratedSubType>;
36
+ generatedPropsValidator: ValidatorTypeResolver<Omit<GeneratedSubType, keyof DB_Object>>;
37
37
  modifiablePropsValidator: ValidatorTypeResolver<ModifiableSubType>;
38
38
  uniqueKeys: P['uniqueKeys'][];
39
39
  generatedProps: P['generatedKeys'][];
@@ -2,6 +2,7 @@ export declare class MemStorage {
2
2
  private readonly cache;
3
3
  constructor();
4
4
  init<R>(makeItContext: () => Promise<R>): Promise<R>;
5
+ initSync<R>(makeItContext: () => R): R;
5
6
  private set;
6
7
  private get;
7
8
  }
@@ -14,4 +15,5 @@ export declare class MemKey<T> {
14
15
  resolve: (storage: MemStorage) => Promise<void>;
15
16
  get: (value?: T) => T;
16
17
  set: (value: T) => T;
18
+ merge: (value: T) => any;
17
19
  }
@@ -41,6 +41,9 @@ class MemStorage {
41
41
  return asyncLocalStorage.run(this, makeItContext);
42
42
  });
43
43
  }
44
+ initSync(makeItContext) {
45
+ return asyncLocalStorage.run(this, makeItContext);
46
+ }
44
47
  }
45
48
  exports.MemStorage = MemStorage;
46
49
  class MemKey {
@@ -70,6 +73,11 @@ class MemKey {
70
73
  // @ts-ignore
71
74
  return asyncLocalStorage.getStore().set(this, value);
72
75
  };
76
+ this.merge = (value) => {
77
+ const currentValue = this.get();
78
+ // @ts-ignore
79
+ return asyncLocalStorage.getStore().set(this, merge(currentValue, value));
80
+ };
73
81
  this.key = key;
74
82
  this.unique = unique;
75
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/ts-common",
3
- "version": "0.202.2",
3
+ "version": "0.202.3",
4
4
  "description": "js and ts infra",
5
5
  "keywords": [
6
6
  "TacB0sS",