@kyro-cms/core 0.3.2 → 0.3.4

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.
Files changed (201) hide show
  1. package/dist/{WebhookService-BznDc2AT.d.ts → WebhookService-BCpW2dyL.d.ts} +1 -1
  2. package/dist/{WebhookService-mZZ75syh.d.cts → WebhookService-DxYSFvNg.d.cts} +1 -1
  3. package/dist/api-handler.cjs +52 -0
  4. package/dist/api-handler.cjs.map +1 -0
  5. package/dist/api-handler.d.cts +9 -0
  6. package/dist/api-handler.d.ts +9 -0
  7. package/dist/api-handler.js +46 -0
  8. package/dist/api-handler.js.map +1 -0
  9. package/dist/{base-Hu6ij8sZ.d.ts → base-DvvNqnM-.d.cts} +16 -5
  10. package/dist/{base-Db9LkB1N.d.cts → base-eVegJ_Pr.d.ts} +16 -5
  11. package/dist/bootstrap-DGJ3N7SO.js +6 -0
  12. package/dist/{bootstrap-LL6O7PWO.js.map → bootstrap-DGJ3N7SO.js.map} +1 -1
  13. package/dist/bootstrap-O5UGUTYU.cjs +31 -0
  14. package/dist/{bootstrap-BMWVB2T6.cjs.map → bootstrap-O5UGUTYU.cjs.map} +1 -1
  15. package/dist/{chunk-QKOFKITP.js → chunk-2HFJUUFZ.js} +3 -11
  16. package/dist/chunk-2HFJUUFZ.js.map +1 -0
  17. package/dist/chunk-2SJATAN4.js +5514 -0
  18. package/dist/chunk-2SJATAN4.js.map +1 -0
  19. package/dist/{chunk-DIC236EW.js → chunk-342BJNBI.js} +167 -24
  20. package/dist/chunk-342BJNBI.js.map +1 -0
  21. package/dist/{chunk-OUGKLCYF.js → chunk-3AJE4SEG.js} +4 -3
  22. package/dist/chunk-3AJE4SEG.js.map +1 -0
  23. package/dist/chunk-6LPNEC6D.js +617 -0
  24. package/dist/chunk-6LPNEC6D.js.map +1 -0
  25. package/dist/{chunk-BXMWDUED.js → chunk-A4USRVTQ.js} +2 -2
  26. package/dist/chunk-A4USRVTQ.js.map +1 -0
  27. package/dist/chunk-ADLJSJSN.cjs +13 -0
  28. package/dist/chunk-ADLJSJSN.cjs.map +1 -0
  29. package/dist/chunk-ATBOUGQP.cjs +513 -0
  30. package/dist/chunk-ATBOUGQP.cjs.map +1 -0
  31. package/dist/{chunk-KB6QF4HO.js → chunk-B76I67F3.js} +246 -141
  32. package/dist/chunk-B76I67F3.js.map +1 -0
  33. package/dist/chunk-BQ2T4WRS.js +140 -0
  34. package/dist/chunk-BQ2T4WRS.js.map +1 -0
  35. package/dist/chunk-CZ3HWX2X.cjs +622 -0
  36. package/dist/chunk-CZ3HWX2X.cjs.map +1 -0
  37. package/dist/{chunk-PNBZZ76A.cjs → chunk-DAIBBBOL.cjs} +246 -140
  38. package/dist/chunk-DAIBBBOL.cjs.map +1 -0
  39. package/dist/{chunk-U74F3YZU.js → chunk-DBUYB32X.js} +15 -3
  40. package/dist/chunk-DBUYB32X.js.map +1 -0
  41. package/dist/chunk-DLHUQO25.cjs +1746 -0
  42. package/dist/chunk-DLHUQO25.cjs.map +1 -0
  43. package/dist/{chunk-GE5DMB44.js → chunk-E3BZLMX6.js} +55 -49
  44. package/dist/chunk-E3BZLMX6.js.map +1 -0
  45. package/dist/{chunk-44BF6ALS.cjs → chunk-H4XCAPA6.cjs} +55 -49
  46. package/dist/chunk-H4XCAPA6.cjs.map +1 -0
  47. package/dist/{chunk-VIONYQ2K.cjs → chunk-IBG6V56E.cjs} +16 -32
  48. package/dist/chunk-IBG6V56E.cjs.map +1 -0
  49. package/dist/{chunk-LIJVWQKU.cjs → chunk-IX3ABYKZ.cjs} +43 -31
  50. package/dist/chunk-IX3ABYKZ.cjs.map +1 -0
  51. package/dist/chunk-JYGIFBBS.cjs +146 -0
  52. package/dist/chunk-JYGIFBBS.cjs.map +1 -0
  53. package/dist/{chunk-42JPONZU.cjs → chunk-K7JPTH3G.cjs} +17 -16
  54. package/dist/chunk-K7JPTH3G.cjs.map +1 -0
  55. package/dist/{chunk-RLTG4YZM.cjs → chunk-KOCTZKPV.cjs} +2 -2
  56. package/dist/chunk-KOCTZKPV.cjs.map +1 -0
  57. package/dist/chunk-MMYAIYHJ.cjs +5538 -0
  58. package/dist/chunk-MMYAIYHJ.cjs.map +1 -0
  59. package/dist/{chunk-EWP5AT6A.cjs → chunk-N4H37VN4.cjs} +2 -11
  60. package/dist/chunk-N4H37VN4.cjs.map +1 -0
  61. package/dist/chunk-P2YW545G.js +11 -0
  62. package/dist/chunk-P2YW545G.js.map +1 -0
  63. package/dist/chunk-Q23JB3KL.js +488 -0
  64. package/dist/chunk-Q23JB3KL.js.map +1 -0
  65. package/dist/{chunk-E5X75WNB.js → chunk-QXIQWPAP.js} +14 -30
  66. package/dist/chunk-QXIQWPAP.js.map +1 -0
  67. package/dist/chunk-R3XIBBAW.cjs +34 -0
  68. package/dist/chunk-R3XIBBAW.cjs.map +1 -0
  69. package/dist/{chunk-KWGNR4HM.js → chunk-REK7AYOC.js} +82 -9
  70. package/dist/chunk-REK7AYOC.js.map +1 -0
  71. package/dist/chunk-RGIQKTZ7.js +68 -0
  72. package/dist/chunk-RGIQKTZ7.js.map +1 -0
  73. package/dist/chunk-RYDGMBIG.js +1737 -0
  74. package/dist/chunk-RYDGMBIG.js.map +1 -0
  75. package/dist/chunk-SDMNUYVU.js +30 -0
  76. package/dist/chunk-SDMNUYVU.js.map +1 -0
  77. package/dist/chunk-VEI5KQVC.cjs +1246 -0
  78. package/dist/chunk-VEI5KQVC.cjs.map +1 -0
  79. package/dist/{chunk-FTSSDDZQ.cjs → chunk-VJT6P4N6.cjs} +82 -9
  80. package/dist/chunk-VJT6P4N6.cjs.map +1 -0
  81. package/dist/{chunk-HT6VE4NW.cjs → chunk-W3KPQX7V.cjs} +168 -25
  82. package/dist/chunk-W3KPQX7V.cjs.map +1 -0
  83. package/dist/{chunk-LTRCYJAG.js → chunk-WOWUL7ZY.js} +3 -2
  84. package/dist/chunk-WOWUL7ZY.js.map +1 -0
  85. package/dist/{chunk-7YITG2US.cjs → chunk-WQBRWOQT.cjs} +3 -2
  86. package/dist/chunk-WQBRWOQT.cjs.map +1 -0
  87. package/dist/chunk-X3CU27OO.cjs +78 -0
  88. package/dist/chunk-X3CU27OO.cjs.map +1 -0
  89. package/dist/chunk-XIXGJGQW.js +1228 -0
  90. package/dist/chunk-XIXGJGQW.js.map +1 -0
  91. package/dist/cli/index.cjs +2 -2
  92. package/dist/cli/index.js +2 -2
  93. package/dist/client.cjs +23 -13
  94. package/dist/client.d.cts +4 -2
  95. package/dist/client.d.ts +4 -2
  96. package/dist/client.js +3 -1
  97. package/dist/drizzle/index.cjs +20 -19
  98. package/dist/drizzle/index.d.cts +28 -7
  99. package/dist/drizzle/index.d.ts +28 -7
  100. package/dist/drizzle/index.js +5 -4
  101. package/dist/fields/index.cjs +105 -0
  102. package/dist/fields/index.cjs.map +1 -0
  103. package/dist/fields/index.d.cts +27 -0
  104. package/dist/fields/index.d.ts +27 -0
  105. package/dist/fields/index.js +4 -0
  106. package/dist/fields/index.js.map +1 -0
  107. package/dist/graphql/index.cjs +4 -3
  108. package/dist/graphql/index.d.cts +3 -2
  109. package/dist/graphql/index.d.ts +3 -2
  110. package/dist/graphql/index.js +2 -1
  111. package/dist/{index-Ci6r4xnN.d.ts → index-CLp-DRKA.d.ts} +2 -1
  112. package/dist/{index-11MDNKce.d.cts → index-DfO7G4kN.d.cts} +2 -1
  113. package/dist/index.cjs +2621 -6672
  114. package/dist/index.cjs.map +1 -1
  115. package/dist/index.d.cts +136 -47
  116. package/dist/index.d.ts +136 -47
  117. package/dist/index.js +2333 -6546
  118. package/dist/index.js.map +1 -1
  119. package/dist/integration.cjs +68 -0
  120. package/dist/integration.cjs.map +1 -0
  121. package/dist/integration.d.cts +27 -0
  122. package/dist/integration.d.ts +27 -0
  123. package/dist/integration.js +61 -0
  124. package/dist/integration.js.map +1 -0
  125. package/dist/mongodb/index.cjs +4 -4
  126. package/dist/mongodb/index.d.cts +20 -6
  127. package/dist/mongodb/index.d.ts +20 -6
  128. package/dist/mongodb/index.js +2 -2
  129. package/dist/postgres-auth-adapter-7F3ECO7I.js +5 -0
  130. package/dist/{postgres-auth-adapter-OTRWSTT5.js.map → postgres-auth-adapter-7F3ECO7I.js.map} +1 -1
  131. package/dist/postgres-auth-adapter-Z463NYJZ.cjs +14 -0
  132. package/dist/{postgres-auth-adapter-EVRPO7BQ.cjs.map → postgres-auth-adapter-Z463NYJZ.cjs.map} +1 -1
  133. package/dist/redis-adapter-LPUWLE4Y.cjs +13 -0
  134. package/dist/{redis-adapter-E7PMN5HW.cjs.map → redis-adapter-LPUWLE4Y.cjs.map} +1 -1
  135. package/dist/redis-adapter-THYDCGQR.js +4 -0
  136. package/dist/{redis-adapter-HOO67RBQ.js.map → redis-adapter-THYDCGQR.js.map} +1 -1
  137. package/dist/rest/index.cjs +8 -5
  138. package/dist/rest/index.d.cts +6 -3
  139. package/dist/rest/index.d.ts +6 -3
  140. package/dist/rest/index.js +6 -3
  141. package/dist/{schema-CNB2DDTX.js → schema-6Q4W6AE6.js} +3 -3
  142. package/dist/{schema-CNB2DDTX.js.map → schema-6Q4W6AE6.js.map} +1 -1
  143. package/dist/{schema-Y777CQQS.cjs → schema-TIYTCIKX.cjs} +14 -14
  144. package/dist/{schema-Y777CQQS.cjs.map → schema-TIYTCIKX.cjs.map} +1 -1
  145. package/dist/templates/index.cjs +27 -23
  146. package/dist/templates/index.d.cts +8 -2
  147. package/dist/templates/index.d.ts +8 -2
  148. package/dist/templates/index.js +1 -1
  149. package/dist/trpc/index.cjs +12 -11
  150. package/dist/trpc/index.d.cts +3 -2
  151. package/dist/trpc/index.d.ts +3 -2
  152. package/dist/trpc/index.js +3 -2
  153. package/dist/{types-kGfsGdos.d.cts → types-Bs1up4yP.d.ts} +76 -244
  154. package/dist/{types-1u353OHN.d.ts → types-Da83JLDk.d.cts} +6 -2
  155. package/dist/{types-1u353OHN.d.cts → types-Da83JLDk.d.ts} +6 -2
  156. package/dist/{types-kGfsGdos.d.ts → types-J3R9nVsZ.d.cts} +76 -244
  157. package/dist/types-VtjUxIMp.d.cts +246 -0
  158. package/dist/types-VtjUxIMp.d.ts +246 -0
  159. package/package.json +16 -9
  160. package/dist/bootstrap-BMWVB2T6.cjs +0 -31
  161. package/dist/bootstrap-LL6O7PWO.js +0 -6
  162. package/dist/chunk-42JPONZU.cjs.map +0 -1
  163. package/dist/chunk-44BF6ALS.cjs.map +0 -1
  164. package/dist/chunk-4M5PHMUE.cjs +0 -947
  165. package/dist/chunk-4M5PHMUE.cjs.map +0 -1
  166. package/dist/chunk-6MSSF46R.js +0 -941
  167. package/dist/chunk-6MSSF46R.js.map +0 -1
  168. package/dist/chunk-7YITG2US.cjs.map +0 -1
  169. package/dist/chunk-BTOE3VUK.js +0 -330
  170. package/dist/chunk-BTOE3VUK.js.map +0 -1
  171. package/dist/chunk-BXMWDUED.js.map +0 -1
  172. package/dist/chunk-DIC236EW.js.map +0 -1
  173. package/dist/chunk-E5X75WNB.js.map +0 -1
  174. package/dist/chunk-E63IF3MD.cjs +0 -951
  175. package/dist/chunk-E63IF3MD.cjs.map +0 -1
  176. package/dist/chunk-EWP5AT6A.cjs.map +0 -1
  177. package/dist/chunk-FTSSDDZQ.cjs.map +0 -1
  178. package/dist/chunk-GE5DMB44.js.map +0 -1
  179. package/dist/chunk-GVFB5C6O.cjs +0 -345
  180. package/dist/chunk-GVFB5C6O.cjs.map +0 -1
  181. package/dist/chunk-HT6VE4NW.cjs.map +0 -1
  182. package/dist/chunk-HVSQDZZJ.cjs +0 -765
  183. package/dist/chunk-HVSQDZZJ.cjs.map +0 -1
  184. package/dist/chunk-HYC4GNHX.js +0 -758
  185. package/dist/chunk-HYC4GNHX.js.map +0 -1
  186. package/dist/chunk-KB6QF4HO.js.map +0 -1
  187. package/dist/chunk-KWGNR4HM.js.map +0 -1
  188. package/dist/chunk-LIJVWQKU.cjs.map +0 -1
  189. package/dist/chunk-LTRCYJAG.js.map +0 -1
  190. package/dist/chunk-OUGKLCYF.js.map +0 -1
  191. package/dist/chunk-PNBZZ76A.cjs.map +0 -1
  192. package/dist/chunk-QKOFKITP.js.map +0 -1
  193. package/dist/chunk-RLTG4YZM.cjs.map +0 -1
  194. package/dist/chunk-RRYXQMZG.js +0 -935
  195. package/dist/chunk-RRYXQMZG.js.map +0 -1
  196. package/dist/chunk-U74F3YZU.js.map +0 -1
  197. package/dist/chunk-VIONYQ2K.cjs.map +0 -1
  198. package/dist/postgres-auth-adapter-EVRPO7BQ.cjs +0 -14
  199. package/dist/postgres-auth-adapter-OTRWSTT5.js +0 -5
  200. package/dist/redis-adapter-E7PMN5HW.cjs +0 -13
  201. package/dist/redis-adapter-HOO67RBQ.js +0 -4
@@ -33,6 +33,7 @@ interface AuditLogFilter {
33
33
 
34
34
  interface AuthUser {
35
35
  id: string;
36
+ name?: string;
36
37
  email: string;
37
38
  passwordHash?: string;
38
39
  role: UserRole;
@@ -60,8 +61,9 @@ interface JWTPayload {
60
61
  email: string;
61
62
  role: UserRole;
62
63
  tenantId?: string;
63
- iat: number;
64
- exp: number;
64
+ iat?: number;
65
+ exp?: number;
66
+ sid?: string;
65
67
  }
66
68
  interface AuthTokenConfig {
67
69
  secret: string;
@@ -92,6 +94,7 @@ interface AuthAdapter {
92
94
  createUser(data: {
93
95
  email: string;
94
96
  password: string;
97
+ name?: string;
95
98
  role?: UserRole;
96
99
  tenantId?: string;
97
100
  }): Promise<AuthUser>;
@@ -108,6 +111,7 @@ interface AuthAdapter {
108
111
  userAgent?: string;
109
112
  }): Promise<Session>;
110
113
  findSessionByToken(token: string): Promise<Session | null>;
114
+ findSessionByRefreshToken(refreshToken: string): Promise<Session | null>;
111
115
  deleteSession(sessionId: string): Promise<boolean>;
112
116
  deleteUserSessions(userId: string): Promise<number>;
113
117
  hasAnyUsers?(): Promise<boolean>;
@@ -33,6 +33,7 @@ interface AuditLogFilter {
33
33
 
34
34
  interface AuthUser {
35
35
  id: string;
36
+ name?: string;
36
37
  email: string;
37
38
  passwordHash?: string;
38
39
  role: UserRole;
@@ -60,8 +61,9 @@ interface JWTPayload {
60
61
  email: string;
61
62
  role: UserRole;
62
63
  tenantId?: string;
63
- iat: number;
64
- exp: number;
64
+ iat?: number;
65
+ exp?: number;
66
+ sid?: string;
65
67
  }
66
68
  interface AuthTokenConfig {
67
69
  secret: string;
@@ -92,6 +94,7 @@ interface AuthAdapter {
92
94
  createUser(data: {
93
95
  email: string;
94
96
  password: string;
97
+ name?: string;
95
98
  role?: UserRole;
96
99
  tenantId?: string;
97
100
  }): Promise<AuthUser>;
@@ -108,6 +111,7 @@ interface AuthAdapter {
108
111
  userAgent?: string;
109
112
  }): Promise<Session>;
110
113
  findSessionByToken(token: string): Promise<Session | null>;
114
+ findSessionByRefreshToken(refreshToken: string): Promise<Session | null>;
111
115
  deleteSession(sessionId: string): Promise<boolean>;
112
116
  deleteUserSessions(userId: string): Promise<number>;
113
117
  hasAnyUsers?(): Promise<boolean>;
@@ -1,242 +1,4 @@
1
- interface FieldAdmin {
2
- description?: string;
3
- placeholder?: string;
4
- readOnly?: boolean;
5
- hidden?: boolean;
6
- width?: string;
7
- position?: "sidebar" | "main";
8
- autoGenerate?: string;
9
- action?: string;
10
- method?: string;
11
- inline?: boolean;
12
- condition?: (data: Record<string, any>, siblingData: Record<string, any>) => boolean;
13
- }
14
- interface BaseField {
15
- name: string;
16
- label?: string;
17
- required?: boolean;
18
- unique?: boolean;
19
- indexed?: boolean;
20
- defaultValue?: any;
21
- admin?: FieldAdmin;
22
- validate?: (value: any, options: ValidateOptions) => string | true | Promise<string | true>;
23
- hooks?: {
24
- beforeValidate?: Hook$1[];
25
- beforeChange?: Hook$1[];
26
- afterChange?: Hook$1[];
27
- afterRead?: Hook$1[];
28
- };
29
- }
30
- interface ValidateOptions {
31
- data?: Record<string, any>;
32
- siblingData?: Record<string, any>;
33
- user?: any;
34
- operation?: string;
35
- required?: boolean;
36
- }
37
- type Hook$1 = (args: any) => Promise<any> | any;
38
- type TextFieldVariant = "text" | "email" | "password" | "url" | "id";
39
- interface TextField extends BaseField {
40
- type: "text";
41
- variant?: TextFieldVariant;
42
- minLength?: number;
43
- maxLength?: number;
44
- pattern?: string;
45
- hasMany?: boolean;
46
- localized?: boolean;
47
- }
48
- interface NumberField extends BaseField {
49
- type: "number";
50
- min?: number;
51
- max?: number;
52
- step?: number;
53
- integer?: boolean;
54
- hasMany?: boolean;
55
- }
56
- interface CheckboxField extends BaseField {
57
- type: "checkbox";
58
- }
59
- interface DateField extends BaseField {
60
- type: "date";
61
- minDate?: string;
62
- maxDate?: string;
63
- time?: boolean;
64
- }
65
- interface EmailField extends BaseField {
66
- type: "email";
67
- }
68
- interface PasswordField extends BaseField {
69
- type: "password";
70
- }
71
- interface TextareaField extends BaseField {
72
- type: "textarea";
73
- minLength?: number;
74
- maxLength?: number;
75
- rows?: number;
76
- localized?: boolean;
77
- }
78
- interface SelectField extends BaseField {
79
- type: "select";
80
- options: Array<{
81
- label: string;
82
- value: string;
83
- }>;
84
- hasMany?: boolean;
85
- defaultValue?: string | string[];
86
- }
87
- interface RadioField extends BaseField {
88
- type: "radio";
89
- options: Array<{
90
- label: string;
91
- value: string;
92
- }>;
93
- defaultValue?: string;
94
- }
95
- interface ColorField extends BaseField {
96
- type: "color";
97
- format?: "hex" | "rgb" | "hsl";
98
- defaultValue?: string;
99
- }
100
- interface ImageField extends BaseField {
101
- type: "image";
102
- minCount?: number;
103
- maxCount?: number;
104
- allowedTypes?: string[];
105
- maxSize?: number;
106
- }
107
- interface RichTextBlock {
108
- type: string;
109
- data: Record<string, any>;
110
- children?: RichTextBlock[];
111
- }
112
- interface RichTextField extends BaseField {
113
- type: "richtext";
114
- editor?: "lexical" | "slate" | "blocks";
115
- hasBlocks?: boolean;
116
- defaultValue?: RichTextBlock[];
117
- localized?: boolean;
118
- }
119
- interface JSONField extends BaseField {
120
- type: "json";
121
- defaultValue?: Record<string, any>;
122
- }
123
- interface CodeField extends BaseField {
124
- type: "code";
125
- language?: string;
126
- defaultValue?: string;
127
- }
128
- interface UploadField extends BaseField {
129
- type: "upload";
130
- relationTo: string;
131
- hasMany?: boolean;
132
- maxDepth?: number;
133
- defaultValue?: string;
134
- }
135
- interface MarkdownField extends BaseField {
136
- type: "markdown";
137
- localized?: boolean;
138
- defaultValue?: string;
139
- }
140
- interface RelationshipField extends BaseField {
141
- type: "relationship";
142
- relationTo: string | string[];
143
- hasMany?: boolean;
144
- maxDepth?: number;
145
- filterOptions?: (args: {
146
- data: any;
147
- user: any;
148
- }) => Record<string, any>;
149
- defaultValue?: string | string[];
150
- }
151
- interface ArrayField extends BaseField {
152
- type: "array";
153
- fields: Field[];
154
- minRows?: number;
155
- maxRows?: number;
156
- labels?: {
157
- singular?: string;
158
- plural?: string;
159
- };
160
- defaultValue?: Record<string, any>[];
161
- }
162
- interface GroupField extends BaseField {
163
- type: "group";
164
- fields: Field[];
165
- defaultValue?: Record<string, any>;
166
- }
167
- interface BlockImage {
168
- url: string;
169
- alt?: string;
170
- }
171
- interface BlockAdmin {
172
- group?: string;
173
- images?: {
174
- icon?: BlockImage | string;
175
- thumbnail?: BlockImage | string;
176
- };
177
- }
178
- interface Block {
179
- slug: string;
180
- label: string;
181
- fields: Field[];
182
- imageURL?: string;
183
- admin?: BlockAdmin;
184
- }
185
- interface BlocksField extends BaseField {
186
- type: "blocks";
187
- blocks?: Block[];
188
- minRows?: number;
189
- maxRows?: number;
190
- defaultValue?: Array<{
191
- blockType: string;
192
- [key: string]: any;
193
- }>;
194
- }
195
- interface RowField extends Omit<BaseField, "name"> {
196
- type: "row";
197
- fields: Field[];
198
- name?: string;
199
- }
200
- interface CollapsibleField extends Omit<BaseField, "name"> {
201
- type: "collapsible";
202
- fields: Field[];
203
- label: string;
204
- name?: string;
205
- }
206
- interface TabsField extends Omit<BaseField, "name"> {
207
- type: "tabs";
208
- tabs: Array<{
209
- label: string;
210
- fields: Field[];
211
- name?: string;
212
- }>;
213
- name?: string;
214
- }
215
- interface ButtonField extends BaseField {
216
- type: "button";
217
- label: string;
218
- action?: string;
219
- method?: string;
220
- inline?: boolean;
221
- }
222
- type Field = TextField | NumberField | CheckboxField | DateField | EmailField | PasswordField | TextareaField | SelectField | RadioField | ColorField | ImageField | RichTextField | JSONField | CodeField | UploadField | MarkdownField | RelationshipField | ArrayField | GroupField | BlocksField | RowField | CollapsibleField | TabsField | ButtonField;
223
- type FieldType = Field["type"];
224
- declare function isTextField(field: Field): field is TextField;
225
- declare function isNumberField(field: Field): field is NumberField;
226
- declare function isRelationshipField(field: Field): field is RelationshipField;
227
- declare function isArrayField(field: Field): field is ArrayField;
228
- declare function isGroupField(field: Field): field is GroupField;
229
- declare function isBlocksField(field: Field): field is BlocksField;
230
- declare function isUploadField(field: Field): field is UploadField;
231
- declare function isImageField(field: Field): field is ImageField;
232
- declare function isRichTextField(field: Field): field is RichTextField;
233
- declare function isSelectField(field: Field): field is SelectField;
234
- declare function isLayoutField(field: Field): field is RowField | CollapsibleField | TabsField;
235
- declare const PRIMITIVE_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color"];
236
- declare const COMPLEX_FIELD_TYPES: readonly ["richtext", "json", "code", "upload", "image", "markdown"];
237
- declare const RELATIONAL_FIELD_TYPES: readonly ["relationship", "array", "group", "blocks"];
238
- declare const LAYOUT_FIELD_TYPES: readonly ["row", "collapsible", "tabs"];
239
- declare const ALL_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color", "richtext", "json", "code", "upload", "image", "markdown", "relationship", "array", "group", "blocks", "row", "collapsible", "tabs"];
1
+ import { F as Field } from './types-VtjUxIMp.cjs';
240
2
 
241
3
  interface Request {
242
4
  body?: any;
@@ -384,6 +146,7 @@ interface VersionConfig {
384
146
  drafts?: boolean;
385
147
  retainDeleted?: boolean;
386
148
  }
149
+ type DocumentStatus = 'draft' | 'published' | 'archived';
387
150
  interface AuthConfig {
388
151
  tokenExpiration?: number;
389
152
  verify?: boolean | {
@@ -468,6 +231,8 @@ interface FindArgs {
468
231
  user?: any;
469
232
  context?: Record<string, any>;
470
233
  overrideAccess?: boolean;
234
+ /** If true, returns draft docs (admin view). If false/omitted, only published docs are returned (public API). */
235
+ draft?: boolean;
471
236
  }
472
237
  interface FindByIDArgs {
473
238
  collection: string;
@@ -478,6 +243,8 @@ interface FindByIDArgs {
478
243
  user?: any;
479
244
  context?: Record<string, any>;
480
245
  overrideAccess?: boolean;
246
+ /** If true, returns document regardless of status (admin view). */
247
+ draft?: boolean;
481
248
  }
482
249
  interface CreateArgs {
483
250
  collection: string;
@@ -520,6 +287,29 @@ interface FindResult<T = any> {
520
287
  prevPage: number | null;
521
288
  nextPage: number | null;
522
289
  }
290
+ interface DraftSnapshot<T = Record<string, any>> {
291
+ id: string;
292
+ collection: string;
293
+ documentId: string;
294
+ tenantID?: string;
295
+ data: T;
296
+ baseUpdatedAt?: string | null;
297
+ draftUpdatedAt: string;
298
+ createdAt: string;
299
+ updatedAt: string;
300
+ }
301
+ interface DraftFindArgs {
302
+ collection: string;
303
+ documentId: string;
304
+ tenantID?: string;
305
+ }
306
+ interface DraftUpsertArgs<T = Record<string, any>> extends DraftFindArgs {
307
+ data: T;
308
+ baseUpdatedAt?: string | null;
309
+ draftUpdatedAt?: string;
310
+ }
311
+ interface DraftDeleteArgs extends DraftFindArgs {
312
+ }
523
313
  interface CreateResult<T = any> {
524
314
  doc: T;
525
315
  errors?: Array<{
@@ -527,6 +317,36 @@ interface CreateResult<T = any> {
527
317
  message: string;
528
318
  }>;
529
319
  }
320
+ interface VersionRecord<T = Record<string, any>> {
321
+ id: string;
322
+ collection: string;
323
+ documentId: string;
324
+ version: number;
325
+ status: DocumentStatus;
326
+ data: T;
327
+ createdBy?: string;
328
+ createdAt: string;
329
+ updatedAt: string;
330
+ publishedAt?: string | null;
331
+ changeDescription?: string;
332
+ }
333
+ interface CreateVersionArgs<T = Record<string, any>> {
334
+ collection: string;
335
+ documentId: string;
336
+ data: T;
337
+ status: DocumentStatus;
338
+ createdBy?: string;
339
+ changeDescription?: string;
340
+ tenantID?: string;
341
+ }
342
+ interface FindVersionsArgs {
343
+ collection: string;
344
+ documentId: string;
345
+ tenantID?: string;
346
+ limit?: number;
347
+ page?: number;
348
+ sort?: string;
349
+ }
530
350
  interface BaseAdapter {
531
351
  init(collections: CollectionConfig[], globals: GlobalConfig[]): Promise<void>;
532
352
  find<T>(args: FindArgs): Promise<FindResult<T>>;
@@ -543,14 +363,24 @@ interface BaseAdapter {
543
363
  collection: string;
544
364
  where: Record<string, any>;
545
365
  tenantID?: string;
366
+ draft?: boolean;
546
367
  }): Promise<any>;
547
- findVersions(args: FindArgs): Promise<FindResult<any>>;
548
- findVersionByID(args: FindByIDArgs): Promise<any>;
549
- createVersion(args: CreateArgs): Promise<any>;
368
+ findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
369
+ findVersionByID(args: {
370
+ collection: string;
371
+ versionId: string;
372
+ tenantID?: string;
373
+ }): Promise<VersionRecord | null>;
374
+ createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
550
375
  deleteVersions(args: {
551
376
  collection: string;
552
- where: Record<string, any>;
377
+ documentId: string;
378
+ keepLatest?: number;
379
+ tenantID?: string;
553
380
  }): Promise<void>;
381
+ findDraft<T = Record<string, any>>(args: DraftFindArgs): Promise<DraftSnapshot<T> | null>;
382
+ upsertDraft<T = Record<string, any>>(args: DraftUpsertArgs<T>): Promise<DraftSnapshot<T>>;
383
+ deleteDraft(args: DraftDeleteArgs): Promise<void>;
554
384
  migrate?(): Promise<void>;
555
385
  rollback?(): Promise<void>;
556
386
  connect(): Promise<void>;
@@ -586,7 +416,9 @@ interface KyroConfig {
586
416
  sameSite?: "strict" | "lax" | "none";
587
417
  domain?: string;
588
418
  };
419
+ checkSession?: boolean;
589
420
  };
421
+ authAdapter?: any;
590
422
  cors?: {
591
423
  origins?: string[];
592
424
  credentials?: boolean;
@@ -626,4 +458,4 @@ interface KyroConfig {
626
458
  debug?: boolean;
627
459
  }
628
460
 
629
- export { type AdapterConfig as $, type AdminConfig as A, type BaseField as B, type CheckboxField as C, type DateField as D, type EmailField as E, type Field as F, type GlobalConfig as G, type CreateArgs as H, type ImageField as I, type JSONField as J, type KyroConfig as K, type UpdateArgs as L, type MarkdownField as M, type NumberField as N, type DeleteArgs as O, type PasswordField as P, type User as Q, type RadioField as R, type SelectField as S, type TabsField as T, type UploadConfig as U, type VersionConfig as V, type Request as W, type Hook as X, ALL_FIELD_TYPES as Y, type AccessArgs as Z, type AccessControl as _, type ArrayField as a, COMPLEX_FIELD_TYPES as a0, type CollectionAccess as a1, type CollectionHooks as a2, type CreateResult as a3, type FieldAccess as a4, type FieldHooks as a5, type GlobalAccess as a6, type GlobalHooks as a7, type HookArgs as a8, LAYOUT_FIELD_TYPES as a9, PRIMITIVE_FIELD_TYPES as aa, RELATIONAL_FIELD_TYPES as ab, type ValidateOptions as ac, type WhereClause as ad, evaluateAccess as ae, getWhereClause as af, isArrayField as ag, isBlocksField as ah, isGroupField as ai, isImageField as aj, isLayoutField as ak, isNumberField as al, isRelationshipField as am, isRichTextField as an, isSelectField as ao, isTextField as ap, isUploadField as aq, mergeWhereClauses as ar, runFieldHooks as as, runHooks as at, type AuthConfig as b, type Block as c, type BlockAdmin as d, type BlockImage as e, type BlocksField as f, type CodeField as g, type CollapsibleField as h, type CollectionConfig as i, type ColorField as j, type FieldAdmin as k, type FieldType as l, type GroupField as m, type ImageSize as n, type RelationshipField as o, type RichTextBlock as p, type RichTextField as q, type RowField as r, type TextField as s, type TextareaField as t, type UploadField as u, type PluginConfig as v, type BaseAdapter as w, type FindArgs as x, type FindResult as y, type FindByIDArgs as z };
461
+ export { type AdminConfig as A, type BaseAdapter as B, type CollectionConfig as C, type DeleteArgs as D, mergeWhereClauses as E, type FindArgs as F, type GlobalConfig as G, type Hook as H, type ImageSize as I, runFieldHooks as J, type KyroConfig as K, runHooks as L, type PluginConfig as P, type Request as R, type UploadConfig as U, type VersionConfig as V, type WhereClause as W, type AuthConfig as a, type FindResult as b, type FindByIDArgs as c, type CreateArgs as d, type UpdateArgs as e, type FindVersionsArgs as f, type VersionRecord as g, type CreateVersionArgs as h, type DraftFindArgs as i, type DraftSnapshot as j, type DraftUpsertArgs as k, type DraftDeleteArgs as l, type User as m, type AccessArgs as n, type AccessControl as o, type AdapterConfig as p, type CollectionAccess as q, type CollectionHooks as r, type CreateResult as s, type FieldAccess as t, type FieldHooks as u, type GlobalAccess as v, type GlobalHooks as w, type HookArgs as x, evaluateAccess as y, getWhereClause as z };
@@ -0,0 +1,246 @@
1
+ interface FieldAdmin {
2
+ description?: string;
3
+ placeholder?: string;
4
+ readOnly?: boolean;
5
+ hidden?: boolean;
6
+ width?: string;
7
+ position?: "sidebar" | "main";
8
+ autoGenerate?: string;
9
+ action?: string;
10
+ method?: string;
11
+ inline?: boolean;
12
+ condition?: (data: Record<string, any>, siblingData: Record<string, any>) => boolean;
13
+ }
14
+ interface BaseField {
15
+ name: string;
16
+ label?: string;
17
+ required?: boolean;
18
+ unique?: boolean;
19
+ indexed?: boolean;
20
+ defaultValue?: any;
21
+ admin?: FieldAdmin;
22
+ validate?: (value: any, options: ValidateOptions) => string | true | Promise<string | true>;
23
+ hooks?: {
24
+ beforeValidate?: Hook[];
25
+ beforeChange?: Hook[];
26
+ afterChange?: Hook[];
27
+ afterRead?: Hook[];
28
+ };
29
+ }
30
+ interface ValidateOptions {
31
+ data?: Record<string, any>;
32
+ siblingData?: Record<string, any>;
33
+ user?: any;
34
+ operation?: string;
35
+ required?: boolean;
36
+ }
37
+ type Hook = (args: any) => Promise<any> | any;
38
+ type TextFieldVariant = "text" | "email" | "password" | "url" | "id";
39
+ interface TextField extends BaseField {
40
+ type: "text";
41
+ variant?: TextFieldVariant;
42
+ minLength?: number;
43
+ maxLength?: number;
44
+ pattern?: string;
45
+ hasMany?: boolean;
46
+ localized?: boolean;
47
+ }
48
+ interface NumberField extends BaseField {
49
+ type: "number";
50
+ min?: number;
51
+ max?: number;
52
+ step?: number;
53
+ integer?: boolean;
54
+ hasMany?: boolean;
55
+ }
56
+ interface CheckboxField extends BaseField {
57
+ type: "checkbox";
58
+ }
59
+ interface DateField extends BaseField {
60
+ type: "date";
61
+ minDate?: string;
62
+ maxDate?: string;
63
+ time?: boolean;
64
+ }
65
+ interface EmailField extends BaseField {
66
+ type: "email";
67
+ }
68
+ interface PasswordField extends BaseField {
69
+ type: "password";
70
+ }
71
+ interface TextareaField extends BaseField {
72
+ type: "textarea";
73
+ minLength?: number;
74
+ maxLength?: number;
75
+ rows?: number;
76
+ localized?: boolean;
77
+ }
78
+ interface SelectField extends BaseField {
79
+ type: "select";
80
+ options: Array<{
81
+ label: string;
82
+ value: string;
83
+ }>;
84
+ hasMany?: boolean;
85
+ defaultValue?: string | string[];
86
+ }
87
+ interface RadioField extends BaseField {
88
+ type: "radio";
89
+ options: Array<{
90
+ label: string;
91
+ value: string;
92
+ }>;
93
+ defaultValue?: string;
94
+ }
95
+ interface ColorField extends BaseField {
96
+ type: "color";
97
+ format?: "hex" | "rgb" | "hsl";
98
+ defaultValue?: string;
99
+ }
100
+ interface ImageField extends BaseField {
101
+ type: "image";
102
+ minCount?: number;
103
+ maxCount?: number;
104
+ allowedTypes?: string[];
105
+ maxSize?: number;
106
+ }
107
+ interface RichTextBlock {
108
+ type: string;
109
+ data: Record<string, any>;
110
+ children?: RichTextBlock[];
111
+ }
112
+ interface RichTextField extends BaseField {
113
+ type: "richtext";
114
+ editor?: "lexical" | "slate" | "blocks";
115
+ hasBlocks?: boolean;
116
+ defaultValue?: RichTextBlock[];
117
+ localized?: boolean;
118
+ }
119
+ interface JSONField extends BaseField {
120
+ type: "json";
121
+ defaultValue?: Record<string, any>;
122
+ }
123
+ interface CodeField extends BaseField {
124
+ type: "code";
125
+ language?: string;
126
+ defaultValue?: string;
127
+ }
128
+ interface UploadField extends BaseField {
129
+ type: "upload";
130
+ relationTo: string;
131
+ hasMany?: boolean;
132
+ maxDepth?: number;
133
+ defaultValue?: string;
134
+ }
135
+ interface MarkdownField extends BaseField {
136
+ type: "markdown";
137
+ localized?: boolean;
138
+ defaultValue?: string;
139
+ }
140
+ interface RelationshipField extends BaseField {
141
+ type: "relationship";
142
+ relationTo: string | string[];
143
+ hasMany?: boolean;
144
+ maxDepth?: number;
145
+ filterOptions?: (args: {
146
+ data: any;
147
+ user: any;
148
+ }) => Record<string, any>;
149
+ defaultValue?: string | string[];
150
+ }
151
+ interface ArrayField extends BaseField {
152
+ type: "array";
153
+ fields: Field[];
154
+ minRows?: number;
155
+ maxRows?: number;
156
+ labels?: {
157
+ singular?: string;
158
+ plural?: string;
159
+ };
160
+ defaultValue?: Record<string, any>[];
161
+ }
162
+ interface ListField extends BaseField {
163
+ type: "list";
164
+ defaultValue?: string[];
165
+ }
166
+ interface GroupField extends BaseField {
167
+ type: "group";
168
+ fields: Field[];
169
+ defaultValue?: Record<string, any>;
170
+ }
171
+ interface BlockImage {
172
+ url: string;
173
+ alt?: string;
174
+ }
175
+ interface BlockAdmin {
176
+ group?: string;
177
+ images?: {
178
+ icon?: BlockImage | string;
179
+ thumbnail?: BlockImage | string;
180
+ };
181
+ }
182
+ interface Block {
183
+ slug: string;
184
+ label: string;
185
+ fields: Field[];
186
+ imageURL?: string;
187
+ admin?: BlockAdmin;
188
+ }
189
+ interface BlocksField extends BaseField {
190
+ type: "blocks";
191
+ blocks?: Block[];
192
+ minRows?: number;
193
+ maxRows?: number;
194
+ defaultValue?: Array<{
195
+ blockType: string;
196
+ [key: string]: any;
197
+ }>;
198
+ }
199
+ interface RowField extends Omit<BaseField, "name"> {
200
+ type: "row";
201
+ fields: Field[];
202
+ name?: string;
203
+ }
204
+ interface CollapsibleField extends Omit<BaseField, "name"> {
205
+ type: "collapsible";
206
+ fields: Field[];
207
+ label: string;
208
+ name?: string;
209
+ }
210
+ interface TabsField extends Omit<BaseField, "name"> {
211
+ type: "tabs";
212
+ tabs: Array<{
213
+ label: string;
214
+ fields: Field[];
215
+ name?: string;
216
+ }>;
217
+ name?: string;
218
+ }
219
+ interface ButtonField extends BaseField {
220
+ type: "button";
221
+ label: string;
222
+ action?: string;
223
+ method?: string;
224
+ inline?: boolean;
225
+ }
226
+ type Field = TextField | NumberField | CheckboxField | DateField | EmailField | PasswordField | TextareaField | SelectField | RadioField | ColorField | ImageField | RichTextField | JSONField | CodeField | UploadField | MarkdownField | RelationshipField | ArrayField | ListField | GroupField | BlocksField | RowField | CollapsibleField | TabsField | ButtonField;
227
+ type FieldType = Field["type"];
228
+ declare function isTextField(field: Field): field is TextField;
229
+ declare function isNumberField(field: Field): field is NumberField;
230
+ declare function isRelationshipField(field: Field): field is RelationshipField;
231
+ declare function isArrayField(field: Field): field is ArrayField;
232
+ declare function isGroupField(field: Field): field is GroupField;
233
+ declare function isBlocksField(field: Field): field is BlocksField;
234
+ declare function isUploadField(field: Field): field is UploadField;
235
+ declare function isImageField(field: Field): field is ImageField;
236
+ declare function isRichTextField(field: Field): field is RichTextField;
237
+ declare function isSelectField(field: Field): field is SelectField;
238
+ declare function isLayoutField(field: Field): field is RowField | CollapsibleField | TabsField;
239
+ declare const PRIMITIVE_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color"];
240
+ declare const COMPLEX_FIELD_TYPES: readonly ["richtext", "json", "code", "upload", "image", "markdown"];
241
+ declare const RELATIONAL_FIELD_TYPES: readonly ["relationship", "array", "group", "blocks"];
242
+ declare const LAYOUT_FIELD_TYPES: readonly ["row", "collapsible", "tabs"];
243
+ declare const ALL_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color", "richtext", "json", "code", "upload", "image", "markdown", "relationship", "array", "group", "blocks", "row", "collapsible", "tabs"];
244
+ declare function createRelationshipFieldConfig(name: string, relationTo: string | string[], options?: Partial<Omit<RelationshipField, "type" | "name" | "relationTo">>): RelationshipField;
245
+
246
+ export { type ArrayField as A, type BaseField as B, type CheckboxField as C, type DateField as D, type EmailField as E, type Field as F, type GroupField as G, isRichTextField as H, type ImageField as I, type JSONField as J, isSelectField as K, LAYOUT_FIELD_TYPES as L, type MarkdownField as M, type NumberField as N, isTextField as O, type PasswordField as P, isUploadField as Q, type RadioField as R, type SelectField as S, type TabsField as T, type UploadField as U, type ValidateOptions as V, type ButtonField as W, type Hook as X, type ListField as Y, type TextFieldVariant as Z, createRelationshipFieldConfig as _, type Block as a, type BlockAdmin as b, type BlockImage as c, type BlocksField as d, type CodeField as e, type CollapsibleField as f, type ColorField as g, type FieldAdmin as h, type FieldType as i, type RelationshipField as j, type RichTextBlock as k, type RichTextField as l, type RowField as m, type TextField as n, type TextareaField as o, ALL_FIELD_TYPES as p, COMPLEX_FIELD_TYPES as q, PRIMITIVE_FIELD_TYPES as r, RELATIONAL_FIELD_TYPES as s, isArrayField as t, isBlocksField as u, isGroupField as v, isImageField as w, isLayoutField as x, isNumberField as y, isRelationshipField as z };