@sonicjs-cms/core 2.2.0 → 2.3.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.
Files changed (105) hide show
  1. package/README.md +75 -1
  2. package/dist/app-Db0AfT5F.d.cts +100 -0
  3. package/dist/app-Db0AfT5F.d.ts +100 -0
  4. package/dist/{chunk-R57VFNP3.js → chunk-3ZLCMOCM.js} +441 -433
  5. package/dist/chunk-3ZLCMOCM.js.map +1 -0
  6. package/dist/{chunk-ZUK55KZB.js → chunk-4C433FET.js} +5 -3
  7. package/dist/chunk-4C433FET.js.map +1 -0
  8. package/dist/{chunk-OORGXYDA.js → chunk-5TRX2JHU.js} +5 -32
  9. package/dist/chunk-5TRX2JHU.js.map +1 -0
  10. package/dist/{chunk-K4Z3IHOK.js → chunk-7CXL5K7N.js} +5 -248
  11. package/dist/chunk-7CXL5K7N.js.map +1 -0
  12. package/dist/{chunk-WBX5YMTB.cjs → chunk-7KCDFDRI.cjs} +27 -15
  13. package/dist/chunk-7KCDFDRI.cjs.map +1 -0
  14. package/dist/chunk-CAMM3MJV.js +1550 -0
  15. package/dist/chunk-CAMM3MJV.js.map +1 -0
  16. package/dist/{chunk-HKEK7UNV.js → chunk-CPXAVWCU.js} +3 -3
  17. package/dist/{chunk-HKEK7UNV.js.map → chunk-CPXAVWCU.js.map} +1 -1
  18. package/dist/{chunk-F5ESJXI2.cjs → chunk-DTLB6UIH.cjs} +3 -3
  19. package/dist/{chunk-F5ESJXI2.cjs.map → chunk-DTLB6UIH.cjs.map} +1 -1
  20. package/dist/{chunk-AINTFRTC.cjs → chunk-ES3BRZQJ.cjs} +252 -2
  21. package/dist/chunk-ES3BRZQJ.cjs.map +1 -0
  22. package/dist/chunk-HBJU3I2Y.cjs +1552 -0
  23. package/dist/chunk-HBJU3I2Y.cjs.map +1 -0
  24. package/dist/{chunk-UEYMFNBN.cjs → chunk-KP4DVEX5.cjs} +7 -36
  25. package/dist/chunk-KP4DVEX5.cjs.map +1 -0
  26. package/dist/{chunk-2DIWLDCA.cjs → chunk-MPFSSBIY.cjs} +541 -533
  27. package/dist/chunk-MPFSSBIY.cjs.map +1 -0
  28. package/dist/{chunk-HV2I6API.cjs → chunk-NAYD76QF.cjs} +4 -251
  29. package/dist/chunk-NAYD76QF.cjs.map +1 -0
  30. package/dist/{chunk-L232U757.js → chunk-Q52ZQFMB.js} +249 -3
  31. package/dist/chunk-Q52ZQFMB.js.map +1 -0
  32. package/dist/{chunk-NMVOTNSL.js → chunk-RRKXFGIO.js} +28 -16
  33. package/dist/chunk-RRKXFGIO.js.map +1 -0
  34. package/dist/{chunk-YTMFJLJZ.cjs → chunk-TT266RYM.cjs} +5 -3
  35. package/dist/chunk-TT266RYM.cjs.map +1 -0
  36. package/dist/collection-config-FLlGtsh9.d.cts +107 -0
  37. package/dist/collection-config-FLlGtsh9.d.ts +107 -0
  38. package/dist/filter-bar.template-By4jeiw_.d.cts +140 -0
  39. package/dist/filter-bar.template-By4jeiw_.d.ts +140 -0
  40. package/dist/index.cjs +146 -165
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +44 -0
  43. package/dist/index.d.ts +43 -5
  44. package/dist/index.js +19 -14
  45. package/dist/index.js.map +1 -1
  46. package/dist/middleware.cjs +24 -33
  47. package/dist/middleware.d.cts +89 -0
  48. package/dist/middleware.d.ts +89 -2
  49. package/dist/middleware.js +3 -4
  50. package/dist/migrations-B2CDNN76.js +4 -0
  51. package/dist/{migrations-IHERIQVD.js.map → migrations-B2CDNN76.js.map} +1 -1
  52. package/dist/migrations-IBKKBIKR.cjs +13 -0
  53. package/dist/{migrations-POFD5KNG.cjs.map → migrations-IBKKBIKR.cjs.map} +1 -1
  54. package/dist/plugin-bootstrap-C0E3jdz-.d.cts +8339 -0
  55. package/dist/plugin-bootstrap-CDh0JHtW.d.ts +8339 -0
  56. package/dist/plugin-manifest-BCMx9CAq.d.cts +35 -0
  57. package/dist/plugin-manifest-BCMx9CAq.d.ts +35 -0
  58. package/dist/plugin-zvZpaiP5.d.cts +357 -0
  59. package/dist/plugin-zvZpaiP5.d.ts +357 -0
  60. package/dist/plugins.cjs +7 -7
  61. package/dist/plugins.d.cts +330 -0
  62. package/dist/plugins.d.ts +330 -2
  63. package/dist/plugins.js +1 -1
  64. package/dist/routes.cjs +27 -27
  65. package/dist/routes.d.cts +224 -0
  66. package/dist/routes.d.ts +224 -2
  67. package/dist/routes.js +7 -7
  68. package/dist/services.cjs +41 -41
  69. package/dist/services.d.cts +236 -0
  70. package/dist/services.d.ts +236 -2
  71. package/dist/services.js +4 -4
  72. package/dist/telemetry-BFBIjBxK.d.cts +36 -0
  73. package/dist/telemetry-BFBIjBxK.d.ts +36 -0
  74. package/dist/templates.d.cts +133 -0
  75. package/dist/templates.d.ts +133 -2
  76. package/dist/types.d.cts +7 -0
  77. package/dist/types.d.ts +7 -2
  78. package/dist/utils.cjs +27 -27
  79. package/dist/utils.d.cts +53 -0
  80. package/dist/utils.d.ts +53 -2
  81. package/dist/utils.js +2 -2
  82. package/dist/version-vktVAxhe.d.cts +195 -0
  83. package/dist/version-vktVAxhe.d.ts +195 -0
  84. package/migrations/001_initial_schema.sql +1 -1
  85. package/package.json +3 -1
  86. package/dist/chunk-2DIWLDCA.cjs.map +0 -1
  87. package/dist/chunk-AINTFRTC.cjs.map +0 -1
  88. package/dist/chunk-HV2I6API.cjs.map +0 -1
  89. package/dist/chunk-K4Z3IHOK.js.map +0 -1
  90. package/dist/chunk-L232U757.js.map +0 -1
  91. package/dist/chunk-NMVOTNSL.js.map +0 -1
  92. package/dist/chunk-OORGXYDA.js.map +0 -1
  93. package/dist/chunk-R57VFNP3.js.map +0 -1
  94. package/dist/chunk-T7IYBGGO.cjs +0 -746
  95. package/dist/chunk-T7IYBGGO.cjs.map +0 -1
  96. package/dist/chunk-UEYMFNBN.cjs.map +0 -1
  97. package/dist/chunk-WBX5YMTB.cjs.map +0 -1
  98. package/dist/chunk-YTMFJLJZ.cjs.map +0 -1
  99. package/dist/chunk-ZPMFT2JW.js +0 -744
  100. package/dist/chunk-ZPMFT2JW.js.map +0 -1
  101. package/dist/chunk-ZUK55KZB.js.map +0 -1
  102. package/dist/migrations-IHERIQVD.js +0 -4
  103. package/dist/migrations-POFD5KNG.cjs +0 -13
  104. package/migrations/013_code_examples_plugin.sql +0 -177
  105. /package/migrations/{021_add_otp_login.sql → 026_add_otp_login.sql} +0 -0
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Collection Configuration Types
3
+ *
4
+ * These types define the structure for collection configuration files.
5
+ * Collections can be defined in TypeScript/JSON files and synced to the database.
6
+ */
7
+ type FieldType = 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'email' | 'url' | 'richtext' | 'markdown' | 'json' | 'array' | 'object' | 'reference' | 'media' | 'select' | 'multiselect' | 'checkbox' | 'radio' | 'textarea' | 'slug' | 'color' | 'file';
8
+ interface FieldConfig {
9
+ type: FieldType;
10
+ title?: string;
11
+ description?: string;
12
+ required?: boolean;
13
+ default?: any;
14
+ placeholder?: string;
15
+ helpText?: string;
16
+ min?: number;
17
+ max?: number;
18
+ minLength?: number;
19
+ maxLength?: number;
20
+ pattern?: string;
21
+ enum?: string[];
22
+ enumLabels?: string[];
23
+ collection?: string;
24
+ items?: FieldConfig;
25
+ properties?: Record<string, FieldConfig>;
26
+ format?: string;
27
+ widget?: string;
28
+ dependsOn?: string;
29
+ showWhen?: any;
30
+ }
31
+ interface CollectionSchema {
32
+ type: 'object';
33
+ properties: Record<string, FieldConfig>;
34
+ required?: string[];
35
+ }
36
+ interface CollectionConfig {
37
+ /**
38
+ * Unique machine name for the collection (lowercase, underscores)
39
+ * e.g., 'blog_posts', 'products', 'team_members'
40
+ */
41
+ name: string;
42
+ /**
43
+ * Human-readable display name
44
+ * e.g., 'Blog Posts', 'Products', 'Team Members'
45
+ */
46
+ displayName: string;
47
+ /**
48
+ * Optional description of the collection
49
+ */
50
+ description?: string;
51
+ /**
52
+ * JSON schema definition for the collection's content structure
53
+ */
54
+ schema: CollectionSchema;
55
+ /**
56
+ * If true, this collection is managed by config files and cannot be edited in the UI
57
+ * Default: true for config-based collections
58
+ */
59
+ managed?: boolean;
60
+ /**
61
+ * If true, the collection is active and available for use
62
+ * Default: true
63
+ */
64
+ isActive?: boolean;
65
+ /**
66
+ * Optional icon name for the collection (used in admin UI)
67
+ */
68
+ icon?: string;
69
+ /**
70
+ * Optional color for the collection (hex code)
71
+ */
72
+ color?: string;
73
+ /**
74
+ * Optional default sort field
75
+ */
76
+ defaultSort?: string;
77
+ /**
78
+ * Optional default sort order
79
+ */
80
+ defaultSortOrder?: 'asc' | 'desc';
81
+ /**
82
+ * Optional fields to show in list view
83
+ */
84
+ listFields?: string[];
85
+ /**
86
+ * Optional search fields
87
+ */
88
+ searchFields?: string[];
89
+ /**
90
+ * Optional metadata
91
+ */
92
+ metadata?: Record<string, any>;
93
+ }
94
+ interface CollectionConfigModule {
95
+ default: CollectionConfig;
96
+ }
97
+ /**
98
+ * Result of syncing a collection
99
+ */
100
+ interface CollectionSyncResult {
101
+ name: string;
102
+ status: 'created' | 'updated' | 'unchanged' | 'error';
103
+ message?: string;
104
+ error?: string;
105
+ }
106
+
107
+ export type { CollectionSchema as C, FieldType as F, FieldConfig as a, CollectionConfig as b, CollectionConfigModule as c, CollectionSyncResult as d };
@@ -0,0 +1,140 @@
1
+ interface FormField {
2
+ name: string;
3
+ label: string;
4
+ type: 'text' | 'email' | 'textarea' | 'select' | 'checkbox' | 'rich_text' | 'number' | 'date' | 'multi_select' | 'file';
5
+ value?: any;
6
+ placeholder?: string;
7
+ required?: boolean;
8
+ readonly?: boolean;
9
+ helpText?: string;
10
+ options?: Array<{
11
+ value: string;
12
+ label: string;
13
+ selected?: boolean;
14
+ }>;
15
+ rows?: number;
16
+ className?: string;
17
+ validation?: {
18
+ min?: number;
19
+ max?: number;
20
+ pattern?: string;
21
+ };
22
+ }
23
+ interface FormData {
24
+ id?: string;
25
+ action?: string;
26
+ method?: string;
27
+ hxPost?: string;
28
+ hxPut?: string;
29
+ hxTarget?: string;
30
+ fields: FormField[];
31
+ submitButtons: Array<{
32
+ label: string;
33
+ type?: 'submit' | 'button';
34
+ value?: string;
35
+ name?: string;
36
+ className?: string;
37
+ onclick?: string;
38
+ }>;
39
+ title?: string;
40
+ description?: string;
41
+ className?: string;
42
+ }
43
+ declare function renderForm(data: FormData): string;
44
+ declare function renderFormField(field: FormField): string;
45
+
46
+ interface TableColumn {
47
+ key: string;
48
+ label: string;
49
+ sortable?: boolean;
50
+ className?: string;
51
+ sortType?: 'string' | 'number' | 'date' | 'boolean';
52
+ render?: (value: any, row: any) => string;
53
+ }
54
+ interface TableData<T = any> {
55
+ columns: TableColumn[];
56
+ rows: T[];
57
+ selectable?: boolean;
58
+ className?: string;
59
+ emptyMessage?: string;
60
+ tableId?: string;
61
+ title?: string;
62
+ rowClickable?: boolean;
63
+ rowClickUrl?: (row: T) => string;
64
+ }
65
+ declare function renderTable<T = any>(data: TableData<T>): string;
66
+
67
+ interface PaginationData {
68
+ currentPage: number;
69
+ totalPages: number;
70
+ totalItems: number;
71
+ itemsPerPage: number;
72
+ startItem: number;
73
+ endItem: number;
74
+ baseUrl: string;
75
+ queryParams?: Record<string, string>;
76
+ showPageNumbers?: boolean;
77
+ maxPageNumbers?: number;
78
+ showPageSizeSelector?: boolean;
79
+ pageSizeOptions?: number[];
80
+ }
81
+ declare function renderPagination(data: PaginationData): string;
82
+
83
+ type AlertType = 'success' | 'error' | 'warning' | 'info';
84
+ interface AlertData {
85
+ type: AlertType;
86
+ title?: string;
87
+ message: string;
88
+ dismissible?: boolean;
89
+ className?: string;
90
+ icon?: boolean;
91
+ }
92
+ declare function renderAlert(data: AlertData): string;
93
+
94
+ interface ConfirmationDialogOptions {
95
+ id: string;
96
+ title: string;
97
+ message: string;
98
+ confirmText?: string;
99
+ cancelText?: string;
100
+ confirmClass?: string;
101
+ iconColor?: 'red' | 'yellow' | 'blue';
102
+ onConfirm?: string;
103
+ }
104
+ declare function renderConfirmationDialog(options: ConfirmationDialogOptions): string;
105
+ /**
106
+ * Helper function to show a confirmation dialog programmatically
107
+ * Usage in templates: Add this script and call showConfirmDialog()
108
+ */
109
+ declare function getConfirmationDialogScript(): string;
110
+
111
+ interface FilterOption {
112
+ value: string;
113
+ label: string;
114
+ selected?: boolean;
115
+ color?: string;
116
+ }
117
+ interface Filter {
118
+ name: string;
119
+ label: string;
120
+ options: FilterOption[];
121
+ }
122
+ interface FilterBarData {
123
+ filters: Filter[];
124
+ actions?: Array<{
125
+ label: string;
126
+ className?: string;
127
+ onclick?: string;
128
+ hxGet?: string;
129
+ hxTarget?: string;
130
+ }>;
131
+ bulkActions?: Array<{
132
+ label: string;
133
+ value: string;
134
+ icon?: string;
135
+ className?: string;
136
+ }>;
137
+ }
138
+ declare function renderFilterBar(data: FilterBarData): string;
139
+
140
+ export { type AlertData as A, type ConfirmationDialogOptions as C, type FormField as F, type PaginationData as P, type TableColumn as T, renderFormField as a, renderTable as b, renderPagination as c, renderAlert as d, renderConfirmationDialog as e, renderFilterBar as f, getConfirmationDialogScript as g, type FormData as h, type TableData as i, type FilterBarData as j, type Filter as k, type FilterOption as l, renderForm as r };
@@ -0,0 +1,140 @@
1
+ interface FormField {
2
+ name: string;
3
+ label: string;
4
+ type: 'text' | 'email' | 'textarea' | 'select' | 'checkbox' | 'rich_text' | 'number' | 'date' | 'multi_select' | 'file';
5
+ value?: any;
6
+ placeholder?: string;
7
+ required?: boolean;
8
+ readonly?: boolean;
9
+ helpText?: string;
10
+ options?: Array<{
11
+ value: string;
12
+ label: string;
13
+ selected?: boolean;
14
+ }>;
15
+ rows?: number;
16
+ className?: string;
17
+ validation?: {
18
+ min?: number;
19
+ max?: number;
20
+ pattern?: string;
21
+ };
22
+ }
23
+ interface FormData {
24
+ id?: string;
25
+ action?: string;
26
+ method?: string;
27
+ hxPost?: string;
28
+ hxPut?: string;
29
+ hxTarget?: string;
30
+ fields: FormField[];
31
+ submitButtons: Array<{
32
+ label: string;
33
+ type?: 'submit' | 'button';
34
+ value?: string;
35
+ name?: string;
36
+ className?: string;
37
+ onclick?: string;
38
+ }>;
39
+ title?: string;
40
+ description?: string;
41
+ className?: string;
42
+ }
43
+ declare function renderForm(data: FormData): string;
44
+ declare function renderFormField(field: FormField): string;
45
+
46
+ interface TableColumn {
47
+ key: string;
48
+ label: string;
49
+ sortable?: boolean;
50
+ className?: string;
51
+ sortType?: 'string' | 'number' | 'date' | 'boolean';
52
+ render?: (value: any, row: any) => string;
53
+ }
54
+ interface TableData<T = any> {
55
+ columns: TableColumn[];
56
+ rows: T[];
57
+ selectable?: boolean;
58
+ className?: string;
59
+ emptyMessage?: string;
60
+ tableId?: string;
61
+ title?: string;
62
+ rowClickable?: boolean;
63
+ rowClickUrl?: (row: T) => string;
64
+ }
65
+ declare function renderTable<T = any>(data: TableData<T>): string;
66
+
67
+ interface PaginationData {
68
+ currentPage: number;
69
+ totalPages: number;
70
+ totalItems: number;
71
+ itemsPerPage: number;
72
+ startItem: number;
73
+ endItem: number;
74
+ baseUrl: string;
75
+ queryParams?: Record<string, string>;
76
+ showPageNumbers?: boolean;
77
+ maxPageNumbers?: number;
78
+ showPageSizeSelector?: boolean;
79
+ pageSizeOptions?: number[];
80
+ }
81
+ declare function renderPagination(data: PaginationData): string;
82
+
83
+ type AlertType = 'success' | 'error' | 'warning' | 'info';
84
+ interface AlertData {
85
+ type: AlertType;
86
+ title?: string;
87
+ message: string;
88
+ dismissible?: boolean;
89
+ className?: string;
90
+ icon?: boolean;
91
+ }
92
+ declare function renderAlert(data: AlertData): string;
93
+
94
+ interface ConfirmationDialogOptions {
95
+ id: string;
96
+ title: string;
97
+ message: string;
98
+ confirmText?: string;
99
+ cancelText?: string;
100
+ confirmClass?: string;
101
+ iconColor?: 'red' | 'yellow' | 'blue';
102
+ onConfirm?: string;
103
+ }
104
+ declare function renderConfirmationDialog(options: ConfirmationDialogOptions): string;
105
+ /**
106
+ * Helper function to show a confirmation dialog programmatically
107
+ * Usage in templates: Add this script and call showConfirmDialog()
108
+ */
109
+ declare function getConfirmationDialogScript(): string;
110
+
111
+ interface FilterOption {
112
+ value: string;
113
+ label: string;
114
+ selected?: boolean;
115
+ color?: string;
116
+ }
117
+ interface Filter {
118
+ name: string;
119
+ label: string;
120
+ options: FilterOption[];
121
+ }
122
+ interface FilterBarData {
123
+ filters: Filter[];
124
+ actions?: Array<{
125
+ label: string;
126
+ className?: string;
127
+ onclick?: string;
128
+ hxGet?: string;
129
+ hxTarget?: string;
130
+ }>;
131
+ bulkActions?: Array<{
132
+ label: string;
133
+ value: string;
134
+ icon?: string;
135
+ className?: string;
136
+ }>;
137
+ }
138
+ declare function renderFilterBar(data: FilterBarData): string;
139
+
140
+ export { type AlertData as A, type ConfirmationDialogOptions as C, type FormField as F, type PaginationData as P, type TableColumn as T, renderFormField as a, renderTable as b, renderPagination as c, renderAlert as d, renderConfirmationDialog as e, renderFilterBar as f, getConfirmationDialogScript as g, type FormData as h, type TableData as i, type FilterBarData as j, type Filter as k, type FilterOption as l, renderForm as r };