@betterstart/cli 0.1.3 → 0.1.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 (234) hide show
  1. package/README.md +133 -0
  2. package/dist/cli.d.ts +1 -9
  3. package/dist/cli.js +13484 -367
  4. package/dist/cli.js.map +1 -1
  5. package/dist/index.d.ts +24 -266
  6. package/dist/index.js +4 -11378
  7. package/dist/index.js.map +1 -1
  8. package/package.json +29 -42
  9. package/templates/schema.json +959 -0
  10. package/templates/tiptap/hooks/use-composed-ref.ts +43 -0
  11. package/templates/tiptap/hooks/use-cursor-visibility.ts +68 -0
  12. package/templates/tiptap/hooks/use-element-rect.ts +166 -0
  13. package/templates/tiptap/hooks/use-is-breakpoint.ts +32 -0
  14. package/templates/tiptap/hooks/use-menu-navigation.ts +182 -0
  15. package/templates/tiptap/hooks/use-scrolling.ts +64 -0
  16. package/templates/tiptap/hooks/use-throttled-callback.ts +146 -0
  17. package/templates/tiptap/hooks/use-tiptap-editor.ts +46 -0
  18. package/templates/tiptap/hooks/use-unmount.ts +21 -0
  19. package/templates/tiptap/hooks/use-window-size.ts +87 -0
  20. package/templates/tiptap/lib/tiptap-utils.ts +587 -0
  21. package/templates/tiptap/styles/_keyframe-animations.scss +91 -0
  22. package/templates/tiptap/styles/_variables.scss +296 -0
  23. package/templates/tiptap/tiptap-extension/node-background-extension.ts +138 -0
  24. package/templates/tiptap/tiptap-icons/align-center-icon.tsx +38 -0
  25. package/templates/tiptap/tiptap-icons/align-justify-icon.tsx +38 -0
  26. package/templates/tiptap/tiptap-icons/align-left-icon.tsx +38 -0
  27. package/templates/tiptap/tiptap-icons/align-right-icon.tsx +38 -0
  28. package/templates/tiptap/tiptap-icons/arrow-left-icon.tsx +24 -0
  29. package/templates/tiptap/tiptap-icons/ban-icon.tsx +26 -0
  30. package/templates/tiptap/tiptap-icons/blockquote-icon.tsx +44 -0
  31. package/templates/tiptap/tiptap-icons/bold-icon.tsx +26 -0
  32. package/templates/tiptap/tiptap-icons/chevron-down-icon.tsx +26 -0
  33. package/templates/tiptap/tiptap-icons/close-icon.tsx +24 -0
  34. package/templates/tiptap/tiptap-icons/code-block-icon.tsx +38 -0
  35. package/templates/tiptap/tiptap-icons/code2-icon.tsx +32 -0
  36. package/templates/tiptap/tiptap-icons/corner-down-left-icon.tsx +26 -0
  37. package/templates/tiptap/tiptap-icons/external-link-icon.tsx +28 -0
  38. package/templates/tiptap/tiptap-icons/heading-five-icon.tsx +28 -0
  39. package/templates/tiptap/tiptap-icons/heading-four-icon.tsx +28 -0
  40. package/templates/tiptap/tiptap-icons/heading-icon.tsx +24 -0
  41. package/templates/tiptap/tiptap-icons/heading-one-icon.tsx +28 -0
  42. package/templates/tiptap/tiptap-icons/heading-six-icon.tsx +30 -0
  43. package/templates/tiptap/tiptap-icons/heading-three-icon.tsx +36 -0
  44. package/templates/tiptap/tiptap-icons/heading-two-icon.tsx +28 -0
  45. package/templates/tiptap/tiptap-icons/highlighter-icon.tsx +26 -0
  46. package/templates/tiptap/tiptap-icons/image-plus-icon.tsx +26 -0
  47. package/templates/tiptap/tiptap-icons/italic-icon.tsx +24 -0
  48. package/templates/tiptap/tiptap-icons/link-icon.tsx +28 -0
  49. package/templates/tiptap/tiptap-icons/list-icon.tsx +56 -0
  50. package/templates/tiptap/tiptap-icons/list-ordered-icon.tsx +56 -0
  51. package/templates/tiptap/tiptap-icons/list-todo-icon.tsx +50 -0
  52. package/templates/tiptap/tiptap-icons/moon-star-icon.tsx +30 -0
  53. package/templates/tiptap/tiptap-icons/redo2-icon.tsx +26 -0
  54. package/templates/tiptap/tiptap-icons/strike-icon.tsx +28 -0
  55. package/templates/tiptap/tiptap-icons/subscript-icon.tsx +38 -0
  56. package/templates/tiptap/tiptap-icons/sun-icon.tsx +58 -0
  57. package/templates/tiptap/tiptap-icons/superscript-icon.tsx +38 -0
  58. package/templates/tiptap/tiptap-icons/trash-icon.tsx +26 -0
  59. package/templates/tiptap/tiptap-icons/underline-icon.tsx +26 -0
  60. package/templates/tiptap/tiptap-icons/undo2-icon.tsx +26 -0
  61. package/templates/tiptap/tiptap-node/blockquote-node/blockquote-node.scss +37 -0
  62. package/templates/tiptap/tiptap-node/code-block-node/code-block-node.scss +54 -0
  63. package/templates/tiptap/tiptap-node/heading-node/heading-node.scss +45 -0
  64. package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.ts +10 -0
  65. package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node.scss +25 -0
  66. package/templates/tiptap/tiptap-node/image-node/image-node.scss +35 -0
  67. package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node-extension.ts +154 -0
  68. package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.scss +249 -0
  69. package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.tsx +522 -0
  70. package/templates/tiptap/tiptap-node/image-upload-node/index.tsx +1 -0
  71. package/templates/tiptap/tiptap-node/list-node/list-node.scss +208 -0
  72. package/templates/tiptap/tiptap-node/paragraph-node/paragraph-node.scss +273 -0
  73. package/templates/tiptap/tiptap-ui/blockquote-button/blockquote-button.tsx +104 -0
  74. package/templates/tiptap/tiptap-ui/blockquote-button/index.tsx +2 -0
  75. package/templates/tiptap/tiptap-ui/blockquote-button/use-blockquote.ts +252 -0
  76. package/templates/tiptap/tiptap-ui/code-block-button/code-block-button.tsx +106 -0
  77. package/templates/tiptap/tiptap-ui/code-block-button/index.tsx +2 -0
  78. package/templates/tiptap/tiptap-ui/code-block-button/use-code-block.ts +261 -0
  79. package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.scss +49 -0
  80. package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.tsx +153 -0
  81. package/templates/tiptap/tiptap-ui/color-highlight-button/index.tsx +2 -0
  82. package/templates/tiptap/tiptap-ui/color-highlight-button/use-color-highlight.ts +345 -0
  83. package/templates/tiptap/tiptap-ui/color-highlight-popover/color-highlight-popover.tsx +207 -0
  84. package/templates/tiptap/tiptap-ui/color-highlight-popover/index.tsx +1 -0
  85. package/templates/tiptap/tiptap-ui/heading-button/heading-button.tsx +107 -0
  86. package/templates/tiptap/tiptap-ui/heading-button/index.tsx +2 -0
  87. package/templates/tiptap/tiptap-ui/heading-button/use-heading.ts +314 -0
  88. package/templates/tiptap/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.tsx +131 -0
  89. package/templates/tiptap/tiptap-ui/heading-dropdown-menu/index.tsx +2 -0
  90. package/templates/tiptap/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.ts +130 -0
  91. package/templates/tiptap/tiptap-ui/image-upload-button/image-upload-button.tsx +114 -0
  92. package/templates/tiptap/tiptap-ui/image-upload-button/index.tsx +2 -0
  93. package/templates/tiptap/tiptap-ui/image-upload-button/use-image-upload.ts +192 -0
  94. package/templates/tiptap/tiptap-ui/link-popover/index.tsx +2 -0
  95. package/templates/tiptap/tiptap-ui/link-popover/link-popover.tsx +285 -0
  96. package/templates/tiptap/tiptap-ui/link-popover/use-link-popover.ts +286 -0
  97. package/templates/tiptap/tiptap-ui/list-button/index.tsx +2 -0
  98. package/templates/tiptap/tiptap-ui/list-button/list-button.tsx +108 -0
  99. package/templates/tiptap/tiptap-ui/list-button/use-list.ts +329 -0
  100. package/templates/tiptap/tiptap-ui/list-dropdown-menu/index.tsx +1 -0
  101. package/templates/tiptap/tiptap-ui/list-dropdown-menu/list-dropdown-menu.tsx +123 -0
  102. package/templates/tiptap/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.ts +203 -0
  103. package/templates/tiptap/tiptap-ui/mark-button/index.tsx +2 -0
  104. package/templates/tiptap/tiptap-ui/mark-button/mark-button.tsx +107 -0
  105. package/templates/tiptap/tiptap-ui/mark-button/use-mark.ts +206 -0
  106. package/templates/tiptap/tiptap-ui/text-align-button/index.tsx +2 -0
  107. package/templates/tiptap/tiptap-ui/text-align-button/text-align-button.tsx +118 -0
  108. package/templates/tiptap/tiptap-ui/text-align-button/use-text-align.ts +212 -0
  109. package/templates/tiptap/tiptap-ui/undo-redo-button/index.tsx +2 -0
  110. package/templates/tiptap/tiptap-ui/undo-redo-button/undo-redo-button.tsx +105 -0
  111. package/templates/tiptap/tiptap-ui/undo-redo-button/use-undo-redo.ts +173 -0
  112. package/templates/tiptap/tiptap-ui-primitive/badge/badge-colors.scss +395 -0
  113. package/templates/tiptap/tiptap-ui-primitive/badge/badge-group.scss +16 -0
  114. package/templates/tiptap/tiptap-ui-primitive/badge/badge.scss +99 -0
  115. package/templates/tiptap/tiptap-ui-primitive/badge/badge.tsx +46 -0
  116. package/templates/tiptap/tiptap-ui-primitive/badge/index.tsx +1 -0
  117. package/templates/tiptap/tiptap-ui-primitive/button/button-colors.scss +429 -0
  118. package/templates/tiptap/tiptap-ui-primitive/button/button-group.scss +22 -0
  119. package/templates/tiptap/tiptap-ui-primitive/button/button.scss +314 -0
  120. package/templates/tiptap/tiptap-ui-primitive/button/button.tsx +102 -0
  121. package/templates/tiptap/tiptap-ui-primitive/button/index.tsx +1 -0
  122. package/templates/tiptap/tiptap-ui-primitive/card/card.scss +77 -0
  123. package/templates/tiptap/tiptap-ui-primitive/card/card.tsx +59 -0
  124. package/templates/tiptap/tiptap-ui-primitive/card/index.tsx +1 -0
  125. package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.scss +63 -0
  126. package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.tsx +95 -0
  127. package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/index.tsx +1 -0
  128. package/templates/tiptap/tiptap-ui-primitive/input/index.tsx +1 -0
  129. package/templates/tiptap/tiptap-ui-primitive/input/input.scss +45 -0
  130. package/templates/tiptap/tiptap-ui-primitive/input/input.tsx +18 -0
  131. package/templates/tiptap/tiptap-ui-primitive/popover/index.tsx +1 -0
  132. package/templates/tiptap/tiptap-ui-primitive/popover/popover.scss +63 -0
  133. package/templates/tiptap/tiptap-ui-primitive/popover/popover.tsx +33 -0
  134. package/templates/tiptap/tiptap-ui-primitive/separator/index.tsx +1 -0
  135. package/templates/tiptap/tiptap-ui-primitive/separator/separator.scss +23 -0
  136. package/templates/tiptap/tiptap-ui-primitive/separator/separator.tsx +33 -0
  137. package/templates/tiptap/tiptap-ui-primitive/spacer/index.tsx +1 -0
  138. package/templates/tiptap/tiptap-ui-primitive/spacer/spacer.tsx +21 -0
  139. package/templates/tiptap/tiptap-ui-primitive/toolbar/index.tsx +1 -0
  140. package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.scss +98 -0
  141. package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.tsx +113 -0
  142. package/templates/tiptap/tiptap-ui-primitive/tooltip/index.tsx +1 -0
  143. package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.scss +43 -0
  144. package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.tsx +223 -0
  145. package/templates/ui/accordion.tsx +52 -0
  146. package/templates/ui/alert-dialog.tsx +116 -0
  147. package/templates/ui/alert.tsx +48 -0
  148. package/templates/ui/aspect-ratio.tsx +7 -0
  149. package/templates/ui/avatar.tsx +46 -0
  150. package/templates/ui/badge.tsx +32 -0
  151. package/templates/ui/breadcrumb.tsx +98 -0
  152. package/templates/ui/button-group.tsx +77 -0
  153. package/templates/ui/button.tsx +48 -0
  154. package/templates/ui/calendar.tsx +176 -0
  155. package/templates/ui/card.tsx +54 -0
  156. package/templates/ui/carousel.tsx +234 -0
  157. package/templates/ui/chart.tsx +349 -0
  158. package/templates/ui/checkbox.tsx +27 -0
  159. package/templates/ui/collapsible.tsx +11 -0
  160. package/templates/ui/command.tsx +142 -0
  161. package/templates/ui/context-menu.tsx +188 -0
  162. package/templates/ui/curriculum-editor.tsx +601 -0
  163. package/templates/ui/date-picker.tsx +70 -0
  164. package/templates/ui/dialog.tsx +103 -0
  165. package/templates/ui/drawer.tsx +99 -0
  166. package/templates/ui/dropdown-menu.tsx +185 -0
  167. package/templates/ui/dynamic-list-field.tsx +95 -0
  168. package/templates/ui/empty.tsx +90 -0
  169. package/templates/ui/field.tsx +231 -0
  170. package/templates/ui/file-upload-example.tsx +113 -0
  171. package/templates/ui/form.tsx +172 -0
  172. package/templates/ui/hover-card.tsx +28 -0
  173. package/templates/ui/icon-picker.tsx +435 -0
  174. package/templates/ui/icons-data.ts +6 -0
  175. package/templates/ui/image-upload-field.tsx +360 -0
  176. package/templates/ui/input-group.tsx +160 -0
  177. package/templates/ui/input-otp.tsx +70 -0
  178. package/templates/ui/input.tsx +21 -0
  179. package/templates/ui/item.tsx +171 -0
  180. package/templates/ui/kbd.tsx +28 -0
  181. package/templates/ui/label.tsx +20 -0
  182. package/templates/ui/logo.tsx +113 -0
  183. package/templates/ui/markdown-editor.tsx +303 -0
  184. package/templates/ui/markdown-utils.ts +128 -0
  185. package/templates/ui/media-upload-field.tsx +255 -0
  186. package/templates/ui/menubar.tsx +230 -0
  187. package/templates/ui/navigation-menu.tsx +119 -0
  188. package/templates/ui/pagination.tsx +96 -0
  189. package/templates/ui/placeholder.tsx +25 -0
  190. package/templates/ui/popover.tsx +32 -0
  191. package/templates/ui/progress.tsx +24 -0
  192. package/templates/ui/radio-group.tsx +37 -0
  193. package/templates/ui/resizable.tsx +41 -0
  194. package/templates/ui/rich-text-editor.tsx +374 -0
  195. package/templates/ui/scroll-area.tsx +45 -0
  196. package/templates/ui/select.tsx +151 -0
  197. package/templates/ui/separator.tsx +25 -0
  198. package/templates/ui/sheet.tsx +120 -0
  199. package/templates/ui/sidebar.tsx +684 -0
  200. package/templates/ui/skeleton.tsx +7 -0
  201. package/templates/ui/slider.tsx +24 -0
  202. package/templates/ui/sonner.tsx +29 -0
  203. package/templates/ui/spinner.tsx +15 -0
  204. package/templates/ui/switch.tsx +28 -0
  205. package/templates/ui/table.tsx +93 -0
  206. package/templates/ui/tabs.tsx +54 -0
  207. package/templates/ui/textarea.tsx +20 -0
  208. package/templates/ui/toast.tsx +127 -0
  209. package/templates/ui/toggle-group.tsx +56 -0
  210. package/templates/ui/toggle.tsx +43 -0
  211. package/templates/ui/tooltip.tsx +31 -0
  212. package/templates/ui/use-mobile.tsx +19 -0
  213. package/templates/ui/video-upload-field.tsx +368 -0
  214. package/dist/chunk-EIH4RRIJ.js +0 -183
  215. package/dist/chunk-EIH4RRIJ.js.map +0 -1
  216. package/dist/chunk-NKRQYAS6.js +0 -260
  217. package/dist/chunk-NKRQYAS6.js.map +0 -1
  218. package/dist/chunk-QLVSHP7X.js +0 -235
  219. package/dist/chunk-QLVSHP7X.js.map +0 -1
  220. package/dist/chunk-WY6BC55D.js +0 -357
  221. package/dist/chunk-WY6BC55D.js.map +0 -1
  222. package/dist/config/index.d.ts +0 -93
  223. package/dist/config/index.js +0 -58
  224. package/dist/config/index.js.map +0 -1
  225. package/dist/core/index.d.ts +0 -415
  226. package/dist/core/index.js +0 -906
  227. package/dist/core/index.js.map +0 -1
  228. package/dist/import-resolver-BaZ-rzkH.d.ts +0 -123
  229. package/dist/logger-awLb347n.d.ts +0 -81
  230. package/dist/plugins/index.d.ts +0 -213
  231. package/dist/plugins/index.js +0 -365
  232. package/dist/plugins/index.js.map +0 -1
  233. package/dist/types-ByX_gl6y.d.ts +0 -232
  234. package/dist/types-eI549DEG.d.ts +0 -331
@@ -1,415 +0,0 @@
1
- import { a as SchemaField, b as FieldType, F as FormSchema, i as FormField } from '../types-ByX_gl6y.js';
2
- export { b as LogEntry, L as LogLevel, a as Logger, e as createBufferedLogger, c as createConsoleLogger, d as createSilentLogger, g as getLogger, l as logger, r as resetLogger, s as setLogger } from '../logger-awLb347n.js';
3
-
4
- /**
5
- * Centralized constants for the codegen package
6
- * These replace magic strings scattered throughout generators
7
- */
8
- /**
9
- * All supported field types for schema definitions
10
- */
11
- declare const FIELD_TYPES: {
12
- readonly STRING: "string";
13
- readonly NUMBER: "number";
14
- readonly BOOLEAN: "boolean";
15
- readonly TEXT: "text";
16
- readonly DECIMAL: "decimal";
17
- readonly VARCHAR: "varchar";
18
- readonly SERIAL: "serial";
19
- readonly DATE: "date";
20
- readonly TIMESTAMP: "timestamp";
21
- readonly TIME: "time";
22
- readonly MARKDOWN: "markdown";
23
- readonly IMAGE: "image";
24
- readonly VIDEO: "video";
25
- readonly MEDIA: "media";
26
- readonly ICON: "icon";
27
- readonly GROUP: "group";
28
- readonly TABS: "tabs";
29
- readonly LIST: "list";
30
- readonly SEPARATOR: "separator";
31
- readonly SELECT: "select";
32
- readonly RELATIONSHIP: "relationship";
33
- readonly CURRICULUM: "curriculum";
34
- };
35
- /**
36
- * Field types that contain nested fields
37
- */
38
- declare const NESTED_FIELD_TYPES: readonly ["group", "tabs", "list"];
39
- /**
40
- * Field types that represent rich text content
41
- */
42
- declare const RICH_TEXT_FIELD_TYPES: readonly ["markdown", "text"];
43
- /**
44
- * Field types that are stored as long text in the database
45
- */
46
- declare const LONG_TEXT_FIELD_TYPES: readonly ["text", "markdown", "list", "media", "video", "curriculum"];
47
- /**
48
- * All supported column types for admin tables
49
- */
50
- declare const COLUMN_TYPES: {
51
- readonly TEXT: "text";
52
- readonly BADGE: "badge";
53
- readonly DATE: "date";
54
- readonly CUSTOM: "custom";
55
- readonly AVATAR: "avatar";
56
- readonly LINK: "link";
57
- readonly IMAGE: "image";
58
- readonly EMAIL: "email";
59
- readonly NUMBER: "number";
60
- readonly BOOLEAN: "boolean";
61
- };
62
- /**
63
- * All supported form field types
64
- */
65
- declare const FORM_FIELD_TYPES: {
66
- readonly TEXT: "text";
67
- readonly TEXTAREA: "textarea";
68
- readonly EMAIL: "email";
69
- readonly PHONE: "phone";
70
- readonly NUMBER: "number";
71
- readonly URL: "url";
72
- readonly DATE: "date";
73
- readonly SELECT: "select";
74
- readonly RADIO: "radio";
75
- readonly CHECKBOX: "checkbox";
76
- readonly MULTISELECT: "multiselect";
77
- readonly FILE: "file";
78
- readonly UPLOAD: "upload";
79
- readonly GROUP: "group";
80
- readonly TIMEZONE: "timezone";
81
- readonly LIST: "list";
82
- };
83
- /**
84
- * Fields that are automatically added to schemas
85
- */
86
- declare const AUTO_FIELDS: {
87
- readonly ID: "id";
88
- readonly CREATED_AT: "createdAt";
89
- readonly UPDATED_AT: "updatedAt";
90
- readonly PUBLISHED: "published";
91
- readonly SLUG: "slug";
92
- };
93
- /**
94
- * Fields automatically added for form submissions
95
- */
96
- declare const FORM_SUBMISSION_FIELDS: {
97
- readonly SUBMITTED_AT: "submittedAt";
98
- readonly IP_ADDRESS: "ipAddress";
99
- readonly USER_AGENT: "userAgent";
100
- };
101
- /**
102
- * Default Drizzle column configurations
103
- */
104
- declare const DRIZZLE_DEFAULTS: {
105
- readonly VARCHAR_LENGTH: 255;
106
- readonly DECIMAL_PRECISION: 10;
107
- readonly DECIMAL_SCALE: 2;
108
- };
109
- /**
110
- * Core generators that are always included
111
- */
112
- declare const CORE_GENERATORS: readonly ["database", "actions", "hooks", "columns", "table", "page", "page-content", "form", "create-page", "edit-page", "navigation"];
113
- /**
114
- * Optional generators that can be enabled via config
115
- */
116
- declare const OPTIONAL_GENERATORS: readonly [];
117
- declare const FILE_EXTENSIONS: {
118
- readonly TYPESCRIPT: ".ts";
119
- readonly TSX: ".tsx";
120
- readonly JSON: ".json";
121
- readonly SQL: ".sql";
122
- };
123
- type FieldTypeValue = (typeof FIELD_TYPES)[keyof typeof FIELD_TYPES];
124
- type ColumnTypeValue = (typeof COLUMN_TYPES)[keyof typeof COLUMN_TYPES];
125
- type FormFieldTypeValue = (typeof FORM_FIELD_TYPES)[keyof typeof FORM_FIELD_TYPES];
126
- /**
127
- * Check if a value is a valid field type
128
- */
129
- declare function isFieldType(value: string): value is FieldTypeValue;
130
- /**
131
- * Check if a field type contains nested fields
132
- */
133
- declare function isNestedFieldType(type: string): boolean;
134
- /**
135
- * Check if a field type is stored as long text
136
- */
137
- declare function isLongTextFieldType(type: string): boolean;
138
-
139
- /**
140
- * Custom error classes for the codegen package
141
- * Provides structured errors with codes and context for better debugging
142
- */
143
- /**
144
- * Base error class for all codegen errors
145
- */
146
- declare class CodegenError extends Error {
147
- readonly code: string;
148
- readonly context?: unknown;
149
- constructor(message: string, code: string, context?: unknown);
150
- /**
151
- * Format error for display
152
- */
153
- toString(): string;
154
- }
155
- /**
156
- * Error thrown when schema validation fails
157
- */
158
- declare class SchemaValidationError extends CodegenError {
159
- readonly validationErrors: string[];
160
- constructor(message: string, validationErrors: string[], context?: unknown);
161
- toString(): string;
162
- }
163
- /**
164
- * Error thrown when configuration is invalid or missing
165
- */
166
- declare class ConfigurationError extends CodegenError {
167
- constructor(message: string, context?: unknown);
168
- }
169
- /**
170
- * Error thrown during code generation
171
- */
172
- declare class GeneratorError extends CodegenError {
173
- readonly generatorName: string;
174
- constructor(message: string, generatorName: string, context?: unknown);
175
- toString(): string;
176
- }
177
- /**
178
- * Error thrown when a plugin fails
179
- */
180
- declare class PluginError extends CodegenError {
181
- readonly pluginName: string;
182
- constructor(message: string, pluginName: string, context?: unknown);
183
- toString(): string;
184
- }
185
- /**
186
- * Error thrown when a file operation fails
187
- */
188
- declare class FileOperationError extends CodegenError {
189
- readonly filePath: string;
190
- readonly operation: 'read' | 'write' | 'delete' | 'create';
191
- constructor(message: string, filePath: string, operation: 'read' | 'write' | 'delete' | 'create', context?: unknown);
192
- toString(): string;
193
- }
194
- /**
195
- * Error thrown when a required field is missing
196
- */
197
- declare class MissingFieldError extends CodegenError {
198
- readonly fieldName: string;
199
- readonly schemaName: string;
200
- constructor(fieldName: string, schemaName: string, context?: unknown);
201
- }
202
- /**
203
- * Error thrown when a field type is not supported
204
- */
205
- declare class UnsupportedFieldTypeError extends CodegenError {
206
- readonly fieldType: string;
207
- readonly fieldName: string;
208
- constructor(fieldType: string, fieldName: string, context?: unknown);
209
- }
210
- declare const ERROR_CODES: {
211
- readonly SCHEMA_VALIDATION_ERROR: "SCHEMA_VALIDATION_ERROR";
212
- readonly CONFIGURATION_ERROR: "CONFIGURATION_ERROR";
213
- readonly GENERATOR_ERROR: "GENERATOR_ERROR";
214
- readonly PLUGIN_ERROR: "PLUGIN_ERROR";
215
- readonly FILE_OPERATION_ERROR: "FILE_OPERATION_ERROR";
216
- readonly MISSING_FIELD_ERROR: "MISSING_FIELD_ERROR";
217
- readonly UNSUPPORTED_FIELD_TYPE_ERROR: "UNSUPPORTED_FIELD_TYPE_ERROR";
218
- };
219
- /**
220
- * Check if an error is a CodegenError
221
- */
222
- declare function isCodegenError(error: unknown): error is CodegenError;
223
- /**
224
- * Wrap an unknown error in a CodegenError
225
- */
226
- declare function wrapError(error: unknown, code: string, message?: string): CodegenError;
227
-
228
- /**
229
- * Field helper utilities for the codegen package
230
- * Consolidates duplicated field-checking functions from actions.ts, form.ts, etc.
231
- */
232
-
233
- /**
234
- * Options for walking the field tree
235
- */
236
- interface WalkFieldsOptions {
237
- /** Include fields inside list items */
238
- includeLists?: boolean;
239
- /** Include fields inside groups */
240
- includeGroups?: boolean;
241
- /** Include fields inside tabs */
242
- includeTabs?: boolean;
243
- }
244
- /**
245
- * Walk through all fields in a schema, including nested ones
246
- * @param fields - The fields to walk
247
- * @param callback - Called for each field with depth and parent info
248
- * @param options - Control which nested structures to traverse
249
- */
250
- declare function walkFields(fields: SchemaField[], callback: (field: SchemaField, depth: number, parent?: SchemaField) => void, options?: WalkFieldsOptions): void;
251
- /**
252
- * Check if any field in the tree matches a specific type
253
- * Replaces the many checkForFieldType() functions
254
- */
255
- declare function hasFieldType(fields: SchemaField[], type: FieldType | string, options?: WalkFieldsOptions): boolean;
256
- /**
257
- * Check if any field in the tree matches any of the given types
258
- */
259
- declare function hasAnyFieldType(fields: SchemaField[], types: (FieldType | string)[], options?: WalkFieldsOptions): boolean;
260
- /**
261
- * Check if any field uses icons (either icon type or hasIcon property)
262
- * Replaces checkForIconUsage() from form.ts
263
- */
264
- declare function hasIconUsage(fields: SchemaField[], options?: WalkFieldsOptions): boolean;
265
- /**
266
- * Check if any field is a relationship field
267
- * Replaces checkForRelationshipField() from form.ts
268
- */
269
- declare function hasRelationshipField(fields: SchemaField[], options?: WalkFieldsOptions): boolean;
270
- /**
271
- * Check if any field is a markdown field
272
- * Replaces checkForMarkdownField() from form.ts
273
- */
274
- declare function hasMarkdownField(fields: SchemaField[], options?: WalkFieldsOptions): boolean;
275
- /**
276
- * Check if any field is a textarea/text field
277
- * Replaces checkForTextareaField() from form.ts
278
- */
279
- declare function hasTextareaField(fields: SchemaField[], options?: WalkFieldsOptions): boolean;
280
- /**
281
- * Collect all fields of a specific type
282
- */
283
- declare function collectFieldsByType(fields: SchemaField[], type: FieldType | string, options?: WalkFieldsOptions): SchemaField[];
284
- /**
285
- * Get all many-to-many relationship fields
286
- * Replaces getManyToManyFields() from actions.ts and database.ts
287
- */
288
- declare function getManyToManyFields(fields: SchemaField[]): SchemaField[];
289
- /**
290
- * Get all relationship fields (excluding many-to-many)
291
- * Replaces _getNestedRelationshipFields() from actions.ts
292
- */
293
- declare function getNestedRelationshipFields(fields: SchemaField[], options?: WalkFieldsOptions): SchemaField[];
294
- /**
295
- * Collect relationship fields from top-level and groups only (not lists)
296
- * Used for form imports where list relationships use different handling
297
- */
298
- declare function collectRelationshipFieldsTopLevel(fields: SchemaField[]): SchemaField[];
299
- /**
300
- * Collect ALL relationship fields including those in lists
301
- * Used for data hooks
302
- */
303
- declare function collectAllRelationshipFields(fields: SchemaField[]): SchemaField[];
304
- /**
305
- * Get list fields that have nested fields (not just items)
306
- */
307
- declare function getListFieldsWithNestedFields(fields: SchemaField[]): SchemaField[];
308
- /**
309
- * Get nested list fields (list fields inside list fields)
310
- */
311
- declare function getNestedListFields(fields: SchemaField[]): {
312
- parent: SchemaField;
313
- nested: SchemaField;
314
- }[];
315
- /**
316
- * Ensure fields have an ID field - automatically injects one if not present
317
- */
318
- declare function ensureIdField(fields: SchemaField[]): SchemaField[];
319
- /**
320
- * Flatten group and tabs fields into individual fields for database operations
321
- * Automatically ensures an ID field exists
322
- */
323
- declare function flattenFields(fields: SchemaField[]): SchemaField[];
324
- /**
325
- * Get all fields from a form schema (including from steps)
326
- * Replaces getAllFields() from email-template.ts and form-generator.ts
327
- */
328
- declare function getAllFormFields(schema: FormSchema): FormField[];
329
- /**
330
- * Check if a form schema is multi-step
331
- */
332
- declare function isMultiStepForm(schema: FormSchema): boolean;
333
- /**
334
- * Result of analyzing all field types in a schema
335
- */
336
- interface FieldAnalysis {
337
- hasBoolean: boolean;
338
- hasImage: boolean;
339
- hasVideo: boolean;
340
- hasMedia: boolean;
341
- hasDate: boolean;
342
- hasList: boolean;
343
- hasNestedList: boolean;
344
- hasSelect: boolean;
345
- hasMarkdown: boolean;
346
- hasTextarea: boolean;
347
- hasSeparator: boolean;
348
- hasIcon: boolean;
349
- hasRelationship: boolean;
350
- hasManyToMany: boolean;
351
- fieldTypes: Set<string>;
352
- }
353
- /**
354
- * Analyze all field types in a schema
355
- * Returns a comprehensive analysis that can be used to determine imports, etc.
356
- */
357
- declare function analyzeFields(fields: SchemaField[]): FieldAnalysis;
358
-
359
- /**
360
- * Type mapping utilities for the codegen package
361
- * Consolidates type mapping functions from form.ts, database.ts, actions.ts, form-generator.ts
362
- */
363
-
364
- /**
365
- * Map a schema field type to Drizzle ORM column type
366
- * @param field - The schema field
367
- * @param requiredImports - Set to track which Drizzle imports are needed
368
- * @returns The Drizzle column type expression
369
- */
370
- declare function toDrizzleType(field: SchemaField, requiredImports: Set<string>): string;
371
- /**
372
- * Map a schema field type to Zod validation schema
373
- * @param field - The schema field
374
- * @returns The Zod schema expression as a string
375
- */
376
- declare function toZodType(field: SchemaField): string;
377
- /**
378
- * Map a schema field type to TypeScript type
379
- * @param field - The schema field
380
- * @param mode - 'input' for form input types, 'output' for database output types
381
- * @returns The TypeScript type as a string
382
- */
383
- declare function toTypeScriptType(field: SchemaField, mode?: 'input' | 'output'): string;
384
- /**
385
- * Map a schema field type to HTML form input type
386
- * @param field - The schema field
387
- * @returns The form input type (checkbox, textarea, number, date, etc.)
388
- */
389
- declare function toFormFieldType(field: SchemaField): string;
390
- /**
391
- * Map a form field type to Drizzle ORM column type
392
- * @param field - The form field
393
- * @param requiredImports - Set to track which Drizzle imports are needed
394
- * @returns The Drizzle column type expression
395
- */
396
- declare function formFieldToDrizzleType(field: FormField, requiredImports: Set<string>): string;
397
- interface FormFieldZodOptions {
398
- /** Treat field as optional even if required (for conditional fields) */
399
- treatAsOptional?: boolean;
400
- }
401
- /**
402
- * Map a form field type to Zod validation schema
403
- * @param field - The form field
404
- * @param options - Options for generating the zod type
405
- * @returns The Zod schema expression as a string
406
- */
407
- declare function formFieldToZodType(field: FormField, options?: FormFieldZodOptions): string;
408
- /**
409
- * Map a schema field type to SQL column type
410
- * @param field - The schema field
411
- * @returns The SQL column type
412
- */
413
- declare function toSQLType(field: SchemaField): string;
414
-
415
- export { AUTO_FIELDS, COLUMN_TYPES, CORE_GENERATORS, CodegenError, type ColumnTypeValue, ConfigurationError, DRIZZLE_DEFAULTS, ERROR_CODES, FIELD_TYPES, FILE_EXTENSIONS, FORM_FIELD_TYPES, FORM_SUBMISSION_FIELDS, type FieldAnalysis, type FieldTypeValue, FileOperationError, type FormFieldTypeValue, type FormFieldZodOptions, GeneratorError, LONG_TEXT_FIELD_TYPES, MissingFieldError, NESTED_FIELD_TYPES, OPTIONAL_GENERATORS, PluginError, RICH_TEXT_FIELD_TYPES, SchemaValidationError, UnsupportedFieldTypeError, type WalkFieldsOptions, analyzeFields, collectAllRelationshipFields, collectFieldsByType, collectRelationshipFieldsTopLevel, ensureIdField, flattenFields, formFieldToDrizzleType, formFieldToZodType, getAllFormFields, getListFieldsWithNestedFields, getManyToManyFields, getNestedListFields, getNestedRelationshipFields, hasAnyFieldType, hasFieldType, hasIconUsage, hasMarkdownField, hasRelationshipField, hasTextareaField, isCodegenError, isFieldType, isLongTextFieldType, isMultiStepForm, isNestedFieldType, toDrizzleType, toFormFieldType, toSQLType, toTypeScriptType, toZodType, walkFields, wrapError };