@actuate-media/cms-core 0.2.3 → 0.3.1
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/LICENSE +21 -21
- package/dist/__tests__/auth/session.test.js +1 -1
- package/dist/__tests__/auth/session.test.js.map +1 -1
- package/dist/api/handler-factory.d.ts.map +1 -1
- package/dist/api/handler-factory.js +85 -68
- package/dist/api/handler-factory.js.map +1 -1
- package/dist/api/handlers.d.ts +1 -1
- package/dist/api/handlers.d.ts.map +1 -1
- package/dist/api/handlers.js +212 -31
- package/dist/api/handlers.js.map +1 -1
- package/dist/api/index.d.ts +2 -19
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -54
- package/dist/api/index.js.map +1 -1
- package/dist/api/router.d.ts +20 -0
- package/dist/api/router.d.ts.map +1 -0
- package/dist/api/router.js +55 -0
- package/dist/api/router.js.map +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -1
- package/dist/i18n/index.js +8 -8
- package/dist/media/optimize.d.ts +2 -3
- package/dist/media/optimize.d.ts.map +1 -1
- package/dist/media/optimize.js +10 -1
- package/dist/media/optimize.js.map +1 -1
- package/dist/next.d.ts +3 -3
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +8 -8
- package/dist/next.js.map +1 -1
- package/dist/search/index.js +22 -22
- package/dist/security/anomaly-detection.d.ts +1 -1
- package/dist/security/anomaly-detection.d.ts.map +1 -1
- package/dist/security/anomaly-detection.js +27 -5
- package/dist/security/anomaly-detection.js.map +1 -1
- package/dist/security/reauth.d.ts +1 -1
- package/dist/security/reauth.d.ts.map +1 -1
- package/dist/security/reauth.js +12 -4
- package/dist/security/reauth.js.map +1 -1
- package/dist/security/sanitize.d.ts +1 -1
- package/dist/security/sanitize.d.ts.map +1 -1
- package/dist/security/sanitize.js +9 -11
- package/dist/security/sanitize.js.map +1 -1
- package/dist/security/webhook.d.ts +1 -1
- package/dist/security/webhook.d.ts.map +1 -1
- package/dist/security/webhook.js +24 -3
- package/dist/security/webhook.js.map +1 -1
- package/package.json +3 -2
- package/prisma/cms-schema.prisma +237 -237
- package/prisma/migrations/0001_init/migration.sql +384 -384
- package/prisma/migrations/0002_folders/migration.sql +39 -39
- package/prisma/migrations/0003_search_and_webhooks/migration.sql +50 -50
- package/prisma/migrations/migration_lock.toml +3 -3
- package/prisma/schema.prisma +485 -485
- package/prisma/seed.ts +82 -82
- package/generated/browser.ts +0 -109
- package/generated/client.ts +0 -133
- package/generated/commonInputTypes.ts +0 -709
- package/generated/enums.ts +0 -125
- package/generated/internal/class.ts +0 -376
- package/generated/internal/prismaNamespace.ts +0 -2617
- package/generated/internal/prismaNamespaceBrowser.ts +0 -611
- package/generated/models/ApiKey.ts +0 -1550
- package/generated/models/AuditLog.ts +0 -1206
- package/generated/models/BackupRecord.ts +0 -1250
- package/generated/models/ContentLock.ts +0 -1472
- package/generated/models/ContentTemplate.ts +0 -1416
- package/generated/models/Document.ts +0 -3005
- package/generated/models/Folder.ts +0 -1904
- package/generated/models/FormSubmission.ts +0 -1200
- package/generated/models/InAppNotification.ts +0 -1457
- package/generated/models/Media.ts +0 -2340
- package/generated/models/MediaUsage.ts +0 -1472
- package/generated/models/OAuthAccount.ts +0 -1463
- package/generated/models/Redirect.ts +0 -1284
- package/generated/models/Session.ts +0 -1492
- package/generated/models/Site.ts +0 -1206
- package/generated/models/User.ts +0 -3513
- package/generated/models/Version.ts +0 -1511
- package/generated/models/WorkflowState.ts +0 -1514
- package/generated/models.ts +0 -29
package/prisma/seed.ts
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Seed script for Actuate CMS.
|
|
3
|
-
*
|
|
4
|
-
* Reads credentials from environment variables (never hardcoded):
|
|
5
|
-
* CMS_ADMIN_EMAIL, CMS_ADMIN_PASSWORD, CMS_ADMIN_NAME
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* cd packages/cms-core
|
|
9
|
-
* pnpm tsx prisma/seed.ts
|
|
10
|
-
*
|
|
11
|
-
* Requires DATABASE_URL + CMS_ADMIN_* vars in environment or .env file.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import 'dotenv/config';
|
|
15
|
-
import pg from 'pg';
|
|
16
|
-
import { PrismaPg } from '@prisma/adapter-pg';
|
|
17
|
-
import { PrismaClient } from '../generated/client.js';
|
|
18
|
-
|
|
19
|
-
async function main() {
|
|
20
|
-
const email = process.env.CMS_ADMIN_EMAIL;
|
|
21
|
-
const password = process.env.CMS_ADMIN_PASSWORD;
|
|
22
|
-
const name = process.env.CMS_ADMIN_NAME ?? 'Admin';
|
|
23
|
-
|
|
24
|
-
if (!email || !password) {
|
|
25
|
-
console.error('Set CMS_ADMIN_EMAIL and CMS_ADMIN_PASSWORD in your .env file');
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
|
|
30
|
-
const adapter = new PrismaPg(pool);
|
|
31
|
-
const prisma = new PrismaClient({ adapter });
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
const existingCount = await prisma.user.count();
|
|
35
|
-
if (existingCount > 0) {
|
|
36
|
-
console.log(`Skipping seed — ${existingCount} user(s) already exist.`);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const salt = crypto.getRandomValues(new Uint8Array(16));
|
|
41
|
-
const key = await crypto.subtle.importKey(
|
|
42
|
-
'raw',
|
|
43
|
-
new TextEncoder().encode(password),
|
|
44
|
-
'PBKDF2',
|
|
45
|
-
false,
|
|
46
|
-
['deriveBits'],
|
|
47
|
-
);
|
|
48
|
-
const derived = await crypto.subtle.deriveBits(
|
|
49
|
-
{ name: 'PBKDF2', salt, iterations: 100_000, hash: 'SHA-256' },
|
|
50
|
-
key,
|
|
51
|
-
256,
|
|
52
|
-
);
|
|
53
|
-
const saltHex = Buffer.from(salt).toString('hex');
|
|
54
|
-
const hashHex = Buffer.from(derived).toString('hex');
|
|
55
|
-
const passwordHash = `pbkdf2:100000:${saltHex}:${hashHex}`;
|
|
56
|
-
|
|
57
|
-
const user = await prisma.user.create({
|
|
58
|
-
data: {
|
|
59
|
-
email: email.toLowerCase().trim(),
|
|
60
|
-
name,
|
|
61
|
-
passwordHash,
|
|
62
|
-
role: 'ADMIN',
|
|
63
|
-
isActive: true,
|
|
64
|
-
isApproved: true,
|
|
65
|
-
emailVerified: true,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
console.log(`Seeded admin user:`);
|
|
70
|
-
console.log(` Email: ${email}`);
|
|
71
|
-
console.log(` Role: ADMIN`);
|
|
72
|
-
console.log(` ID: ${user.id}`);
|
|
73
|
-
} finally {
|
|
74
|
-
await prisma.$disconnect();
|
|
75
|
-
await pool.end();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
main().catch((err) => {
|
|
80
|
-
console.error('Seed failed:', err);
|
|
81
|
-
process.exit(1);
|
|
82
|
-
});
|
|
1
|
+
/**
|
|
2
|
+
* Seed script for Actuate CMS.
|
|
3
|
+
*
|
|
4
|
+
* Reads credentials from environment variables (never hardcoded):
|
|
5
|
+
* CMS_ADMIN_EMAIL, CMS_ADMIN_PASSWORD, CMS_ADMIN_NAME
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* cd packages/cms-core
|
|
9
|
+
* pnpm tsx prisma/seed.ts
|
|
10
|
+
*
|
|
11
|
+
* Requires DATABASE_URL + CMS_ADMIN_* vars in environment or .env file.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import 'dotenv/config';
|
|
15
|
+
import pg from 'pg';
|
|
16
|
+
import { PrismaPg } from '@prisma/adapter-pg';
|
|
17
|
+
import { PrismaClient } from '../generated/client.js';
|
|
18
|
+
|
|
19
|
+
async function main() {
|
|
20
|
+
const email = process.env.CMS_ADMIN_EMAIL;
|
|
21
|
+
const password = process.env.CMS_ADMIN_PASSWORD;
|
|
22
|
+
const name = process.env.CMS_ADMIN_NAME ?? 'Admin';
|
|
23
|
+
|
|
24
|
+
if (!email || !password) {
|
|
25
|
+
console.error('Set CMS_ADMIN_EMAIL and CMS_ADMIN_PASSWORD in your .env file');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
|
|
30
|
+
const adapter = new PrismaPg(pool);
|
|
31
|
+
const prisma = new PrismaClient({ adapter });
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const existingCount = await prisma.user.count();
|
|
35
|
+
if (existingCount > 0) {
|
|
36
|
+
console.log(`Skipping seed — ${existingCount} user(s) already exist.`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const salt = crypto.getRandomValues(new Uint8Array(16));
|
|
41
|
+
const key = await crypto.subtle.importKey(
|
|
42
|
+
'raw',
|
|
43
|
+
new TextEncoder().encode(password),
|
|
44
|
+
'PBKDF2',
|
|
45
|
+
false,
|
|
46
|
+
['deriveBits'],
|
|
47
|
+
);
|
|
48
|
+
const derived = await crypto.subtle.deriveBits(
|
|
49
|
+
{ name: 'PBKDF2', salt, iterations: 100_000, hash: 'SHA-256' },
|
|
50
|
+
key,
|
|
51
|
+
256,
|
|
52
|
+
);
|
|
53
|
+
const saltHex = Buffer.from(salt).toString('hex');
|
|
54
|
+
const hashHex = Buffer.from(derived).toString('hex');
|
|
55
|
+
const passwordHash = `pbkdf2:100000:${saltHex}:${hashHex}`;
|
|
56
|
+
|
|
57
|
+
const user = await prisma.user.create({
|
|
58
|
+
data: {
|
|
59
|
+
email: email.toLowerCase().trim(),
|
|
60
|
+
name,
|
|
61
|
+
passwordHash,
|
|
62
|
+
role: 'ADMIN',
|
|
63
|
+
isActive: true,
|
|
64
|
+
isApproved: true,
|
|
65
|
+
emailVerified: true,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
console.log(`Seeded admin user:`);
|
|
70
|
+
console.log(` Email: ${email}`);
|
|
71
|
+
console.log(` Role: ADMIN`);
|
|
72
|
+
console.log(` ID: ${user.id}`);
|
|
73
|
+
} finally {
|
|
74
|
+
await prisma.$disconnect();
|
|
75
|
+
await pool.end();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
main().catch((err) => {
|
|
80
|
+
console.error('Seed failed:', err);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
});
|
package/generated/browser.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
// biome-ignore-all lint: generated file
|
|
5
|
-
// @ts-nocheck
|
|
6
|
-
/*
|
|
7
|
-
* This file should be your main import to use Prisma-related types and utilities in a browser.
|
|
8
|
-
* Use it to get access to models, enums, and input types.
|
|
9
|
-
*
|
|
10
|
-
* This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.
|
|
11
|
-
* See `client.ts` for the standard, server-side entry point.
|
|
12
|
-
*
|
|
13
|
-
* 🟢 You can import this file directly.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import * as Prisma from './internal/prismaNamespaceBrowser'
|
|
17
|
-
export { Prisma }
|
|
18
|
-
export * as $Enums from './enums'
|
|
19
|
-
export * from './enums';
|
|
20
|
-
/**
|
|
21
|
-
* Model User
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
export type User = Prisma.UserModel
|
|
25
|
-
/**
|
|
26
|
-
* Model OAuthAccount
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
export type OAuthAccount = Prisma.OAuthAccountModel
|
|
30
|
-
/**
|
|
31
|
-
* Model Session
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
export type Session = Prisma.SessionModel
|
|
35
|
-
/**
|
|
36
|
-
* Model ApiKey
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
export type ApiKey = Prisma.ApiKeyModel
|
|
40
|
-
/**
|
|
41
|
-
* Model AuditLog
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
export type AuditLog = Prisma.AuditLogModel
|
|
45
|
-
/**
|
|
46
|
-
* Model Folder
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
export type Folder = Prisma.FolderModel
|
|
50
|
-
/**
|
|
51
|
-
* Model Document
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
export type Document = Prisma.DocumentModel
|
|
55
|
-
/**
|
|
56
|
-
* Model Version
|
|
57
|
-
*
|
|
58
|
-
*/
|
|
59
|
-
export type Version = Prisma.VersionModel
|
|
60
|
-
/**
|
|
61
|
-
* Model Media
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
|
-
export type Media = Prisma.MediaModel
|
|
65
|
-
/**
|
|
66
|
-
* Model MediaUsage
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
|
-
export type MediaUsage = Prisma.MediaUsageModel
|
|
70
|
-
/**
|
|
71
|
-
* Model ContentLock
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
|
-
export type ContentLock = Prisma.ContentLockModel
|
|
75
|
-
/**
|
|
76
|
-
* Model InAppNotification
|
|
77
|
-
*
|
|
78
|
-
*/
|
|
79
|
-
export type InAppNotification = Prisma.InAppNotificationModel
|
|
80
|
-
/**
|
|
81
|
-
* Model ContentTemplate
|
|
82
|
-
*
|
|
83
|
-
*/
|
|
84
|
-
export type ContentTemplate = Prisma.ContentTemplateModel
|
|
85
|
-
/**
|
|
86
|
-
* Model Site
|
|
87
|
-
*
|
|
88
|
-
*/
|
|
89
|
-
export type Site = Prisma.SiteModel
|
|
90
|
-
/**
|
|
91
|
-
* Model WorkflowState
|
|
92
|
-
*
|
|
93
|
-
*/
|
|
94
|
-
export type WorkflowState = Prisma.WorkflowStateModel
|
|
95
|
-
/**
|
|
96
|
-
* Model Redirect
|
|
97
|
-
*
|
|
98
|
-
*/
|
|
99
|
-
export type Redirect = Prisma.RedirectModel
|
|
100
|
-
/**
|
|
101
|
-
* Model FormSubmission
|
|
102
|
-
*
|
|
103
|
-
*/
|
|
104
|
-
export type FormSubmission = Prisma.FormSubmissionModel
|
|
105
|
-
/**
|
|
106
|
-
* Model BackupRecord
|
|
107
|
-
*
|
|
108
|
-
*/
|
|
109
|
-
export type BackupRecord = Prisma.BackupRecordModel
|
package/generated/client.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
// biome-ignore-all lint: generated file
|
|
5
|
-
// @ts-nocheck
|
|
6
|
-
/*
|
|
7
|
-
* This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
|
|
8
|
-
* If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.
|
|
9
|
-
*
|
|
10
|
-
* 🟢 You can import this file directly.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import * as process from 'node:process'
|
|
14
|
-
import * as path from 'node:path'
|
|
15
|
-
import { fileURLToPath } from 'node:url'
|
|
16
|
-
globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))
|
|
17
|
-
|
|
18
|
-
import * as runtime from "@prisma/client/runtime/client"
|
|
19
|
-
import * as $Enums from "./enums"
|
|
20
|
-
import * as $Class from "./internal/class"
|
|
21
|
-
import * as Prisma from "./internal/prismaNamespace"
|
|
22
|
-
|
|
23
|
-
export * as $Enums from './enums'
|
|
24
|
-
export * from "./enums"
|
|
25
|
-
/**
|
|
26
|
-
* ## Prisma Client
|
|
27
|
-
*
|
|
28
|
-
* Type-safe database client for TypeScript
|
|
29
|
-
* @example
|
|
30
|
-
* ```
|
|
31
|
-
* const prisma = new PrismaClient({
|
|
32
|
-
* adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL })
|
|
33
|
-
* })
|
|
34
|
-
* // Fetch zero or more Users
|
|
35
|
-
* const users = await prisma.user.findMany()
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* Read more in our [docs](https://pris.ly/d/client).
|
|
39
|
-
*/
|
|
40
|
-
export const PrismaClient = $Class.getPrismaClientClass()
|
|
41
|
-
export type PrismaClient<LogOpts extends Prisma.LogLevel = never, OmitOpts extends Prisma.PrismaClientOptions["omit"] = Prisma.PrismaClientOptions["omit"], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>
|
|
42
|
-
export { Prisma }
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Model User
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
export type User = Prisma.UserModel
|
|
49
|
-
/**
|
|
50
|
-
* Model OAuthAccount
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
export type OAuthAccount = Prisma.OAuthAccountModel
|
|
54
|
-
/**
|
|
55
|
-
* Model Session
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
export type Session = Prisma.SessionModel
|
|
59
|
-
/**
|
|
60
|
-
* Model ApiKey
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
export type ApiKey = Prisma.ApiKeyModel
|
|
64
|
-
/**
|
|
65
|
-
* Model AuditLog
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
export type AuditLog = Prisma.AuditLogModel
|
|
69
|
-
/**
|
|
70
|
-
* Model Folder
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
|
-
export type Folder = Prisma.FolderModel
|
|
74
|
-
/**
|
|
75
|
-
* Model Document
|
|
76
|
-
*
|
|
77
|
-
*/
|
|
78
|
-
export type Document = Prisma.DocumentModel
|
|
79
|
-
/**
|
|
80
|
-
* Model Version
|
|
81
|
-
*
|
|
82
|
-
*/
|
|
83
|
-
export type Version = Prisma.VersionModel
|
|
84
|
-
/**
|
|
85
|
-
* Model Media
|
|
86
|
-
*
|
|
87
|
-
*/
|
|
88
|
-
export type Media = Prisma.MediaModel
|
|
89
|
-
/**
|
|
90
|
-
* Model MediaUsage
|
|
91
|
-
*
|
|
92
|
-
*/
|
|
93
|
-
export type MediaUsage = Prisma.MediaUsageModel
|
|
94
|
-
/**
|
|
95
|
-
* Model ContentLock
|
|
96
|
-
*
|
|
97
|
-
*/
|
|
98
|
-
export type ContentLock = Prisma.ContentLockModel
|
|
99
|
-
/**
|
|
100
|
-
* Model InAppNotification
|
|
101
|
-
*
|
|
102
|
-
*/
|
|
103
|
-
export type InAppNotification = Prisma.InAppNotificationModel
|
|
104
|
-
/**
|
|
105
|
-
* Model ContentTemplate
|
|
106
|
-
*
|
|
107
|
-
*/
|
|
108
|
-
export type ContentTemplate = Prisma.ContentTemplateModel
|
|
109
|
-
/**
|
|
110
|
-
* Model Site
|
|
111
|
-
*
|
|
112
|
-
*/
|
|
113
|
-
export type Site = Prisma.SiteModel
|
|
114
|
-
/**
|
|
115
|
-
* Model WorkflowState
|
|
116
|
-
*
|
|
117
|
-
*/
|
|
118
|
-
export type WorkflowState = Prisma.WorkflowStateModel
|
|
119
|
-
/**
|
|
120
|
-
* Model Redirect
|
|
121
|
-
*
|
|
122
|
-
*/
|
|
123
|
-
export type Redirect = Prisma.RedirectModel
|
|
124
|
-
/**
|
|
125
|
-
* Model FormSubmission
|
|
126
|
-
*
|
|
127
|
-
*/
|
|
128
|
-
export type FormSubmission = Prisma.FormSubmissionModel
|
|
129
|
-
/**
|
|
130
|
-
* Model BackupRecord
|
|
131
|
-
*
|
|
132
|
-
*/
|
|
133
|
-
export type BackupRecord = Prisma.BackupRecordModel
|