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.
- package/dist/chunk-CE7E5MAB.js +2716 -0
- package/dist/chunk-CE7E5MAB.js.map +1 -0
- package/dist/chunk-GGD7I4JO.js +253 -0
- package/dist/chunk-GGD7I4JO.js.map +1 -0
- package/dist/chunk-KCQJHXZP.js +67 -0
- package/dist/chunk-KCQJHXZP.js.map +1 -0
- package/dist/cli/index.js +242 -0
- package/dist/components/index.d.ts +154 -0
- package/dist/components/index.js +47 -0
- package/dist/components/index.js.map +1 -0
- package/dist/handlers/index.d.ts +253 -0
- package/dist/handlers/index.js +587 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/index-CIX0MBHm.d.ts +180 -0
- package/dist/index.d.ts +130 -0
- package/dist/index.js +495 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/index.d.ts +4 -0
- package/dist/providers/index.js +28 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/styles/gavaengine.css +733 -0
- package/dist/types-BZgSeTU8.d.ts +101 -0
- package/package.json +103 -0
- package/src/prisma/schema.partial.prisma +76 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { G as GEActions } from './types-BZgSeTU8.js';
|
|
4
|
+
|
|
5
|
+
interface GavaEngineConfig {
|
|
6
|
+
branding: {
|
|
7
|
+
name: string;
|
|
8
|
+
logo?: string;
|
|
9
|
+
splashWords: string[];
|
|
10
|
+
};
|
|
11
|
+
roles: {
|
|
12
|
+
list: string[];
|
|
13
|
+
labels: Record<string, string>;
|
|
14
|
+
canEdit: (role: string) => boolean;
|
|
15
|
+
canPublish: (role: string) => boolean;
|
|
16
|
+
adminRole: string;
|
|
17
|
+
};
|
|
18
|
+
categories: string[];
|
|
19
|
+
upload: {
|
|
20
|
+
endpoint: string;
|
|
21
|
+
imageTypes: string[];
|
|
22
|
+
videoTypes: string[];
|
|
23
|
+
maxImageSize: number;
|
|
24
|
+
maxVideoSize: number;
|
|
25
|
+
};
|
|
26
|
+
editor: {
|
|
27
|
+
placeholder: string;
|
|
28
|
+
autoSaveDelay: number;
|
|
29
|
+
revisionThrottleMinutes: number;
|
|
30
|
+
headingLevels: number[];
|
|
31
|
+
};
|
|
32
|
+
routes: {
|
|
33
|
+
articles: string;
|
|
34
|
+
articleEdit: (id: string) => string;
|
|
35
|
+
articleNew: string;
|
|
36
|
+
articleView: (slug: string) => string;
|
|
37
|
+
articlePreview: (id: string) => string;
|
|
38
|
+
users: string;
|
|
39
|
+
userEdit: (id: string) => string;
|
|
40
|
+
userNew: string;
|
|
41
|
+
media: string;
|
|
42
|
+
dashboard: string;
|
|
43
|
+
login: string;
|
|
44
|
+
home: string;
|
|
45
|
+
};
|
|
46
|
+
strings: {
|
|
47
|
+
articles: string;
|
|
48
|
+
newArticle: string;
|
|
49
|
+
media: string;
|
|
50
|
+
users: string;
|
|
51
|
+
statistics: string;
|
|
52
|
+
settings: string;
|
|
53
|
+
revisions: string;
|
|
54
|
+
publish: string;
|
|
55
|
+
unpublish: string;
|
|
56
|
+
saveDraft: string;
|
|
57
|
+
delete: string;
|
|
58
|
+
edit: string;
|
|
59
|
+
search: string;
|
|
60
|
+
titlePlaceholder: string;
|
|
61
|
+
excerptPlaceholder: string;
|
|
62
|
+
slugPlaceholder: string;
|
|
63
|
+
authorPlaceholder: string;
|
|
64
|
+
category: string;
|
|
65
|
+
selectCategory: string;
|
|
66
|
+
excerpt: string;
|
|
67
|
+
author: string;
|
|
68
|
+
slugUrl: string;
|
|
69
|
+
draft: string;
|
|
70
|
+
published: string;
|
|
71
|
+
all: string;
|
|
72
|
+
drafts: string;
|
|
73
|
+
saving: string;
|
|
74
|
+
saved: string;
|
|
75
|
+
saveError: string;
|
|
76
|
+
noArticles: string;
|
|
77
|
+
noArticlesSearch: string;
|
|
78
|
+
noMedia: string;
|
|
79
|
+
noMediaSearch: string;
|
|
80
|
+
noRevisions: string;
|
|
81
|
+
loading: string;
|
|
82
|
+
confirm: string;
|
|
83
|
+
cancel: string;
|
|
84
|
+
apply: string;
|
|
85
|
+
change: string;
|
|
86
|
+
logout: string;
|
|
87
|
+
viewArticle: string;
|
|
88
|
+
preview: string;
|
|
89
|
+
restore: string;
|
|
90
|
+
restoreConfirm: string;
|
|
91
|
+
beforeRestore: string;
|
|
92
|
+
publishedNote: string;
|
|
93
|
+
deleteConfirm: (title: string) => string;
|
|
94
|
+
unpublishConfirm: (title: string) => string;
|
|
95
|
+
deleteUserConfirm: (name: string) => string;
|
|
96
|
+
totalArticles: (count: number) => string;
|
|
97
|
+
totalFiles: (count: number) => string;
|
|
98
|
+
coverImageLabel: string;
|
|
99
|
+
coverImageHint: string;
|
|
100
|
+
chooseFile: string;
|
|
101
|
+
dragHint: string;
|
|
102
|
+
uploadHint: string;
|
|
103
|
+
mediaLibrary: string;
|
|
104
|
+
uploadNew: string;
|
|
105
|
+
searchFiles: string;
|
|
106
|
+
searchArticles: string;
|
|
107
|
+
selectImage: string;
|
|
108
|
+
noImages: string;
|
|
109
|
+
noImagesSearch: string;
|
|
110
|
+
copyUrl: string;
|
|
111
|
+
editImage: string;
|
|
112
|
+
restoreOriginal: string;
|
|
113
|
+
freeAspect: string;
|
|
114
|
+
unauthorized: string;
|
|
115
|
+
notAuthenticated: string;
|
|
116
|
+
allFieldsRequired: string;
|
|
117
|
+
passwordMinLength: string;
|
|
118
|
+
emailExists: string;
|
|
119
|
+
invalidRole: string;
|
|
120
|
+
cannotDeleteSelf: string;
|
|
121
|
+
name: string;
|
|
122
|
+
email: string;
|
|
123
|
+
password: string;
|
|
124
|
+
passwordEditHint: string;
|
|
125
|
+
role: string;
|
|
126
|
+
createdAt: string;
|
|
127
|
+
actions: string;
|
|
128
|
+
createUser: string;
|
|
129
|
+
saveChanges: string;
|
|
130
|
+
updated: string;
|
|
131
|
+
status: string;
|
|
132
|
+
title: string;
|
|
133
|
+
untitled: string;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
declare const DEFAULT_CONFIG: GavaEngineConfig;
|
|
137
|
+
declare function defineConfig(overrides?: Partial<GavaEngineConfig>): GavaEngineConfig;
|
|
138
|
+
|
|
139
|
+
interface GavaEngineProviderProps {
|
|
140
|
+
config: GavaEngineConfig;
|
|
141
|
+
actions: GEActions;
|
|
142
|
+
children: ReactNode;
|
|
143
|
+
}
|
|
144
|
+
declare function GavaEngineProvider({ config, actions, children, }: GavaEngineProviderProps): react_jsx_runtime.JSX.Element;
|
|
145
|
+
|
|
146
|
+
declare function useGavaConfig(): GavaEngineConfig;
|
|
147
|
+
declare function ConfigProvider({ config, children, }: {
|
|
148
|
+
config: GavaEngineConfig;
|
|
149
|
+
children: ReactNode;
|
|
150
|
+
}): react_jsx_runtime.JSX.Element;
|
|
151
|
+
|
|
152
|
+
declare function useGavaActions(): GEActions;
|
|
153
|
+
declare function ActionsProvider({ actions, children, }: {
|
|
154
|
+
actions: GEActions;
|
|
155
|
+
children: ReactNode;
|
|
156
|
+
}): react_jsx_runtime.JSX.Element;
|
|
157
|
+
|
|
158
|
+
type Phase = "idle" | "closing" | "closed" | "opening";
|
|
159
|
+
interface SplashContextValue {
|
|
160
|
+
phase: Phase;
|
|
161
|
+
navigateWithSplash: (url: string) => void;
|
|
162
|
+
openSplash: () => void;
|
|
163
|
+
}
|
|
164
|
+
declare function useSplash(): SplashContextValue;
|
|
165
|
+
declare function SplashProvider({ children, navigate, }: {
|
|
166
|
+
children: ReactNode;
|
|
167
|
+
navigate: (url: string) => void;
|
|
168
|
+
}): react_jsx_runtime.JSX.Element;
|
|
169
|
+
|
|
170
|
+
declare function SessionProvider({ children }: {
|
|
171
|
+
children: ReactNode;
|
|
172
|
+
}): react_jsx_runtime.JSX.Element;
|
|
173
|
+
|
|
174
|
+
declare function ThemeProvider({ children }: {
|
|
175
|
+
children: ReactNode;
|
|
176
|
+
}): react_jsx_runtime.JSX.Element;
|
|
177
|
+
|
|
178
|
+
declare function ThemeToggle(): react_jsx_runtime.JSX.Element;
|
|
179
|
+
|
|
180
|
+
export { ActionsProvider as A, ConfigProvider as C, DEFAULT_CONFIG as D, type GavaEngineConfig as G, SessionProvider as S, ThemeProvider as T, GavaEngineProvider as a, SplashProvider as b, ThemeToggle as c, defineConfig as d, useGavaConfig as e, useSplash as f, useGavaActions as u };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { G as GavaEngineConfig } from './index-CIX0MBHm.js';
|
|
2
|
+
export { A as ActionsProvider, C as ConfigProvider, D as DEFAULT_CONFIG, a as GavaEngineProvider, S as SessionProvider, b as SplashProvider, T as ThemeProvider, c as ThemeToggle, d as defineConfig, u as useGavaActions, e as useGavaConfig, f as useSplash } from './index-CIX0MBHm.js';
|
|
3
|
+
export { G as GEActions, a as GEArticle, b as GEMedia, c as GERevision, d as GESession, e as GEUser } from './types-BZgSeTU8.js';
|
|
4
|
+
export { ArticleEditor, ArticleList, CoverImageUpload, DashboardNavbar, DashboardSplashTrigger, DraggableYoutube, DraggableYoutubeView, EditorToolbar, ImageEditModal, MediaGrid, MediaPickerModal, ResizableImage, ResizableImageView, RevisionPanel, SplashScreen, StatCard, UserForm, UserTable, VideoExtension, VideoView } from './components/index.js';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@tiptap/react';
|
|
8
|
+
import '@tiptap/core';
|
|
9
|
+
import '@tiptap/extension-youtube';
|
|
10
|
+
import 'lucide-react';
|
|
11
|
+
|
|
12
|
+
declare function createArticleHandlers(prisma: any, config: GavaEngineConfig): {
|
|
13
|
+
getArticles(): Promise<any>;
|
|
14
|
+
getArticleById(id: string): Promise<any>;
|
|
15
|
+
createArticle(authorName: string): Promise<any>;
|
|
16
|
+
updateArticle(userId: string, id: string, data: {
|
|
17
|
+
title?: string;
|
|
18
|
+
slug?: string;
|
|
19
|
+
excerpt?: string;
|
|
20
|
+
content?: string;
|
|
21
|
+
coverImage?: string;
|
|
22
|
+
category?: string;
|
|
23
|
+
authorName?: string;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
success: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
deleteArticle(id: string): Promise<{
|
|
28
|
+
success: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
publishArticle(userId: string, id: string): Promise<{
|
|
31
|
+
success: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
unpublishArticle(id: string): Promise<{
|
|
34
|
+
success: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
declare function createRevisionHandlers(prisma: any, config: GavaEngineConfig): {
|
|
39
|
+
getRevisions(articleId: string): Promise<any>;
|
|
40
|
+
restoreRevision(articleId: string, revisionId: string, editorId: string): Promise<{
|
|
41
|
+
success: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
createRevisionSnapshot(articleId: string, editorId: string, note?: string): Promise<void>;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
declare function createUserHandlers(prisma: any, config: GavaEngineConfig): {
|
|
47
|
+
getUsers(): Promise<any>;
|
|
48
|
+
getUserById(id: string): Promise<any>;
|
|
49
|
+
createUser(formData: FormData): Promise<{
|
|
50
|
+
error: string;
|
|
51
|
+
success?: undefined;
|
|
52
|
+
} | {
|
|
53
|
+
success: boolean;
|
|
54
|
+
error?: undefined;
|
|
55
|
+
}>;
|
|
56
|
+
updateUser(id: string, formData: FormData): Promise<{
|
|
57
|
+
error: string;
|
|
58
|
+
success?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
success: boolean;
|
|
61
|
+
error?: undefined;
|
|
62
|
+
}>;
|
|
63
|
+
deleteUser(currentUserId: string, id: string): Promise<{
|
|
64
|
+
error: string;
|
|
65
|
+
success?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
success: boolean;
|
|
68
|
+
error?: undefined;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
declare function createMediaHandlers(prisma: any, _config: GavaEngineConfig): {
|
|
73
|
+
getMedia(search?: string): Promise<any>;
|
|
74
|
+
deleteMedia(userId: string, userRole: string, id: string, deleteFileFromDisk?: (path: string) => Promise<void>): Promise<{
|
|
75
|
+
success: boolean;
|
|
76
|
+
}>;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
interface UploadResult {
|
|
80
|
+
url?: string;
|
|
81
|
+
error?: string;
|
|
82
|
+
}
|
|
83
|
+
interface FileStorage {
|
|
84
|
+
save(filename: string, buffer: Buffer, mimeType: string): Promise<string>;
|
|
85
|
+
}
|
|
86
|
+
declare function createUploadHandler(prisma: any, config: GavaEngineConfig, storage: FileStorage): {
|
|
87
|
+
handleUpload(file: {
|
|
88
|
+
name: string;
|
|
89
|
+
type: string;
|
|
90
|
+
size: number;
|
|
91
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
92
|
+
}, uploaderId: string): Promise<UploadResult>;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
declare function buildCredentialsProvider(prisma: any): {
|
|
96
|
+
credentials: {
|
|
97
|
+
email: {};
|
|
98
|
+
password: {};
|
|
99
|
+
};
|
|
100
|
+
authorize(credentials: Record<string, unknown>): Promise<{
|
|
101
|
+
id: any;
|
|
102
|
+
name: any;
|
|
103
|
+
email: any;
|
|
104
|
+
role: any;
|
|
105
|
+
} | null>;
|
|
106
|
+
};
|
|
107
|
+
declare function buildAuthCallbacks(config: GavaEngineConfig): {
|
|
108
|
+
jwt({ token, user, }: {
|
|
109
|
+
token: Record<string, unknown>;
|
|
110
|
+
user?: Record<string, unknown>;
|
|
111
|
+
}): Promise<Record<string, unknown>>;
|
|
112
|
+
session({ session, token, }: {
|
|
113
|
+
session: Record<string, any>;
|
|
114
|
+
token: Record<string, unknown>;
|
|
115
|
+
}): Promise<Record<string, any>>;
|
|
116
|
+
authorized({ auth, request: { nextUrl }, }: {
|
|
117
|
+
auth: Record<string, any> | null;
|
|
118
|
+
request: {
|
|
119
|
+
nextUrl: URL;
|
|
120
|
+
};
|
|
121
|
+
}): true | Response;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
declare function createAuthUtils(config: GavaEngineConfig): {
|
|
125
|
+
canEdit(role: string): boolean;
|
|
126
|
+
canPublish(role: string): boolean;
|
|
127
|
+
isAdmin(role: string): boolean;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export { type FileStorage, GavaEngineConfig, type UploadResult, buildAuthCallbacks, buildCredentialsProvider, createArticleHandlers, createAuthUtils, createMediaHandlers, createRevisionHandlers, createUploadHandler, createUserHandlers };
|