inanis 0.0.6-beta.21 → 0.0.6-beta.23

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,44 +3,60 @@ 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
14
  export declare class DataModelControl<T extends DataModelConfig<any, any, any>, M extends {
13
15
  new (..._args: any[]): any;
14
- }, RM = InstanceType<M>> {
15
- _config: T;
16
+ }, TB extends TableManager<any, any, any, any, any, any, any, any>, RM = InstanceType<M>, ID = T['_initData']> {
17
+ _config: () => T;
18
+ _table: () => TB;
16
19
  _model: () => M;
17
- constructor(config: T, model: () => M);
18
- getPublicScheam(): any;
19
- create(data: T['table']['_putType']): Promise<RM>;
20
+ constructor(params: {
21
+ config: () => T;
22
+ table: () => TB;
23
+ model: () => M;
24
+ });
25
+ get config(): T;
26
+ get model(): M;
27
+ get table(): TB;
28
+ create(data: ID): Promise<RM>;
20
29
  find(pkey: string | number, skey?: string | number): Promise<null | RM>;
21
30
  scan(params: {
22
31
  next?: string;
23
- limit: number;
32
+ limit?: number;
24
33
  }): Promise<{
25
34
  items: RM[];
26
35
  next?: string;
27
36
  }>;
28
37
  list(pkey: number | string, params: {
29
38
  next?: string;
30
- limit: number;
39
+ limit?: number;
31
40
  forward?: boolean;
32
41
  }): Promise<{
33
42
  items: RM[];
34
43
  next?: string;
35
44
  }>;
36
45
  count(pkey: number | string): Promise<number>;
46
+ toList(params: {
47
+ items: any[];
48
+ next?: string | null;
49
+ }): {
50
+ items: RM[];
51
+ next: string;
52
+ };
37
53
  }
38
54
  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
55
  _config: T;
56
+ _initData: T['_initData'];
41
57
  data: D;
42
- constructor(config: T, data: Omit<D, PublicKey> & Partial<D>);
58
+ constructor(config: T, data: T['_initData']);
43
59
  getPublic(): Pick<D, PublicKey>;
44
- save(): Promise<void>;
60
+ save(reader?: (_data: D) => Partial<D>): Promise<void>;
45
61
  remove(): Promise<void>;
46
62
  }
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.23",
4
4
  "description": "Micro Service Best Tools.",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {