nextly 0.0.1 → 0.0.2-alpha.1
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/LICENSE +22 -0
- package/README.md +122 -0
- package/dist/_dts-chunks/collections-handler.d-DjgO74Wt.d.ts +20540 -0
- package/dist/_dts-chunks/config.d-DNwsDnjs.d.ts +2589 -0
- package/dist/_dts-chunks/define-component.d-BUgTHmt3.d.ts +1149 -0
- package/dist/_dts-chunks/image-processor.d-OO1PmMrv.d.ts +335 -0
- package/dist/_dts-chunks/index.d-axCAzZ7m.d.ts +17842 -0
- package/dist/_dts-chunks/media.d-DjDOZo4B.d.ts +117 -0
- package/dist/_dts-chunks/on-error.d-CHIKWNxd.d.ts +38 -0
- package/dist/_dts-chunks/storage.d-BUhQ2we_.d.ts +404 -0
- package/dist/actions/index.d.ts +239 -0
- package/dist/actions/index.mjs +281 -0
- package/dist/api/auth-state.d.ts +5 -0
- package/dist/api/auth-state.mjs +131 -0
- package/dist/api/collections-schema-detail.d.ts +56 -0
- package/dist/api/collections-schema-detail.mjs +244 -0
- package/dist/api/collections-schema-export.d.ts +56 -0
- package/dist/api/collections-schema-export.mjs +129 -0
- package/dist/api/collections-schema.d.ts +59 -0
- package/dist/api/collections-schema.mjs +207 -0
- package/dist/api/components-detail.d.ts +50 -0
- package/dist/api/components-detail.mjs +132 -0
- package/dist/api/components.d.ts +69 -0
- package/dist/api/components.mjs +144 -0
- package/dist/api/email-providers-default.d.ts +40 -0
- package/dist/api/email-providers-default.mjs +75 -0
- package/dist/api/email-providers-detail.d.ts +81 -0
- package/dist/api/email-providers-detail.mjs +109 -0
- package/dist/api/email-providers-test.d.ts +43 -0
- package/dist/api/email-providers-test.mjs +114 -0
- package/dist/api/email-providers.d.ts +69 -0
- package/dist/api/email-providers.mjs +110 -0
- package/dist/api/email-send-template.d.ts +41 -0
- package/dist/api/email-send-template.mjs +58 -0
- package/dist/api/email-send.d.ts +42 -0
- package/dist/api/email-send.mjs +58 -0
- package/dist/api/email-templates-detail.d.ts +74 -0
- package/dist/api/email-templates-detail.mjs +112 -0
- package/dist/api/email-templates-layout.d.ts +55 -0
- package/dist/api/email-templates-layout.mjs +92 -0
- package/dist/api/email-templates-preview.d.ts +48 -0
- package/dist/api/email-templates-preview.mjs +93 -0
- package/dist/api/email-templates.d.ts +61 -0
- package/dist/api/email-templates.mjs +118 -0
- package/dist/api/health.d.ts +68 -0
- package/dist/api/health.mjs +67 -0
- package/dist/api/index.d.ts +54 -0
- package/dist/api/index.mjs +16 -0
- package/dist/api/media-bulk.d.ts +74 -0
- package/dist/api/media-bulk.mjs +196 -0
- package/dist/api/media-folders.d.ts +112 -0
- package/dist/api/media-folders.mjs +187 -0
- package/dist/api/media-handlers.d.ts +102 -0
- package/dist/api/media-handlers.mjs +437 -0
- package/dist/api/media.d.ts +117 -0
- package/dist/api/media.mjs +242 -0
- package/dist/api/singles-detail.d.ts +87 -0
- package/dist/api/singles-detail.mjs +170 -0
- package/dist/api/singles-schema-detail.d.ts +54 -0
- package/dist/api/singles-schema-detail.mjs +182 -0
- package/dist/api/singles.d.ts +34 -0
- package/dist/api/singles.mjs +94 -0
- package/dist/api/storage-upload-url.d.ts +48 -0
- package/dist/api/storage-upload-url.mjs +202 -0
- package/dist/api/uploads.d.ts +109 -0
- package/dist/api/uploads.mjs +359 -0
- package/dist/auth/index.d.ts +425 -0
- package/dist/auth/index.mjs +199 -0
- package/dist/boot-apply-PQSYLDIN.mjs +7 -0
- package/dist/chunk-2OALJTK6.mjs +489 -0
- package/dist/chunk-2Q2SX2CS.mjs +365 -0
- package/dist/chunk-2TFX4ND3.mjs +13 -0
- package/dist/chunk-2TWPDSYD.mjs +87 -0
- package/dist/chunk-2W3DVD7S.mjs +647 -0
- package/dist/chunk-2ZFKXPQM.mjs +88 -0
- package/dist/chunk-3FA7FKAV.mjs +832 -0
- package/dist/chunk-3NZ2KMBL.mjs +58 -0
- package/dist/chunk-4MJLT6PZ.mjs +0 -0
- package/dist/chunk-56WO4WX7.mjs +0 -0
- package/dist/chunk-5APFUGAD.mjs +89 -0
- package/dist/chunk-5HMZ644B.mjs +108 -0
- package/dist/chunk-67GXH6PR.mjs +32 -0
- package/dist/chunk-6JNEPWRW.mjs +14368 -0
- package/dist/chunk-6NFHQIJD.mjs +45 -0
- package/dist/chunk-7P6ASYW6.mjs +9 -0
- package/dist/chunk-A3WPLSDT.mjs +1364 -0
- package/dist/chunk-AGJ6F2T3.mjs +144 -0
- package/dist/chunk-AK6Z23OX.mjs +1464 -0
- package/dist/chunk-APKKRD2G.mjs +102 -0
- package/dist/chunk-B2GV2BWH.mjs +73 -0
- package/dist/chunk-D5HQBNUB.mjs +74 -0
- package/dist/chunk-DNNG377Z.mjs +204 -0
- package/dist/chunk-DP3G27G5.mjs +135 -0
- package/dist/chunk-DV6WVX2Q.mjs +0 -0
- package/dist/chunk-DXGGXIUZ.mjs +57 -0
- package/dist/chunk-EGXBZCGC.mjs +943 -0
- package/dist/chunk-ERCNLX3V.mjs +176 -0
- package/dist/chunk-FQULBZ53.mjs +850 -0
- package/dist/chunk-G2AA4QLC.mjs +262 -0
- package/dist/chunk-GDBJ5JCU.mjs +488 -0
- package/dist/chunk-GJNSJU4S.mjs +19 -0
- package/dist/chunk-GZ6DCQKC.mjs +69 -0
- package/dist/chunk-H26B4FYG.mjs +167 -0
- package/dist/chunk-I4JMR3UR.mjs +21 -0
- package/dist/chunk-INV7QKLG.mjs +508 -0
- package/dist/chunk-IUDOC7N7.mjs +46 -0
- package/dist/chunk-IZWPRDC3.mjs +206 -0
- package/dist/chunk-KIMNCZGV.mjs +15 -0
- package/dist/chunk-L6HW2DA7.mjs +15 -0
- package/dist/chunk-LAZXX4HR.mjs +100 -0
- package/dist/chunk-LDKCUMHK.mjs +95 -0
- package/dist/chunk-LRXMECUA.mjs +0 -0
- package/dist/chunk-M52VMPGA.mjs +119 -0
- package/dist/chunk-MGUWEEI6.mjs +160 -0
- package/dist/chunk-NRUWQ5Z7.mjs +419 -0
- package/dist/chunk-NSEFNNU4.mjs +25360 -0
- package/dist/chunk-NTHVDFGO.mjs +138 -0
- package/dist/chunk-O3QHXMOX.mjs +3166 -0
- package/dist/chunk-P7NH2OSC.mjs +2605 -0
- package/dist/chunk-PKMABBB5.mjs +184 -0
- package/dist/chunk-PWS6XGJK.mjs +76 -0
- package/dist/chunk-R6JJQHFC.mjs +20 -0
- package/dist/chunk-RJLLGGPG.mjs +0 -0
- package/dist/chunk-SBACDPNX.mjs +689 -0
- package/dist/chunk-TO5AFLVQ.mjs +124 -0
- package/dist/chunk-TS7GHTG2.mjs +5436 -0
- package/dist/chunk-UJ2IMJ4W.mjs +133 -0
- package/dist/chunk-UOP63Q54.mjs +102 -0
- package/dist/chunk-UUOFWCM6.mjs +78 -0
- package/dist/chunk-V4EQTOA4.mjs +893 -0
- package/dist/chunk-VJ66NCL4.mjs +193 -0
- package/dist/chunk-VQJQHVEV.mjs +29 -0
- package/dist/chunk-VTJADRO3.mjs +141 -0
- package/dist/chunk-VWF3JO32.mjs +0 -0
- package/dist/chunk-W4MGXIRR.mjs +27 -0
- package/dist/chunk-W5KKPZT5.mjs +1204 -0
- package/dist/chunk-WD34YQ6T.mjs +381 -0
- package/dist/chunk-WZBYMYVW.mjs +14 -0
- package/dist/chunk-X23WKS3Z.mjs +50 -0
- package/dist/chunk-X7TXCYYN.mjs +6496 -0
- package/dist/chunk-XGI4EMS3.mjs +140 -0
- package/dist/chunk-XZKLBMN6.mjs +1153 -0
- package/dist/chunk-YB7INWPY.mjs +0 -0
- package/dist/chunk-YV4Y7SDL.mjs +83 -0
- package/dist/chunk-YZNBLFIW.mjs +1688 -0
- package/dist/chunk-YZZCTONM.mjs +263 -0
- package/dist/chunk-ZE6A3FYH.mjs +289 -0
- package/dist/cli/nextly.mjs +68 -0
- package/dist/cli/utils/index.d.ts +449 -0
- package/dist/cli/utils/index.mjs +49 -0
- package/dist/component-schema-service-5577KVW6.mjs +11 -0
- package/dist/config-loader-23YEMC3Z.mjs +23 -0
- package/dist/config.d.ts +44 -0
- package/dist/config.mjs +109 -0
- package/dist/container-ORGFGYSZ.mjs +9 -0
- package/dist/database/index.d.ts +12 -0
- package/dist/database/index.mjs +40 -0
- package/dist/database/seeders/index.d.ts +93 -0
- package/dist/database/seeders/index.mjs +47 -0
- package/dist/db-sync-demote-LJGKLB3S.mjs +117 -0
- package/dist/db-sync-promote-B26VSYQF.mjs +113 -0
- package/dist/dev-reload-broadcaster-B73IQ53V.mjs +25 -0
- package/dist/dist-M2NOU37V.mjs +19 -0
- package/dist/drizzle-kit-lazy-D2M2PXR2.mjs +13 -0
- package/dist/dynamic-collection-schema-service-IEXTPIZ7.mjs +8 -0
- package/dist/errors/index.d.ts +159 -0
- package/dist/errors/index.mjs +10 -0
- package/dist/factory-IWMBKUJM.mjs +15 -0
- package/dist/first-run-QIVKWJIF.mjs +63 -0
- package/dist/fresh-push-NR67DC3R.mjs +8 -0
- package/dist/index.d.ts +4175 -0
- package/dist/index.mjs +1336 -0
- package/dist/local-plugin-PTET4NAT.mjs +7 -0
- package/dist/logger-NU46DXNY.mjs +15 -0
- package/dist/logger-YE4TC7ZN.mjs +9 -0
- package/dist/migration-journal-EP532Y4L.mjs +139 -0
- package/dist/migrations/mysql/0000_eager_sentry.sql +174 -0
- package/dist/migrations/mysql/0001_soft_giant_girl.sql +27 -0
- package/dist/migrations/mysql/0002_media_table.sql +24 -0
- package/dist/migrations/mysql/0003_dynamic_singles.sql +37 -0
- package/dist/migrations/mysql/0004_dynamic_components.sql +35 -0
- package/dist/migrations/mysql/0005_user_management_tables.sql +92 -0
- package/dist/migrations/mysql/0006_api_keys.sql +36 -0
- package/dist/migrations/mysql/0007_general_settings.sql +20 -0
- package/dist/migrations/mysql/0008_site_settings_logo_url.sql +9 -0
- package/dist/migrations/mysql/0009_activity_log.sql +30 -0
- package/dist/migrations/mysql/0010_site_settings_sidebar.sql +13 -0
- package/dist/migrations/mysql/0011_missing_tables_and_columns.sql +54 -0
- package/dist/migrations/mysql/0012_image_sizes_and_focal_point.sql +30 -0
- package/dist/migrations/mysql/0012_media_folders.sql +43 -0
- package/dist/migrations/mysql/0013_user_brute_force_protection.sql +31 -0
- package/dist/migrations/mysql/0014_email_template_attachments.sql +12 -0
- package/dist/migrations/mysql/0015_media_uploaded_by_nullable.sql +15 -0
- package/dist/migrations/mysql/20260429_000000_000_initial_journal.sql +22 -0
- package/dist/migrations/mysql/20260501_000000_journal_batch.sql +17 -0
- package/dist/migrations/mysql/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/mysql/20260504_000000_nextly_meta.sql +21 -0
- package/dist/migrations/mysql/meta/0000_snapshot.json +1005 -0
- package/dist/migrations/mysql/meta/0001_snapshot.json +1099 -0
- package/dist/migrations/mysql/meta/_journal.json +41 -0
- package/dist/migrations/postgresql/0000_misty_king_bedlam.sql +169 -0
- package/dist/migrations/postgresql/0001_perpetual_captain_marvel.sql +8 -0
- package/dist/migrations/postgresql/0002_sad_spectrum.sql +16 -0
- package/dist/migrations/postgresql/0003_hesitant_ultron.sql +17 -0
- package/dist/migrations/postgresql/0004_media_table.sql +24 -0
- package/dist/migrations/postgresql/0005_media_folders.sql +36 -0
- package/dist/migrations/postgresql/0006_dynamic_collections_update.sql +50 -0
- package/dist/migrations/postgresql/0007_dynamic_singles.sql +38 -0
- package/dist/migrations/postgresql/0008_dynamic_components.sql +37 -0
- package/dist/migrations/postgresql/0009_user_management_tables.sql +95 -0
- package/dist/migrations/postgresql/0010_api_keys.sql +34 -0
- package/dist/migrations/postgresql/0011_general_settings.sql +20 -0
- package/dist/migrations/postgresql/0012_site_settings_logo_url.sql +9 -0
- package/dist/migrations/postgresql/0013_activity_log.sql +29 -0
- package/dist/migrations/postgresql/0014_image_sizes_and_focal_point.sql +33 -0
- package/dist/migrations/postgresql/0014_site_settings_sidebar.sql +13 -0
- package/dist/migrations/postgresql/0015_user_brute_force_protection.sql +29 -0
- package/dist/migrations/postgresql/0016_email_template_attachments.sql +12 -0
- package/dist/migrations/postgresql/0017_media_uploaded_by_nullable.sql +15 -0
- package/dist/migrations/postgresql/20260429_000000_000_initial_journal.sql +24 -0
- package/dist/migrations/postgresql/20260501_000000_journal_batch.sql +17 -0
- package/dist/migrations/postgresql/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/postgresql/20260504_000000_nextly_meta.sql +22 -0
- package/dist/migrations/postgresql/meta/0000_snapshot.json +1286 -0
- package/dist/migrations/postgresql/meta/0001_snapshot.json +1407 -0
- package/dist/migrations/postgresql/meta/0002_snapshot.json +1552 -0
- package/dist/migrations/postgresql/meta/0003_snapshot.json +1695 -0
- package/dist/migrations/postgresql/meta/0010_snapshot.json +2345 -0
- package/dist/migrations/postgresql/meta/_journal.json +90 -0
- package/dist/migrations/sqlite/0000_api_keys.sql +34 -0
- package/dist/migrations/sqlite/0001_general_settings.sql +20 -0
- package/dist/migrations/sqlite/0002_site_settings_logo_url.sql +9 -0
- package/dist/migrations/sqlite/0003_activity_log.sql +29 -0
- package/dist/migrations/sqlite/0004_image_sizes_and_focal_point.sql +29 -0
- package/dist/migrations/sqlite/0004_site_settings_sidebar.sql +11 -0
- package/dist/migrations/sqlite/0005_user_brute_force_protection.sql +29 -0
- package/dist/migrations/sqlite/0006_email_template_attachments.sql +12 -0
- package/dist/migrations/sqlite/0007_media_uploaded_by_nullable.sql +111 -0
- package/dist/migrations/sqlite/20260429_000000_000_initial_journal.sql +24 -0
- package/dist/migrations/sqlite/20260501_000000_journal_batch.sql +19 -0
- package/dist/migrations/sqlite/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/sqlite/20260504_000000_nextly_meta.sql +21 -0
- package/dist/migrations/sqlite/20260505_000000_user_management_tables.sql +77 -0
- package/dist/next.d.ts +57 -0
- package/dist/next.mjs +55 -0
- package/dist/observability/index.d.ts +87 -0
- package/dist/observability/index.mjs +57 -0
- package/dist/permissions-3DZZQZMI.mjs +39 -0
- package/dist/pipeline-YOML7SWF.mjs +29 -0
- package/dist/preview-ZZTR3QGS.mjs +9 -0
- package/dist/program-PW6UB2ZC.mjs +5934 -0
- package/dist/reconcile-single-tables-7ENVXJGB.mjs +7 -0
- package/dist/register-SF6E6FVU.mjs +49 -0
- package/dist/reload-config-HWQ4G5MM.mjs +23 -0
- package/dist/resolve-single-table-name-JSOMUB3R.mjs +7 -0
- package/dist/routeHandler-UNMMJIBM.mjs +77 -0
- package/dist/runtime-schema-generator-NRA6A6Z6.mjs +8 -0
- package/dist/runtime.d.ts +120 -0
- package/dist/runtime.mjs +73 -0
- package/dist/schema-hash-FMMG6VPJ.mjs +13 -0
- package/dist/schema-registry-EQ36FZDP.mjs +7 -0
- package/dist/scripts/load-env.mjs +42 -0
- package/dist/storage/index.d.ts +566 -0
- package/dist/storage/index.mjs +45 -0
- package/dist/super-admin-G5ZK5F4T.mjs +39 -0
- package/dist/system-table-service-WGSRVEGT.mjs +17 -0
- package/dist/users-7KELGRYJ.mjs +38 -0
- package/package.json +308 -9
|
@@ -0,0 +1,1149 @@
|
|
|
1
|
+
import { P as FieldConfig, ay as RepeaterFieldConfig, X as GroupFieldConfig, c as CheckboxFieldConfig, f as ChipsFieldConfig, j as CodeFieldConfig, u as ComponentFieldConfig, x as DataFieldConfig, E as DateFieldConfig, J as EmailFieldConfig, a3 as JSONFieldConfig, ac as NumberFieldConfig, ag as PasswordFieldConfig, aj as RadioFieldConfig, ao as RelationshipFieldConfig, a$ as UploadFieldConfig, aG as RichTextFieldConfig, aL as SelectFieldConfig, aV as TextFieldConfig, aY as TextareaFieldConfig, aN as SelectOption, aQ as SingleConfig, t as ComponentConfig } from './collections-handler.d-DjgO74Wt.d.ts';
|
|
2
|
+
import { N as NextlyConfig, S as SanitizedNextlyConfig } from './config.d-DNwsDnjs.d.ts';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Field Type Guards
|
|
6
|
+
*
|
|
7
|
+
* Runtime type guard functions for narrowing FieldConfig union types.
|
|
8
|
+
* Uses discriminated union pattern based on the `type` property.
|
|
9
|
+
*
|
|
10
|
+
* @module collections/fields/guards
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Type guard for text field config.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* if (isTextField(field)) {
|
|
20
|
+
* console.log(field.hasMany, field.minLength, field.maxLength);
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare const isTextField: (field: FieldConfig) => field is TextFieldConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Type guard for textarea field config.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* if (isTextareaField(field)) {
|
|
31
|
+
* console.log(field.rows);
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare const isTextareaField: (field: FieldConfig) => field is TextareaFieldConfig;
|
|
36
|
+
/**
|
|
37
|
+
* Type guard for rich text field config.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* if (isRichTextField(field)) {
|
|
42
|
+
* console.log(field.features);
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare const isRichTextField: (field: FieldConfig) => field is RichTextFieldConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Type guard for email field config.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* if (isEmailField(field)) {
|
|
53
|
+
* // Email field has auto-validation
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare const isEmailField: (field: FieldConfig) => field is EmailFieldConfig;
|
|
58
|
+
/**
|
|
59
|
+
* Type guard for password field config.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* if (isPasswordField(field)) {
|
|
64
|
+
* console.log(field.minLength, field.maxLength);
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
declare const isPasswordField: (field: FieldConfig) => field is PasswordFieldConfig;
|
|
69
|
+
/**
|
|
70
|
+
* Type guard for code field config.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* if (isCodeField(field)) {
|
|
75
|
+
* console.log(field.language, field.editorOptions);
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
declare const isCodeField: (field: FieldConfig) => field is CodeFieldConfig;
|
|
80
|
+
/**
|
|
81
|
+
* Type guard for number field config.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* if (isNumberField(field)) {
|
|
86
|
+
* console.log(field.min, field.max, field.step);
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare const isNumberField: (field: FieldConfig) => field is NumberFieldConfig;
|
|
91
|
+
/**
|
|
92
|
+
* Type guard for checkbox field config.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* if (isCheckboxField(field)) {
|
|
97
|
+
* console.log(field.defaultValue); // boolean
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare const isCheckboxField: (field: FieldConfig) => field is CheckboxFieldConfig;
|
|
102
|
+
/**
|
|
103
|
+
* Type guard for date field config.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* if (isDateField(field)) {
|
|
108
|
+
* console.log(field.admin?.date?.pickerAppearance);
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
declare const isDateField: (field: FieldConfig) => field is DateFieldConfig;
|
|
113
|
+
/**
|
|
114
|
+
* Type guard for select field config.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* if (isSelectField(field)) {
|
|
119
|
+
* console.log(field.options, field.hasMany);
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
declare const isSelectField: (field: FieldConfig) => field is SelectFieldConfig;
|
|
124
|
+
/**
|
|
125
|
+
* Type guard for radio field config.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* if (isRadioField(field)) {
|
|
130
|
+
* console.log(field.options, field.admin?.layout);
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
declare const isRadioField: (field: FieldConfig) => field is RadioFieldConfig;
|
|
135
|
+
/**
|
|
136
|
+
* Type guard for upload field config.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* if (isUploadField(field)) {
|
|
141
|
+
* console.log(field.relationTo, field.hasMany);
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
declare const isUploadField: (field: FieldConfig) => field is UploadFieldConfig;
|
|
146
|
+
/**
|
|
147
|
+
* Type guard for relationship field config.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* if (isRelationshipField(field)) {
|
|
152
|
+
* console.log(field.relationTo, field.hasMany, field.maxDepth);
|
|
153
|
+
* }
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
declare const isRelationshipField: (field: FieldConfig) => field is RelationshipFieldConfig;
|
|
157
|
+
/**
|
|
158
|
+
* Type guard for repeater field config.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* if (isRepeaterField(field)) {
|
|
163
|
+
* console.log(field.fields, field.minRows, field.maxRows);
|
|
164
|
+
* }
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
declare function isRepeaterField(field: FieldConfig): field is RepeaterFieldConfig;
|
|
168
|
+
/**
|
|
169
|
+
* Type guard for group field config.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* if (isGroupField(field)) {
|
|
174
|
+
* console.log(field.fields, field.admin?.hideGutter);
|
|
175
|
+
* }
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
declare const isGroupField: (field: FieldConfig) => field is GroupFieldConfig;
|
|
179
|
+
/**
|
|
180
|
+
* Type guard for JSON field config.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* if (isJSONField(field)) {
|
|
185
|
+
* console.log(field.jsonSchema, field.editorOptions);
|
|
186
|
+
* }
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
declare const isJSONField: (field: FieldConfig) => field is JSONFieldConfig;
|
|
190
|
+
/**
|
|
191
|
+
* Type guard for component field config.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```typescript
|
|
195
|
+
* if (isComponentField(field)) {
|
|
196
|
+
* console.log(field.component, field.components, field.repeatable);
|
|
197
|
+
* }
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
declare const isComponentField: (field: FieldConfig) => field is ComponentFieldConfig;
|
|
201
|
+
/**
|
|
202
|
+
* Type guard for chips field config.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* if (isChipsField(field)) {
|
|
207
|
+
* console.log(field.maxChips, field.minChips);
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
declare const isChipsField: (field: FieldConfig) => field is ChipsFieldConfig;
|
|
212
|
+
/**
|
|
213
|
+
* Type guard for data-storing fields.
|
|
214
|
+
*
|
|
215
|
+
* Returns true if the field stores data in the database.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* if (isDataField(field)) {
|
|
220
|
+
* // Generate database column for this field
|
|
221
|
+
* generateColumn(field);
|
|
222
|
+
* }
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
declare function isDataField(field: FieldConfig): field is DataFieldConfig;
|
|
226
|
+
/**
|
|
227
|
+
* Type guard for fields that contain nested fields.
|
|
228
|
+
*
|
|
229
|
+
* Returns true for array and group fields.
|
|
230
|
+
* These field types have a `fields` property containing
|
|
231
|
+
* nested field configurations.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* if (hasNestedFields(field)) {
|
|
236
|
+
* // Recursively process nested fields
|
|
237
|
+
* const nestedFields = 'fields' in field ? field.fields : [];
|
|
238
|
+
* nestedFields.forEach(processField);
|
|
239
|
+
* }
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
declare function hasNestedFields(field: FieldConfig): field is RepeaterFieldConfig | GroupFieldConfig;
|
|
243
|
+
/**
|
|
244
|
+
* Type guard for relational fields.
|
|
245
|
+
*
|
|
246
|
+
* Returns true for relationship and upload fields.
|
|
247
|
+
* These field types reference other collections via `relationTo`.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```typescript
|
|
251
|
+
* if (isRelationalField(field)) {
|
|
252
|
+
* console.log(field.relationTo, field.hasMany, field.maxDepth);
|
|
253
|
+
* }
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare function isRelationalField(field: FieldConfig): field is RelationshipFieldConfig | UploadFieldConfig;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Field Builder Helpers
|
|
260
|
+
*
|
|
261
|
+
* Convenient factory functions for creating field configurations.
|
|
262
|
+
* These helpers eliminate the need to manually specify the `type` property,
|
|
263
|
+
* providing a cleaner, more ergonomic API for code-first collection definitions.
|
|
264
|
+
*
|
|
265
|
+
* @module collections/fields/helpers
|
|
266
|
+
* @since 1.0.0
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```typescript
|
|
270
|
+
* import { text, select, relationship, option } from '@nextly/collections/fields';
|
|
271
|
+
*
|
|
272
|
+
* const fields = [
|
|
273
|
+
* text({ name: 'title', required: true }),
|
|
274
|
+
* select({
|
|
275
|
+
* name: 'status',
|
|
276
|
+
* options: [
|
|
277
|
+
* option('Draft'),
|
|
278
|
+
* option('Published'),
|
|
279
|
+
* option('Archived'),
|
|
280
|
+
* ],
|
|
281
|
+
* }),
|
|
282
|
+
* relationship({ name: 'author', relationTo: 'users' }),
|
|
283
|
+
* ];
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Creates a text field configuration.
|
|
289
|
+
*
|
|
290
|
+
* Text fields store simple string values with optional constraints
|
|
291
|
+
* like min/max length. Supports `hasMany` for storing arrays of strings.
|
|
292
|
+
*
|
|
293
|
+
* @param config - Field configuration without the `type` property
|
|
294
|
+
* @returns Complete text field configuration
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```typescript
|
|
298
|
+
* // Basic text field
|
|
299
|
+
* text({ name: 'title', required: true })
|
|
300
|
+
*
|
|
301
|
+
* // Text with constraints
|
|
302
|
+
* text({ name: 'slug', minLength: 3, maxLength: 100, unique: true })
|
|
303
|
+
*
|
|
304
|
+
* // Multiple values (tags)
|
|
305
|
+
* text({ name: 'tags', hasMany: true, minRows: 1, maxRows: 10 })
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
declare const text: (config: Omit<TextFieldConfig, "type">) => TextFieldConfig;
|
|
309
|
+
/**
|
|
310
|
+
* Creates a textarea field configuration.
|
|
311
|
+
*
|
|
312
|
+
* Textarea fields store longer text content with a multi-line input.
|
|
313
|
+
* Supports configurable row height and resize behavior.
|
|
314
|
+
*
|
|
315
|
+
* @param config - Field configuration without the `type` property
|
|
316
|
+
* @returns Complete textarea field configuration
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* ```typescript
|
|
320
|
+
* // Basic textarea
|
|
321
|
+
* textarea({ name: 'description' })
|
|
322
|
+
*
|
|
323
|
+
* // Fixed height textarea
|
|
324
|
+
* textarea({ name: 'bio', admin: { rows: 5, resize: 'none' } })
|
|
325
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
declare const textarea: (config: Omit<TextareaFieldConfig, "type">) => TextareaFieldConfig;
|
|
328
|
+
/**
|
|
329
|
+
* Creates a rich text field configuration.
|
|
330
|
+
*
|
|
331
|
+
* Rich text fields provide a Lexical-based WYSIWYG editor with
|
|
332
|
+
* configurable formatting features (bold, italic, lists, etc.).
|
|
333
|
+
*
|
|
334
|
+
* @param config - Field configuration without the `type` property
|
|
335
|
+
* @returns Complete rich text field configuration
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```typescript
|
|
339
|
+
* // Basic rich text
|
|
340
|
+
* richText({ name: 'content' })
|
|
341
|
+
*
|
|
342
|
+
* // Rich text with specific features
|
|
343
|
+
* richText({
|
|
344
|
+
* name: 'body',
|
|
345
|
+
* features: ['bold', 'italic', 'link', 'orderedList', 'unorderedList'],
|
|
346
|
+
* })
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
declare const richText: (config: Omit<RichTextFieldConfig, "type">) => RichTextFieldConfig;
|
|
350
|
+
/**
|
|
351
|
+
* Creates an email field configuration.
|
|
352
|
+
*
|
|
353
|
+
* Email fields store email addresses with built-in format validation.
|
|
354
|
+
*
|
|
355
|
+
* @param config - Field configuration without the `type` property
|
|
356
|
+
* @returns Complete email field configuration
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```typescript
|
|
360
|
+
* // Basic email field
|
|
361
|
+
* email({ name: 'email', required: true, unique: true })
|
|
362
|
+
*
|
|
363
|
+
* // Optional contact email
|
|
364
|
+
* email({ name: 'contactEmail', label: 'Contact Email' })
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
declare const email: (config: Omit<EmailFieldConfig, "type">) => EmailFieldConfig;
|
|
368
|
+
/**
|
|
369
|
+
* Creates a password field configuration.
|
|
370
|
+
*
|
|
371
|
+
* Password fields store hashed passwords with masked input.
|
|
372
|
+
* Includes optional strength indicator and auto-generation.
|
|
373
|
+
*
|
|
374
|
+
* @param config - Field configuration without the `type` property
|
|
375
|
+
* @returns Complete password field configuration
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* ```typescript
|
|
379
|
+
* // Basic password field
|
|
380
|
+
* password({ name: 'password', required: true })
|
|
381
|
+
*
|
|
382
|
+
* // Password with strength indicator
|
|
383
|
+
* password({
|
|
384
|
+
* name: 'password',
|
|
385
|
+
* minLength: 8,
|
|
386
|
+
* admin: { showStrengthIndicator: true },
|
|
387
|
+
* })
|
|
388
|
+
* ```
|
|
389
|
+
*/
|
|
390
|
+
declare const password: (config: Omit<PasswordFieldConfig, "type">) => PasswordFieldConfig;
|
|
391
|
+
/**
|
|
392
|
+
* Creates a code field configuration.
|
|
393
|
+
*
|
|
394
|
+
* Code fields provide a code editor with syntax highlighting
|
|
395
|
+
* for various programming languages.
|
|
396
|
+
*
|
|
397
|
+
* @param config - Field configuration without the `type` property
|
|
398
|
+
* @returns Complete code field configuration
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* ```typescript
|
|
402
|
+
* // JavaScript code field
|
|
403
|
+
* code({ name: 'snippet', language: 'javascript' })
|
|
404
|
+
*
|
|
405
|
+
* // JSON configuration field
|
|
406
|
+
* code({
|
|
407
|
+
* name: 'config',
|
|
408
|
+
* language: 'json',
|
|
409
|
+
* admin: { editorOptions: { lineNumbers: true } },
|
|
410
|
+
* })
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
declare const code: (config: Omit<CodeFieldConfig, "type">) => CodeFieldConfig;
|
|
414
|
+
/**
|
|
415
|
+
* Creates a number field configuration.
|
|
416
|
+
*
|
|
417
|
+
* Number fields store numeric values (integers or decimals)
|
|
418
|
+
* with optional min/max constraints and step values.
|
|
419
|
+
*
|
|
420
|
+
* @param config - Field configuration without the `type` property
|
|
421
|
+
* @returns Complete number field configuration
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* ```typescript
|
|
425
|
+
* // Basic number field
|
|
426
|
+
* number({ name: 'price', required: true })
|
|
427
|
+
*
|
|
428
|
+
* // Integer with range
|
|
429
|
+
* number({ name: 'quantity', min: 0, max: 100, step: 1 })
|
|
430
|
+
*
|
|
431
|
+
* // Decimal price
|
|
432
|
+
* number({ name: 'amount', min: 0, step: 0.01 })
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
declare const number: (config: Omit<NumberFieldConfig, "type">) => NumberFieldConfig;
|
|
436
|
+
/**
|
|
437
|
+
* Creates a checkbox field configuration.
|
|
438
|
+
*
|
|
439
|
+
* Checkbox fields store boolean true/false values.
|
|
440
|
+
*
|
|
441
|
+
* @param config - Field configuration without the `type` property
|
|
442
|
+
* @returns Complete checkbox field configuration
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```typescript
|
|
446
|
+
* // Basic checkbox
|
|
447
|
+
* checkbox({ name: 'isActive', defaultValue: true })
|
|
448
|
+
*
|
|
449
|
+
* // Feature flag
|
|
450
|
+
* checkbox({ name: 'featured', label: 'Featured Post' })
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
declare const checkbox: (config: Omit<CheckboxFieldConfig, "type">) => CheckboxFieldConfig;
|
|
454
|
+
/**
|
|
455
|
+
* Creates a date field configuration.
|
|
456
|
+
*
|
|
457
|
+
* Date fields store date and/or time values with a date picker UI.
|
|
458
|
+
* Supports various display formats and picker appearances.
|
|
459
|
+
*
|
|
460
|
+
* @param config - Field configuration without the `type` property
|
|
461
|
+
* @returns Complete date field configuration
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* ```typescript
|
|
465
|
+
* // Date only
|
|
466
|
+
* date({ name: 'publishedAt' })
|
|
467
|
+
*
|
|
468
|
+
* // Date and time
|
|
469
|
+
* date({
|
|
470
|
+
* name: 'eventTime',
|
|
471
|
+
* admin: { date: { pickerAppearance: 'dayAndTime' } },
|
|
472
|
+
* })
|
|
473
|
+
*
|
|
474
|
+
* // Time only
|
|
475
|
+
* date({
|
|
476
|
+
* name: 'openingTime',
|
|
477
|
+
* admin: { date: { pickerAppearance: 'timeOnly' } },
|
|
478
|
+
* })
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
declare const date: (config: Omit<DateFieldConfig, "type">) => DateFieldConfig;
|
|
482
|
+
/**
|
|
483
|
+
* Creates a select field configuration.
|
|
484
|
+
*
|
|
485
|
+
* Select fields provide a dropdown for choosing from predefined options.
|
|
486
|
+
* Supports single or multiple selections with searchable dropdown.
|
|
487
|
+
*
|
|
488
|
+
* @param config - Field configuration without the `type` property
|
|
489
|
+
* @returns Complete select field configuration
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```typescript
|
|
493
|
+
* // Basic select
|
|
494
|
+
* select({
|
|
495
|
+
* name: 'status',
|
|
496
|
+
* options: [
|
|
497
|
+
* { label: 'Draft', value: 'draft' },
|
|
498
|
+
* { label: 'Published', value: 'published' },
|
|
499
|
+
* ],
|
|
500
|
+
* })
|
|
501
|
+
*
|
|
502
|
+
* // Using option helper
|
|
503
|
+
* select({
|
|
504
|
+
* name: 'status',
|
|
505
|
+
* options: [option('Draft'), option('Published'), option('Archived')],
|
|
506
|
+
* })
|
|
507
|
+
*
|
|
508
|
+
* // Multi-select
|
|
509
|
+
* select({
|
|
510
|
+
* name: 'categories',
|
|
511
|
+
* hasMany: true,
|
|
512
|
+
* options: [option('Tech'), option('Business'), option('Design')],
|
|
513
|
+
* })
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
declare const select: (config: Omit<SelectFieldConfig, "type">) => SelectFieldConfig;
|
|
517
|
+
/**
|
|
518
|
+
* Creates a radio field configuration.
|
|
519
|
+
*
|
|
520
|
+
* Radio fields display options as radio buttons for single selection.
|
|
521
|
+
* Better for small option sets where all choices should be visible.
|
|
522
|
+
*
|
|
523
|
+
* @param config - Field configuration without the `type` property
|
|
524
|
+
* @returns Complete radio field configuration
|
|
525
|
+
*
|
|
526
|
+
* @example
|
|
527
|
+
* ```typescript
|
|
528
|
+
* // Basic radio field
|
|
529
|
+
* radio({
|
|
530
|
+
* name: 'priority',
|
|
531
|
+
* options: [option('Low'), option('Medium'), option('High')],
|
|
532
|
+
* })
|
|
533
|
+
*
|
|
534
|
+
* // Horizontal layout
|
|
535
|
+
* radio({
|
|
536
|
+
* name: 'size',
|
|
537
|
+
* options: [option('S'), option('M'), option('L'), option('XL')],
|
|
538
|
+
* admin: { layout: 'horizontal' },
|
|
539
|
+
* })
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
declare const radio: (config: Omit<RadioFieldConfig, "type">) => RadioFieldConfig;
|
|
543
|
+
/**
|
|
544
|
+
* Creates an upload field configuration.
|
|
545
|
+
*
|
|
546
|
+
* Upload fields reference files from upload-enabled collections.
|
|
547
|
+
* Supports single or multiple files with polymorphic references.
|
|
548
|
+
*
|
|
549
|
+
* @param config - Field configuration without the `type` property
|
|
550
|
+
* @returns Complete upload field configuration
|
|
551
|
+
*
|
|
552
|
+
* @example
|
|
553
|
+
* ```typescript
|
|
554
|
+
* // Single image
|
|
555
|
+
* upload({ name: 'featuredImage', relationTo: 'media' })
|
|
556
|
+
*
|
|
557
|
+
* // Multiple images (gallery)
|
|
558
|
+
* upload({
|
|
559
|
+
* name: 'gallery',
|
|
560
|
+
* relationTo: 'media',
|
|
561
|
+
* hasMany: true,
|
|
562
|
+
* maxRows: 10,
|
|
563
|
+
* })
|
|
564
|
+
*
|
|
565
|
+
* // Polymorphic uploads (multiple collections)
|
|
566
|
+
* upload({
|
|
567
|
+
* name: 'attachment',
|
|
568
|
+
* relationTo: ['media', 'documents'],
|
|
569
|
+
* })
|
|
570
|
+
* ```
|
|
571
|
+
*/
|
|
572
|
+
declare const upload: (config: Omit<UploadFieldConfig, "type">) => UploadFieldConfig;
|
|
573
|
+
/**
|
|
574
|
+
* Creates a relationship field configuration.
|
|
575
|
+
*
|
|
576
|
+
* Relationship fields reference documents from other collections.
|
|
577
|
+
* Supports single or multiple references with polymorphic relations.
|
|
578
|
+
*
|
|
579
|
+
* @param config - Field configuration without the `type` property
|
|
580
|
+
* @returns Complete relationship field configuration
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* ```typescript
|
|
584
|
+
* // Single relationship
|
|
585
|
+
* relationship({ name: 'author', relationTo: 'users' })
|
|
586
|
+
*
|
|
587
|
+
* // Multiple relationships
|
|
588
|
+
* relationship({
|
|
589
|
+
* name: 'relatedPosts',
|
|
590
|
+
* relationTo: 'posts',
|
|
591
|
+
* hasMany: true,
|
|
592
|
+
* maxRows: 5,
|
|
593
|
+
* })
|
|
594
|
+
*
|
|
595
|
+
* // Polymorphic relationship
|
|
596
|
+
* relationship({
|
|
597
|
+
* name: 'reference',
|
|
598
|
+
* relationTo: ['posts', 'pages', 'products'],
|
|
599
|
+
* })
|
|
600
|
+
* ```
|
|
601
|
+
*/
|
|
602
|
+
declare const relationship: (config: Omit<RelationshipFieldConfig, "type">) => RelationshipFieldConfig;
|
|
603
|
+
/**
|
|
604
|
+
* Creates an array field configuration.
|
|
605
|
+
*
|
|
606
|
+
* Array fields store repeatable sets of fields. Each row in the
|
|
607
|
+
* array has the same structure defined by the `fields` property.
|
|
608
|
+
*
|
|
609
|
+
* @param config - Field configuration without the `type` property
|
|
610
|
+
* @returns Complete array field configuration
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* ```typescript
|
|
614
|
+
* // Simple array of links
|
|
615
|
+
* array({
|
|
616
|
+
* name: 'links',
|
|
617
|
+
* fields: [
|
|
618
|
+
* text({ name: 'label', required: true }),
|
|
619
|
+
* text({ name: 'url', required: true }),
|
|
620
|
+
* ],
|
|
621
|
+
* })
|
|
622
|
+
*
|
|
623
|
+
* // Array with constraints
|
|
624
|
+
* array({
|
|
625
|
+
* name: 'features',
|
|
626
|
+
* minRows: 1,
|
|
627
|
+
* maxRows: 10,
|
|
628
|
+
* fields: [
|
|
629
|
+
* text({ name: 'title', required: true }),
|
|
630
|
+
* textarea({ name: 'description' }),
|
|
631
|
+
* upload({ name: 'icon', relationTo: 'media' }),
|
|
632
|
+
* ],
|
|
633
|
+
* })
|
|
634
|
+
* ```
|
|
635
|
+
*/
|
|
636
|
+
declare const array: (config: Omit<RepeaterFieldConfig, "type">) => RepeaterFieldConfig;
|
|
637
|
+
/**
|
|
638
|
+
* Creates a repeater field configuration.
|
|
639
|
+
*
|
|
640
|
+
* Repeater fields are functionally identical to array fields. Each row in a
|
|
641
|
+
* repeater has the same structure defined by the `fields` property.
|
|
642
|
+
*
|
|
643
|
+
* @param config - Field configuration without the `type` property
|
|
644
|
+
* @returns Complete repeater field configuration
|
|
645
|
+
*
|
|
646
|
+
* @example
|
|
647
|
+
* ```typescript
|
|
648
|
+
* repeater({
|
|
649
|
+
* name: 'features',
|
|
650
|
+
* fields: [
|
|
651
|
+
* text({ name: 'title', required: true }),
|
|
652
|
+
* textarea({ name: 'description' }),
|
|
653
|
+
* ],
|
|
654
|
+
* })
|
|
655
|
+
* ```
|
|
656
|
+
*/
|
|
657
|
+
declare const repeater: (config: Omit<RepeaterFieldConfig, "type">) => RepeaterFieldConfig;
|
|
658
|
+
/**
|
|
659
|
+
* Creates a group field configuration.
|
|
660
|
+
*
|
|
661
|
+
* Group fields organize related fields together. Named groups create
|
|
662
|
+
* nested data structures, while presentational groups just organize UI.
|
|
663
|
+
*
|
|
664
|
+
* @param config - Field configuration without the `type` property
|
|
665
|
+
* @returns Complete group field configuration
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* ```typescript
|
|
669
|
+
* // Named group (creates nested data)
|
|
670
|
+
* group({
|
|
671
|
+
* name: 'seo',
|
|
672
|
+
* fields: [
|
|
673
|
+
* text({ name: 'metaTitle' }),
|
|
674
|
+
* textarea({ name: 'metaDescription' }),
|
|
675
|
+
* ],
|
|
676
|
+
* })
|
|
677
|
+
* // Data: { seo: { metaTitle: '...', metaDescription: '...' } }
|
|
678
|
+
*
|
|
679
|
+
* // Presentational group (no data nesting)
|
|
680
|
+
* group({
|
|
681
|
+
* name: 'contactInfo',
|
|
682
|
+
* admin: { hideGutter: true },
|
|
683
|
+
* fields: [
|
|
684
|
+
* email({ name: 'email' }),
|
|
685
|
+
* text({ name: 'phone' }),
|
|
686
|
+
* ],
|
|
687
|
+
* })
|
|
688
|
+
* ```
|
|
689
|
+
*/
|
|
690
|
+
declare const group: (config: Omit<GroupFieldConfig, "type">) => GroupFieldConfig;
|
|
691
|
+
/**
|
|
692
|
+
* Creates a JSON field configuration.
|
|
693
|
+
*
|
|
694
|
+
* JSON fields store arbitrary JSON data with optional schema validation.
|
|
695
|
+
* Provides a Monaco-based JSON editor in the Admin UI.
|
|
696
|
+
*
|
|
697
|
+
* @param config - Field configuration without the `type` property
|
|
698
|
+
* @returns Complete JSON field configuration
|
|
699
|
+
*
|
|
700
|
+
* @example
|
|
701
|
+
* ```typescript
|
|
702
|
+
* // Basic JSON field
|
|
703
|
+
* json({ name: 'metadata' })
|
|
704
|
+
*
|
|
705
|
+
* // JSON with schema validation
|
|
706
|
+
* json({
|
|
707
|
+
* name: 'config',
|
|
708
|
+
* jsonSchema: {
|
|
709
|
+
* type: 'object',
|
|
710
|
+
* properties: {
|
|
711
|
+
* theme: { type: 'string', enum: ['light', 'dark'] },
|
|
712
|
+
* maxItems: { type: 'number', minimum: 1 },
|
|
713
|
+
* },
|
|
714
|
+
* required: ['theme'],
|
|
715
|
+
* },
|
|
716
|
+
* })
|
|
717
|
+
* ```
|
|
718
|
+
*/
|
|
719
|
+
declare const json: (config: Omit<JSONFieldConfig, "type">) => JSONFieldConfig;
|
|
720
|
+
/**
|
|
721
|
+
* Creates a component field configuration.
|
|
722
|
+
*
|
|
723
|
+
* Component fields embed reusable Components within Collections, Singles,
|
|
724
|
+
* or other Components. Supports single component, multi-component (dynamic
|
|
725
|
+
* zone), and repeatable modes.
|
|
726
|
+
*
|
|
727
|
+
* @param config - Field configuration without the `type` property
|
|
728
|
+
* @returns Complete component field configuration
|
|
729
|
+
*
|
|
730
|
+
* @example
|
|
731
|
+
* ```typescript
|
|
732
|
+
* // Single component (one specific type)
|
|
733
|
+
* component({ name: 'seo', component: 'seo' })
|
|
734
|
+
*
|
|
735
|
+
* // Multi-component / dynamic zone (editor picks type)
|
|
736
|
+
* component({
|
|
737
|
+
* name: 'layout',
|
|
738
|
+
* components: ['hero', 'cta', 'content'],
|
|
739
|
+
* repeatable: true,
|
|
740
|
+
* })
|
|
741
|
+
*
|
|
742
|
+
* // Repeatable single component
|
|
743
|
+
* component({
|
|
744
|
+
* name: 'features',
|
|
745
|
+
* component: 'feature-card',
|
|
746
|
+
* repeatable: true,
|
|
747
|
+
* minRows: 1,
|
|
748
|
+
* maxRows: 12,
|
|
749
|
+
* })
|
|
750
|
+
* ```
|
|
751
|
+
*/
|
|
752
|
+
declare const component: (config: Omit<ComponentFieldConfig, "type">) => ComponentFieldConfig;
|
|
753
|
+
/**
|
|
754
|
+
* Creates a chips field configuration.
|
|
755
|
+
*
|
|
756
|
+
* Chips fields store an array of unique free-form string values.
|
|
757
|
+
* Renders as interactive chips/tags with add/remove capability.
|
|
758
|
+
* Duplicate values are automatically prevented.
|
|
759
|
+
*
|
|
760
|
+
* @param config - Field configuration without the `type` property
|
|
761
|
+
* @returns Complete chips field configuration
|
|
762
|
+
*
|
|
763
|
+
* @example
|
|
764
|
+
* ```typescript
|
|
765
|
+
* // Basic chips field
|
|
766
|
+
* chips({ name: 'tags' })
|
|
767
|
+
*
|
|
768
|
+
* // Tags with limit
|
|
769
|
+
* chips({ name: 'keywords', maxChips: 10 })
|
|
770
|
+
*
|
|
771
|
+
* // Required with min/max
|
|
772
|
+
* chips({ name: 'categories', required: true, minChips: 1, maxChips: 5 })
|
|
773
|
+
* ```
|
|
774
|
+
*/
|
|
775
|
+
declare const chips: (config: Omit<ChipsFieldConfig, "type">) => ChipsFieldConfig;
|
|
776
|
+
/**
|
|
777
|
+
* Creates a select option configuration.
|
|
778
|
+
*
|
|
779
|
+
* A convenient helper for creating select/radio options.
|
|
780
|
+
* If no value is provided, it's auto-generated from the label.
|
|
781
|
+
*
|
|
782
|
+
* @param label - Display text for the option
|
|
783
|
+
* @param value - Value stored in database (defaults to lowercase label with underscores)
|
|
784
|
+
* @returns Select option object
|
|
785
|
+
*
|
|
786
|
+
* @example
|
|
787
|
+
* ```typescript
|
|
788
|
+
* // Auto-generated values
|
|
789
|
+
* option('Draft') // { label: 'Draft', value: 'draft' }
|
|
790
|
+
* option('In Progress') // { label: 'In Progress', value: 'in_progress' }
|
|
791
|
+
* option('Published') // { label: 'Published', value: 'published' }
|
|
792
|
+
*
|
|
793
|
+
* // Custom value
|
|
794
|
+
* option('Active', 'active')
|
|
795
|
+
* option('High Priority', 'high')
|
|
796
|
+
*
|
|
797
|
+
* // Used in select field
|
|
798
|
+
* select({
|
|
799
|
+
* name: 'status',
|
|
800
|
+
* options: [
|
|
801
|
+
* option('Draft'),
|
|
802
|
+
* option('In Review'),
|
|
803
|
+
* option('Published'),
|
|
804
|
+
* ],
|
|
805
|
+
* })
|
|
806
|
+
* ```
|
|
807
|
+
*/
|
|
808
|
+
declare const option: (label: string, value?: string) => SelectOption;
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Define Config Helper
|
|
812
|
+
*
|
|
813
|
+
* Provides the `defineConfig()` function for creating the main Nextly
|
|
814
|
+
* configuration file. This is the primary API for aggregating collections,
|
|
815
|
+
* singles, and configuring TypeScript/database output paths.
|
|
816
|
+
*
|
|
817
|
+
* Type definitions and the pure sanitization step live in
|
|
818
|
+
* `src/shared/types/config.ts`. This file keeps the validation logic
|
|
819
|
+
* (duplicate slugs, component nesting depth, user-field constraints)
|
|
820
|
+
* and re-exports the types for backwards compatibility.
|
|
821
|
+
*
|
|
822
|
+
* @module collections/config/define-config
|
|
823
|
+
* @since 1.0.0
|
|
824
|
+
*
|
|
825
|
+
* @example
|
|
826
|
+
* ```typescript
|
|
827
|
+
* // nextly.config.ts
|
|
828
|
+
* import { defineConfig } from '@nextly/core';
|
|
829
|
+
* import Posts from './src/collections/posts';
|
|
830
|
+
* import Users from './src/collections/users';
|
|
831
|
+
* import Media from './src/collections/media';
|
|
832
|
+
* import SiteSettings from './src/singles/site-settings';
|
|
833
|
+
*
|
|
834
|
+
* export default defineConfig({
|
|
835
|
+
* collections: [Posts, Users, Media],
|
|
836
|
+
* singles: [SiteSettings],
|
|
837
|
+
* typescript: {
|
|
838
|
+
* outputFile: './src/types/payload-types.ts',
|
|
839
|
+
* },
|
|
840
|
+
* });
|
|
841
|
+
* ```
|
|
842
|
+
*/
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Define the Nextly configuration for your application.
|
|
846
|
+
*
|
|
847
|
+
* This is the main entry point for configuring Nextly. It validates
|
|
848
|
+
* the configuration, applies sensible defaults via `sanitizeConfig()`,
|
|
849
|
+
* and returns a fully normalized config object.
|
|
850
|
+
*
|
|
851
|
+
* **Validation:**
|
|
852
|
+
* - Checks for duplicate collection slugs
|
|
853
|
+
* - Checks for duplicate single slugs
|
|
854
|
+
* - Checks for slug conflicts between collections and singles
|
|
855
|
+
* - Checks for component nesting depth and circular references
|
|
856
|
+
* - Validates user-field constraints
|
|
857
|
+
*
|
|
858
|
+
* **Defaults Applied (via sanitizeConfig):**
|
|
859
|
+
* - `collections`: `[]`
|
|
860
|
+
* - `singles`: `[]`
|
|
861
|
+
* - `components`: `[]`
|
|
862
|
+
* - `typescript.outputFile`: `'./src/types/generated/payload-types.ts'`
|
|
863
|
+
* - `typescript.declare`: `true`
|
|
864
|
+
* - `db.schemasDir`: `'./src/db/schemas/collections'`
|
|
865
|
+
* - `db.migrationsDir`: `'./src/db/migrations'`
|
|
866
|
+
* - `storage`: `[]`
|
|
867
|
+
* - `plugins`: `[]`
|
|
868
|
+
* - `rateLimit`: enabled with defaults (100 read / 30 write per minute)
|
|
869
|
+
*
|
|
870
|
+
* @param config - The Nextly configuration object
|
|
871
|
+
* @returns Normalized configuration with all defaults applied
|
|
872
|
+
* @throws Error if configuration is invalid (e.g., duplicate slugs)
|
|
873
|
+
*/
|
|
874
|
+
declare function defineConfig(config: NextlyConfig): SanitizedNextlyConfig;
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Define Single Helper
|
|
878
|
+
*
|
|
879
|
+
* Provides the `defineSingle()` function for creating code-first Single
|
|
880
|
+
* configurations with full TypeScript support. This is the primary API for
|
|
881
|
+
* defining Singles in TypeScript files.
|
|
882
|
+
*
|
|
883
|
+
* Singles are single-document entities for storing site-wide configuration
|
|
884
|
+
* such as site settings, navigation menus, footers, and homepage configurations.
|
|
885
|
+
*
|
|
886
|
+
* Key differences from Collections:
|
|
887
|
+
* - Only one document per Single (no list view)
|
|
888
|
+
* - No create/delete operations (auto-created on first access)
|
|
889
|
+
* - Simplified hooks (4 vs 8 for Collections)
|
|
890
|
+
* - Simplified access control (read/update only)
|
|
891
|
+
* - No timestamps configuration (always has updatedAt)
|
|
892
|
+
* - No pagination options
|
|
893
|
+
*
|
|
894
|
+
* @module singles/config/define-single
|
|
895
|
+
* @since 1.0.0
|
|
896
|
+
*
|
|
897
|
+
* @example
|
|
898
|
+
* ```typescript
|
|
899
|
+
* import { defineSingle, text, upload, array } from 'nextly';
|
|
900
|
+
*
|
|
901
|
+
* export default defineSingle({
|
|
902
|
+
* slug: 'site-settings',
|
|
903
|
+
* label: { singular: 'Site Settings' },
|
|
904
|
+
* fields: [
|
|
905
|
+
* text({ name: 'siteName', required: true }),
|
|
906
|
+
* text({ name: 'tagline' }),
|
|
907
|
+
* upload({ name: 'logo', relationTo: 'media' }),
|
|
908
|
+
* ],
|
|
909
|
+
* access: {
|
|
910
|
+
* read: true,
|
|
911
|
+
* update: ({ roles }) => roles.includes('admin'),
|
|
912
|
+
* },
|
|
913
|
+
* });
|
|
914
|
+
* ```
|
|
915
|
+
*/
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Define a code-first Single with full type safety.
|
|
919
|
+
*
|
|
920
|
+
* This is the primary API for creating Single configurations in TypeScript.
|
|
921
|
+
* It validates the configuration, applies sensible defaults, and returns a
|
|
922
|
+
* normalized `SingleConfig` object.
|
|
923
|
+
*
|
|
924
|
+
* **Defaults Applied:**
|
|
925
|
+
* - `label.singular`: Generated from slug (e.g., 'site-settings' → 'Site Settings')
|
|
926
|
+
* - `admin`: Empty object if not provided
|
|
927
|
+
*
|
|
928
|
+
* **Validation:**
|
|
929
|
+
* - Slug must be valid (lowercase, URL-friendly, not reserved)
|
|
930
|
+
* - Fields array must be non-empty
|
|
931
|
+
* - Access functions must be functions (if provided)
|
|
932
|
+
*
|
|
933
|
+
* @param config - The Single configuration
|
|
934
|
+
* @returns Normalized Single configuration with defaults applied
|
|
935
|
+
* @throws Error if configuration is invalid
|
|
936
|
+
*
|
|
937
|
+
* @example Basic Single
|
|
938
|
+
* ```typescript
|
|
939
|
+
* import { defineSingle, text } from 'nextly';
|
|
940
|
+
*
|
|
941
|
+
* export default defineSingle({
|
|
942
|
+
* slug: 'site-settings',
|
|
943
|
+
* fields: [
|
|
944
|
+
* text({ name: 'siteName', required: true }),
|
|
945
|
+
* text({ name: 'tagline' }),
|
|
946
|
+
* ],
|
|
947
|
+
* });
|
|
948
|
+
* ```
|
|
949
|
+
*
|
|
950
|
+
* @example Single with Admin Options
|
|
951
|
+
* ```typescript
|
|
952
|
+
* import { defineSingle, text, upload, group, array } from 'nextly';
|
|
953
|
+
*
|
|
954
|
+
* export default defineSingle({
|
|
955
|
+
* slug: 'site-settings',
|
|
956
|
+
* label: { singular: 'Site Settings' },
|
|
957
|
+
* admin: {
|
|
958
|
+
* group: 'Settings',
|
|
959
|
+
* icon: 'Settings',
|
|
960
|
+
* description: 'Site configuration',
|
|
961
|
+
* },
|
|
962
|
+
* fields: [
|
|
963
|
+
* text({ name: 'siteName', required: true, label: 'Site Name' }),
|
|
964
|
+
* text({ name: 'tagline', label: 'Tagline' }),
|
|
965
|
+
* upload({ name: 'logo', relationTo: 'media', label: 'Logo' }),
|
|
966
|
+
* upload({ name: 'favicon', relationTo: 'media', label: 'Favicon' }),
|
|
967
|
+
* group({
|
|
968
|
+
* name: 'seo',
|
|
969
|
+
* label: 'SEO Defaults',
|
|
970
|
+
* fields: [
|
|
971
|
+
* text({ name: 'metaTitle', label: 'Default Meta Title' }),
|
|
972
|
+
* text({ name: 'metaDescription', label: 'Default Meta Description' }),
|
|
973
|
+
* ],
|
|
974
|
+
* }),
|
|
975
|
+
* array({
|
|
976
|
+
* name: 'socialLinks',
|
|
977
|
+
* label: 'Social Links',
|
|
978
|
+
* fields: [
|
|
979
|
+
* text({ name: 'platform', required: true }),
|
|
980
|
+
* text({ name: 'url', required: true }),
|
|
981
|
+
* ],
|
|
982
|
+
* }),
|
|
983
|
+
* ],
|
|
984
|
+
* access: {
|
|
985
|
+
* read: () => true,
|
|
986
|
+
* update: ({ req }) => req.user?.role === 'admin',
|
|
987
|
+
* },
|
|
988
|
+
* hooks: {
|
|
989
|
+
* afterChange: [
|
|
990
|
+
* async ({ doc }) => {
|
|
991
|
+
* // Revalidate frontend cache
|
|
992
|
+
* await fetch('/api/revalidate?tag=site-settings', { method: 'POST' });
|
|
993
|
+
* },
|
|
994
|
+
* ],
|
|
995
|
+
* },
|
|
996
|
+
* });
|
|
997
|
+
* ```
|
|
998
|
+
*
|
|
999
|
+
* @example Header Navigation Single
|
|
1000
|
+
* ```typescript
|
|
1001
|
+
* import { defineSingle, array, text, relationship } from 'nextly';
|
|
1002
|
+
*
|
|
1003
|
+
* export default defineSingle({
|
|
1004
|
+
* slug: 'header',
|
|
1005
|
+
* label: { singular: 'Header Navigation' },
|
|
1006
|
+
* admin: {
|
|
1007
|
+
* group: 'Navigation',
|
|
1008
|
+
* icon: 'Menu',
|
|
1009
|
+
* },
|
|
1010
|
+
* fields: [
|
|
1011
|
+
* array({
|
|
1012
|
+
* name: 'navItems',
|
|
1013
|
+
* label: 'Navigation Items',
|
|
1014
|
+
* fields: [
|
|
1015
|
+
* text({ name: 'label', required: true }),
|
|
1016
|
+
* text({ name: 'url' }),
|
|
1017
|
+
* relationship({ name: 'page', relationTo: 'pages' }),
|
|
1018
|
+
* ],
|
|
1019
|
+
* }),
|
|
1020
|
+
* ],
|
|
1021
|
+
* });
|
|
1022
|
+
* ```
|
|
1023
|
+
*/
|
|
1024
|
+
declare function defineSingle(config: SingleConfig): SingleConfig;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Define Component Helper
|
|
1028
|
+
*
|
|
1029
|
+
* Provides the `defineComponent()` function for creating code-first Component
|
|
1030
|
+
* configurations with full TypeScript support. This is the primary API for
|
|
1031
|
+
* defining Components (reusable field groups) in TypeScript files.
|
|
1032
|
+
*
|
|
1033
|
+
* Components are shared, reusable field structures that can be independently
|
|
1034
|
+
* created and then selected from within Collections and Singles.
|
|
1035
|
+
*
|
|
1036
|
+
* Key characteristics:
|
|
1037
|
+
* - Components are templates (schemas), not documents
|
|
1038
|
+
* - Each instance is unique to its parent entry
|
|
1039
|
+
* - Support all field types including nested components (max depth: 3)
|
|
1040
|
+
* - Separate database table per component type (comp_{slug})
|
|
1041
|
+
*
|
|
1042
|
+
* @module components/config/define-component
|
|
1043
|
+
* @since 1.0.0
|
|
1044
|
+
*
|
|
1045
|
+
* @example
|
|
1046
|
+
* ```typescript
|
|
1047
|
+
* import { defineComponent, text, upload } from 'nextly';
|
|
1048
|
+
*
|
|
1049
|
+
* export default defineComponent({
|
|
1050
|
+
* slug: 'seo',
|
|
1051
|
+
* label: { singular: 'SEO Metadata' },
|
|
1052
|
+
* admin: {
|
|
1053
|
+
* category: 'Shared',
|
|
1054
|
+
* icon: 'Search',
|
|
1055
|
+
* description: 'Search engine optimization metadata',
|
|
1056
|
+
* },
|
|
1057
|
+
* fields: [
|
|
1058
|
+
* text({ name: 'metaTitle', required: true, label: 'Meta Title' }),
|
|
1059
|
+
* text({ name: 'metaDescription', label: 'Meta Description' }),
|
|
1060
|
+
* upload({ name: 'metaImage', relationTo: 'media', label: 'OG Image' }),
|
|
1061
|
+
* text({ name: 'canonicalUrl', label: 'Canonical URL' }),
|
|
1062
|
+
* ],
|
|
1063
|
+
* });
|
|
1064
|
+
* ```
|
|
1065
|
+
*/
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* Define a code-first Component with full type safety.
|
|
1069
|
+
*
|
|
1070
|
+
* This is the primary API for creating Component configurations in TypeScript.
|
|
1071
|
+
* It validates the configuration, applies sensible defaults, and returns a
|
|
1072
|
+
* normalized `ComponentConfig` object.
|
|
1073
|
+
*
|
|
1074
|
+
* **Defaults Applied:**
|
|
1075
|
+
* - `label.singular`: Generated from slug (e.g., 'social-link' → 'Social Link')
|
|
1076
|
+
* - `admin`: Empty object if not provided
|
|
1077
|
+
*
|
|
1078
|
+
* **Validation:**
|
|
1079
|
+
* - Slug must be valid (lowercase, URL-friendly, not reserved)
|
|
1080
|
+
* - Fields array must be non-empty
|
|
1081
|
+
* - Component field references validated (single vs multi mode)
|
|
1082
|
+
*
|
|
1083
|
+
* @param config - The Component configuration
|
|
1084
|
+
* @returns Normalized Component configuration with defaults applied
|
|
1085
|
+
* @throws Error if configuration is invalid
|
|
1086
|
+
*
|
|
1087
|
+
* @example Basic Component
|
|
1088
|
+
* ```typescript
|
|
1089
|
+
* import { defineComponent, text } from 'nextly';
|
|
1090
|
+
*
|
|
1091
|
+
* export default defineComponent({
|
|
1092
|
+
* slug: 'seo',
|
|
1093
|
+
* fields: [
|
|
1094
|
+
* text({ name: 'metaTitle', required: true }),
|
|
1095
|
+
* text({ name: 'metaDescription' }),
|
|
1096
|
+
* ],
|
|
1097
|
+
* });
|
|
1098
|
+
* ```
|
|
1099
|
+
*
|
|
1100
|
+
* @example Component with Admin Options
|
|
1101
|
+
* ```typescript
|
|
1102
|
+
* import { defineComponent, text, upload, select } from 'nextly';
|
|
1103
|
+
*
|
|
1104
|
+
* export default defineComponent({
|
|
1105
|
+
* slug: 'hero',
|
|
1106
|
+
* label: { singular: 'Hero Section' },
|
|
1107
|
+
* admin: {
|
|
1108
|
+
* category: 'Blocks',
|
|
1109
|
+
* icon: 'Image',
|
|
1110
|
+
* description: 'Full-width hero banner with heading and CTA',
|
|
1111
|
+
* },
|
|
1112
|
+
* fields: [
|
|
1113
|
+
* text({ name: 'heading', required: true, label: 'Heading' }),
|
|
1114
|
+
* text({ name: 'subheading', label: 'Subheading' }),
|
|
1115
|
+
* upload({ name: 'backgroundImage', relationTo: 'media', label: 'Background Image' }),
|
|
1116
|
+
* text({ name: 'ctaText', label: 'CTA Button Text' }),
|
|
1117
|
+
* text({ name: 'ctaLink', label: 'CTA Button Link' }),
|
|
1118
|
+
* select({
|
|
1119
|
+
* name: 'alignment',
|
|
1120
|
+
* label: 'Content Alignment',
|
|
1121
|
+
* options: [
|
|
1122
|
+
* { label: 'Left', value: 'left' },
|
|
1123
|
+
* { label: 'Center', value: 'center' },
|
|
1124
|
+
* { label: 'Right', value: 'right' },
|
|
1125
|
+
* ],
|
|
1126
|
+
* defaultValue: 'center',
|
|
1127
|
+
* }),
|
|
1128
|
+
* ],
|
|
1129
|
+
* });
|
|
1130
|
+
* ```
|
|
1131
|
+
*
|
|
1132
|
+
* @example Component with Nested Component Field
|
|
1133
|
+
* ```typescript
|
|
1134
|
+
* import { defineComponent, text, component } from 'nextly';
|
|
1135
|
+
*
|
|
1136
|
+
* export default defineComponent({
|
|
1137
|
+
* slug: 'faq-item',
|
|
1138
|
+
* label: { singular: 'FAQ Item' },
|
|
1139
|
+
* fields: [
|
|
1140
|
+
* text({ name: 'question', required: true }),
|
|
1141
|
+
* text({ name: 'answer', required: true }),
|
|
1142
|
+
* component({ name: 'cta', component: 'cta' }),
|
|
1143
|
+
* ],
|
|
1144
|
+
* });
|
|
1145
|
+
* ```
|
|
1146
|
+
*/
|
|
1147
|
+
declare function defineComponent(config: ComponentConfig): ComponentConfig;
|
|
1148
|
+
|
|
1149
|
+
export { isRepeaterField as A, isRichTextField as B, isSelectField as C, isTextField as D, isTextareaField as E, isUploadField as F, json as G, number as H, option as I, password as J, radio as K, relationship as L, repeater as M, richText as N, select as O, text as P, textarea as Q, upload as R, array as a, chips as b, checkbox as c, code as d, component as e, date as f, defineComponent as g, defineConfig as h, defineSingle as i, email as j, group as k, hasNestedFields as l, isCheckboxField as m, isChipsField as n, isCodeField as o, isComponentField as p, isDataField as q, isDateField as r, isEmailField as s, isGroupField as t, isJSONField as u, isNumberField as v, isPasswordField as w, isRadioField as x, isRelationalField as y, isRelationshipField as z };
|