@kyro-cms/core 0.1.0
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/README.md +241 -0
- package/dist/base-CQkFzqQl.d.ts +62 -0
- package/dist/base-DlhVlwnN.d.cts +62 -0
- package/dist/chunk-3Q3FS5J4.cjs +273 -0
- package/dist/chunk-3Q3FS5J4.cjs.map +1 -0
- package/dist/chunk-3TPQ2BU6.js +423 -0
- package/dist/chunk-3TPQ2BU6.js.map +1 -0
- package/dist/chunk-3VZCX4DF.cjs +384 -0
- package/dist/chunk-3VZCX4DF.cjs.map +1 -0
- package/dist/chunk-BXMWDUED.js +115 -0
- package/dist/chunk-BXMWDUED.js.map +1 -0
- package/dist/chunk-DIC236EW.js +290 -0
- package/dist/chunk-DIC236EW.js.map +1 -0
- package/dist/chunk-DKSMFC3L.js +268 -0
- package/dist/chunk-DKSMFC3L.js.map +1 -0
- package/dist/chunk-DVD5P72E.cjs +428 -0
- package/dist/chunk-DVD5P72E.cjs.map +1 -0
- package/dist/chunk-HT6VE4NW.cjs +293 -0
- package/dist/chunk-HT6VE4NW.cjs.map +1 -0
- package/dist/chunk-K7QF2QCM.cjs +311 -0
- package/dist/chunk-K7QF2QCM.cjs.map +1 -0
- package/dist/chunk-OG3KX56O.js +308 -0
- package/dist/chunk-OG3KX56O.js.map +1 -0
- package/dist/chunk-R3XIBBAW.cjs +34 -0
- package/dist/chunk-R3XIBBAW.cjs.map +1 -0
- package/dist/chunk-RLTG4YZM.cjs +117 -0
- package/dist/chunk-RLTG4YZM.cjs.map +1 -0
- package/dist/chunk-SDMNUYVU.js +30 -0
- package/dist/chunk-SDMNUYVU.js.map +1 -0
- package/dist/chunk-UEG7KMKC.cjs +228 -0
- package/dist/chunk-UEG7KMKC.cjs.map +1 -0
- package/dist/chunk-UEYC46RL.js +374 -0
- package/dist/chunk-UEYC46RL.js.map +1 -0
- package/dist/chunk-YPAFJ7EV.js +225 -0
- package/dist/chunk-YPAFJ7EV.js.map +1 -0
- package/dist/cli/index.cjs +306 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +303 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/drizzle/index.cjs +25 -0
- package/dist/drizzle/index.cjs.map +1 -0
- package/dist/drizzle/index.d.cts +49 -0
- package/dist/drizzle/index.d.ts +49 -0
- package/dist/drizzle/index.js +4 -0
- package/dist/drizzle/index.js.map +1 -0
- package/dist/graphql/index.cjs +16 -0
- package/dist/graphql/index.cjs.map +1 -0
- package/dist/graphql/index.d.cts +20 -0
- package/dist/graphql/index.d.ts +20 -0
- package/dist/graphql/index.js +3 -0
- package/dist/graphql/index.js.map +1 -0
- package/dist/index-4fJKLFK2.d.ts +63 -0
- package/dist/index-DI0DRPNv.d.cts +63 -0
- package/dist/index.cjs +2506 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +525 -0
- package/dist/index.d.ts +525 -0
- package/dist/index.js +2334 -0
- package/dist/index.js.map +1 -0
- package/dist/mongodb/index.cjs +17 -0
- package/dist/mongodb/index.cjs.map +1 -0
- package/dist/mongodb/index.d.cts +49 -0
- package/dist/mongodb/index.d.ts +49 -0
- package/dist/mongodb/index.js +4 -0
- package/dist/mongodb/index.js.map +1 -0
- package/dist/rest/index.cjs +17 -0
- package/dist/rest/index.cjs.map +1 -0
- package/dist/rest/index.d.cts +28 -0
- package/dist/rest/index.d.ts +28 -0
- package/dist/rest/index.js +4 -0
- package/dist/rest/index.js.map +1 -0
- package/dist/trpc/index.cjs +45 -0
- package/dist/trpc/index.cjs.map +1 -0
- package/dist/trpc/index.d.cts +130 -0
- package/dist/trpc/index.d.ts +130 -0
- package/dist/trpc/index.js +4 -0
- package/dist/trpc/index.js.map +1 -0
- package/dist/types-BGM5MV_K.d.cts +589 -0
- package/dist/types-BGM5MV_K.d.ts +589 -0
- package/dist/ws/index.cjs +24 -0
- package/dist/ws/index.cjs.map +1 -0
- package/dist/ws/index.d.cts +88 -0
- package/dist/ws/index.d.ts +88 -0
- package/dist/ws/index.js +3 -0
- package/dist/ws/index.js.map +1 -0
- package/package.json +120 -0
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
interface FieldAdmin {
|
|
2
|
+
description?: string;
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
hidden?: boolean;
|
|
6
|
+
width?: string;
|
|
7
|
+
condition?: (data: Record<string, any>, siblingData: Record<string, any>) => boolean;
|
|
8
|
+
position?: 'sidebar' | 'main';
|
|
9
|
+
}
|
|
10
|
+
interface BaseField {
|
|
11
|
+
name: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
unique?: boolean;
|
|
15
|
+
indexed?: boolean;
|
|
16
|
+
defaultValue?: any;
|
|
17
|
+
admin?: FieldAdmin;
|
|
18
|
+
validate?: (value: any, options: ValidateOptions) => string | true | Promise<string | true>;
|
|
19
|
+
hooks?: {
|
|
20
|
+
beforeValidate?: Hook$1[];
|
|
21
|
+
beforeChange?: Hook$1[];
|
|
22
|
+
afterChange?: Hook$1[];
|
|
23
|
+
afterRead?: Hook$1[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface ValidateOptions {
|
|
27
|
+
data?: Record<string, any>;
|
|
28
|
+
siblingData?: Record<string, any>;
|
|
29
|
+
user?: any;
|
|
30
|
+
operation?: string;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
}
|
|
33
|
+
type Hook$1 = (args: any) => Promise<any> | any;
|
|
34
|
+
type TextFieldVariant = 'text' | 'email' | 'password' | 'url' | 'id';
|
|
35
|
+
interface TextField extends BaseField {
|
|
36
|
+
type: 'text';
|
|
37
|
+
variant?: TextFieldVariant;
|
|
38
|
+
minLength?: number;
|
|
39
|
+
maxLength?: number;
|
|
40
|
+
pattern?: string;
|
|
41
|
+
hasMany?: boolean;
|
|
42
|
+
localized?: boolean;
|
|
43
|
+
}
|
|
44
|
+
interface NumberField extends BaseField {
|
|
45
|
+
type: 'number';
|
|
46
|
+
min?: number;
|
|
47
|
+
max?: number;
|
|
48
|
+
step?: number;
|
|
49
|
+
integer?: boolean;
|
|
50
|
+
hasMany?: boolean;
|
|
51
|
+
}
|
|
52
|
+
interface CheckboxField extends BaseField {
|
|
53
|
+
type: 'checkbox';
|
|
54
|
+
}
|
|
55
|
+
interface DateField extends BaseField {
|
|
56
|
+
type: 'date';
|
|
57
|
+
minDate?: string;
|
|
58
|
+
maxDate?: string;
|
|
59
|
+
time?: boolean;
|
|
60
|
+
}
|
|
61
|
+
interface EmailField extends BaseField {
|
|
62
|
+
type: 'email';
|
|
63
|
+
}
|
|
64
|
+
interface PasswordField extends BaseField {
|
|
65
|
+
type: 'password';
|
|
66
|
+
}
|
|
67
|
+
interface TextareaField extends BaseField {
|
|
68
|
+
type: 'textarea';
|
|
69
|
+
minLength?: number;
|
|
70
|
+
maxLength?: number;
|
|
71
|
+
rows?: number;
|
|
72
|
+
localized?: boolean;
|
|
73
|
+
}
|
|
74
|
+
interface SelectField extends BaseField {
|
|
75
|
+
type: 'select';
|
|
76
|
+
options: Array<{
|
|
77
|
+
label: string;
|
|
78
|
+
value: string;
|
|
79
|
+
}>;
|
|
80
|
+
hasMany?: boolean;
|
|
81
|
+
defaultValue?: string | string[];
|
|
82
|
+
}
|
|
83
|
+
interface RadioField extends BaseField {
|
|
84
|
+
type: 'radio';
|
|
85
|
+
options: Array<{
|
|
86
|
+
label: string;
|
|
87
|
+
value: string;
|
|
88
|
+
}>;
|
|
89
|
+
defaultValue?: string;
|
|
90
|
+
}
|
|
91
|
+
interface ColorField extends BaseField {
|
|
92
|
+
type: 'color';
|
|
93
|
+
format?: 'hex' | 'rgb' | 'hsl';
|
|
94
|
+
defaultValue?: string;
|
|
95
|
+
}
|
|
96
|
+
interface RichTextBlock {
|
|
97
|
+
type: string;
|
|
98
|
+
data: Record<string, any>;
|
|
99
|
+
children?: RichTextBlock[];
|
|
100
|
+
}
|
|
101
|
+
interface RichTextField extends BaseField {
|
|
102
|
+
type: 'richtext';
|
|
103
|
+
editor?: 'lexical' | 'slate' | 'blocks';
|
|
104
|
+
defaultValue?: RichTextBlock[];
|
|
105
|
+
localized?: boolean;
|
|
106
|
+
}
|
|
107
|
+
interface JSONField extends BaseField {
|
|
108
|
+
type: 'json';
|
|
109
|
+
defaultValue?: Record<string, any>;
|
|
110
|
+
}
|
|
111
|
+
interface CodeField extends BaseField {
|
|
112
|
+
type: 'code';
|
|
113
|
+
language?: string;
|
|
114
|
+
defaultValue?: string;
|
|
115
|
+
}
|
|
116
|
+
interface UploadField extends BaseField {
|
|
117
|
+
type: 'upload';
|
|
118
|
+
relationTo: string;
|
|
119
|
+
hasMany?: boolean;
|
|
120
|
+
maxDepth?: number;
|
|
121
|
+
defaultValue?: string;
|
|
122
|
+
}
|
|
123
|
+
interface MarkdownField extends BaseField {
|
|
124
|
+
type: 'markdown';
|
|
125
|
+
localized?: boolean;
|
|
126
|
+
defaultValue?: string;
|
|
127
|
+
}
|
|
128
|
+
interface RelationshipField extends BaseField {
|
|
129
|
+
type: 'relationship';
|
|
130
|
+
relationTo: string | string[];
|
|
131
|
+
hasMany?: boolean;
|
|
132
|
+
maxDepth?: number;
|
|
133
|
+
filterOptions?: (args: {
|
|
134
|
+
data: any;
|
|
135
|
+
user: any;
|
|
136
|
+
}) => Record<string, any>;
|
|
137
|
+
defaultValue?: string | string[];
|
|
138
|
+
}
|
|
139
|
+
interface ArrayField extends BaseField {
|
|
140
|
+
type: 'array';
|
|
141
|
+
fields: Field[];
|
|
142
|
+
minRows?: number;
|
|
143
|
+
maxRows?: number;
|
|
144
|
+
labels?: {
|
|
145
|
+
singular?: string;
|
|
146
|
+
plural?: string;
|
|
147
|
+
};
|
|
148
|
+
defaultValue?: Record<string, any>[];
|
|
149
|
+
}
|
|
150
|
+
interface GroupField extends BaseField {
|
|
151
|
+
type: 'group';
|
|
152
|
+
fields: Field[];
|
|
153
|
+
defaultValue?: Record<string, any>;
|
|
154
|
+
}
|
|
155
|
+
interface Block {
|
|
156
|
+
slug: string;
|
|
157
|
+
label: string;
|
|
158
|
+
fields: Field[];
|
|
159
|
+
imageURL?: string;
|
|
160
|
+
}
|
|
161
|
+
interface BlocksField extends BaseField {
|
|
162
|
+
type: 'blocks';
|
|
163
|
+
blocks: Block[];
|
|
164
|
+
minRows?: number;
|
|
165
|
+
maxRows?: number;
|
|
166
|
+
defaultValue?: Array<{
|
|
167
|
+
blockType: string;
|
|
168
|
+
[key: string]: any;
|
|
169
|
+
}>;
|
|
170
|
+
}
|
|
171
|
+
interface RowField extends Omit<BaseField, 'name'> {
|
|
172
|
+
type: 'row';
|
|
173
|
+
fields: Field[];
|
|
174
|
+
name?: string;
|
|
175
|
+
}
|
|
176
|
+
interface CollapsibleField extends Omit<BaseField, 'name'> {
|
|
177
|
+
type: 'collapsible';
|
|
178
|
+
fields: Field[];
|
|
179
|
+
label: string;
|
|
180
|
+
name?: string;
|
|
181
|
+
}
|
|
182
|
+
interface TabsField extends Omit<BaseField, 'name'> {
|
|
183
|
+
type: 'tabs';
|
|
184
|
+
tabs: Array<{
|
|
185
|
+
label: string;
|
|
186
|
+
fields: Field[];
|
|
187
|
+
name?: string;
|
|
188
|
+
}>;
|
|
189
|
+
name?: string;
|
|
190
|
+
}
|
|
191
|
+
type Field = TextField | NumberField | CheckboxField | DateField | EmailField | PasswordField | TextareaField | SelectField | RadioField | ColorField | RichTextField | JSONField | CodeField | UploadField | MarkdownField | RelationshipField | ArrayField | GroupField | BlocksField | RowField | CollapsibleField | TabsField;
|
|
192
|
+
type FieldType = Field['type'];
|
|
193
|
+
declare function isTextField(field: Field): field is TextField;
|
|
194
|
+
declare function isNumberField(field: Field): field is NumberField;
|
|
195
|
+
declare function isRelationshipField(field: Field): field is RelationshipField;
|
|
196
|
+
declare function isArrayField(field: Field): field is ArrayField;
|
|
197
|
+
declare function isGroupField(field: Field): field is GroupField;
|
|
198
|
+
declare function isBlocksField(field: Field): field is BlocksField;
|
|
199
|
+
declare function isUploadField(field: Field): field is UploadField;
|
|
200
|
+
declare function isRichTextField(field: Field): field is RichTextField;
|
|
201
|
+
declare function isSelectField(field: Field): field is SelectField;
|
|
202
|
+
declare function isLayoutField(field: Field): field is RowField | CollapsibleField | TabsField;
|
|
203
|
+
declare const PRIMITIVE_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color"];
|
|
204
|
+
declare const COMPLEX_FIELD_TYPES: readonly ["richtext", "json", "code", "upload", "markdown"];
|
|
205
|
+
declare const RELATIONAL_FIELD_TYPES: readonly ["relationship", "array", "group", "blocks"];
|
|
206
|
+
declare const LAYOUT_FIELD_TYPES: readonly ["row", "collapsible", "tabs"];
|
|
207
|
+
declare const ALL_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "email", "password", "textarea", "select", "radio", "color", "richtext", "json", "code", "upload", "markdown", "relationship", "array", "group", "blocks", "row", "collapsible", "tabs"];
|
|
208
|
+
|
|
209
|
+
interface Request {
|
|
210
|
+
body?: any;
|
|
211
|
+
headers: Record<string, string>;
|
|
212
|
+
method?: string;
|
|
213
|
+
url?: string;
|
|
214
|
+
cookies?: Record<string, string>;
|
|
215
|
+
query?: Record<string, any>;
|
|
216
|
+
}
|
|
217
|
+
interface User {
|
|
218
|
+
id: string;
|
|
219
|
+
email: string;
|
|
220
|
+
role: string;
|
|
221
|
+
tenantID?: string;
|
|
222
|
+
[key: string]: any;
|
|
223
|
+
}
|
|
224
|
+
interface HookArgs<T = any> {
|
|
225
|
+
collection?: string;
|
|
226
|
+
global?: string;
|
|
227
|
+
data?: T;
|
|
228
|
+
originalDoc?: T;
|
|
229
|
+
doc?: T;
|
|
230
|
+
req: Request;
|
|
231
|
+
user?: User;
|
|
232
|
+
operation: 'create' | 'read' | 'update' | 'delete';
|
|
233
|
+
tenantID?: string;
|
|
234
|
+
field?: string;
|
|
235
|
+
siblingData?: Record<string, any>;
|
|
236
|
+
value?: any;
|
|
237
|
+
previousValue?: any;
|
|
238
|
+
context?: Record<string, any>;
|
|
239
|
+
}
|
|
240
|
+
type Hook<T = any> = (args: HookArgs<T>) => Promise<T | void> | T | void;
|
|
241
|
+
interface CollectionHooks {
|
|
242
|
+
beforeValidate?: Hook[];
|
|
243
|
+
beforeChange?: Hook[];
|
|
244
|
+
afterChange?: Hook[];
|
|
245
|
+
beforeRead?: Hook[];
|
|
246
|
+
afterRead?: Hook[];
|
|
247
|
+
beforeDelete?: Hook[];
|
|
248
|
+
afterDelete?: Hook[];
|
|
249
|
+
beforeLogin?: Hook[];
|
|
250
|
+
afterLogin?: Hook[];
|
|
251
|
+
afterLogout?: Hook[];
|
|
252
|
+
afterRefresh?: Hook[];
|
|
253
|
+
afterForgotPassword?: Hook[];
|
|
254
|
+
}
|
|
255
|
+
interface FieldHooks {
|
|
256
|
+
beforeValidate?: Hook[];
|
|
257
|
+
beforeChange?: Hook[];
|
|
258
|
+
afterChange?: Hook[];
|
|
259
|
+
afterRead?: Hook[];
|
|
260
|
+
}
|
|
261
|
+
interface GlobalHooks {
|
|
262
|
+
beforeValidate?: Hook[];
|
|
263
|
+
beforeChange?: Hook[];
|
|
264
|
+
afterChange?: Hook[];
|
|
265
|
+
beforeRead?: Hook[];
|
|
266
|
+
afterRead?: Hook[];
|
|
267
|
+
}
|
|
268
|
+
declare function runHooks(hooks: Hook[], args: HookArgs): Promise<any>;
|
|
269
|
+
declare function runFieldHooks(hooks: Hook[], args: HookArgs): Promise<any>;
|
|
270
|
+
|
|
271
|
+
interface WhereClause {
|
|
272
|
+
[field: string]: any;
|
|
273
|
+
}
|
|
274
|
+
interface AccessArgs {
|
|
275
|
+
req: Request;
|
|
276
|
+
user?: User;
|
|
277
|
+
data?: any;
|
|
278
|
+
doc?: any;
|
|
279
|
+
id?: string;
|
|
280
|
+
tenantID?: string;
|
|
281
|
+
context?: Record<string, any>;
|
|
282
|
+
}
|
|
283
|
+
type AccessControl = boolean | ((args: AccessArgs) => Promise<boolean | WhereClause> | boolean | WhereClause);
|
|
284
|
+
interface CollectionAccess {
|
|
285
|
+
create?: AccessControl;
|
|
286
|
+
read?: AccessControl;
|
|
287
|
+
update?: AccessControl;
|
|
288
|
+
delete?: AccessControl;
|
|
289
|
+
admin?: AccessControl;
|
|
290
|
+
unlock?: AccessControl;
|
|
291
|
+
readVersions?: AccessControl;
|
|
292
|
+
}
|
|
293
|
+
interface GlobalAccess {
|
|
294
|
+
read?: AccessControl;
|
|
295
|
+
update?: AccessControl;
|
|
296
|
+
}
|
|
297
|
+
interface FieldAccess {
|
|
298
|
+
create?: AccessControl;
|
|
299
|
+
read?: AccessControl;
|
|
300
|
+
update?: AccessControl;
|
|
301
|
+
}
|
|
302
|
+
declare function evaluateAccess(access: AccessControl, args: AccessArgs): Promise<boolean | WhereClause>;
|
|
303
|
+
declare function mergeWhereClauses(...whereClauses: (WhereClause | boolean | undefined)[]): WhereClause;
|
|
304
|
+
declare function getWhereClause(access: AccessControl, args: AccessArgs): Promise<WhereClause | undefined>;
|
|
305
|
+
|
|
306
|
+
interface AdminConfig {
|
|
307
|
+
useAsTitle?: string;
|
|
308
|
+
defaultColumns?: string[];
|
|
309
|
+
hidden?: boolean;
|
|
310
|
+
description?: string;
|
|
311
|
+
hideAPIURL?: boolean;
|
|
312
|
+
group?: string;
|
|
313
|
+
icon?: string;
|
|
314
|
+
preview?: (doc: any, options: {
|
|
315
|
+
req: any;
|
|
316
|
+
}) => string;
|
|
317
|
+
disableDuplicate?: boolean;
|
|
318
|
+
pagination?: {
|
|
319
|
+
defaultLimit?: number;
|
|
320
|
+
limits?: number[];
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
interface UploadConfig {
|
|
324
|
+
staticDir?: string;
|
|
325
|
+
staticURL?: string;
|
|
326
|
+
mimeTypes?: string[];
|
|
327
|
+
fileSize?: number;
|
|
328
|
+
imageSizes?: ImageSize[];
|
|
329
|
+
crop?: boolean;
|
|
330
|
+
focalPoint?: boolean;
|
|
331
|
+
formatOptions?: {
|
|
332
|
+
format: 'webp' | 'png' | 'jpg';
|
|
333
|
+
options?: Record<string, any>;
|
|
334
|
+
};
|
|
335
|
+
resizeOptions?: Record<string, any>;
|
|
336
|
+
adminThumbnail?: string;
|
|
337
|
+
}
|
|
338
|
+
interface ImageSize {
|
|
339
|
+
name: string;
|
|
340
|
+
width?: number;
|
|
341
|
+
height?: number;
|
|
342
|
+
crop?: string;
|
|
343
|
+
position?: string;
|
|
344
|
+
formatOptions?: {
|
|
345
|
+
format: 'webp' | 'png' | 'jpg';
|
|
346
|
+
};
|
|
347
|
+
generateImageName?: (doc: any) => string;
|
|
348
|
+
}
|
|
349
|
+
interface VersionConfig {
|
|
350
|
+
maxPerDoc?: number;
|
|
351
|
+
drafts?: boolean;
|
|
352
|
+
retainDeleted?: boolean;
|
|
353
|
+
}
|
|
354
|
+
interface AuthConfig {
|
|
355
|
+
tokenExpiration?: number;
|
|
356
|
+
verify?: boolean | {
|
|
357
|
+
generateEmailHTML?: (args: any) => string;
|
|
358
|
+
};
|
|
359
|
+
maxLoginAttempts?: number;
|
|
360
|
+
lockTime?: number;
|
|
361
|
+
cookies?: {
|
|
362
|
+
secure?: boolean;
|
|
363
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
364
|
+
domain?: string;
|
|
365
|
+
};
|
|
366
|
+
forgotPassword?: {
|
|
367
|
+
generateEmailHTML?: (args: any) => string;
|
|
368
|
+
generateEmailSubject?: (args: any) => string;
|
|
369
|
+
};
|
|
370
|
+
strategies?: Array<{
|
|
371
|
+
name: string;
|
|
372
|
+
authenticate: (args: any) => Promise<any>;
|
|
373
|
+
}>;
|
|
374
|
+
}
|
|
375
|
+
interface CollectionConfig {
|
|
376
|
+
slug: string;
|
|
377
|
+
label?: string;
|
|
378
|
+
labelPlural?: string;
|
|
379
|
+
singularLabel?: string;
|
|
380
|
+
admin?: AdminConfig;
|
|
381
|
+
fields: Field[];
|
|
382
|
+
access?: CollectionAccess;
|
|
383
|
+
hooks?: CollectionHooks;
|
|
384
|
+
timestamps?: boolean;
|
|
385
|
+
tenantScoped?: boolean;
|
|
386
|
+
tenantField?: string;
|
|
387
|
+
upload?: UploadConfig;
|
|
388
|
+
versions?: VersionConfig;
|
|
389
|
+
auth?: boolean | AuthConfig;
|
|
390
|
+
graphQL?: {
|
|
391
|
+
singularName?: string;
|
|
392
|
+
pluralName?: string;
|
|
393
|
+
};
|
|
394
|
+
indexes?: Array<{
|
|
395
|
+
fields: Record<string, number | 'text'>;
|
|
396
|
+
options?: Record<string, any>;
|
|
397
|
+
}>;
|
|
398
|
+
typescript?: {
|
|
399
|
+
interface?: string;
|
|
400
|
+
};
|
|
401
|
+
custom?: Record<string, any>;
|
|
402
|
+
}
|
|
403
|
+
interface GlobalConfig {
|
|
404
|
+
slug: string;
|
|
405
|
+
label?: string;
|
|
406
|
+
admin?: AdminConfig;
|
|
407
|
+
fields: Field[];
|
|
408
|
+
access?: GlobalAccess;
|
|
409
|
+
hooks?: GlobalHooks;
|
|
410
|
+
versions?: VersionConfig;
|
|
411
|
+
graphQL?: {
|
|
412
|
+
name?: string;
|
|
413
|
+
};
|
|
414
|
+
typescript?: {
|
|
415
|
+
interface?: string;
|
|
416
|
+
};
|
|
417
|
+
custom?: Record<string, any>;
|
|
418
|
+
}
|
|
419
|
+
interface FindArgs {
|
|
420
|
+
collection: string;
|
|
421
|
+
where?: Record<string, any>;
|
|
422
|
+
sort?: string;
|
|
423
|
+
limit?: number;
|
|
424
|
+
page?: number;
|
|
425
|
+
depth?: number;
|
|
426
|
+
tenantID?: string;
|
|
427
|
+
select?: string[];
|
|
428
|
+
user?: any;
|
|
429
|
+
context?: Record<string, any>;
|
|
430
|
+
overrideAccess?: boolean;
|
|
431
|
+
}
|
|
432
|
+
interface FindByIDArgs {
|
|
433
|
+
collection: string;
|
|
434
|
+
id: string;
|
|
435
|
+
depth?: number;
|
|
436
|
+
tenantID?: string;
|
|
437
|
+
select?: string[];
|
|
438
|
+
user?: any;
|
|
439
|
+
context?: Record<string, any>;
|
|
440
|
+
overrideAccess?: boolean;
|
|
441
|
+
}
|
|
442
|
+
interface CreateArgs {
|
|
443
|
+
collection: string;
|
|
444
|
+
data: Record<string, any>;
|
|
445
|
+
depth?: number;
|
|
446
|
+
tenantID?: string;
|
|
447
|
+
select?: string[];
|
|
448
|
+
user?: any;
|
|
449
|
+
context?: Record<string, any>;
|
|
450
|
+
overrideAccess?: boolean;
|
|
451
|
+
}
|
|
452
|
+
interface UpdateArgs {
|
|
453
|
+
collection: string;
|
|
454
|
+
id: string;
|
|
455
|
+
data: Record<string, any>;
|
|
456
|
+
depth?: number;
|
|
457
|
+
tenantID?: string;
|
|
458
|
+
select?: string[];
|
|
459
|
+
user?: any;
|
|
460
|
+
context?: Record<string, any>;
|
|
461
|
+
overrideAccess?: boolean;
|
|
462
|
+
}
|
|
463
|
+
interface DeleteArgs {
|
|
464
|
+
collection: string;
|
|
465
|
+
id: string;
|
|
466
|
+
tenantID?: string;
|
|
467
|
+
user?: any;
|
|
468
|
+
context?: Record<string, any>;
|
|
469
|
+
overrideAccess?: boolean;
|
|
470
|
+
}
|
|
471
|
+
interface FindResult<T = any> {
|
|
472
|
+
docs: T[];
|
|
473
|
+
totalDocs: number;
|
|
474
|
+
limit: number;
|
|
475
|
+
totalPages: number;
|
|
476
|
+
page: number;
|
|
477
|
+
pagingCounter: number;
|
|
478
|
+
hasPrevPage: boolean;
|
|
479
|
+
hasNextPage: boolean;
|
|
480
|
+
prevPage: number | null;
|
|
481
|
+
nextPage: number | null;
|
|
482
|
+
}
|
|
483
|
+
interface CreateResult<T = any> {
|
|
484
|
+
doc: T;
|
|
485
|
+
errors?: Array<{
|
|
486
|
+
field: string;
|
|
487
|
+
message: string;
|
|
488
|
+
}>;
|
|
489
|
+
}
|
|
490
|
+
interface BaseAdapter {
|
|
491
|
+
init(collections: CollectionConfig[], globals: GlobalConfig[]): Promise<void>;
|
|
492
|
+
find<T>(args: FindArgs): Promise<FindResult<T>>;
|
|
493
|
+
findByID<T>(args: FindByIDArgs): Promise<T | null>;
|
|
494
|
+
create<T>(args: CreateArgs): Promise<T>;
|
|
495
|
+
update<T>(args: UpdateArgs): Promise<T>;
|
|
496
|
+
delete<T>(args: DeleteArgs): Promise<T>;
|
|
497
|
+
count(args: {
|
|
498
|
+
collection: string;
|
|
499
|
+
where?: Record<string, any>;
|
|
500
|
+
tenantID?: string;
|
|
501
|
+
}): Promise<number>;
|
|
502
|
+
findOne(args: {
|
|
503
|
+
collection: string;
|
|
504
|
+
where: Record<string, any>;
|
|
505
|
+
tenantID?: string;
|
|
506
|
+
}): Promise<any>;
|
|
507
|
+
findVersions(args: FindArgs): Promise<FindResult<any>>;
|
|
508
|
+
findVersionByID(args: FindByIDArgs): Promise<any>;
|
|
509
|
+
createVersion(args: CreateArgs): Promise<any>;
|
|
510
|
+
deleteVersions(args: {
|
|
511
|
+
collection: string;
|
|
512
|
+
where: Record<string, any>;
|
|
513
|
+
}): Promise<void>;
|
|
514
|
+
migrate?(): Promise<void>;
|
|
515
|
+
rollback?(): Promise<void>;
|
|
516
|
+
connect(): Promise<void>;
|
|
517
|
+
disconnect(): Promise<void>;
|
|
518
|
+
transaction?<T>(fn: (tx: any) => Promise<T>): Promise<T>;
|
|
519
|
+
}
|
|
520
|
+
interface AdapterConfig {
|
|
521
|
+
type: 'drizzle' | 'mongodb';
|
|
522
|
+
client: any;
|
|
523
|
+
schema?: any;
|
|
524
|
+
connectionOptions?: Record<string, any>;
|
|
525
|
+
}
|
|
526
|
+
interface PluginConfig {
|
|
527
|
+
name: string;
|
|
528
|
+
version?: string;
|
|
529
|
+
init?: (kyro: any) => void | Promise<void>;
|
|
530
|
+
extendCollection?: (slug: string, config: CollectionConfig) => CollectionConfig;
|
|
531
|
+
extendGlobal?: (slug: string, config: GlobalConfig) => GlobalConfig;
|
|
532
|
+
hooks?: CollectionHooks;
|
|
533
|
+
fields?: Field[];
|
|
534
|
+
api?: (kyro: any) => any;
|
|
535
|
+
}
|
|
536
|
+
interface KyroConfig {
|
|
537
|
+
collections?: CollectionConfig[];
|
|
538
|
+
globals?: GlobalConfig[];
|
|
539
|
+
adapter: BaseAdapter;
|
|
540
|
+
plugins?: PluginConfig[];
|
|
541
|
+
auth?: {
|
|
542
|
+
secret: string;
|
|
543
|
+
tokenExpiration?: number;
|
|
544
|
+
cookie?: {
|
|
545
|
+
secure?: boolean;
|
|
546
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
547
|
+
domain?: string;
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
cors?: {
|
|
551
|
+
origins?: string[];
|
|
552
|
+
credentials?: boolean;
|
|
553
|
+
};
|
|
554
|
+
admin?: {
|
|
555
|
+
meta?: {
|
|
556
|
+
title?: string;
|
|
557
|
+
description?: string;
|
|
558
|
+
ogImage?: string;
|
|
559
|
+
};
|
|
560
|
+
dateFormat?: string;
|
|
561
|
+
avatar?: 'default' | 'gravatar';
|
|
562
|
+
disable?: boolean;
|
|
563
|
+
indexRoute?: string;
|
|
564
|
+
components?: Record<string, any>;
|
|
565
|
+
};
|
|
566
|
+
upload?: {
|
|
567
|
+
limits?: {
|
|
568
|
+
fileSize?: number;
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
graphQL?: {
|
|
572
|
+
maxComplexity?: number;
|
|
573
|
+
disablePlayground?: boolean;
|
|
574
|
+
};
|
|
575
|
+
typescript?: {
|
|
576
|
+
outputFile?: string;
|
|
577
|
+
};
|
|
578
|
+
localization?: {
|
|
579
|
+
locales: string[];
|
|
580
|
+
defaultLocale: string;
|
|
581
|
+
};
|
|
582
|
+
rateLimit?: {
|
|
583
|
+
window?: number;
|
|
584
|
+
max?: number;
|
|
585
|
+
};
|
|
586
|
+
debug?: boolean;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
export { type RadioField as $, ALL_FIELD_TYPES as A, type BaseAdapter as B, type CollectionConfig as C, type DeleteArgs as D, type EmailField as E, type Field as F, type GlobalConfig as G, type Hook as H, type FieldAdmin as I, type FieldHooks as J, type KyroConfig as K, type FieldType as L, type GlobalAccess as M, type GlobalHooks as N, type GroupField as O, type PluginConfig as P, type HookArgs as Q, type RelationshipField as R, type ImageSize as S, type JSONField as T, type UpdateArgs as U, LAYOUT_FIELD_TYPES as V, type MarkdownField as W, type NumberField as X, PRIMITIVE_FIELD_TYPES as Y, type PasswordField as Z, RELATIONAL_FIELD_TYPES as _, type FindArgs as a, type RichTextBlock as a0, type RichTextField as a1, type RowField as a2, type SelectField as a3, type TabsField as a4, type TextField as a5, type TextareaField as a6, type UploadConfig as a7, type ValidateOptions as a8, type VersionConfig as a9, type WhereClause as aa, evaluateAccess as ab, getWhereClause as ac, isArrayField as ad, isBlocksField as ae, isGroupField as af, isLayoutField as ag, isNumberField as ah, isRelationshipField as ai, isRichTextField as aj, isSelectField as ak, isTextField as al, isUploadField as am, mergeWhereClauses as an, runFieldHooks as ao, runHooks as ap, type FindResult as b, type FindByIDArgs as c, type CreateArgs as d, type UploadField as e, type User as f, type Request as g, type AccessArgs as h, type AccessControl as i, type AdapterConfig as j, type AdminConfig as k, type ArrayField as l, type AuthConfig as m, type BaseField as n, type Block as o, type BlocksField as p, COMPLEX_FIELD_TYPES as q, type CheckboxField as r, type CodeField as s, type CollapsibleField as t, type CollectionAccess as u, type CollectionHooks as v, type ColorField as w, type CreateResult as x, type DateField as y, type FieldAccess as z };
|