@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.
Files changed (81) hide show
  1. package/LICENSE +21 -21
  2. package/dist/__tests__/auth/session.test.js +1 -1
  3. package/dist/__tests__/auth/session.test.js.map +1 -1
  4. package/dist/api/handler-factory.d.ts.map +1 -1
  5. package/dist/api/handler-factory.js +85 -68
  6. package/dist/api/handler-factory.js.map +1 -1
  7. package/dist/api/handlers.d.ts +1 -1
  8. package/dist/api/handlers.d.ts.map +1 -1
  9. package/dist/api/handlers.js +212 -31
  10. package/dist/api/handlers.js.map +1 -1
  11. package/dist/api/index.d.ts +2 -19
  12. package/dist/api/index.d.ts.map +1 -1
  13. package/dist/api/index.js +1 -54
  14. package/dist/api/index.js.map +1 -1
  15. package/dist/api/router.d.ts +20 -0
  16. package/dist/api/router.d.ts.map +1 -0
  17. package/dist/api/router.js +55 -0
  18. package/dist/api/router.js.map +1 -0
  19. package/dist/config/index.d.ts.map +1 -1
  20. package/dist/config/index.js +2 -0
  21. package/dist/config/index.js.map +1 -1
  22. package/dist/i18n/index.js +8 -8
  23. package/dist/media/optimize.d.ts +2 -3
  24. package/dist/media/optimize.d.ts.map +1 -1
  25. package/dist/media/optimize.js +10 -1
  26. package/dist/media/optimize.js.map +1 -1
  27. package/dist/next.d.ts +3 -3
  28. package/dist/next.d.ts.map +1 -1
  29. package/dist/next.js +8 -8
  30. package/dist/next.js.map +1 -1
  31. package/dist/search/index.js +22 -22
  32. package/dist/security/anomaly-detection.d.ts +1 -1
  33. package/dist/security/anomaly-detection.d.ts.map +1 -1
  34. package/dist/security/anomaly-detection.js +27 -5
  35. package/dist/security/anomaly-detection.js.map +1 -1
  36. package/dist/security/reauth.d.ts +1 -1
  37. package/dist/security/reauth.d.ts.map +1 -1
  38. package/dist/security/reauth.js +12 -4
  39. package/dist/security/reauth.js.map +1 -1
  40. package/dist/security/sanitize.d.ts +1 -1
  41. package/dist/security/sanitize.d.ts.map +1 -1
  42. package/dist/security/sanitize.js +9 -11
  43. package/dist/security/sanitize.js.map +1 -1
  44. package/dist/security/webhook.d.ts +1 -1
  45. package/dist/security/webhook.d.ts.map +1 -1
  46. package/dist/security/webhook.js +24 -3
  47. package/dist/security/webhook.js.map +1 -1
  48. package/package.json +3 -2
  49. package/prisma/cms-schema.prisma +237 -237
  50. package/prisma/migrations/0001_init/migration.sql +384 -384
  51. package/prisma/migrations/0002_folders/migration.sql +39 -39
  52. package/prisma/migrations/0003_search_and_webhooks/migration.sql +50 -50
  53. package/prisma/migrations/migration_lock.toml +3 -3
  54. package/prisma/schema.prisma +485 -485
  55. package/prisma/seed.ts +82 -82
  56. package/generated/browser.ts +0 -109
  57. package/generated/client.ts +0 -133
  58. package/generated/commonInputTypes.ts +0 -709
  59. package/generated/enums.ts +0 -125
  60. package/generated/internal/class.ts +0 -376
  61. package/generated/internal/prismaNamespace.ts +0 -2617
  62. package/generated/internal/prismaNamespaceBrowser.ts +0 -611
  63. package/generated/models/ApiKey.ts +0 -1550
  64. package/generated/models/AuditLog.ts +0 -1206
  65. package/generated/models/BackupRecord.ts +0 -1250
  66. package/generated/models/ContentLock.ts +0 -1472
  67. package/generated/models/ContentTemplate.ts +0 -1416
  68. package/generated/models/Document.ts +0 -3005
  69. package/generated/models/Folder.ts +0 -1904
  70. package/generated/models/FormSubmission.ts +0 -1200
  71. package/generated/models/InAppNotification.ts +0 -1457
  72. package/generated/models/Media.ts +0 -2340
  73. package/generated/models/MediaUsage.ts +0 -1472
  74. package/generated/models/OAuthAccount.ts +0 -1463
  75. package/generated/models/Redirect.ts +0 -1284
  76. package/generated/models/Session.ts +0 -1492
  77. package/generated/models/Site.ts +0 -1206
  78. package/generated/models/User.ts +0 -3513
  79. package/generated/models/Version.ts +0 -1511
  80. package/generated/models/WorkflowState.ts +0 -1514
  81. 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
+ });
@@ -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
@@ -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