inanis 0.0.6-beta.21 → 0.0.6-beta.22

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.
@@ -3,20 +3,24 @@ export declare class DataModelConfig<T extends TableManager<any, any, any, any,
3
3
  table: T;
4
4
  defData: DefData;
5
5
  publicKeys: PublicKey[];
6
+ _initData: Omit<T['_putType'], keyof ReturnType<DefData>> & Partial<T['_putType']>;
6
7
  constructor(params: {
7
8
  table: T;
8
9
  defData: DefData;
9
10
  publicKeys: PublicKey[];
10
11
  });
12
+ newData(data: this['_initData']): T['_putType'];
11
13
  }
12
- export declare class DataModelControl<T extends DataModelConfig<any, any, any>, M extends {
14
+ export declare class DataModelControl<T extends () => DataModelConfig<any, any, any>, M extends {
13
15
  new (..._args: any[]): any;
14
- }, RM = InstanceType<M>> {
16
+ }, RM = InstanceType<M>, ID = ReturnType<T>['_initData']> {
15
17
  _config: T;
16
18
  _model: () => M;
17
19
  constructor(config: T, model: () => M);
20
+ get config(): DataModelConfig<any, any, any>;
21
+ get model(): M;
18
22
  getPublicScheam(): any;
19
- create(data: T['table']['_putType']): Promise<RM>;
23
+ create(data: ID): Promise<RM>;
20
24
  find(pkey: string | number, skey?: string | number): Promise<null | RM>;
21
25
  scan(params: {
22
26
  next?: string;
@@ -36,10 +40,9 @@ export declare class DataModelControl<T extends DataModelConfig<any, any, any>,
36
40
  count(pkey: number | string): Promise<number>;
37
41
  }
38
42
  export declare class DataModel<T extends DataModelConfig<any, any, any>, D extends T['table']['_putType'] = T['table']['_putType'], PublicKey extends keyof D = T['publicKeys'][0]> {
39
- _initData: Omit<D, PublicKey> & Partial<D>;
40
43
  _config: T;
41
44
  data: D;
42
- constructor(config: T, data: Omit<D, PublicKey> & Partial<D>);
45
+ constructor(config: T, data: T['_initData']);
43
46
  getPublic(): Pick<D, PublicKey>;
44
47
  save(): Promise<void>;
45
48
  remove(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inanis",
3
- "version": "0.0.6-beta.21",
3
+ "version": "0.0.6-beta.22",
4
4
  "description": "Micro Service Best Tools.",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {