@brightsideoy/kama 1.0.0-alpha.3 → 1.0.0-alpha.31
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/README.md +25 -7
- package/bin/cli.js +539 -359
- package/content/definitions/blocks/button.yaml +15 -5
- package/content/definitions/blocks/form.yaml +20 -0
- package/content/definitions/blocks/image-gallery.yaml +34 -0
- package/content/definitions/blocks/node-list.yaml +75 -0
- package/content/definitions/blocks/youtube.yaml +8 -0
- package/content/definitions/field-sets/access.yaml +14 -0
- package/content/definitions/field-sets/page-base.yaml +19 -1
- package/content/definitions/forms/.gitkeep +0 -0
- package/content/definitions/forms/contact.yaml +38 -0
- package/content/definitions/forms/subscription.yaml +26 -0
- package/content/definitions/nodes/article.yaml +19 -1
- package/content/definitions/taxonomies/categories.yaml +5 -2
- package/content/definitions/taxonomies/media-tag.yaml +15 -0
- package/content/definitions/taxonomies/tags.yaml +5 -2
- package/definitions/editor/default.ts +19 -2
- package/dist/assets/AssetEditor-CAvQEsBT.js +1 -0
- package/dist/assets/AssetEditor-CQtKSOjX.css +1 -0
- package/dist/assets/CmsAccordion-91I5Rx5D.css +1 -0
- package/dist/assets/CmsAccordion-BgdaB8QZ.js +1 -0
- package/dist/assets/CmsBadge-BT2jTJUu.js +1 -0
- package/dist/assets/CmsBadge-Ip5hXw8G.css +1 -0
- package/dist/assets/CmsButton-DATGQeoC.css +1 -0
- package/dist/assets/CmsButton-DnhPsHXA.js +1 -0
- package/dist/assets/CmsFieldTaxonomy-CNY3-MbD.js +1 -0
- package/dist/assets/CmsFieldTaxonomy-CVlKL-l2.css +1 -0
- package/dist/assets/CmsHelp-BO_vWABq.css +1 -0
- package/dist/assets/CmsHelp-DtPeURCv.js +1 -0
- package/dist/assets/CmsImagePreview-BhM7S_v8.js +1 -0
- package/dist/assets/CmsImagePreview-CujwG8r_.css +1 -0
- package/dist/assets/CmsPublisher-BcrQAr1m.css +1 -0
- package/dist/assets/CmsPublisher-DiQhfPID.js +3 -0
- package/dist/assets/CmsUserCenter-CAaiCweN.js +1 -0
- package/dist/assets/CmsUserCenter-D3OZYHD0.css +1 -0
- package/dist/assets/EditorSplitPreview-BfGni85I.js +1 -0
- package/dist/assets/EditorSplitPreview-CMoTjLW5.css +1 -0
- package/dist/assets/FormsWorkspace-CGs6eUjz.css +1 -0
- package/dist/assets/FormsWorkspace-CUK-y2dR.js +2 -0
- package/dist/assets/NodeContextMenu-C5RTK0sr.js +1 -0
- package/dist/assets/NodeContextMenu-Cj-2TvQC.css +1 -0
- package/dist/assets/NodeEditor-C2meZIvc.css +1 -0
- package/dist/assets/NodeEditor-C5VQu52a.js +161 -0
- package/dist/assets/SettingsDashboard-XBOgYUn3.css +1 -0
- package/dist/assets/SettingsDashboard-gzHzxsIc.js +1 -0
- package/dist/assets/StatusPill-Dlm6uvGe.css +1 -0
- package/dist/assets/StatusPill-HY1gCP9c.js +1 -0
- package/dist/assets/TrashWorkspace-DtMgxg13.css +1 -0
- package/dist/assets/TrashWorkspace-t0lOrFRK.js +1 -0
- package/dist/assets/_plugin-vue_export-helper-BK_c4R_m.js +5 -0
- package/dist/assets/circle-check-CksZGUB7.js +1 -0
- package/dist/assets/database--QlkzG9u.js +1 -0
- package/dist/assets/file-U7h4eOhG.js +1 -0
- package/dist/assets/globe-TuZP0v6A.js +1 -0
- package/dist/assets/history-CIbqkRx3.js +1 -0
- package/dist/assets/index-C171UGo4.css +1 -0
- package/dist/assets/index-_Tc6Vb8T.js +14 -0
- package/dist/assets/layers-BwACvD_U.js +1 -0
- package/dist/assets/loader-circle-DYEFqbD4.js +1 -0
- package/dist/assets/panel-left-close-Cpq52HZy.js +1 -0
- package/dist/assets/plus-7rv1C56N.js +1 -0
- package/dist/assets/preload-helper-BB8Wl1va.js +1 -0
- package/dist/assets/preload-helper-BxFQpwa9.css +1 -0
- package/dist/assets/rotate-ccw-DvjWccJd.js +1 -0
- package/dist/assets/save-Dwhm8QNL.js +1 -0
- package/dist/assets/schema-helpers-uuDCw8Rb.js +1 -0
- package/dist/assets/send-Bs4eROle.js +1 -0
- package/dist/assets/smartphone-i429gh5p.js +1 -0
- package/dist/assets/trash-2-BbKTm8cC.js +1 -0
- package/dist/assets/useCmsState-CDENPbKL.js +1 -0
- package/dist/assets/useNodes-D-Vuwq5_.js +1 -0
- package/dist/assets/user-DKryA1QU.js +1 -0
- package/dist/assets/x-DOWbsdzd.js +1 -0
- package/dist/build-seed.js +495 -0
- package/dist/{dist-cK3xGnBZ.js → dist-DKRU6nhX.js} +9254 -5762
- package/dist/index.html +32 -2
- package/dist/index.js +9179 -5689
- package/dist/nodemailer-Ccic7tRm-Dw2jwzbm.js +7877 -0
- package/dist/nodemailer-Ccic7tRm.js +7908 -0
- package/dist/rolldown-runtime-B0aSnxlc.js +20 -0
- package/dist/schema-compiler.js +1 -1
- package/documentation/FORMS.md +261 -0
- package/documentation/SCHEMAS.md +450 -119
- package/package.json +14 -6
- package/schema.sql +46 -1
- package/templates/astro-starter/astro-preview-dev-integration.mjs +83 -0
- package/templates/astro-starter/astro.config.mjs +11 -0
- package/templates/astro-starter/src/components/blocks/BlockRenderer.astro +17 -0
- package/templates/astro-starter/src/components/blocks/Form.astro +313 -0
- package/templates/astro-starter/src/components/blocks/HeaderImage.astro +6 -12
- package/templates/astro-starter/src/components/blocks/ImageBlock.astro +5 -6
- package/templates/astro-starter/src/components/blocks/NodeList.astro +274 -0
- package/templates/astro-starter/src/components/global/NavigationMenu.astro +17 -8
- package/templates/astro-starter/src/components/ui/KamaImage.astro +13 -5
- package/templates/astro-starter/src/layouts/StandardLayout.astro +4 -3
- package/templates/astro-starter/src/lib/cms-fetch.ts +22 -0
- package/templates/astro-starter/src/lib/cms.ts +18 -9
- package/templates/astro-starter/src/lib/media/kama-image-service.ts +15 -4
- package/templates/astro-starter/src/lib/media/media-proxy.ts +22 -3
- package/templates/astro-starter/src/lib/media/media-url.ts +17 -3
- package/templates/astro-starter/src/middleware.ts +199 -71
- package/templates/astro-starter/src/pages/[...slug].astro +122 -45
- package/templates/astro-starter/src/pages/api/forms/[...path].ts +57 -0
- package/templates/astro-starter/src/pages/api/load-nodes.ts +68 -0
- package/templates/astro-starter/src/pages/api/partials/node-cards.astro +98 -0
- package/templates/astro-starter/src/pages/partials/nav.astro +6 -5
- package/templates/kama-worker/index.js +22 -12
- package/templates/kama-worker/setup-local-db.mjs +17 -0
- package/wrangler.json +19 -0
- package/dist/assets/index-C3LzwJjY.css +0 -1
- package/dist/assets/index-DhguVxzs.js +0 -164
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
|
|
3
|
+
let r = {};
|
|
4
|
+
for (var i in e) t(r, i, {
|
|
5
|
+
get: e[i],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
+
}, c = (e, i, o, s) => {
|
|
10
|
+
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
11
|
+
get: ((e) => i[e]).bind(null, d),
|
|
12
|
+
enumerable: !(s = n(i, d)) || s.enumerable
|
|
13
|
+
});
|
|
14
|
+
return e;
|
|
15
|
+
}, l = (n, r, o) => (o = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
|
|
16
|
+
value: n,
|
|
17
|
+
enumerable: !0
|
|
18
|
+
}) : o, n));
|
|
19
|
+
//#endregion
|
|
20
|
+
export { s as n, l as r, o as t };
|
package/dist/schema-compiler.js
CHANGED
|
@@ -30,7 +30,7 @@ async function f() {
|
|
|
30
30
|
if (n(f)) l = (await import(t(f).href)).compileDefinitions;
|
|
31
31
|
else if (n(p)) l = (await import(t(p).href)).compileDefinitions;
|
|
32
32
|
else try {
|
|
33
|
-
l = (await import("./dist-
|
|
33
|
+
l = (await import("./dist-DKRU6nhX.js")).compileDefinitions;
|
|
34
34
|
} catch (e) {
|
|
35
35
|
console.error("\x1B[31m ✖\x1B[0m \x1B[31mCould not resolve Kama Schema Engine:\x1B[0m", e), process.exit(1);
|
|
36
36
|
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# Forms
|
|
2
|
+
|
|
3
|
+
KAMA forms are defined in YAML and can be added to pages with the built-in
|
|
4
|
+
**Form** block. The CMS lets you configure submission storage and email
|
|
5
|
+
finishers, and view saved submissions.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- [Form definitions](#form-definitions)
|
|
10
|
+
- [Add a form to a page](#add-a-form-to-a-page)
|
|
11
|
+
- [Submissions](#submissions)
|
|
12
|
+
- [Finishers](#finishers)
|
|
13
|
+
- [Email delivery](#email-delivery)
|
|
14
|
+
- [Turnstile verification](#turnstile-verification)
|
|
15
|
+
- [Local development](#local-development)
|
|
16
|
+
- [API reference](#api-reference)
|
|
17
|
+
|
|
18
|
+
## Form definitions
|
|
19
|
+
|
|
20
|
+
Create a YAML file in `content/definitions/forms/`. Its filename is used as the
|
|
21
|
+
form ID if you do not set `id` in the file. After adding or changing definitions,
|
|
22
|
+
run `npm run bundle:definitions` before deploying.
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
id: contact
|
|
26
|
+
title: Contact us
|
|
27
|
+
description: Send our team a message.
|
|
28
|
+
fields:
|
|
29
|
+
- name: email
|
|
30
|
+
label: Email
|
|
31
|
+
type: email
|
|
32
|
+
required: true
|
|
33
|
+
- name: message
|
|
34
|
+
label: Message
|
|
35
|
+
type: textarea
|
|
36
|
+
required: true
|
|
37
|
+
settings:
|
|
38
|
+
successMessage: Thanks for getting in touch.
|
|
39
|
+
requireTurnstile: false
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Add a form to a page
|
|
43
|
+
|
|
44
|
+
Add the **Form** block to a page and select the form. The block's optional
|
|
45
|
+
**Success Message** overrides the message in the form definition. The selected
|
|
46
|
+
form and block settings are saved as part of the page draft. Draft preview shows
|
|
47
|
+
the selection after autosave; it does not become public until you publish the
|
|
48
|
+
page. Form definitions themselves are shared YAML configuration, not page
|
|
49
|
+
drafts. If a previously selected definition is unavailable, the selector
|
|
50
|
+
displays its ID rather than silently selecting a different form.
|
|
51
|
+
|
|
52
|
+
## Submissions
|
|
53
|
+
|
|
54
|
+
All finishers are disabled by default. A valid submission with no finisher
|
|
55
|
+
enabled receives the configured success response, but is not saved or emailed.
|
|
56
|
+
|
|
57
|
+
Select a form in the Forms sidebar, then use the **Finishers** tab in the main
|
|
58
|
+
workspace to enable **Save submissions to database**. Saved entries are
|
|
59
|
+
available in the **Submissions** tab. That tab is shown only when database
|
|
60
|
+
storage is enabled. If an existing table has the old schema, KAMA recreates it
|
|
61
|
+
at startup.
|
|
62
|
+
|
|
63
|
+
Expand a submission to view its values in a field/value table using the form's
|
|
64
|
+
field labels. Use **Download CSV** to export submissions, or select individual
|
|
65
|
+
submissions and delete them together; each submission can also be deleted on
|
|
66
|
+
its own.
|
|
67
|
+
|
|
68
|
+
The **Finishers** tab also lets you configure email notifications, including a
|
|
69
|
+
fixed team recipient or the form's email field for a submitter confirmation.
|
|
70
|
+
Provider credentials remain deployment configuration. Set a package-wide
|
|
71
|
+
default sender with `FORMS_EMAIL_FROM`, or set a sender address on an individual
|
|
72
|
+
email finisher. Finisher settings are grouped into collapsible sections to make
|
|
73
|
+
the configuration easier to scan. Team notifications and submitter confirmations
|
|
74
|
+
have separate sections and can be enabled and configured independently. Each
|
|
75
|
+
section shows its enabled state while collapsed.
|
|
76
|
+
|
|
77
|
+
## Finishers
|
|
78
|
+
|
|
79
|
+
Finishers run after field validation and Turnstile verification, in the order
|
|
80
|
+
listed. KAMA registers the `database` and `email` finishers by default. You can
|
|
81
|
+
configure finishers on the form or override them on an individual Form block.
|
|
82
|
+
|
|
83
|
+
### Configure finishers on a form
|
|
84
|
+
|
|
85
|
+
For code-defined forms, configure email finishers in the form's YAML:
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
finishers:
|
|
89
|
+
- id: notify-team
|
|
90
|
+
type: email
|
|
91
|
+
from: notifications@example.com
|
|
92
|
+
to: team@example.com
|
|
93
|
+
subject: "New message from {{fullName}}"
|
|
94
|
+
replyToField: email
|
|
95
|
+
- id: confirmation
|
|
96
|
+
type: email
|
|
97
|
+
toField: email
|
|
98
|
+
subject: "We received your message"
|
|
99
|
+
text: "Thanks {{fullName}}, we received your message."
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
When finisher settings are saved in the CMS, they override the YAML settings.
|
|
103
|
+
Registered custom finishers are preserved when built-in settings are edited.
|
|
104
|
+
|
|
105
|
+
### Override finishers on a Form block
|
|
106
|
+
|
|
107
|
+
The block editor can replace the form's complete finisher list. It supports
|
|
108
|
+
enabling or disabling database storage, adding or removing email finishers, and
|
|
109
|
+
setting their recipient, sender email, subject, sender name, reply-to, and
|
|
110
|
+
message templates. Registered custom finishers can also be added, enabled,
|
|
111
|
+
removed, or edited as JSON. Email transport is configured once for the KAMA
|
|
112
|
+
package environment, not per form or block.
|
|
113
|
+
|
|
114
|
+
Block overrides are saved with the page. On submission, KAMA reloads and
|
|
115
|
+
validates the published finisher configuration from the database instead of
|
|
116
|
+
trusting settings sent by the visitor. Transport credentials cannot be changed
|
|
117
|
+
in the block editor. Sender addresses must be authorized by the configured
|
|
118
|
+
email provider. Custom finisher JSON is validated for size and type; each
|
|
119
|
+
custom handler must validate its own settings.
|
|
120
|
+
|
|
121
|
+
### Add a custom finisher
|
|
122
|
+
|
|
123
|
+
Register a handler during server startup, before submissions are handled:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import { registerFormFinisher } from '@brightsideoy/kama';
|
|
127
|
+
|
|
128
|
+
registerFormFinisher('webhook', async ({ finisher, payload, env }) => {
|
|
129
|
+
// Implement this finisher and throw if it fails.
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Then add `type: webhook` to a form's `finishers` list. Handlers run in list
|
|
134
|
+
order. If one throws, later finishers do not run and the submission fails.
|
|
135
|
+
|
|
136
|
+
## Email delivery
|
|
137
|
+
|
|
138
|
+
### Configure the transport
|
|
139
|
+
|
|
140
|
+
Set `FORMS_EMAIL_PROVIDER` once in the KAMA package's runtime environment. For
|
|
141
|
+
local Cloudflare development, put it in `.dev.vars`; for deployed Workers, put
|
|
142
|
+
it in Wrangler `vars`:
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
# .dev.vars
|
|
146
|
+
FORMS_EMAIL_PROVIDER=cloudflare
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
- `cloudflare` requires the Cloudflare Email Sending binding.
|
|
150
|
+
- `smtp` requires SMTP configuration and is available in the Node runtime.
|
|
151
|
+
- `auto` (the default) uses the Cloudflare binding when available; otherwise
|
|
152
|
+
it uses SMTP in Node.
|
|
153
|
+
|
|
154
|
+
For Workers, set the provider as a Wrangler variable and add the Email Sending
|
|
155
|
+
binding after onboarding a sender domain in Cloudflare Email Service:
|
|
156
|
+
|
|
157
|
+
```jsonc
|
|
158
|
+
{
|
|
159
|
+
"vars": {
|
|
160
|
+
"FORMS_EMAIL_PROVIDER": "cloudflare"
|
|
161
|
+
},
|
|
162
|
+
"send_email": [{ "name": "FORMS_EMAIL" }]
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Set `FORMS_EMAIL_FROM` to the package-wide default sender address at the
|
|
167
|
+
onboarded domain. An individual email finisher can override it with `from`.
|
|
168
|
+
Cloudflare Email Sending requires the appropriate Workers plan for arbitrary
|
|
169
|
+
external recipients. KAMA does not enable the binding automatically.
|
|
170
|
+
|
|
171
|
+
For Node deployments, configure:
|
|
172
|
+
|
|
173
|
+
```sh
|
|
174
|
+
FORMS_EMAIL_PROVIDER=smtp
|
|
175
|
+
FORMS_SMTP_HOST=smtp.example.com
|
|
176
|
+
FORMS_SMTP_PORT=465
|
|
177
|
+
FORMS_SMTP_SECURE=true
|
|
178
|
+
FORMS_SMTP_USER=...
|
|
179
|
+
FORMS_SMTP_PASSWORD=...
|
|
180
|
+
FORMS_EMAIL_FROM=forms@example.com
|
|
181
|
+
FORMS_EMAIL_FROM_NAME=KAMA
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
For Cloudflare authenticated SMTP, use `smtp.mx.cloudflare.net:465`, username
|
|
185
|
+
`api_token`, and an Email Sending: Edit API token as the password. Keep SMTP
|
|
186
|
+
credentials in the deployment's secret manager, never in form YAML. Use valid
|
|
187
|
+
sender and recipient addresses; Email Sending is intended for transactional
|
|
188
|
+
mail, not bulk marketing.
|
|
189
|
+
|
|
190
|
+
### Customize email content
|
|
191
|
+
|
|
192
|
+
Use `from` to override the package-wide `FORMS_EMAIL_FROM` sender for this
|
|
193
|
+
finisher. The address must be authorized by the selected email provider. If
|
|
194
|
+
omitted, the package-wide sender is used.
|
|
195
|
+
|
|
196
|
+
Use `toField` to select a recipient from the submission; it must name a form
|
|
197
|
+
field with `type: email`. Use `subjectField`, `fromNameField`, or
|
|
198
|
+
`replyToField` to select submission values. `replyToField` must also name an
|
|
199
|
+
email field. Keep the sender address fixed; use `replyToField` when replies
|
|
200
|
+
should go to the submitter. Subject text and optional `text` or `html` bodies
|
|
201
|
+
support `{{field}}` placeholders. Interpolated HTML values are escaped.
|
|
202
|
+
|
|
203
|
+
If no body template is set, the message includes all submitted fields.
|
|
204
|
+
`FORMS_EMAIL_FROM` is the sender fallback, and `FORMS_EMAIL_FROM_NAME` provides
|
|
205
|
+
an optional deployment-wide sender-name fallback.
|
|
206
|
+
|
|
207
|
+
If an email finisher fails, the submission fails and KAMA does not return a
|
|
208
|
+
success response. Email delivery and database writes cannot be rolled back
|
|
209
|
+
atomically, so earlier finishers may already have run. Retrying can repeat
|
|
210
|
+
those side effects.
|
|
211
|
+
|
|
212
|
+
## Turnstile verification
|
|
213
|
+
|
|
214
|
+
For forms with `settings.requireTurnstile: true`, configure both keys:
|
|
215
|
+
|
|
216
|
+
- `PUBLIC_TURNSTILE_SITE_KEY` on the frontend site, as a public Wrangler `vars`
|
|
217
|
+
value or local `.dev.vars` value. This renders the widget.
|
|
218
|
+
- `TURNSTILE_SECRET_KEY` on the KAMA Worker, as a Wrangler secret or local
|
|
219
|
+
`.dev.vars` value. The server uses it to verify each response.
|
|
220
|
+
|
|
221
|
+
Use keys from the same Turnstile widget. The Form block warns when Turnstile is
|
|
222
|
+
required but the site key is missing.
|
|
223
|
+
|
|
224
|
+
For local Astro development only, KAMA uses Cloudflare's documented always-pass
|
|
225
|
+
test keys when no site key or secret is configured. These keys do not protect a
|
|
226
|
+
production form; configure real keys for deployed environments.
|
|
227
|
+
|
|
228
|
+
## Local development
|
|
229
|
+
|
|
230
|
+
### Connect the Astro site to KAMA
|
|
231
|
+
|
|
232
|
+
When available, the Astro starter uses the `CMS_WORKER` service binding for CMS
|
|
233
|
+
API and `/media/*` requests. Form submissions go through the same-origin
|
|
234
|
+
`/api/forms/:formId/submissions` proxy. Without the binding, it uses
|
|
235
|
+
`PUBLIC_API_URL` server-side; local development defaults to the CMS Worker at
|
|
236
|
+
`http://127.0.0.1:8787`.
|
|
237
|
+
|
|
238
|
+
For local Astro development, run the CMS Worker on port `8787` as well as the
|
|
239
|
+
Astro site. If the local service binding reports that its target Worker is not
|
|
240
|
+
running, page and media proxies fall back to `127.0.0.1:8787`. Keep the site's
|
|
241
|
+
and CMS Worker's `FRONTEND_API_SECRET` values matched in their local secret
|
|
242
|
+
files. Never expose a server-only API secret in browser code.
|
|
243
|
+
|
|
244
|
+
### Draft preview iframe
|
|
245
|
+
|
|
246
|
+
The starter serves Vite modules requested by KAMA's sandboxed Draft iframe from
|
|
247
|
+
the local dev server. The exception is limited to opaque-origin `GET` and `HEAD`
|
|
248
|
+
requests for Vite/source assets and media; API and page requests remain
|
|
249
|
+
protected by Astro's cross-origin dev guard. Keep the dev server bound to
|
|
250
|
+
loopback.
|
|
251
|
+
|
|
252
|
+
## API reference
|
|
253
|
+
|
|
254
|
+
| Method | Endpoint | Purpose |
|
|
255
|
+
| --- | --- | --- |
|
|
256
|
+
| `GET` | `/api/v1/forms/:formId` | Fetch a form definition. |
|
|
257
|
+
| `POST` | `/api/v1/forms/:formId/submissions` | Submit a form. |
|
|
258
|
+
| `GET` | `/api/cms/forms` | Populate the Form block selector. |
|
|
259
|
+
| `GET` | `/api/cms/forms/:formId/submissions` | Fetch saved submissions and field labels. |
|
|
260
|
+
| `DELETE` | `/api/cms/forms/:formId/submissions/:submissionId` | Delete one saved submission. |
|
|
261
|
+
| `DELETE` | `/api/cms/forms/:formId/submissions` | Delete selected submissions; send `{ "ids": [1, 2] }` as JSON. |
|