@reldens/cms 0.85.0 → 0.86.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/.claude/api-reference.md +172 -171
- package/.claude/architecture-guide.md +1 -1
- package/.claude/configuration-guide.md +128 -126
- package/.claude/installation-guide.md +225 -225
- package/.claude/password-management-guide.md +2 -2
- package/CLAUDE.md +1 -1
- package/README.md +1 -1
- package/bin/reldens-cms-generate-entities.js +19 -8
- package/bin/reldens-cms-update-password.js +16 -8
- package/bin/reldens-cms.js +145 -138
- package/install/index.html +132 -132
- package/lib/admin-manager/router-contents.js +854 -854
- package/lib/installer.js +673 -636
- package/lib/manager-config-loader.js +35 -33
- package/lib/manager-services-initializer.js +346 -323
- package/lib/manager.js +310 -306
- package/lib/mysql-installer.js +104 -104
- package/lib/prisma-subprocess-worker.js +9 -4
- package/package.json +4 -4
- package/templates/.env.dist +2 -0
- package/templates/index.js.dist +30 -30
package/.claude/api-reference.md
CHANGED
|
@@ -1,171 +1,172 @@
|
|
|
1
|
-
# API Reference
|
|
2
|
-
|
|
3
|
-
## Manager Class
|
|
4
|
-
|
|
5
|
-
- `start()` - Initialize and start the CMS
|
|
6
|
-
- `isInstalled()` - Check if CMS is installed
|
|
7
|
-
- `buildAppServerConfiguration()` - Build server configuration
|
|
8
|
-
- `validateCdnMappingsInDevelopment()` - Warn when CDN domains are missing from CSP directives
|
|
9
|
-
- `isCdnUrlInDirectives(cdnUrlWithProtocol, cdnHostname)` - Check if a CDN URL appears in any CSP directive
|
|
10
|
-
- `initializeCmsAfterInstall(props)` - Post-installation callback
|
|
11
|
-
|
|
12
|
-
## ManagerComponentValidator Class (lib/manager-component-validator.js)
|
|
13
|
-
|
|
14
|
-
Static validators called from the Manager constructor:
|
|
15
|
-
|
|
16
|
-
- `validateProvidedServer(app, appServer)` - Validate provided Express app and server
|
|
17
|
-
- `validateProvidedDataServer(dataServer)` - Validate provided data server
|
|
18
|
-
- `validateProvidedAdminManager(adminManager)` - Validate provided admin manager
|
|
19
|
-
- `validateProvidedFrontend(frontend)` - Validate provided frontend
|
|
20
|
-
|
|
21
|
-
## ManagerConfigLoader Class (lib/manager-config-loader.js)
|
|
22
|
-
|
|
23
|
-
- `loadFromEnv()` - Build config object from `RELDENS_*` environment variables
|
|
24
|
-
|
|
25
|
-
## ManagerServicesInitializer Class (lib/manager-services-initializer.js)
|
|
26
|
-
|
|
27
|
-
Receives the Manager instance via constructor and handles all service initialization:
|
|
28
|
-
|
|
29
|
-
- `initializeServices()` - Orchestrate full service initialization sequence
|
|
30
|
-
- `
|
|
31
|
-
- `
|
|
32
|
-
- `
|
|
33
|
-
- `
|
|
34
|
-
- `
|
|
35
|
-
- `
|
|
36
|
-
- `
|
|
37
|
-
- `
|
|
38
|
-
- `
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- `
|
|
44
|
-
- `
|
|
45
|
-
- `
|
|
46
|
-
- `
|
|
47
|
-
- `
|
|
48
|
-
- `
|
|
49
|
-
- `
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- `
|
|
57
|
-
- `
|
|
58
|
-
- `
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
- `
|
|
64
|
-
- `
|
|
65
|
-
- `
|
|
66
|
-
- `
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- `
|
|
72
|
-
- `
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- `
|
|
78
|
-
- `
|
|
79
|
-
- `
|
|
80
|
-
- `
|
|
81
|
-
- `
|
|
82
|
-
- `
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- `
|
|
88
|
-
- `
|
|
89
|
-
- `
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
- `
|
|
95
|
-
- `
|
|
96
|
-
- `
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
- `
|
|
102
|
-
- `
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
- `
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- `
|
|
117
|
-
- `
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
- `
|
|
123
|
-
- `
|
|
124
|
-
- `
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
- `Search.
|
|
130
|
-
- `
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- `
|
|
138
|
-
- `
|
|
139
|
-
- `
|
|
140
|
-
- `
|
|
141
|
-
- `
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
- `
|
|
147
|
-
- `
|
|
148
|
-
- `
|
|
149
|
-
- `
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
- `
|
|
155
|
-
- `
|
|
156
|
-
- `
|
|
157
|
-
- `
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
- `
|
|
163
|
-
- `
|
|
164
|
-
- `
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
- `
|
|
170
|
-
- `
|
|
171
|
-
- `
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
## Manager Class
|
|
4
|
+
|
|
5
|
+
- `start()` - Initialize and start the CMS
|
|
6
|
+
- `isInstalled()` - Check if CMS is installed
|
|
7
|
+
- `buildAppServerConfiguration()` - Build server configuration
|
|
8
|
+
- `validateCdnMappingsInDevelopment()` - Warn when CDN domains are missing from CSP directives
|
|
9
|
+
- `isCdnUrlInDirectives(cdnUrlWithProtocol, cdnHostname)` - Check if a CDN URL appears in any CSP directive
|
|
10
|
+
- `initializeCmsAfterInstall(props)` - Post-installation callback
|
|
11
|
+
|
|
12
|
+
## ManagerComponentValidator Class (lib/manager-component-validator.js)
|
|
13
|
+
|
|
14
|
+
Static validators called from the Manager constructor:
|
|
15
|
+
|
|
16
|
+
- `validateProvidedServer(app, appServer)` - Validate provided Express app and server
|
|
17
|
+
- `validateProvidedDataServer(dataServer)` - Validate provided data server
|
|
18
|
+
- `validateProvidedAdminManager(adminManager)` - Validate provided admin manager
|
|
19
|
+
- `validateProvidedFrontend(frontend)` - Validate provided frontend
|
|
20
|
+
|
|
21
|
+
## ManagerConfigLoader Class (lib/manager-config-loader.js)
|
|
22
|
+
|
|
23
|
+
- `loadFromEnv()` - Build config object from `RELDENS_*` environment variables
|
|
24
|
+
|
|
25
|
+
## ManagerServicesInitializer Class (lib/manager-services-initializer.js)
|
|
26
|
+
|
|
27
|
+
Receives the Manager instance via constructor and handles all service initialization:
|
|
28
|
+
|
|
29
|
+
- `initializeServices()` - Orchestrate full service initialization sequence
|
|
30
|
+
- `loadPrismaModules(projectRoot, clientPath, connectionData, adapterPackage, adapterClass)` - Static; resolves the Prisma adapter from the project and loads the Prisma modules via PrismaClientLoader
|
|
31
|
+
- `initializeDataServer()` - Create data server; auto-loads Prisma modules via `loadPrismaModules()` when driver is `prisma` and no `prismaModules` provided
|
|
32
|
+
- `setupEntityAccess()` - Sync entity access rules to database
|
|
33
|
+
- `loadProcessedEntities()` - Apply config overrides and process raw entities
|
|
34
|
+
- `generateAdminEntities()` - Generate admin panel entity definitions
|
|
35
|
+
- `initializeAdminManager()` - Set up admin routes and authentication
|
|
36
|
+
- `initializePasswordEncryptionHandler()` - Register password encryption event listeners
|
|
37
|
+
- `initializeCmsPagesRouteManager()` - Wire CMS page routes to the data server
|
|
38
|
+
- `initializeFrontend()` - Create and initialize Frontend instance
|
|
39
|
+
- `renderCallback(template, params)` - Render a template via the configured render engine
|
|
40
|
+
|
|
41
|
+
## Installer Class
|
|
42
|
+
|
|
43
|
+
- `isInstalled()` - Check installation status
|
|
44
|
+
- `configureAppServerRoutes(app, appServer, appServerFactory, renderEngine)` - Setup installer routes
|
|
45
|
+
- `executeInstallProcess(req, res)` - Complete installation process
|
|
46
|
+
- `runSubprocessInstallation(dbConfig, templateVariables)` - Handle subprocess operations
|
|
47
|
+
- `checkAndInstallPackages(requiredPackages)` - Check and install dependencies
|
|
48
|
+
- `generateEntities(server, isOverride, isInstallationMode, isDryPrisma, dbConfig)` - Generate entities
|
|
49
|
+
- `createEnvFile(templateVariables)` - Create environment configuration
|
|
50
|
+
- `copyAdminDirectory()` - Copy admin assets and templates
|
|
51
|
+
|
|
52
|
+
## Frontend Architecture Classes
|
|
53
|
+
|
|
54
|
+
### Frontend Class (Orchestrator)
|
|
55
|
+
|
|
56
|
+
- `initialize()` - Set up frontend routes and templates
|
|
57
|
+
- `handleRequest(req, res)` - Main request handler
|
|
58
|
+
- `renderRoute(route, domain, res, req)` - Route-based rendering
|
|
59
|
+
- `setupStaticAssets()` - Configure static asset serving
|
|
60
|
+
|
|
61
|
+
### TemplateResolver Class
|
|
62
|
+
|
|
63
|
+
- `findTemplatePath(templateName, domain)` - Template discovery with domain fallback
|
|
64
|
+
- `findLayoutPath(layoutName, domain)` - Layout path resolution
|
|
65
|
+
- `findTemplateByPath(path, domain)` - Template lookup by URL path
|
|
66
|
+
- `resolveDomainToFolder(domain)` - Domain to folder mapping
|
|
67
|
+
- `resolveDomainToSiteKey(domain)` - Domain to site key mapping
|
|
68
|
+
|
|
69
|
+
### TemplateCache Class
|
|
70
|
+
|
|
71
|
+
- `loadPartials()` - Load and cache template partials
|
|
72
|
+
- `setupDomainTemplates()` - Initialize domain-specific templates
|
|
73
|
+
- `getPartialsForDomain(domain)` - Get domain-specific partials with fallback
|
|
74
|
+
|
|
75
|
+
### TemplateReloader Class
|
|
76
|
+
|
|
77
|
+
- `checkAndReloadAdminTemplates()` - Check and reload admin templates when changed
|
|
78
|
+
- `checkAndReloadFrontendTemplates()` - Check and reload frontend templates when changed
|
|
79
|
+
- `trackTemplateFiles(templatesPaths)` - Start tracking template files for changes
|
|
80
|
+
- `shouldReloadAdminTemplates(mappedAdminTemplates)` - Check if admin templates need reloading
|
|
81
|
+
- `shouldReloadFrontendTemplates(templatesPath, templateExtensions)` - Check if frontend templates need reloading
|
|
82
|
+
- `handleAdminTemplateReload(adminManager)` - Complete admin template reload process
|
|
83
|
+
- `handleFrontendTemplateReload(templateCache, templateResolver)` - Complete frontend template reload process
|
|
84
|
+
|
|
85
|
+
### RequestProcessor Class
|
|
86
|
+
|
|
87
|
+
- `findRouteByPath(path, domain)` - Database route lookup
|
|
88
|
+
- `handleRouteRedirect(route, res)` - Handle route redirects
|
|
89
|
+
- `getDomainFromRequest(req)` - Extract domain from request
|
|
90
|
+
- `buildCacheKey(path, req)` - Generate cache keys
|
|
91
|
+
|
|
92
|
+
### ContentRenderer Class
|
|
93
|
+
|
|
94
|
+
- `renderWithTemplateContent(content, data, domain, req, route)` - Main content rendering
|
|
95
|
+
- `generateRouteContent(route, domain, req)` - Route-based content generation
|
|
96
|
+
- `generateTemplateContent(templatePath, domain, req, data)` - Template-based content generation
|
|
97
|
+
- `fetchMetaFields(data)` - Process meta fields for templates
|
|
98
|
+
|
|
99
|
+
### EntityAccessManager Class
|
|
100
|
+
|
|
101
|
+
- `loadEntityAccessRules()` - Load entity access configuration
|
|
102
|
+
- `isEntityAccessible(entityName)` - Check entity accessibility
|
|
103
|
+
- `findEntityByPath(path)` - Entity lookup by URL path
|
|
104
|
+
|
|
105
|
+
### ResponseManager Class
|
|
106
|
+
|
|
107
|
+
- `renderWithCacheHandler(contentGenerator, errorHandler, responseHandler, domain, res, path, req)` - Generic cached response handler
|
|
108
|
+
- `renderNotFound(domain, res, req)` - 404 error handling
|
|
109
|
+
|
|
110
|
+
### SearchRequestHandler Class
|
|
111
|
+
|
|
112
|
+
- `handleSearchRequest(req, res)` - Process search requests with template data support
|
|
113
|
+
|
|
114
|
+
## TemplateEngine Class
|
|
115
|
+
|
|
116
|
+
- `render(template, data, partials, domain, req, route, currentEntityData)` - Main template rendering with enhanced context
|
|
117
|
+
- `processAllTemplateFunctions(template, domain, req, systemVariables)` - Process all template functions
|
|
118
|
+
- `buildEnhancedRenderData(data, systemVariables, currentEntityData)` - Build template context with system variables
|
|
119
|
+
|
|
120
|
+
## SystemVariablesProvider Class
|
|
121
|
+
|
|
122
|
+
- `buildSystemVariables(req, route, domain)` - Create system variables for templates
|
|
123
|
+
- `buildCurrentRequestData(req, domain)` - Build request context
|
|
124
|
+
- `buildCurrentRouteData(route)` - Build route context
|
|
125
|
+
- `buildCurrentDomainData(domain)` - Build domain context
|
|
126
|
+
|
|
127
|
+
## Search Classes
|
|
128
|
+
|
|
129
|
+
- `Search.parseSearchParameters(query)` - Parse search query parameters including templateData
|
|
130
|
+
- `Search.executeSearch(config)` - Execute search with configuration
|
|
131
|
+
- `SearchRenderer.renderSearchResults(searchResults, config, domain, req)` - Render search results with template data
|
|
132
|
+
|
|
133
|
+
## Forms System Classes
|
|
134
|
+
|
|
135
|
+
### DynamicForm Class
|
|
136
|
+
|
|
137
|
+
- `validateFormSubmission(formKey, submittedValues, req)` - Validate form submission
|
|
138
|
+
- `getFormConfig(formKey)` - Load form configuration from database
|
|
139
|
+
- `validateHoneypot(submittedValues)` - Check honeypot field for bots
|
|
140
|
+
- `validateFields(fieldsSchema, submittedValues)` - Schema-based field validation
|
|
141
|
+
- `prepareSubmittedValues(submittedValues, fieldsSchema)` - Process and normalize values
|
|
142
|
+
- `saveFormSubmission(formConfig, preparedValues)` - Save to database
|
|
143
|
+
|
|
144
|
+
### DynamicFormRenderer Class
|
|
145
|
+
|
|
146
|
+
- `renderForm(formConfig, fieldsToRender, domain, req, attributes)` - Render complete form
|
|
147
|
+
- `renderFormFields(fieldsToRender, domain, req)` - Render field set
|
|
148
|
+
- `renderFormField(field, domain, submittedValues, errors)` - Render individual field
|
|
149
|
+
- `loadFormTemplate(templateName, domain)` - Load form template with domain fallback
|
|
150
|
+
- `findFormTemplate(templateName, domain)` - Template discovery for forms
|
|
151
|
+
|
|
152
|
+
### DynamicFormRequestHandler Class
|
|
153
|
+
|
|
154
|
+
- `handleFormSubmission(req, res)` - Process POST form submissions
|
|
155
|
+
- `handleBadRequest(res, message)` - Handle validation errors
|
|
156
|
+
- `handleSuccessResponse(req, res, formKey, result)` - Handle successful submissions
|
|
157
|
+
- `buildErrorRedirectPath(req, error, formKey)` - Build error redirect URLs
|
|
158
|
+
- `buildSuccessRedirectPath(successRedirect, formKey)` - Build success redirect URLs
|
|
159
|
+
|
|
160
|
+
### FormsTransformer Class
|
|
161
|
+
|
|
162
|
+
- `transform(template, domain, req, systemVariables, enhancedData)` - Process cmsForm tags
|
|
163
|
+
- `findAllFormTags(template)` - Find cmsForm tags in template
|
|
164
|
+
- `parseFormAttributes(fullTag)` - Parse tag attributes
|
|
165
|
+
- `parseFieldsFilter(attributes, formConfig)` - Filter fields based on attributes
|
|
166
|
+
|
|
167
|
+
## AdminManager Class
|
|
168
|
+
|
|
169
|
+
- `setupAdmin()` - Initialize admin panel
|
|
170
|
+
- `generateListRouteContent()` - Entity list pages
|
|
171
|
+
- `generateEditRouteContent()` - Entity edit forms
|
|
172
|
+
- `processSaveEntity()` - Handle form submissions
|
|
@@ -20,7 +20,7 @@ Responsibilities are split across four files:
|
|
|
20
20
|
- `lib/manager.js` — orchestration, server config, lifecycle
|
|
21
21
|
- `lib/manager-component-validator.js` — static validation of provided server/dataServer/adminManager/frontend instances
|
|
22
22
|
- `lib/manager-config-loader.js` — static `loadFromEnv()` reading all `RELDENS_*` env vars into a config object
|
|
23
|
-
- `lib/manager-services-initializer.js` — data server, admin, frontend, entity and route manager initialization; auto-
|
|
23
|
+
- `lib/manager-services-initializer.js` — data server, admin, frontend, entity and route manager initialization; auto-loads the Prisma modules via `PrismaClientLoader` from `@reldens/storage` when driver is `prisma` and no `prismaModules` is provided
|
|
24
24
|
|
|
25
25
|
### Frontend
|
|
26
26
|
|
|
@@ -1,126 +1,128 @@
|
|
|
1
|
-
# Configuration Guide
|
|
2
|
-
|
|
3
|
-
## Environment Variables
|
|
4
|
-
|
|
5
|
-
```env
|
|
6
|
-
RELDENS_APP_HOST=http://localhost
|
|
7
|
-
RELDENS_APP_PORT=8080
|
|
8
|
-
RELDENS_ADMIN_ROUTE_PATH=/admin
|
|
9
|
-
RELDENS_ADMIN_SECRET=your-secret-key
|
|
10
|
-
|
|
11
|
-
RELDENS_DB_CLIENT=mysql
|
|
12
|
-
RELDENS_DB_HOST=localhost
|
|
13
|
-
RELDENS_DB_PORT=3306
|
|
14
|
-
RELDENS_DB_NAME=cms_db
|
|
15
|
-
RELDENS_DB_USER=username
|
|
16
|
-
RELDENS_DB_PASSWORD=password
|
|
17
|
-
RELDENS_STORAGE_DRIVER=
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- `reloadTime:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
1
|
+
# Configuration Guide
|
|
2
|
+
|
|
3
|
+
## Environment Variables
|
|
4
|
+
|
|
5
|
+
```env
|
|
6
|
+
RELDENS_APP_HOST=http://localhost
|
|
7
|
+
RELDENS_APP_PORT=8080
|
|
8
|
+
RELDENS_ADMIN_ROUTE_PATH=/admin
|
|
9
|
+
RELDENS_ADMIN_SECRET=your-secret-key
|
|
10
|
+
|
|
11
|
+
RELDENS_DB_CLIENT=mysql
|
|
12
|
+
RELDENS_DB_HOST=localhost
|
|
13
|
+
RELDENS_DB_PORT=3306
|
|
14
|
+
RELDENS_DB_NAME=cms_db
|
|
15
|
+
RELDENS_DB_USER=username
|
|
16
|
+
RELDENS_DB_PASSWORD=password
|
|
17
|
+
RELDENS_STORAGE_DRIVER=mikro-orm
|
|
18
|
+
RELDENS_PRISMA_ADAPTER=@prisma/adapter-mariadb
|
|
19
|
+
RELDENS_PRISMA_ADAPTER_CLASS=PrismaMariaDb
|
|
20
|
+
|
|
21
|
+
RELDENS_DEFAULT_DOMAIN=example.com
|
|
22
|
+
RELDENS_DOMAIN_MAPPING={"dev.example.com":"development"}
|
|
23
|
+
RELDENS_SITE_KEY_MAPPING={"example.com":"main"}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Template Reloading Configuration
|
|
27
|
+
|
|
28
|
+
Configure template reloading for development environments:
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
const cms = new Manager({
|
|
32
|
+
// Development: reload templates on every request when changes detected
|
|
33
|
+
reloadTime: -1,
|
|
34
|
+
|
|
35
|
+
// Production: disable template reloading (default)
|
|
36
|
+
reloadTime: 0,
|
|
37
|
+
|
|
38
|
+
// Interval-based: reload every 5 seconds when changes detected
|
|
39
|
+
reloadTime: 5000
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Template Reloading Options:**
|
|
44
|
+
|
|
45
|
+
- `reloadTime: 0` (default) - Template reloading disabled. Templates load once at startup.
|
|
46
|
+
- `reloadTime: -1` - Reload templates on every request when file changes are detected. Best for active development.
|
|
47
|
+
- `reloadTime: > 0` - Check for template changes at specified interval (milliseconds) and reload when needed. Good for development with lower overhead.
|
|
48
|
+
|
|
49
|
+
**How it works:**
|
|
50
|
+
|
|
51
|
+
- Tracks file modification times for admin and frontend templates
|
|
52
|
+
- Only reloads templates that have actually changed
|
|
53
|
+
- Automatically updates admin contents and frontend template cache
|
|
54
|
+
- Works with both admin panel templates and frontend templates/partials
|
|
55
|
+
- Zero performance impact when disabled (`reloadTime: 0`)
|
|
56
|
+
|
|
57
|
+
## Custom Entity Configuration
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
const entityConfig = {
|
|
61
|
+
articles: {
|
|
62
|
+
listProperties: ['title', 'status', 'created_at'],
|
|
63
|
+
showProperties: ['title', 'content', 'author', 'status'],
|
|
64
|
+
editProperties: ['title', 'content', 'author_id', 'status'],
|
|
65
|
+
filterProperties: ['status', 'author_id'],
|
|
66
|
+
titleProperty: 'title',
|
|
67
|
+
parentItemLabel: 'Content',
|
|
68
|
+
properties: {
|
|
69
|
+
title: { type: 'string', isRequired: true },
|
|
70
|
+
content: { type: 'text' },
|
|
71
|
+
author_id: { type: 'reference', reference: 'users' },
|
|
72
|
+
featured_image: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
isUpload: true,
|
|
75
|
+
allowedTypes: 'image',
|
|
76
|
+
bucket: 'uploads'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const cms = new Manager({
|
|
83
|
+
entitiesConfig: entityConfig
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Manager Configuration Options
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
const cms = new Manager({
|
|
91
|
+
projectRoot: process.cwd(),
|
|
92
|
+
|
|
93
|
+
// Entity Access Control
|
|
94
|
+
entityAccess: {
|
|
95
|
+
cmsPages: { public: true, operations: ['read'] },
|
|
96
|
+
articles: { public: true, operations: ['read'] },
|
|
97
|
+
users: { public: false }
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
// Authentication
|
|
101
|
+
authenticationMethod: 'db-users',
|
|
102
|
+
adminRoleId: 99,
|
|
103
|
+
authenticationCallback: async (email, password, roleId) => {
|
|
104
|
+
return await yourAuthService.validate(email, password, roleId);
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
// Performance
|
|
108
|
+
cache: true,
|
|
109
|
+
reloadTime: 0,
|
|
110
|
+
|
|
111
|
+
// Multi-Domain
|
|
112
|
+
defaultDomain: 'example.com',
|
|
113
|
+
domainMapping: {'dev.example.com': 'development'},
|
|
114
|
+
siteKeyMapping: {'example.com': 'main'},
|
|
115
|
+
|
|
116
|
+
// Custom Entities
|
|
117
|
+
entitiesConfig: entityConfig,
|
|
118
|
+
entitiesTranslations: {},
|
|
119
|
+
adminTranslations: {},
|
|
120
|
+
|
|
121
|
+
// Optional Custom Services
|
|
122
|
+
app: customExpressApp,
|
|
123
|
+
appServer: customAppServer,
|
|
124
|
+
dataServer: customDataServer,
|
|
125
|
+
adminManager: customAdmin,
|
|
126
|
+
frontend: customFrontend
|
|
127
|
+
});
|
|
128
|
+
```
|