jourycms-sdk 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,17 +3,76 @@ declare module Levelup {
3
3
  namespace V1 {
4
4
  namespace Utils {
5
5
  namespace SystemStructure {
6
- namespace Models {
7
- /**
8
- * TODO: finish this
9
- */
10
- export type AllModels = string;
11
-
12
- /**
13
- * TODO: finish this
14
- */
15
- export type EntityType<M extends AllModels> = any;
16
- }
6
+ namespace Models {
7
+
8
+ export type AuthModels =
9
+ | "user"
10
+ | "role"
11
+ | "permission"
12
+ | "permissionGroup"
13
+ | "apiKey";
14
+
15
+ export type CmModels =
16
+ | "translationProject"
17
+ | "translationNamespace"
18
+ | "translationItem"
19
+ | "taxonomy"
20
+ | "term"
21
+ | "review"
22
+ | "comment"
23
+ | "article"
24
+ | "articleType";
25
+ export type SystemModels = "app";
26
+
27
+ export type AllModels =
28
+ | AuthModels
29
+ | CmModels
30
+ | SystemModels;
31
+
32
+ /**
33
+ * TODO: finish this
34
+ */
35
+
36
+ export type EntityType<E extends AllModels> =
37
+ // auth
38
+ E extends "user"
39
+ ? Levelup.V2.Users.Entity.ExposedUser &
40
+ Record<"password" | "confirm_password", string>
41
+ : E extends "permission"
42
+ ? Levelup.V2.Auth.Entity.Permission
43
+ : E extends "permissionGroup"
44
+ ? Levelup.V2.Auth.Entity.PermissionGroup
45
+ : E extends "role"
46
+ ? Levelup.V2.Auth.Entity.Role
47
+ : E extends "apiKey"
48
+ ? Levelup.V2.Auth.Entity.ApiKey
49
+ : // cm
50
+ E extends "article"
51
+ ? Levelup.V2.Cm.Entity.Article
52
+ : E extends "articleType"
53
+ ? Levelup.V2.Cm.Entity.ArticleType
54
+ : E extends "review"
55
+ ? Levelup.V2.Cm.Entity.Review
56
+ : E extends "comment"
57
+ ? Levelup.V2.Cm.Entity.Comment
58
+ : E extends "term"
59
+ ? Levelup.V2.Cm.Entity.Term
60
+ : E extends "taxonomy"
61
+ ? Levelup.V2.Cm.Entity.Taxonomy
62
+ : E extends "translationItem"
63
+ ? Levelup.V2.Cm.Translation.Entity.Item
64
+ : E extends "translationProject"
65
+ ? Levelup.V2.Cm.Translation.Entity.Project
66
+ : E extends "translationNamespace"
67
+ ? Levelup.V2.Cm.Translation.Entity.Namespace
68
+ : // Storage
69
+ E extends "uploadedFile"
70
+ ? Levelup.V2.Storage.Entity.UploadedFile
71
+ : // system
72
+ E extends "app"
73
+ ? Levelup.V2.System.Entity.App
74
+ : never;
75
+ }
17
76
  }
18
77
  }
19
78
  }