domma-cms 0.25.15 → 0.25.16
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/admin/js/app.js +2 -2
- package/admin/js/templates/api-reference.html +68 -1233
- package/admin/js/templates/docs/api-actions.html +146 -0
- package/admin/js/templates/docs/api-authentication.html +202 -0
- package/admin/js/templates/docs/api-collections.html +347 -0
- package/admin/js/templates/docs/api-layouts.html +123 -0
- package/admin/js/templates/docs/api-media.html +158 -0
- package/admin/js/templates/docs/api-navigation.html +99 -0
- package/admin/js/templates/docs/api-pages.html +214 -0
- package/admin/js/templates/docs/api-plugins.html +136 -0
- package/admin/js/templates/docs/api-settings.html +148 -0
- package/admin/js/templates/docs/api-users.html +189 -0
- package/admin/js/templates/docs/api-views.html +142 -0
- package/admin/js/templates/docs/components-howto.html +175 -0
- package/admin/js/templates/docs/components-reference.html +259 -0
- package/admin/js/templates/docs/components-rules.html +167 -0
- package/admin/js/templates/docs/components-walkthrough.html +167 -0
- package/admin/js/templates/docs/tutorial-crud.html +344 -0
- package/admin/js/templates/docs/tutorial-forms.html +93 -0
- package/admin/js/templates/docs/tutorial-plugin.html +234 -0
- package/admin/js/templates/docs/usage-actions.html +122 -0
- package/admin/js/templates/docs/usage-cta-shortcode.html +124 -0
- package/admin/js/templates/docs/usage-dconfig.html +148 -0
- package/admin/js/templates/docs/usage-media.html +25 -0
- package/admin/js/templates/docs/usage-navigation.html +31 -0
- package/admin/js/templates/docs/usage-pages.html +68 -0
- package/admin/js/templates/docs/usage-plugins.html +36 -0
- package/admin/js/templates/docs/usage-shortcodes.html +810 -0
- package/admin/js/templates/docs/usage-site-settings.html +52 -0
- package/admin/js/templates/docs/usage-users-roles.html +84 -0
- package/admin/js/templates/docs/usage-views.html +105 -0
- package/admin/js/templates/documentation.html +60 -1522
- package/admin/js/templates/tutorials.html +46 -659
- package/admin/js/views/api-reference.js +1 -1
- package/admin/js/views/doc-pages.js +1 -0
- package/admin/js/views/documentation.js +1 -1
- package/admin/js/views/index.js +1 -1
- package/admin/js/views/tutorials.js +1 -1
- package/config/menus/admin-sidebar.json +76 -6
- package/package.json +1 -1
- package/server/server.js +3 -1
- package/server/services/sidebar-migration.js +145 -3
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<div class="view-header">
|
|
2
|
+
<h1><span data-icon="code"></span> API · Actions API</h1>
|
|
3
|
+
<a href="#/api-reference" class="btn btn-ghost btn-sm"><span data-icon="arrow-left"></span> API overview</a>
|
|
4
|
+
</div>
|
|
5
|
+
<style>
|
|
6
|
+
.method-badge {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
font-size: 11px;
|
|
9
|
+
font-weight: 700;
|
|
10
|
+
letter-spacing: 0.5px;
|
|
11
|
+
padding: 2px 7px;
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
font-family: var(--dm-font-mono, monospace);
|
|
14
|
+
margin-right: 6px;
|
|
15
|
+
vertical-align: middle;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.method-get {
|
|
19
|
+
background: #d1fae5;
|
|
20
|
+
color: #065f46;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.method-post {
|
|
24
|
+
background: #dbeafe;
|
|
25
|
+
color: #1e40af;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.method-put {
|
|
29
|
+
background: #fef3c7;
|
|
30
|
+
color: #92400e;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.method-patch {
|
|
34
|
+
background: #ccfbf1;
|
|
35
|
+
color: #134e4a;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.method-delete {
|
|
39
|
+
background: #fee2e2;
|
|
40
|
+
color: #991b1b;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.endpoint-path {
|
|
44
|
+
font-family: var(--dm-font-mono, monospace);
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.auth-note {
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
color: var(--dm-color-text-muted, #6b7280);
|
|
51
|
+
margin: 4px 0 12px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.auth-note code {
|
|
55
|
+
font-size: 11px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.docs-body h3 {
|
|
59
|
+
margin-top: 24px;
|
|
60
|
+
margin-bottom: 8px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.docs-body h3:first-child {
|
|
64
|
+
margin-top: 0;
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
67
|
+
|
|
68
|
+
<div class="row">
|
|
69
|
+
<div class="col-12">
|
|
70
|
+
<div class="docs-body">
|
|
71
|
+
|
|
72
|
+
<p>Actions require a MongoDB connection. All admin endpoints require authentication and the
|
|
73
|
+
<code>actions</code> permission. Action configs are stored in <code>cms__actions</code>.</p>
|
|
74
|
+
|
|
75
|
+
<h3 style="margin-top:16px;font-size:15px;text-transform:uppercase;letter-spacing:.5px;opacity:.6">
|
|
76
|
+
Admin Endpoints</h3>
|
|
77
|
+
|
|
78
|
+
<h3><span class="method-badge method-get">GET</span><span class="endpoint-path">/api/actions</span>
|
|
79
|
+
</h3>
|
|
80
|
+
<p class="auth-note">Requires: <code>actions</code> permission</p>
|
|
81
|
+
<p>List all action configs.</p>
|
|
82
|
+
|
|
83
|
+
<h3><span class="method-badge method-post">POST</span><span class="endpoint-path">/api/actions</span>
|
|
84
|
+
</h3>
|
|
85
|
+
<p class="auth-note">Requires: <code>actions</code> permission</p>
|
|
86
|
+
<p>Create a new action config. Returns <code>201</code> on success.</p>
|
|
87
|
+
<pre class="code-block"><code>{
|
|
88
|
+
"title": "Approve Application",
|
|
89
|
+
"slug": "approve-application",
|
|
90
|
+
"collection": "applications",
|
|
91
|
+
"trigger": { "type": "manual", "label": "Approve", "icon": "check-circle", "confirmMessage": "Approve this application?" },
|
|
92
|
+
"steps": [
|
|
93
|
+
{ "type": "updateField", "config": { "field": "status", "value": "approved" } },
|
|
94
|
+
{ "type": "updateField", "config": { "field": "approvedAt", "value": "{{now}}" } },
|
|
95
|
+
{ "type": "email", "config": { "to": "{{entry.data.email}}", "subject": "Application approved",
|
|
96
|
+
"template": "Hi {{entry.data.name}}, your application is approved." } }
|
|
97
|
+
],
|
|
98
|
+
"access": { "roles": ["admin", "manager"] }
|
|
99
|
+
}</code></pre>
|
|
100
|
+
|
|
101
|
+
<h3><span class="method-badge method-get">GET</span><span
|
|
102
|
+
class="endpoint-path">/api/actions/:slug</span></h3>
|
|
103
|
+
<p class="auth-note">Requires: <code>actions</code> permission</p>
|
|
104
|
+
<p>Return a single action config by slug.</p>
|
|
105
|
+
|
|
106
|
+
<h3><span class="method-badge method-put">PUT</span><span
|
|
107
|
+
class="endpoint-path">/api/actions/:slug</span></h3>
|
|
108
|
+
<p class="auth-note">Requires: <code>actions</code> permission</p>
|
|
109
|
+
<p>Update an action config.</p>
|
|
110
|
+
|
|
111
|
+
<h3><span class="method-badge method-delete">DELETE</span><span class="endpoint-path">/api/actions/:slug</span>
|
|
112
|
+
</h3>
|
|
113
|
+
<p class="auth-note">Requires: <code>actions</code> permission</p>
|
|
114
|
+
<p>Delete an action config.</p>
|
|
115
|
+
|
|
116
|
+
<h3><span class="method-badge method-post">POST</span><span class="endpoint-path">/api/actions/:slug/execute</span>
|
|
117
|
+
</h3>
|
|
118
|
+
<p class="auth-note">Requires: <code>actions</code> permission</p>
|
|
119
|
+
<p>Execute an action against a specific entry.</p>
|
|
120
|
+
<pre class="code-block"><code>// Request body
|
|
121
|
+
{ "entryId": "uuid-of-the-entry" }
|
|
122
|
+
|
|
123
|
+
// Response
|
|
124
|
+
{ "success": true, "stepsCompleted": 4, "results": [ { "type": "updateField", "success": true, ... } ] }
|
|
125
|
+
|
|
126
|
+
// Partial failure
|
|
127
|
+
{ "success": false, "stepsCompleted": 2, "results": [ ..., { "type": "webhook", "success": false, "error": "Webhook returned HTTP 500" } ] }</code></pre>
|
|
128
|
+
|
|
129
|
+
<h3><span class="method-badge method-get">GET</span><span class="endpoint-path">/api/actions/collection/:slug</span>
|
|
130
|
+
</h3>
|
|
131
|
+
<p class="auth-note">Requires: <code>actions</code> permission</p>
|
|
132
|
+
<p>List all action configs targeting a given collection slug. Used by the entry list view to populate
|
|
133
|
+
per-row trigger buttons.</p>
|
|
134
|
+
|
|
135
|
+
<h3 style="margin-top:24px;font-size:15px;text-transform:uppercase;letter-spacing:.5px;opacity:.6">
|
|
136
|
+
Public Endpoint</h3>
|
|
137
|
+
|
|
138
|
+
<h3><span class="method-badge method-post">POST</span><span class="endpoint-path">/api/actions/:slug/public</span>
|
|
139
|
+
</h3>
|
|
140
|
+
<p class="auth-note">Requires: JWT + role in <code>access.roles</code></p>
|
|
141
|
+
<p>Execute an action publicly. Always requires a valid JWT — the role is checked against <code>access.roles</code>.
|
|
142
|
+
Request body and response shape are identical to the admin <code>/execute</code> endpoint.</p>
|
|
143
|
+
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
<div class="view-header">
|
|
2
|
+
<h1><span data-icon="code"></span> API · Authentication</h1>
|
|
3
|
+
<a href="#/api-reference" class="btn btn-ghost btn-sm"><span data-icon="arrow-left"></span> API overview</a>
|
|
4
|
+
</div>
|
|
5
|
+
<style>
|
|
6
|
+
.method-badge {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
font-size: 11px;
|
|
9
|
+
font-weight: 700;
|
|
10
|
+
letter-spacing: 0.5px;
|
|
11
|
+
padding: 2px 7px;
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
font-family: var(--dm-font-mono, monospace);
|
|
14
|
+
margin-right: 6px;
|
|
15
|
+
vertical-align: middle;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.method-get {
|
|
19
|
+
background: #d1fae5;
|
|
20
|
+
color: #065f46;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.method-post {
|
|
24
|
+
background: #dbeafe;
|
|
25
|
+
color: #1e40af;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.method-put {
|
|
29
|
+
background: #fef3c7;
|
|
30
|
+
color: #92400e;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.method-patch {
|
|
34
|
+
background: #ccfbf1;
|
|
35
|
+
color: #134e4a;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.method-delete {
|
|
39
|
+
background: #fee2e2;
|
|
40
|
+
color: #991b1b;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.endpoint-path {
|
|
44
|
+
font-family: var(--dm-font-mono, monospace);
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.auth-note {
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
color: var(--dm-color-text-muted, #6b7280);
|
|
51
|
+
margin: 4px 0 12px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.auth-note code {
|
|
55
|
+
font-size: 11px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.docs-body h3 {
|
|
59
|
+
margin-top: 24px;
|
|
60
|
+
margin-bottom: 8px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.docs-body h3:first-child {
|
|
64
|
+
margin-top: 0;
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
67
|
+
|
|
68
|
+
<div class="row">
|
|
69
|
+
<div class="col-12">
|
|
70
|
+
<div class="docs-body">
|
|
71
|
+
|
|
72
|
+
<h3><span class="method-badge method-get">GET</span><span
|
|
73
|
+
class="endpoint-path">/api/auth/setup-status</span></h3>
|
|
74
|
+
<p class="auth-note">No authentication required.</p>
|
|
75
|
+
<p>Check whether the CMS has been set up. Returns <code>{ needsSetup: true }</code> when no users
|
|
76
|
+
exist.</p>
|
|
77
|
+
<pre class="code-block"><code>// Response
|
|
78
|
+
{ "needsSetup": false }</code></pre>
|
|
79
|
+
|
|
80
|
+
<h3><span class="method-badge method-post">POST</span><span
|
|
81
|
+
class="endpoint-path">/api/auth/setup</span></h3>
|
|
82
|
+
<p class="auth-note">No authentication required. Only succeeds when zero users exist.</p>
|
|
83
|
+
<p>Create the initial admin account. Blocked once any user exists (returns 403).</p>
|
|
84
|
+
<table class="table table-sm">
|
|
85
|
+
<thead>
|
|
86
|
+
<tr>
|
|
87
|
+
<th>Field</th>
|
|
88
|
+
<th>Type</th>
|
|
89
|
+
<th>Description</th>
|
|
90
|
+
</tr>
|
|
91
|
+
</thead>
|
|
92
|
+
<tbody>
|
|
93
|
+
<tr>
|
|
94
|
+
<td><code>name</code></td>
|
|
95
|
+
<td>string</td>
|
|
96
|
+
<td>Display name</td>
|
|
97
|
+
</tr>
|
|
98
|
+
<tr>
|
|
99
|
+
<td><code>email</code></td>
|
|
100
|
+
<td>string</td>
|
|
101
|
+
<td>Email address</td>
|
|
102
|
+
</tr>
|
|
103
|
+
<tr>
|
|
104
|
+
<td><code>password</code></td>
|
|
105
|
+
<td>string</td>
|
|
106
|
+
<td>Minimum 8 characters</td>
|
|
107
|
+
</tr>
|
|
108
|
+
</tbody>
|
|
109
|
+
</table>
|
|
110
|
+
<pre class="code-block"><code>// Response 201
|
|
111
|
+
{ "token": "eyJ...", "refreshToken": "eyJ...", "user": { "id": "...", "name": "...", "email": "...", "role": "admin" } }</code></pre>
|
|
112
|
+
|
|
113
|
+
<h3><span class="method-badge method-post">POST</span><span
|
|
114
|
+
class="endpoint-path">/api/auth/login</span></h3>
|
|
115
|
+
<p class="auth-note">No authentication required.</p>
|
|
116
|
+
<p>Authenticate with email and password. Returns access and refresh tokens.</p>
|
|
117
|
+
<table class="table table-sm">
|
|
118
|
+
<thead>
|
|
119
|
+
<tr>
|
|
120
|
+
<th>Field</th>
|
|
121
|
+
<th>Type</th>
|
|
122
|
+
<th>Description</th>
|
|
123
|
+
</tr>
|
|
124
|
+
</thead>
|
|
125
|
+
<tbody>
|
|
126
|
+
<tr>
|
|
127
|
+
<td><code>email</code></td>
|
|
128
|
+
<td>string</td>
|
|
129
|
+
<td>User email</td>
|
|
130
|
+
</tr>
|
|
131
|
+
<tr>
|
|
132
|
+
<td><code>password</code></td>
|
|
133
|
+
<td>string</td>
|
|
134
|
+
<td>User password</td>
|
|
135
|
+
</tr>
|
|
136
|
+
</tbody>
|
|
137
|
+
</table>
|
|
138
|
+
<pre class="code-block"><code>// Response 200
|
|
139
|
+
{ "token": "eyJ...", "refreshToken": "eyJ...", "user": { "id": "uuid", "name": "Alice", "email": "alice@example.com", "role": "admin" } }
|
|
140
|
+
|
|
141
|
+
// Error 401
|
|
142
|
+
{ "error": "Invalid credentials" }</code></pre>
|
|
143
|
+
|
|
144
|
+
<h3><span class="method-badge method-get">GET</span><span class="endpoint-path">/api/auth/me</span>
|
|
145
|
+
</h3>
|
|
146
|
+
<p class="auth-note">Requires Bearer token.</p>
|
|
147
|
+
<p>Return the authenticated user's profile.</p>
|
|
148
|
+
<pre class="code-block"><code>// Response 200
|
|
149
|
+
{ "id": "uuid", "name": "Alice", "email": "alice@example.com", "role": "admin", "isActive": true }</code></pre>
|
|
150
|
+
|
|
151
|
+
<h3><span class="method-badge method-post">POST</span><span
|
|
152
|
+
class="endpoint-path">/api/auth/logout</span></h3>
|
|
153
|
+
<p class="auth-note">No authentication required. Safe to call without a token.</p>
|
|
154
|
+
<p>Blacklists the provided refresh token. The in-memory blacklist is cleared on server restart.</p>
|
|
155
|
+
<table class="table table-sm">
|
|
156
|
+
<thead>
|
|
157
|
+
<tr>
|
|
158
|
+
<th>Field</th>
|
|
159
|
+
<th>Type</th>
|
|
160
|
+
<th>Description</th>
|
|
161
|
+
</tr>
|
|
162
|
+
</thead>
|
|
163
|
+
<tbody>
|
|
164
|
+
<tr>
|
|
165
|
+
<td><code>refreshToken</code></td>
|
|
166
|
+
<td>string</td>
|
|
167
|
+
<td>The refresh token to revoke (optional)</td>
|
|
168
|
+
</tr>
|
|
169
|
+
</tbody>
|
|
170
|
+
</table>
|
|
171
|
+
<pre class="code-block"><code>// Response 200
|
|
172
|
+
{ "ok": true }</code></pre>
|
|
173
|
+
|
|
174
|
+
<h3><span class="method-badge method-post">POST</span><span
|
|
175
|
+
class="endpoint-path">/api/auth/refresh</span></h3>
|
|
176
|
+
<p class="auth-note">No authentication required. Provide a valid refresh token.</p>
|
|
177
|
+
<p>Exchange a refresh token for a new access token.</p>
|
|
178
|
+
<table class="table table-sm">
|
|
179
|
+
<thead>
|
|
180
|
+
<tr>
|
|
181
|
+
<th>Field</th>
|
|
182
|
+
<th>Type</th>
|
|
183
|
+
<th>Description</th>
|
|
184
|
+
</tr>
|
|
185
|
+
</thead>
|
|
186
|
+
<tbody>
|
|
187
|
+
<tr>
|
|
188
|
+
<td><code>refreshToken</code></td>
|
|
189
|
+
<td>string</td>
|
|
190
|
+
<td>A valid, non-revoked refresh token</td>
|
|
191
|
+
</tr>
|
|
192
|
+
</tbody>
|
|
193
|
+
</table>
|
|
194
|
+
<pre class="code-block"><code>// Response 200
|
|
195
|
+
{ "token": "eyJ..." }
|
|
196
|
+
|
|
197
|
+
// Error 401
|
|
198
|
+
{ "error": "Invalid or expired refresh token" }</code></pre>
|
|
199
|
+
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|