oksy 0.1.17 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oksy",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "The OKSY framework",
5
5
  "main": "library.js",
6
6
  "typings": "./types/src/library.pub.d.ts",
@@ -7,7 +7,10 @@ import { IValidator } from './Validators/IValidator';
7
7
  export type Draft<T> = {
8
8
  [P in keyof T]: T[P] extends Function ? T[P] : (P extends 'id' | 'workspaceId' ? T[P] : null | T[P]);
9
9
  };
10
- export type One<T1 extends GlobalEntity, T2 extends keyof T1, T3 extends BlueprintFieldOne['cascade'] = 'DELETE'> = T1;
10
+ type ManyFields<T1 extends GlobalEntity> = {
11
+ [K in keyof T1]: T1[K] extends Many<any, any> ? K : never;
12
+ }[keyof T1];
13
+ export type One<T1 extends GlobalEntity, T2 extends ManyFields<T1>, T3 extends BlueprintFieldOne['cascade'] = 'DELETE'> = T1;
11
14
  export declare abstract class GlobalEntity {
12
15
  id: string;
13
16
  isValid: boolean;
@@ -48,3 +51,4 @@ export declare abstract class BaseFile extends Entity {
48
51
  size: number;
49
52
  type: string;
50
53
  }
54
+ export {};
@@ -13,9 +13,10 @@ declare abstract class GlobalEntity {
13
13
  [key: string]: IValidator[];
14
14
  };
15
15
  }
16
- declare class Many<T1 extends {
17
- id: string;
18
- } = any, T2 extends keyof T1 = any> {
16
+ type RelationFields<T1 extends GlobalEntity> = {
17
+ [K in keyof T1]: T1[K] extends GlobalEntity ? K : (T1[K] extends Many<any, any> ? K : never);
18
+ }[keyof T1];
19
+ declare class Many<T1 extends GlobalEntity = any, T2 extends RelationFields<T1> = any> {
19
20
  all(): T1[];
20
21
  allWithDraft(): Draft<T1>[];
21
22
  size(): number;