@nu-art/ts-common 0.201.17 → 0.201.18
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 +13 -1
- package/package.json +1 -1
package/db/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DB_Object, OmitDBObject } from '../utils/types';
|
|
1
|
+
import { DB_Object, OmitDBObject, PartialProperties } from '../utils/types';
|
|
2
2
|
import { ValidatorTypeResolver } from '../validator/validator-core';
|
|
3
3
|
export type DBIndex<T extends DB_Object> = {
|
|
4
4
|
id: string;
|
|
@@ -9,6 +9,18 @@ export type DBIndex<T extends DB_Object> = {
|
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
export type Default_UniqueKey = '_id';
|
|
12
|
+
export type VersionType = string;
|
|
13
|
+
export type DBProto<T extends DB_Object, Ks extends keyof T = Default_UniqueKey, Versions extends VersionType[] = ['1.0.0'], GeneratedKeys extends keyof T = keyof DB_Object> = {
|
|
14
|
+
generatedKeys: keyof DB_Object | GeneratedKeys;
|
|
15
|
+
uiType: PartialProperties<T, keyof DB_Object | GeneratedKeys>;
|
|
16
|
+
dbType: T;
|
|
17
|
+
uniqueKeys: Ks;
|
|
18
|
+
versions: Versions;
|
|
19
|
+
validatorBE: ValidatorTypeResolver<OmitDBObject<T>>;
|
|
20
|
+
validatorFE: ValidatorTypeResolver<Omit<T, keyof GeneratedKeys>>;
|
|
21
|
+
dbIndices: DBIndex<T>;
|
|
22
|
+
};
|
|
23
|
+
export type DBDef_V2<Proto extends DBProto<any>> = DBDef<Proto['dbType'], Proto['uniqueKeys']>;
|
|
12
24
|
/**
|
|
13
25
|
* @field version - First item in the array is current version, Must pass all past versions with the current, default version is 1.0.0
|
|
14
26
|
*/
|