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,101 @@
1
+ interface GEArticle {
2
+ id: string;
3
+ title: string;
4
+ slug: string;
5
+ excerpt: string;
6
+ content: string;
7
+ coverImage: string;
8
+ category: string;
9
+ status: string;
10
+ authorName: string;
11
+ viewCount?: number;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ publishedAt: Date | null;
15
+ }
16
+ interface GEUser {
17
+ id: string;
18
+ name: string;
19
+ email: string;
20
+ role: string;
21
+ createdAt: Date;
22
+ }
23
+ interface GEMedia {
24
+ id: string;
25
+ filename: string;
26
+ path: string;
27
+ mimeType: string;
28
+ size: number;
29
+ createdAt: Date;
30
+ uploader: {
31
+ name: string;
32
+ };
33
+ }
34
+ interface GERevision {
35
+ id: string;
36
+ title: string;
37
+ content: string;
38
+ excerpt: string;
39
+ coverImage: string;
40
+ category: string;
41
+ note: string;
42
+ createdAt: Date;
43
+ editor: {
44
+ name: string;
45
+ };
46
+ }
47
+ interface GESession {
48
+ user: {
49
+ id: string;
50
+ name?: string | null;
51
+ email?: string | null;
52
+ role: string;
53
+ };
54
+ }
55
+ interface GEActions {
56
+ getArticles: () => Promise<GEArticle[]>;
57
+ getArticleById: (id: string) => Promise<GEArticle | null>;
58
+ createArticle: () => Promise<string>;
59
+ updateArticle: (id: string, data: {
60
+ title?: string;
61
+ slug?: string;
62
+ excerpt?: string;
63
+ content?: string;
64
+ coverImage?: string;
65
+ category?: string;
66
+ authorName?: string;
67
+ }) => Promise<{
68
+ success: boolean;
69
+ }>;
70
+ deleteArticle: (id: string) => Promise<{
71
+ success: boolean;
72
+ }>;
73
+ publishArticle: (id: string) => Promise<{
74
+ success: boolean;
75
+ }>;
76
+ unpublishArticle: (id: string) => Promise<{
77
+ success: boolean;
78
+ }>;
79
+ getMedia: (search?: string) => Promise<GEMedia[]>;
80
+ deleteMedia: (id: string) => Promise<{
81
+ success: boolean;
82
+ }>;
83
+ uploadUrl: string;
84
+ getRevisions: (articleId: string) => Promise<GERevision[]>;
85
+ restoreRevision: (articleId: string, revisionId: string) => Promise<{
86
+ success: boolean;
87
+ }>;
88
+ getUsers: () => Promise<GEUser[]>;
89
+ getUserById: (id: string) => Promise<GEUser | null>;
90
+ createUser: (formData: FormData) => Promise<{
91
+ error?: string;
92
+ } | void>;
93
+ updateUser: (id: string, formData: FormData) => Promise<{
94
+ error?: string;
95
+ } | void>;
96
+ deleteUser: (id: string) => Promise<{
97
+ error?: string;
98
+ } | void>;
99
+ }
100
+
101
+ export type { GEActions as G, GEArticle as a, GEMedia as b, GERevision as c, GESession as d, GEUser as e };
package/package.json ADDED
@@ -0,0 +1,103 @@
1
+ {
2
+ "name": "gavaengine",
3
+ "version": "0.1.0",
4
+ "description": "Modular CMS engine — editor, auth, media & user management as React components",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
13
+ "./handlers": {
14
+ "import": "./dist/handlers/index.js",
15
+ "types": "./dist/handlers/index.d.ts"
16
+ },
17
+ "./providers": {
18
+ "import": "./dist/providers/index.js",
19
+ "types": "./dist/providers/index.d.ts"
20
+ },
21
+ "./components": {
22
+ "import": "./dist/components/index.js",
23
+ "types": "./dist/components/index.d.ts"
24
+ },
25
+ "./styles": "./dist/styles/gavaengine.css",
26
+ "./styles/gavaengine.css": "./dist/styles/gavaengine.css"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "src/prisma"
31
+ ],
32
+ "scripts": {
33
+ "build": "node -e \"const fs=require('fs');fs.rmSync('dist',{recursive:true,force:true})\" && tsup && node -e \"const fs=require('fs');fs.mkdirSync('dist/styles',{recursive:true});fs.copyFileSync('src/styles/gavaengine.css','dist/styles/gavaengine.css')\"",
34
+ "prepublishOnly": "npm run build",
35
+ "dev": "tsup --watch",
36
+ "typecheck": "tsc --noEmit"
37
+ },
38
+ "bin": {
39
+ "gavaengine": "./dist/cli/index.js"
40
+ },
41
+ "peerDependencies": {
42
+ "react": "^18.0.0 || ^19.0.0",
43
+ "react-dom": "^18.0.0 || ^19.0.0",
44
+ "next": ">=14.0.0",
45
+ "next-auth": "^5.0.0-beta.0",
46
+ "next-themes": ">=0.3.0",
47
+ "@tiptap/react": "^3.0.0",
48
+ "@tiptap/starter-kit": "^3.0.0",
49
+ "@tiptap/pm": "^3.0.0",
50
+ "lucide-react": ">=0.300.0"
51
+ },
52
+ "peerDependenciesMeta": {
53
+ "react-easy-crop": {
54
+ "optional": true
55
+ }
56
+ },
57
+ "dependencies": {
58
+ "@tiptap/extension-color": "^3.19.0",
59
+ "@tiptap/extension-highlight": "^3.19.0",
60
+ "@tiptap/extension-image": "^3.19.0",
61
+ "@tiptap/extension-link": "^3.19.0",
62
+ "@tiptap/extension-placeholder": "^3.19.0",
63
+ "@tiptap/extension-subscript": "^3.19.0",
64
+ "@tiptap/extension-superscript": "^3.19.0",
65
+ "@tiptap/extension-table": "^3.19.0",
66
+ "@tiptap/extension-table-cell": "^3.19.0",
67
+ "@tiptap/extension-table-header": "^3.19.0",
68
+ "@tiptap/extension-table-row": "^3.19.0",
69
+ "@tiptap/extension-text-align": "^3.19.0",
70
+ "@tiptap/extension-text-style": "^3.19.0",
71
+ "@tiptap/extension-underline": "^3.19.0",
72
+ "@tiptap/extension-youtube": "^3.19.0",
73
+ "bcryptjs": "^3.0.0"
74
+ },
75
+ "devDependencies": {
76
+ "@types/bcryptjs": "^2.4.6",
77
+ "@types/node": "^20",
78
+ "@types/react": "^19",
79
+ "@types/react-dom": "^19",
80
+ "react": "^19.0.0",
81
+ "react-dom": "^19.0.0",
82
+ "react-easy-crop": "^5.5.6",
83
+ "next": "^16.0.0",
84
+ "next-auth": "^5.0.0-beta.30",
85
+ "next-themes": "^0.4.0",
86
+ "@tiptap/react": "^3.19.0",
87
+ "@tiptap/starter-kit": "^3.19.0",
88
+ "@tiptap/pm": "^3.19.0",
89
+ "lucide-react": "^0.563.0",
90
+ "tsup": "^8.0.0",
91
+ "typescript": "^5.0.0"
92
+ },
93
+ "keywords": [
94
+ "cms",
95
+ "editor",
96
+ "tiptap",
97
+ "nextjs",
98
+ "react",
99
+ "dashboard",
100
+ "gava-engine"
101
+ ],
102
+ "license": "MIT"
103
+ }
@@ -0,0 +1,76 @@
1
+ // GavaEngine Prisma Models
2
+ // Copy these models into your project's schema.prisma file
3
+ // Adjust the datasource and generator blocks to match your setup
4
+
5
+ model User {
6
+ id String @id @default(cuid())
7
+ name String
8
+ email String @unique
9
+ password String
10
+ role String @default("lettore")
11
+ createdAt DateTime @default(now())
12
+ updatedAt DateTime @updatedAt
13
+ revisions ArticleRevision[]
14
+ media Media[]
15
+ }
16
+
17
+ model Article {
18
+ id String @id @default(cuid())
19
+ title String @default("")
20
+ slug String @unique @default("")
21
+ excerpt String @default("")
22
+ content String @default("")
23
+ coverImage String @default("")
24
+ category String @default("")
25
+ status String @default("bozza")
26
+ authorName String @default("")
27
+ viewCount Int @default(0)
28
+ createdAt DateTime @default(now())
29
+ updatedAt DateTime @updatedAt
30
+ publishedAt DateTime?
31
+ views ArticleView[]
32
+ revisions ArticleRevision[]
33
+ }
34
+
35
+ model ArticleView {
36
+ id String @id @default(cuid())
37
+ articleId String
38
+ article Article @relation(fields: [articleId], references: [id], onDelete: Cascade)
39
+ ip String @default("")
40
+ createdAt DateTime @default(now())
41
+
42
+ @@index([articleId])
43
+ @@index([createdAt])
44
+ }
45
+
46
+ model ArticleRevision {
47
+ id String @id @default(cuid())
48
+ articleId String
49
+ article Article @relation(fields: [articleId], references: [id], onDelete: Cascade)
50
+ title String @default("")
51
+ content String @default("")
52
+ excerpt String @default("")
53
+ coverImage String @default("")
54
+ category String @default("")
55
+ editorId String
56
+ editor User @relation(fields: [editorId], references: [id])
57
+ note String @default("")
58
+ createdAt DateTime @default(now())
59
+
60
+ @@index([articleId])
61
+ @@index([createdAt])
62
+ }
63
+
64
+ model Media {
65
+ id String @id @default(cuid())
66
+ filename String
67
+ path String @unique
68
+ mimeType String @default("")
69
+ size Int @default(0)
70
+ uploaderId String
71
+ uploader User @relation(fields: [uploaderId], references: [id])
72
+ createdAt DateTime @default(now())
73
+
74
+ @@index([uploaderId])
75
+ @@index([createdAt])
76
+ }