gavaengine 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,154 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Editor, NodeViewProps } from '@tiptap/react';
3
+ import * as _tiptap_core from '@tiptap/core';
4
+ import { Node } from '@tiptap/core';
5
+ import * as _tiptap_extension_youtube from '@tiptap/extension-youtube';
6
+ import { b as GEMedia } from '../types-BZgSeTU8.js';
7
+ import { LucideIcon } from 'lucide-react';
8
+
9
+ interface ArticleData {
10
+ id: string;
11
+ title: string;
12
+ slug: string;
13
+ excerpt: string;
14
+ content: string;
15
+ coverImage: string;
16
+ category: string;
17
+ status: string;
18
+ authorName: string;
19
+ }
20
+ interface ArticleEditorProps {
21
+ article: ArticleData;
22
+ canPublish: boolean;
23
+ }
24
+ declare function ArticleEditor({ article, canPublish: canPub }: ArticleEditorProps): react_jsx_runtime.JSX.Element;
25
+
26
+ interface EditorToolbarProps {
27
+ editor: Editor | null;
28
+ }
29
+ declare function EditorToolbar({ editor }: EditorToolbarProps): react_jsx_runtime.JSX.Element | null;
30
+
31
+ interface CoverImageUploadProps {
32
+ value: string;
33
+ onChange: (url: string) => void;
34
+ }
35
+ declare function CoverImageUpload({ value, onChange }: CoverImageUploadProps): react_jsx_runtime.JSX.Element;
36
+
37
+ interface RevisionPanelProps {
38
+ articleId: string;
39
+ onClose: () => void;
40
+ onRestore: () => void;
41
+ }
42
+ declare function RevisionPanel({ articleId, onClose, onRestore, }: RevisionPanelProps): react_jsx_runtime.JSX.Element;
43
+
44
+ interface ImageEditModalProps {
45
+ src: string;
46
+ originalSrc?: string | null;
47
+ onSave: (newUrl: string) => void;
48
+ onRestore?: () => void;
49
+ onClose: () => void;
50
+ }
51
+ declare function ImageEditModal({ src, originalSrc, onSave, onRestore, onClose, }: ImageEditModalProps): react_jsx_runtime.JSX.Element;
52
+
53
+ interface ImageOptions {
54
+ HTMLAttributes: Record<string, any>;
55
+ }
56
+ declare module "@tiptap/core" {
57
+ interface Commands<ReturnType> {
58
+ resizableImage: {
59
+ setImage: (options: {
60
+ src: string;
61
+ alt?: string;
62
+ title?: string;
63
+ }) => ReturnType;
64
+ };
65
+ }
66
+ }
67
+ declare const ResizableImage: Node<ImageOptions, any>;
68
+
69
+ declare function ResizableImageView({ node, updateAttributes, selected, deleteNode, }: NodeViewProps): react_jsx_runtime.JSX.Element;
70
+
71
+ declare const DraggableYoutube: _tiptap_core.Node<_tiptap_extension_youtube.YoutubeOptions, any>;
72
+
73
+ declare function DraggableYoutubeView({ node, selected }: NodeViewProps): react_jsx_runtime.JSX.Element;
74
+
75
+ declare module "@tiptap/core" {
76
+ interface Commands<ReturnType> {
77
+ videoBlock: {
78
+ setVideo: (options: {
79
+ src: string;
80
+ }) => ReturnType;
81
+ };
82
+ }
83
+ }
84
+ declare const VideoExtension: Node<any, any>;
85
+
86
+ declare function VideoView({ node, selected }: NodeViewProps): react_jsx_runtime.JSX.Element;
87
+
88
+ interface Article {
89
+ id: string;
90
+ title: string;
91
+ status: string;
92
+ category: string;
93
+ coverImage: string;
94
+ authorName: string;
95
+ updatedAt: Date;
96
+ publishedAt: Date | null;
97
+ }
98
+ interface ArticleListProps {
99
+ articles: Article[];
100
+ canCreate: boolean;
101
+ canEdit: boolean;
102
+ canPublish: boolean;
103
+ }
104
+ declare function ArticleList({ articles, canCreate, canEdit, canPublish: canPub, }: ArticleListProps): react_jsx_runtime.JSX.Element;
105
+
106
+ type User = {
107
+ id: string;
108
+ name: string;
109
+ email: string;
110
+ role: string;
111
+ createdAt: Date;
112
+ };
113
+ declare function UserTable({ users, currentUserId, }: {
114
+ users: User[];
115
+ currentUserId: string;
116
+ }): react_jsx_runtime.JSX.Element;
117
+
118
+ type UserData = {
119
+ id: string;
120
+ name: string;
121
+ email: string;
122
+ role: string;
123
+ } | null;
124
+ declare function UserForm({ user }: {
125
+ user?: UserData;
126
+ }): react_jsx_runtime.JSX.Element;
127
+
128
+ interface MediaGridProps {
129
+ media: GEMedia[];
130
+ }
131
+ declare function MediaGrid({ media }: MediaGridProps): react_jsx_runtime.JSX.Element;
132
+
133
+ interface MediaPickerModalProps {
134
+ open: boolean;
135
+ onClose: () => void;
136
+ onSelect: (url: string) => void;
137
+ }
138
+ declare function MediaPickerModal({ open, onClose, onSelect, }: MediaPickerModalProps): react_jsx_runtime.JSX.Element | null;
139
+
140
+ declare function DashboardNavbar(): react_jsx_runtime.JSX.Element;
141
+
142
+ interface StatCardProps {
143
+ label: string;
144
+ value: number | string;
145
+ icon: LucideIcon;
146
+ accent?: "blue" | "green" | "purple" | "amber";
147
+ }
148
+ declare function StatCard({ label, value, icon: Icon, accent, }: StatCardProps): react_jsx_runtime.JSX.Element;
149
+
150
+ declare function SplashScreen(): react_jsx_runtime.JSX.Element | null;
151
+
152
+ declare function DashboardSplashTrigger(): null;
153
+
154
+ export { ArticleEditor, ArticleList, CoverImageUpload, DashboardNavbar, DashboardSplashTrigger, DraggableYoutube, DraggableYoutubeView, EditorToolbar, ImageEditModal, MediaGrid, MediaPickerModal, ResizableImage, ResizableImageView, RevisionPanel, SplashScreen, StatCard, UserForm, UserTable, VideoExtension, VideoView };
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import {
3
+ ArticleEditor,
4
+ ArticleList,
5
+ CoverImageUpload,
6
+ DashboardNavbar,
7
+ DashboardSplashTrigger,
8
+ DraggableYoutube,
9
+ DraggableYoutubeView,
10
+ EditorToolbar,
11
+ ImageEditModal,
12
+ MediaGrid,
13
+ MediaPickerModal,
14
+ ResizableImage,
15
+ ResizableImageView,
16
+ RevisionPanel,
17
+ SplashScreen,
18
+ StatCard,
19
+ UserForm,
20
+ UserTable,
21
+ VideoExtension,
22
+ VideoView
23
+ } from "../chunk-CE7E5MAB.js";
24
+ import "../chunk-GGD7I4JO.js";
25
+ export {
26
+ ArticleEditor,
27
+ ArticleList,
28
+ CoverImageUpload,
29
+ DashboardNavbar,
30
+ DashboardSplashTrigger,
31
+ DraggableYoutube,
32
+ DraggableYoutubeView,
33
+ EditorToolbar,
34
+ ImageEditModal,
35
+ MediaGrid,
36
+ MediaPickerModal,
37
+ ResizableImage,
38
+ ResizableImageView,
39
+ RevisionPanel,
40
+ SplashScreen,
41
+ StatCard,
42
+ UserForm,
43
+ UserTable,
44
+ VideoExtension,
45
+ VideoView
46
+ };
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,253 @@
1
+ interface GavaEngineConfig {
2
+ branding: {
3
+ name: string;
4
+ logo?: string;
5
+ splashWords: string[];
6
+ };
7
+ roles: {
8
+ list: string[];
9
+ labels: Record<string, string>;
10
+ canEdit: (role: string) => boolean;
11
+ canPublish: (role: string) => boolean;
12
+ adminRole: string;
13
+ };
14
+ categories: string[];
15
+ upload: {
16
+ endpoint: string;
17
+ imageTypes: string[];
18
+ videoTypes: string[];
19
+ maxImageSize: number;
20
+ maxVideoSize: number;
21
+ };
22
+ editor: {
23
+ placeholder: string;
24
+ autoSaveDelay: number;
25
+ revisionThrottleMinutes: number;
26
+ headingLevels: number[];
27
+ };
28
+ routes: {
29
+ articles: string;
30
+ articleEdit: (id: string) => string;
31
+ articleNew: string;
32
+ articleView: (slug: string) => string;
33
+ articlePreview: (id: string) => string;
34
+ users: string;
35
+ userEdit: (id: string) => string;
36
+ userNew: string;
37
+ media: string;
38
+ dashboard: string;
39
+ login: string;
40
+ home: string;
41
+ };
42
+ strings: {
43
+ articles: string;
44
+ newArticle: string;
45
+ media: string;
46
+ users: string;
47
+ statistics: string;
48
+ settings: string;
49
+ revisions: string;
50
+ publish: string;
51
+ unpublish: string;
52
+ saveDraft: string;
53
+ delete: string;
54
+ edit: string;
55
+ search: string;
56
+ titlePlaceholder: string;
57
+ excerptPlaceholder: string;
58
+ slugPlaceholder: string;
59
+ authorPlaceholder: string;
60
+ category: string;
61
+ selectCategory: string;
62
+ excerpt: string;
63
+ author: string;
64
+ slugUrl: string;
65
+ draft: string;
66
+ published: string;
67
+ all: string;
68
+ drafts: string;
69
+ saving: string;
70
+ saved: string;
71
+ saveError: string;
72
+ noArticles: string;
73
+ noArticlesSearch: string;
74
+ noMedia: string;
75
+ noMediaSearch: string;
76
+ noRevisions: string;
77
+ loading: string;
78
+ confirm: string;
79
+ cancel: string;
80
+ apply: string;
81
+ change: string;
82
+ logout: string;
83
+ viewArticle: string;
84
+ preview: string;
85
+ restore: string;
86
+ restoreConfirm: string;
87
+ beforeRestore: string;
88
+ publishedNote: string;
89
+ deleteConfirm: (title: string) => string;
90
+ unpublishConfirm: (title: string) => string;
91
+ deleteUserConfirm: (name: string) => string;
92
+ totalArticles: (count: number) => string;
93
+ totalFiles: (count: number) => string;
94
+ coverImageLabel: string;
95
+ coverImageHint: string;
96
+ chooseFile: string;
97
+ dragHint: string;
98
+ uploadHint: string;
99
+ mediaLibrary: string;
100
+ uploadNew: string;
101
+ searchFiles: string;
102
+ searchArticles: string;
103
+ selectImage: string;
104
+ noImages: string;
105
+ noImagesSearch: string;
106
+ copyUrl: string;
107
+ editImage: string;
108
+ restoreOriginal: string;
109
+ freeAspect: string;
110
+ unauthorized: string;
111
+ notAuthenticated: string;
112
+ allFieldsRequired: string;
113
+ passwordMinLength: string;
114
+ emailExists: string;
115
+ invalidRole: string;
116
+ cannotDeleteSelf: string;
117
+ name: string;
118
+ email: string;
119
+ password: string;
120
+ passwordEditHint: string;
121
+ role: string;
122
+ createdAt: string;
123
+ actions: string;
124
+ createUser: string;
125
+ saveChanges: string;
126
+ updated: string;
127
+ status: string;
128
+ title: string;
129
+ untitled: string;
130
+ };
131
+ }
132
+ declare const DEFAULT_CONFIG: GavaEngineConfig;
133
+ declare function defineConfig(overrides?: Partial<GavaEngineConfig>): GavaEngineConfig;
134
+
135
+ declare function createArticleHandlers(prisma: any, config: GavaEngineConfig): {
136
+ getArticles(): Promise<any>;
137
+ getArticleById(id: string): Promise<any>;
138
+ createArticle(authorName: string): Promise<any>;
139
+ updateArticle(userId: string, id: string, data: {
140
+ title?: string;
141
+ slug?: string;
142
+ excerpt?: string;
143
+ content?: string;
144
+ coverImage?: string;
145
+ category?: string;
146
+ authorName?: string;
147
+ }): Promise<{
148
+ success: boolean;
149
+ }>;
150
+ deleteArticle(id: string): Promise<{
151
+ success: boolean;
152
+ }>;
153
+ publishArticle(userId: string, id: string): Promise<{
154
+ success: boolean;
155
+ }>;
156
+ unpublishArticle(id: string): Promise<{
157
+ success: boolean;
158
+ }>;
159
+ };
160
+
161
+ declare function createRevisionHandlers(prisma: any, config: GavaEngineConfig): {
162
+ getRevisions(articleId: string): Promise<any>;
163
+ restoreRevision(articleId: string, revisionId: string, editorId: string): Promise<{
164
+ success: boolean;
165
+ }>;
166
+ createRevisionSnapshot(articleId: string, editorId: string, note?: string): Promise<void>;
167
+ };
168
+
169
+ declare function createUserHandlers(prisma: any, config: GavaEngineConfig): {
170
+ getUsers(): Promise<any>;
171
+ getUserById(id: string): Promise<any>;
172
+ createUser(formData: FormData): Promise<{
173
+ error: string;
174
+ success?: undefined;
175
+ } | {
176
+ success: boolean;
177
+ error?: undefined;
178
+ }>;
179
+ updateUser(id: string, formData: FormData): Promise<{
180
+ error: string;
181
+ success?: undefined;
182
+ } | {
183
+ success: boolean;
184
+ error?: undefined;
185
+ }>;
186
+ deleteUser(currentUserId: string, id: string): Promise<{
187
+ error: string;
188
+ success?: undefined;
189
+ } | {
190
+ success: boolean;
191
+ error?: undefined;
192
+ }>;
193
+ };
194
+
195
+ declare function createMediaHandlers(prisma: any, _config: GavaEngineConfig): {
196
+ getMedia(search?: string): Promise<any>;
197
+ deleteMedia(userId: string, userRole: string, id: string, deleteFileFromDisk?: (path: string) => Promise<void>): Promise<{
198
+ success: boolean;
199
+ }>;
200
+ };
201
+
202
+ interface UploadResult {
203
+ url?: string;
204
+ error?: string;
205
+ }
206
+ interface FileStorage {
207
+ save(filename: string, buffer: Buffer, mimeType: string): Promise<string>;
208
+ }
209
+ declare function createUploadHandler(prisma: any, config: GavaEngineConfig, storage: FileStorage): {
210
+ handleUpload(file: {
211
+ name: string;
212
+ type: string;
213
+ size: number;
214
+ arrayBuffer: () => Promise<ArrayBuffer>;
215
+ }, uploaderId: string): Promise<UploadResult>;
216
+ };
217
+
218
+ declare function buildCredentialsProvider(prisma: any): {
219
+ credentials: {
220
+ email: {};
221
+ password: {};
222
+ };
223
+ authorize(credentials: Record<string, unknown>): Promise<{
224
+ id: any;
225
+ name: any;
226
+ email: any;
227
+ role: any;
228
+ } | null>;
229
+ };
230
+ declare function buildAuthCallbacks(config: GavaEngineConfig): {
231
+ jwt({ token, user, }: {
232
+ token: Record<string, unknown>;
233
+ user?: Record<string, unknown>;
234
+ }): Promise<Record<string, unknown>>;
235
+ session({ session, token, }: {
236
+ session: Record<string, any>;
237
+ token: Record<string, unknown>;
238
+ }): Promise<Record<string, any>>;
239
+ authorized({ auth, request: { nextUrl }, }: {
240
+ auth: Record<string, any> | null;
241
+ request: {
242
+ nextUrl: URL;
243
+ };
244
+ }): true | Response;
245
+ };
246
+
247
+ declare function createAuthUtils(config: GavaEngineConfig): {
248
+ canEdit(role: string): boolean;
249
+ canPublish(role: string): boolean;
250
+ isAdmin(role: string): boolean;
251
+ };
252
+
253
+ export { DEFAULT_CONFIG, type FileStorage, type GavaEngineConfig, type UploadResult, buildAuthCallbacks, buildCredentialsProvider, createArticleHandlers, createAuthUtils, createMediaHandlers, createRevisionHandlers, createUploadHandler, createUserHandlers, defineConfig };