@stacksjs/defaults 0.75.612 → 0.75.614
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/ai/skills/stacks-actions/SKILL.md +209 -1
- package/ai/skills/stacks-api/SKILL.md +1 -1
- package/ai/skills/stacks-buddy/SKILL.md +1 -1
- package/ai/skills/stacks-dashboard/SKILL.md +120 -9
- package/ai/skills/stacks-database/SKILL.md +4 -2
- package/ai/skills/stacks-email/SKILL.md +15 -0
- package/ai/skills/stacks-middleware/SKILL.md +4 -1
- package/ai/skills/stacks-native/CAPABILITIES.md +1 -1
- package/ai/skills/stacks-native/CATALOG.md +12 -12
- package/ai/skills/stacks-validation/SKILL.md +7 -0
- package/app/Actions/Dashboard/Models/ModelDestroyAction.ts +4 -47
- package/app/Actions/Dashboard/Models/ModelSaveAction.ts +257 -0
- package/app/Actions/Dashboard/Models/ModelStoreAction.ts +4 -31
- package/app/Actions/Dashboard/Models/ModelUpdateAction.ts +5 -61
- package/app/Actions/Dashboard/Models/model-related.ts +2 -3
- package/app/Actions/Dashboard/Models/model-row-writes.ts +188 -0
- package/app/Actions/Storefront/AddToCartAction.ts +12 -15
- package/app/Actions/Storefront/CheckoutContactAction.ts +18 -10
- package/app/Actions/Storefront/CheckoutShippingAction.ts +20 -10
- package/app/Actions/Storefront/PlaceOrderAction.ts +9 -12
- package/app/Actions/Storefront/UpdateCartItemAction.ts +11 -9
- package/app/Middleware/Abilities.ts +4 -3
- package/app/Middleware/Csrf.ts +10 -1
- package/app/Middleware/Throttle.ts +4 -4
- package/functions/dashboard-api.ts +9 -3
- package/functions/dashboard-model-bulk.ts +3 -3
- package/functions/dashboard-model-drafts.test.ts +122 -0
- package/functions/dashboard-model-drafts.ts +228 -0
- package/functions/dashboard-model-record.ts +1 -1
- package/ide/vscode/package.json +1 -1
- package/package.json +5 -5
- package/resources/components/Dashboard/Analytics/AnalyticsPageHeader.stx +3 -13
- package/resources/components/Dashboard/App/RequestsOverview.stx +3 -20
- package/resources/components/Dashboard/App/SourceInventory.stx +1 -5
- package/resources/components/Dashboard/Auth/AccessTokenCreateDialog.stx +11 -28
- package/resources/components/Dashboard/Commerce/CommerceCategoriesDashboard.stx +4 -8
- package/resources/components/Dashboard/Commerce/CommerceCategoryDialog.stx +9 -9
- package/resources/components/Dashboard/Commerce/CommerceCouponDialog.stx +14 -14
- package/resources/components/Dashboard/Commerce/CommerceCouponsDashboard.stx +5 -9
- package/resources/components/Dashboard/Commerce/CommerceCustomerDialog.stx +7 -7
- package/resources/components/Dashboard/Commerce/CommerceCustomersDashboard.stx +3 -7
- package/resources/components/Dashboard/Commerce/CommerceGiftCardDialog.stx +15 -15
- package/resources/components/Dashboard/Commerce/CommerceGiftCardsDashboard.stx +5 -9
- package/resources/components/Dashboard/Commerce/CommerceManufacturerDialog.stx +12 -15
- package/resources/components/Dashboard/Commerce/CommerceManufacturersDashboard.stx +4 -28
- package/resources/components/Dashboard/Commerce/CommerceOrderDialog.stx +15 -15
- package/resources/components/Dashboard/Commerce/CommerceOrdersDashboard.stx +4 -8
- package/resources/components/Dashboard/Commerce/CommerceOverviewDashboard.stx +3 -11
- package/resources/components/Dashboard/Commerce/CommercePaymentsDashboard.stx +8 -9
- package/resources/components/Dashboard/Commerce/CommercePosCatalog.stx +3 -20
- package/resources/components/Dashboard/Commerce/CommercePosCheckoutDialog.stx +4 -4
- package/resources/components/Dashboard/Commerce/CommerceProductDialog.stx +14 -14
- package/resources/components/Dashboard/Commerce/CommerceProductsDashboard.stx +4 -8
- package/resources/components/Dashboard/Commerce/CommerceReviewEditDialog.stx +14 -24
- package/resources/components/Dashboard/Commerce/CommerceReviewsDashboard.stx +5 -43
- package/resources/components/Dashboard/Commerce/CommerceTaxDialog.stx +22 -38
- package/resources/components/Dashboard/Commerce/CommerceTaxesDashboard.stx +5 -33
- package/resources/components/Dashboard/Commerce/CommerceUnitDialog.stx +16 -30
- package/resources/components/Dashboard/Commerce/CommerceUnitsDashboard.stx +4 -28
- package/resources/components/Dashboard/Commerce/CommerceVariantDialog.stx +15 -9
- package/resources/components/Dashboard/Commerce/CommerceVariantsDashboard.stx +8 -9
- package/resources/components/Dashboard/Commerce/Delivery/CourierDialog.stx +14 -12
- package/resources/components/Dashboard/Commerce/Delivery/DeliveryRouteDialog.stx +9 -11
- package/resources/components/Dashboard/Commerce/Delivery/DigitalDeliveryDialog.stx +15 -9
- package/resources/components/Dashboard/Commerce/Delivery/LicenseKeyDialog.stx +11 -7
- package/resources/components/Dashboard/Commerce/Delivery/ShippingMethodDialog.stx +14 -8
- package/resources/components/Dashboard/Commerce/Delivery/ShippingRateDialog.stx +11 -17
- package/resources/components/Dashboard/Commerce/Delivery/ShippingZoneDialog.stx +18 -12
- package/resources/components/Dashboard/Commerce/PaymentRefundDialog.stx +1 -1
- package/resources/components/Dashboard/Commerce/PrintDeviceDialog.stx +5 -5
- package/resources/components/Dashboard/Commerce/PrintDevicesDashboard.stx +4 -8
- package/resources/components/Dashboard/Commerce/PrintLogsDashboard.stx +5 -9
- package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +2 -10
- package/resources/components/Dashboard/Commerce/ProductWaitlistEntryDialog.stx +14 -67
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +3 -18
- package/resources/components/Dashboard/Commerce/RestaurantWaitlistEntryDialog.stx +23 -69
- package/resources/components/Dashboard/Content/AuthorEditorDialog.stx +4 -16
- package/resources/components/Dashboard/Content/BlogDashboard.stx +2 -19
- package/resources/components/Dashboard/Content/BlogPostEditorDialog.stx +31 -51
- package/resources/components/Dashboard/Content/CommentsDashboard.stx +1 -1
- package/resources/components/Dashboard/Content/ContentDashboard.stx +1 -11
- package/resources/components/Dashboard/Content/CreateFolderDialog.stx +1 -4
- package/resources/components/Dashboard/Content/FileManagerDashboard.stx +2 -2
- package/resources/components/Dashboard/Content/PageEditorDialog.stx +8 -17
- package/resources/components/Dashboard/Content/PostEditorDialog.stx +35 -45
- package/resources/components/Dashboard/Content/PostsDashboard.stx +1 -13
- package/resources/components/Dashboard/Content/SeoDashboard.stx +2 -20
- package/resources/components/Dashboard/Content/SeoEditorDialog.stx +4 -38
- package/resources/components/Dashboard/Content/TaxonomyEditorDialog.stx +8 -15
- package/resources/components/Dashboard/Data/ActivityLog.stx +1 -5
- package/resources/components/Dashboard/Deployments/DeploymentList.stx +2 -11
- package/resources/components/Dashboard/Email/InboxMessageList.stx +1 -5
- package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +2 -16
- package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +6 -10
- package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +1 -5
- package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -5
- package/resources/components/Dashboard/Jobs/JobHistory.stx +3 -12
- package/resources/components/Dashboard/Kanban/KanbanCardDialog.stx +57 -51
- package/resources/components/Dashboard/Library/ComponentsDashboard.stx +4 -14
- package/resources/components/Dashboard/Library/DependenciesDashboard.stx +2 -15
- package/resources/components/Dashboard/Library/PackagesDashboard.stx +1 -8
- package/resources/components/Dashboard/Library/SourceScaffoldDialog.stx +1 -12
- package/resources/components/Dashboard/Management/PermissionsDashboard.stx +3 -3
- package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +4 -4
- package/resources/components/Dashboard/Marketing/CampaignDeliveryDialog.stx +3 -5
- package/resources/components/Dashboard/Marketing/CampaignDialog.stx +59 -93
- package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +5 -5
- package/resources/components/Dashboard/Marketing/MarketingListDialog.stx +12 -26
- package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +4 -4
- package/resources/components/Dashboard/Marketing/RecoveryCampaignDialog.stx +12 -43
- package/resources/components/Dashboard/Marketing/SocialPostDialog.stx +7 -41
- package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +5 -5
- package/resources/components/Dashboard/Models/ModelRecordEdit.stx +240 -28
- package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +7 -23
- package/resources/components/Dashboard/Models/ModelsOverview.stx +2 -12
- package/resources/components/Dashboard/Notifications/NotificationDeliveries.stx +4 -27
- package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +4 -36
- package/resources/components/Dashboard/Operations/RecoveryDestinationDialog.stx +18 -47
- package/resources/components/Dashboard/Operations/RecoveryPolicyDialog.stx +24 -78
- package/resources/components/Dashboard/Operations/RecoveryRestoreDialog.stx +8 -19
- package/resources/components/Dashboard/Queries/QueryDashboard.stx +3 -21
- package/resources/components/Dashboard/Releases/ReleaseDashboard.stx +2 -9
- package/resources/components/Dashboard/Settings/SettingsDashboard.stx +1 -11
- package/resources/components/Dashboard/UI/Input.stx +50 -1
- package/resources/components/Dashboard/UI/SearchFilter.stx +27 -17
- package/resources/components/Dashboard/UI/Select.stx +4 -1
- package/resources/components/Dashboard/UI/Textarea.stx +16 -1
- package/resources/views/cart.stx +14 -0
- package/resources/views/checkout/contact.stx +15 -1
- package/resources/views/checkout/payment.stx +7 -0
- package/resources/views/checkout/shipping.stx +39 -5
- package/routes/dashboard-api.ts +2 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: stacks-actions
|
|
3
|
-
description: Use when working with Stacks server actions - creating actions in app/Actions/, auto-generated API actions from the useApi model trait, the
|
|
3
|
+
description: Use when working with Stacks server actions - creating actions in app/Actions/, auto-generated API actions from the useApi model trait, the 761 default framework actions (auth, dashboard, commerce, content, deployment, jobs), action request/response handling, or action registration. Covers @stacksjs/actions and storage/framework/defaults/app/Actions/.
|
|
4
4
|
license: MIT
|
|
5
5
|
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
6
|
allowed-tools: Read Edit Write Bash Grep Glob
|
|
@@ -88,6 +88,214 @@ returning a raw Response owns the wire format and yields unknown client output.
|
|
|
88
88
|
external boundaries without module-wide mocking. They do not justify mocking
|
|
89
89
|
every internal collaborator or replacing a real database test with a fake.
|
|
90
90
|
|
|
91
|
+
### A refused form goes back to its page
|
|
92
|
+
|
|
93
|
+
What a refused request is answered with follows what the caller asked for,
|
|
94
|
+
never the endpoint (stacksjs/stacks#3309):
|
|
95
|
+
|
|
96
|
+
| Caller | Answer |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `fetch()`, an API client, anything that did not ask for a page | `422` with `{ success: false, message: 'Validation failed', errors }`, as always |
|
|
99
|
+
| A browser submitting an HTML form (`Accept` has `text/html`, not a GET) | `303` back to the page the form was on, with the messages and what was posted |
|
|
100
|
+
|
|
101
|
+
A script that asks for HTML is still a script: when the browser says what it
|
|
102
|
+
is fetching (`Sec-Fetch-Dest`), only a document or a frame counts as a page.
|
|
103
|
+
An action or route group with `apiResponse: true` answers JSON to everyone.
|
|
104
|
+
|
|
105
|
+
`validations` run before `handle()`, so an action cannot do this for itself.
|
|
106
|
+
The browser used to get the 422 body: a page of JSON with the back button as
|
|
107
|
+
the only way out. Do not work around it in `handle()` with a hand-rolled
|
|
108
|
+
`response.json({ error }, 422)`: declare the rule and let the router answer.
|
|
109
|
+
`request.validate()` inside a handler is answered the same way.
|
|
110
|
+
|
|
111
|
+
The page reads what came back, in a `<script server>`:
|
|
112
|
+
|
|
113
|
+
```html
|
|
114
|
+
<script server>
|
|
115
|
+
const emailError = requestContext.error('email') // '' when there is none
|
|
116
|
+
const emailValue = requestContext.old('email', cart.email) // what was typed, else the saved value
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<input type="email" name="email" value="{{ emailValue }}" aria-invalid="{{ emailError ? 'true' : 'false' }}">
|
|
120
|
+
@if (emailError)
|
|
121
|
+
<p role="alert">{{ emailError }}</p>
|
|
122
|
+
@endif
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
- `requestContext.errors()` is every message by field (`{}` when nothing was
|
|
126
|
+
refused), `error(field)` the first for one field, `hasErrors()` whether
|
|
127
|
+
there are any, `old(field, fallback)` what was posted and `oldValues(field)`
|
|
128
|
+
every value of a repeated field.
|
|
129
|
+
- **Shown once.** They travel in a cookie (`stacks_form_flash`) signed with
|
|
130
|
+
`APP_KEY`, good for two minutes and for the one page it names. The page's
|
|
131
|
+
server removes it with the response that showed it. With no `APP_KEY` there
|
|
132
|
+
is nothing to sign with, and the browser gets a plain page listing the
|
|
133
|
+
messages instead.
|
|
134
|
+
- **Never a secret.** A field whose name says password, token, secret, key or
|
|
135
|
+
card is not sent back, and nor is a file. Draw those empty.
|
|
136
|
+
- **Only to this application's own page.** The form has to be on the same
|
|
137
|
+
origin (`Sec-Fetch-Site: same-origin`, or a matching host for a browser too
|
|
138
|
+
old to send it). A form on another site, or one with no `Referer`, gets the
|
|
139
|
+
plain page of messages and is not redirected.
|
|
140
|
+
- What was typed is dropped, longest value first, when it would not fit a
|
|
141
|
+
cookie. The messages always arrive.
|
|
142
|
+
- A form says a list by repeating a field name, and one occurrence arrives as
|
|
143
|
+
a string. A rule that asks for `schema.array()` takes it as a list of one,
|
|
144
|
+
and an empty field as an empty list. A value is never split on commas.
|
|
145
|
+
- A ticked checkbox with no `value` sends `on`, which a `schema.boolean()`
|
|
146
|
+
rule takes as true, like `true` and `1`.
|
|
147
|
+
|
|
148
|
+
A refusal only `handle()` can know about ("your cart is empty", "that item
|
|
149
|
+
has gone") is answered with `refuse()` from `@stacksjs/router`, never with a
|
|
150
|
+
hand-written `response.json({ error }, 400)` (stacksjs/stacks#3311):
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
import { refuse } from '@stacksjs/router'
|
|
154
|
+
|
|
155
|
+
if (!cart)
|
|
156
|
+
return refuse('Your cart is empty.', { status: 400 })
|
|
157
|
+
if (!deliversTo(zip))
|
|
158
|
+
return refuse('We do not deliver to that postcode yet.', { field: 'shipping_zip' })
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- A caller that asked for data gets `{ error: message }` with that status
|
|
162
|
+
(`422` when none is given), plus `errors` by field when `field` is named:
|
|
163
|
+
the body such actions already wrote.
|
|
164
|
+
- A browser form goes back to its page with what was posted. A message with
|
|
165
|
+
a `field` is read with `requestContext.error(field)`; one without is about
|
|
166
|
+
the whole form and is read with `requestContext.formError()`.
|
|
167
|
+
`hasErrors()` is true for either.
|
|
168
|
+
- `authorize` and `before` can return one too.
|
|
169
|
+
- With no page to go back to, the browser gets the plain page of messages,
|
|
170
|
+
with the status the action chose.
|
|
171
|
+
|
|
172
|
+
```html
|
|
173
|
+
<script server>
|
|
174
|
+
const formError = requestContext.formError()
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
@if (formError)
|
|
178
|
+
<p role="alert">{{ formError }}</p>
|
|
179
|
+
@endif
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
A browser form refused for its CSRF token (a tab left open past the token's
|
|
183
|
+
life, or a second tab that replaced it) goes back to its page the same way,
|
|
184
|
+
with a sentence for the whole form and what was typed. The action does not
|
|
185
|
+
run. A script still gets the `403`, and a form posted from another site is
|
|
186
|
+
never sent back to a page of this one. A middleware of your own can do the
|
|
187
|
+
same by marking the error it throws with `FORM_REFUSAL` (`{ message, status }`).
|
|
188
|
+
|
|
189
|
+
A form can only send text, files and a name repeated for a list, and an
|
|
190
|
+
unticked checkbox sends nothing. `buddy doctor` reads every page's plain POST
|
|
191
|
+
form, finds the action it posts to in the route table, and warns, with the
|
|
192
|
+
file and line, about each rule that form can never meet: an object, a
|
|
193
|
+
required field the form has no control for, a required yes or no only a
|
|
194
|
+
checkbox sends, or a checkbox, radio or option value the rule refuses
|
|
195
|
+
(stacksjs/stacks#3311). A form whose address or field names are computed on
|
|
196
|
+
the page is not read.
|
|
197
|
+
|
|
198
|
+
Not covered yet: a form submitted with `method="get"`. It is a navigation, so
|
|
199
|
+
a failed rule is still answered with the 422 body; going back to its page
|
|
200
|
+
with a cookie is a different design, since the query string already holds
|
|
201
|
+
what was typed.
|
|
202
|
+
|
|
203
|
+
The shipped checkout is the worked example: the contact and shipping steps
|
|
204
|
+
declare their fields (`Actions/Storefront/CheckoutContactAction.ts`,
|
|
205
|
+
`CheckoutShippingAction.ts`), and every storefront action refuses an empty
|
|
206
|
+
cart with `refuse()`. The pages are `views/checkout/*.stx` and `views/cart.stx`.
|
|
207
|
+
Tests: `core/router/tests/form-validation-refusal.test.ts`,
|
|
208
|
+
`core/router/tests/form-action-refusal.test.ts`,
|
|
209
|
+
`core/config/tests/form-flash.test.ts`, and
|
|
210
|
+
`core/buddy/tests/refused-form-page.test.ts`, which posts a form through each
|
|
211
|
+
view server and reads the page that comes back.
|
|
212
|
+
|
|
213
|
+
### A form that worked goes back to its page
|
|
214
|
+
|
|
215
|
+
The same split holds when the action succeeds (stacksjs/stacks#3312). A
|
|
216
|
+
browser form the action answers with **data** (an object, a list, a string,
|
|
217
|
+
nothing, or a JSON `Response`) is sent back (`303`) to the page it was on. A
|
|
218
|
+
`fetch()` or API caller gets the body, unchanged. The data in a tab was a page
|
|
219
|
+
of JSON that said nothing a person could read: from it, "revoked" and "broken"
|
|
220
|
+
looked the same.
|
|
221
|
+
|
|
222
|
+
Say what happened with `notice`, in the words the person would use about the
|
|
223
|
+
control they pressed:
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
export default new Action({
|
|
227
|
+
name: 'RevokeTokenAction',
|
|
228
|
+
method: 'POST',
|
|
229
|
+
notice: result => result.already_revoked ? 'That token was already revoked' : 'Token revoked',
|
|
230
|
+
async handle(request) {
|
|
231
|
+
// ...
|
|
232
|
+
return { id: token.id, revoked_at: token.revoked_at, already_revoked: false }
|
|
233
|
+
},
|
|
234
|
+
})
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
```html
|
|
238
|
+
<script server>
|
|
239
|
+
const notice = requestContext.notice() // '' when there is nothing to say
|
|
240
|
+
</script>
|
|
241
|
+
|
|
242
|
+
@if (notice)
|
|
243
|
+
<p role="status">{{ notice }}</p>
|
|
244
|
+
@endif
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
- **The words are yours.** `notice` is a string, or a function of what
|
|
248
|
+
`handle` returned and the request. The framework never makes one up: "Done"
|
|
249
|
+
cannot say which of the controls on a page just worked.
|
|
250
|
+
- **No notice, or an empty one, goes back and says nothing.** Right for a POST
|
|
251
|
+
that only reads. No cookie is set, so the page draws no empty bar.
|
|
252
|
+
- **What the action built itself is left alone**: a page it rendered (an HTML
|
|
253
|
+
`Response`), a redirect, an error status, a download, a stream. A secret
|
|
254
|
+
shown once, such as a new API token, must not travel in a redirect, so
|
|
255
|
+
answer with a rendered page that carries it.
|
|
256
|
+
- With no page of this application to go back to (no `Referer`, another site),
|
|
257
|
+
a notice is shown on a small page of its own; with no notice the body is
|
|
258
|
+
sent as before. With no `APP_KEY`, the notice is shown on that small page.
|
|
259
|
+
- Do not write the split by hand (`if (accept.includes('text/html')) return
|
|
260
|
+
response.redirect(...)`). Return the data and declare the notice, and
|
|
261
|
+
`next` when the form should go on somewhere else.
|
|
262
|
+
|
|
263
|
+
To send the browser on instead of back, say where with `next`, a path of this
|
|
264
|
+
application or a function of the result and the request:
|
|
265
|
+
|
|
266
|
+
```ts
|
|
267
|
+
export default new Action({
|
|
268
|
+
name: 'CheckoutShippingAction',
|
|
269
|
+
method: 'POST',
|
|
270
|
+
next: '/checkout/payment',
|
|
271
|
+
async handle(request) {
|
|
272
|
+
// ...
|
|
273
|
+
return { ok: true, next: '/checkout/payment' }
|
|
274
|
+
},
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
// next: result => `/orders/${result.order_id}`
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
- A script gets the body and is never redirected. A refusal still goes back
|
|
281
|
+
to the form's own page. A `notice` goes with the browser to the next page.
|
|
282
|
+
- Only ever a path on this application. A string that is not one fails when
|
|
283
|
+
the route is registered. A function's answer that is not one (an address
|
|
284
|
+
taken from the request) is not followed, and the browser goes back to the
|
|
285
|
+
form's page instead, so `next: (_, request) => request.get('redirect')`
|
|
286
|
+
cannot send anyone to another site.
|
|
287
|
+
- `notice` and `next` are told only what `handle` answered when it did what
|
|
288
|
+
was asked: `refuse()` is left out of `result`'s type. When `handle` reads
|
|
289
|
+
its request without a type written on it, declare `handle` first, because
|
|
290
|
+
TypeScript works out what it returns in the order the object is written.
|
|
291
|
+
|
|
292
|
+
The shipped cart is the worked example (`Actions/Storefront/UpdateCartItemAction.ts`,
|
|
293
|
+
`views/cart.stx`), and the checkout steps declare `next`
|
|
294
|
+
(`CheckoutContactAction`, `CheckoutShippingAction`, `PlaceOrderAction`,
|
|
295
|
+
`AddToCartAction`). Tests: `core/router/tests/form-success-answer.test.ts`,
|
|
296
|
+
`core/router/tests/form-next-page.test.ts`, and
|
|
297
|
+
`core/buddy/tests/refused-form-page.test.ts` for the cart page.
|
|
298
|
+
|
|
91
299
|
`Precognition: true` or `?_validate=1` requests a validation-only probe.
|
|
92
300
|
`Precognition-Validate-Only` narrows explicit validation fields. Probes stop
|
|
93
301
|
before authorization/hooks/handler side effects, and do not magically run
|
|
@@ -616,7 +616,7 @@ buddy ai:context # compact deterministic project context for coding
|
|
|
616
616
|
-o/--output [path] # write to a file instead of stdout
|
|
617
617
|
--max-chars [characters] # prompt payload character budget (default: 4000)
|
|
618
618
|
--model [model] # model family for heuristic token estimates
|
|
619
|
-
buddy doctor # health checks (Bun version, Node, package.json, .env, APP_KEY, mail DNS)
|
|
619
|
+
buddy doctor # health checks (Bun version, Node, package.json, .env, APP_KEY, mail DNS, forms their action's rules refuse)
|
|
620
620
|
buddy tinker # interactive REPL with Stacks preloaded
|
|
621
621
|
-e/--eval [expr] # evaluate expression and exit
|
|
622
622
|
--print [expr] # evaluate, print, and exit
|
|
@@ -635,6 +635,85 @@ this save only ("Clear stored password"), an acknowledgement, and "remember
|
|
|
635
635
|
me" or the terms on the sign-in forms. `tests/unit/dashboard-switch-contract.test.ts`
|
|
636
636
|
lists every one by file with its reason and fails on any other.
|
|
637
637
|
|
|
638
|
+
### A dialog asks with the shared controls
|
|
639
|
+
|
|
640
|
+
A hand-built dialog asks for a value with `Dashboard/UI/Input.stx`,
|
|
641
|
+
`Select.stx` and `Textarea.stx`, as a model's form does, never with a native
|
|
642
|
+
`<input>`, `<select>` or `<textarea>` and a copy of their classes
|
|
643
|
+
(stacksjs/stacks#3310). Every dashboard dialog is converted;
|
|
644
|
+
`tests/unit/dashboard-form-controls.test.ts` fails if one writes its own again,
|
|
645
|
+
and names the one native control a converted dialog keeps (the upload
|
|
646
|
+
dialog's file picker) with its reason.
|
|
647
|
+
|
|
648
|
+
```html
|
|
649
|
+
<Input v-model:value="name" label="Name" :maxLength="50" :required="true" />
|
|
650
|
+
<Input v-model:value="price" :label="'Price (' + currency() + ')'" type="number" min="0" :step="moneyInputStep(currency())" inputmode="decimal" :required="true" :error="price() !== '' ? priceError() : ''" />
|
|
651
|
+
<Select v-model:value="parentCategoryId" label="Parent category" placeholder="" :options="[{ value: '', label: 'Root category' }, ...parentOptions().map(option => ({ value: option.id, label: option.name }))]" />
|
|
652
|
+
<Textarea v-model:value="notes" label="Notes" :rows="3" :maxLength="500" />
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
- **Input** takes what the browser holds a value to: `min`, `max`, `step`,
|
|
656
|
+
`maxLength`, `minLength`, `inputmode`, `:spellcheck="false"`, `list` (the id
|
|
657
|
+
of a `<datalist>` kept beside it), plus `monospace` for a code, a key or a
|
|
658
|
+
slug and `class` for what is added to the input itself (`uppercase`). A
|
|
659
|
+
number input gets digits of one width without being asked.
|
|
660
|
+
- **Select** takes its choices as `:options`, each `{ value, label }`. A choice
|
|
661
|
+
that may be left empty is one of the options and `placeholder=""`; a choice
|
|
662
|
+
that must be made keeps a `placeholder`, which is shown and cannot be
|
|
663
|
+
chosen. It keeps its choice when the options arrive after the value, which a
|
|
664
|
+
search-then-pick field does every time.
|
|
665
|
+
- **A hint and an error are props.** `hint` is the sentence under the field;
|
|
666
|
+
`error` takes its place and marks the field. Both can follow what is typed
|
|
667
|
+
(`:hint`, `:error`).
|
|
668
|
+
- **The input reports text.** There is no `.number` or `.trim`: make a value a
|
|
669
|
+
number, or trim it, where it is checked and where it is sent. `@input`,
|
|
670
|
+
`@change` and `@blur` hand the handler the value, not the event.
|
|
671
|
+
- **Do not name a field as the Modal names its own.** A prop bound inside a
|
|
672
|
+
`Modal`'s slot is first read in the Modal's own script, so a field called
|
|
673
|
+
`description` opened showing the dialog's description text. The Modal's
|
|
674
|
+
names are its props: `title`, `description`, `size`, `position`, `role` and
|
|
675
|
+
the rest. Call the field `descriptionText`, `reviewTitle`. The test reads
|
|
676
|
+
the Modal's props and fails on a collision.
|
|
677
|
+
- **Give it a box of its own inside a `space-y-*` stack**, as a switch needs.
|
|
678
|
+
- **Several of many is a `Checkbox` per option**, ticked when its id is in the
|
|
679
|
+
list and adding or removing it as it is ticked. Loop on a wrapper, not on
|
|
680
|
+
the component (a loop on a component tag loses its item in slot content):
|
|
681
|
+
|
|
682
|
+
```html
|
|
683
|
+
<span :for="tagOption in tags()" class="contents">
|
|
684
|
+
<Checkbox size="sm" :label="tagOption.name" :checked="tagIds().includes(tagOption.id)" @update:checked="chooseTag(tagOption.id, $event)" />
|
|
685
|
+
</span>
|
|
686
|
+
```
|
|
687
|
+
- `Input` takes `autofocus` for the field a dialog focuses when it opens and
|
|
688
|
+
`pattern` as a native input does, and `Textarea` takes `minLength`.
|
|
689
|
+
- **Keys arrive as the event.** `@keydown` on either hands over the
|
|
690
|
+
`KeyboardEvent`, so the dialog says what Enter, Command+Enter or Escape
|
|
691
|
+
does and can call `preventDefault()` or `stopPropagation()`; there are no
|
|
692
|
+
`.enter` or `.meta` modifiers on a component.
|
|
693
|
+
|
|
694
|
+
### A list page filters with the shared controls
|
|
695
|
+
|
|
696
|
+
A list page's filter row is `UI/SearchFilter.stx` and `Select`, never a native
|
|
697
|
+
search box or dropdown with copied classes (stacksjs/stacks#3310). The same
|
|
698
|
+
test fails if one comes back, and names the few native ones left (a settings
|
|
699
|
+
form, a console, the search palette) with what they are.
|
|
700
|
+
|
|
701
|
+
```html
|
|
702
|
+
<div class="sm:col-span-2"><SearchFilter v-model:searchValue="search" placeholder="Search codes or products" ariaLabel="Search coupons" /></div>
|
|
703
|
+
<Select v-model:value="statusFilter" ariaLabel="Coupon status" placeholder="" :options="[{ value: 'all', label: 'All statuses' }, ...statuses().map(status => ({ value: status, label: status }))]" @change="reloadFilters" />
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
- **SearchFilter is the shared input with a search icon**, so it matches the
|
|
707
|
+
dropdowns beside it. `ariaLabel` names the list it searches; a `class` on
|
|
708
|
+
it sizes the whole field (`class="w-56"`).
|
|
709
|
+
- **It reports only what is typed**: `@search` does not fire as the page
|
|
710
|
+
mounts, nor when the page sets the box itself (`search.set('')` to clear
|
|
711
|
+
it), so a page that reloads on `@search` loads once.
|
|
712
|
+
- **A dropdown updates its value before `@change`**, so a handler that reloads
|
|
713
|
+
reads the choice just made.
|
|
714
|
+
- A hidden label becomes `ariaLabel`. A visible word beside the dropdown
|
|
715
|
+
("Sort") stays, with the dropdown inside its label at `size="sm"`.
|
|
716
|
+
|
|
638
717
|
### Sidebar-aware overlays
|
|
639
718
|
|
|
640
719
|
The desktop sidebar is fixed and publishes its current width through
|
|
@@ -1240,12 +1319,45 @@ pages use (`POST`, `PATCH` and `DELETE /api/dashboard/models/{slug}`), so
|
|
|
1240
1319
|
casts, observers, validation and soft deletes apply and nothing new is
|
|
1241
1320
|
opened. The panels are read again afterwards.
|
|
1242
1321
|
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1322
|
+
Here each row is saved on its own, and stays saved when the next is
|
|
1323
|
+
refused. To change a record and its rows together, use its edit page.
|
|
1324
|
+
|
|
1325
|
+
### The edit page saves a record and its rows together
|
|
1326
|
+
|
|
1327
|
+
A record's edit page (`ModelRecordEdit.stx`) shows the same panels under its
|
|
1328
|
+
fields, wherever the related model lets the dashboard write its rows
|
|
1329
|
+
(stacksjs/stacks#3315). There, adding, editing or deleting a row does not
|
|
1330
|
+
write it: the row is kept as a draft (`functions/dashboard-model-drafts.ts`),
|
|
1331
|
+
marked New, Edited or Will be deleted, and "Save changes" sends the record's
|
|
1332
|
+
changed fields and every panel's drafts in one request:
|
|
1333
|
+
|
|
1334
|
+
```
|
|
1335
|
+
PATCH /api/dashboard/models/{slug}/{id}/save
|
|
1336
|
+
{ fields: { status: 'paid' },
|
|
1337
|
+
related: [{ slug: 'order-line',
|
|
1338
|
+
create: [{ key: 'new-1', fields: { sku: 'A-1' } }],
|
|
1339
|
+
update: [{ id: 5, fields: { quantity: 2 } }],
|
|
1340
|
+
destroy: [7] }] }
|
|
1341
|
+
```
|
|
1342
|
+
|
|
1343
|
+
`ModelSaveAction` runs every write inside one `transaction()`, through the
|
|
1344
|
+
same steps the single-row endpoints use (`model-row-writes.ts`), so each row
|
|
1345
|
+
gets every rule a single save has. The first refusal rolls all of it back,
|
|
1346
|
+
and the answer says where it was, in `at`:
|
|
1347
|
+
|
|
1348
|
+
- `{ operation: 'update' }` for the record's own fields;
|
|
1349
|
+
- `{ operation, panel, row }` for one row: its id, or the key a new row was
|
|
1350
|
+
sent with.
|
|
1351
|
+
|
|
1352
|
+
The page then says "Nothing was saved." It shows the record's messages under
|
|
1353
|
+
its fields, and a row's message on that row and in its form.
|
|
1354
|
+
|
|
1355
|
+
It allows no more than the record's page does. A panel must be one of the
|
|
1356
|
+
record's `hasMany`/`hasOne` that allows that write, decided by `relatedPanel`
|
|
1357
|
+
as the page decides it. A row edited or deleted must point at this record,
|
|
1358
|
+
and a new one is pointed at it: the link back is never taken from the form,
|
|
1359
|
+
so no row moves to another record from here. Bulk actions on a list stay one
|
|
1360
|
+
record at a time (below).
|
|
1249
1361
|
|
|
1250
1362
|
The link between the two models is the foreign key the declaration names,
|
|
1251
1363
|
else the related model's own `belongsTo`, else the conventional
|
|
@@ -1395,9 +1507,8 @@ applies to each record (`when`, `authorize`, `validations`, the self-delete
|
|
|
1395
1507
|
guard, anonymizing a user others refer to), and the page shows how far it
|
|
1396
1508
|
has got.
|
|
1397
1509
|
|
|
1398
|
-
It is not all or nothing, and does not claim to be:
|
|
1399
|
-
|
|
1400
|
-
happened: how many were done and, for the rest, which and why ("Order 8:
|
|
1510
|
+
It is not all or nothing, and does not claim to be: one record refused does
|
|
1511
|
+
not take back the others. The toast says what happened: how many were done and, for the rest, which and why ("Order 8:
|
|
1401
1512
|
Already shipped."). A refusal about the record (any 4xx) goes on to the
|
|
1402
1513
|
next. A failure that is not (a 5xx, no answer at all) stops the run and says
|
|
1403
1514
|
where, so a broken backend is not pressed once per row.
|
|
@@ -334,7 +334,8 @@ SQLite's SQL on a Turso or `sqld` server. Configure `TURSO_DATABASE_URL`
|
|
|
334
334
|
`stacks_migration_lock` (`acquireLibsqlMigrationLock`), since migrating hosts share no filesystem.
|
|
335
335
|
- libSQL rejects SQLite's double-quoted-string fallback, so a statement naming a missing column fails
|
|
336
336
|
instead of storing the column name as text. `tests/corpus-rebuild-sources.test.ts` guards the corpus.
|
|
337
|
-
- Inside `transaction()`, write through the `tx` handle
|
|
337
|
+
- Inside `transaction()`, write through the `tx` handle: a model write made from the callback is part of
|
|
338
|
+
the transaction on SQLite, PostgreSQL and MySQL (stacksjs/stacks#3269), but that is not measured on libSQL.
|
|
338
339
|
|
|
339
340
|
## config/database.ts Shape
|
|
340
341
|
```typescript
|
|
@@ -413,7 +414,8 @@ are experimental with explicit service/topology limits. DynamoDB helpers are a
|
|
|
413
414
|
separate entity API and cannot be selected as the SQL/ORM default.
|
|
414
415
|
|
|
415
416
|
Turso's libsql alias shares SQLite rendering, but uses remote Hrana transport.
|
|
416
|
-
Transactions
|
|
417
|
+
Transactions write through the tx handle (model writes inside one are not
|
|
418
|
+
measured on libSQL); no embedded replicas or native
|
|
417
419
|
file backup are provided. Scheduler locks remain per host. Read the registry's
|
|
418
420
|
provider versions and retained evidence rather than equating an available adapter
|
|
419
421
|
with an unrestricted supported service.
|
|
@@ -244,6 +244,21 @@ abstract class BaseEmailDriver {
|
|
|
244
244
|
}
|
|
245
245
|
```
|
|
246
246
|
|
|
247
|
+
### A mailbox from config, in one deploy
|
|
248
|
+
|
|
249
|
+
Declare the address the app sends from and let the deploy make it:
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
{
|
|
253
|
+
from: { name: 'Votescape', address: 'hello@votescape.org' },
|
|
254
|
+
domain: 'votescape.org',
|
|
255
|
+
mailboxes: ['hello'],
|
|
256
|
+
server: { enabled: true, generatePasswords: true },
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
`buddy deploy` generates `MAIL_PASSWORD_HELLO` before the environment ships (saved encrypted to the environment file, never printed in CI), creates `hello@votescape.org` on the mail server with it, and publishes the mail DNS below. The SMTP driver signs in as `from.address` with that password, and with no `MAIL_HOST` set it uses `mail.<domain>` on port 587 with STARTTLS in production and staging (`ownMailHost` in `core/email/src/drivers/smtp.ts`); elsewhere the default stays loopback. Set `MAIL_MAILER=smtp` to send through the mailbox when the app is also connected to CommsHQ, which otherwise carries its mail.
|
|
261
|
+
|
|
247
262
|
### Mail DNS a deploy publishes
|
|
248
263
|
|
|
249
264
|
With `server.enabled`, `buddy deploy` reconciles the mail domain's DNS through whichever configured provider holds the zone: MX, SPF, DKIM at the selector the server signs under, DMARC (`server.dmarc`), `mail.<domain>`, and the Gmail Postmaster Tools verification TXT when `server.postmaster.google` is set. Writes are surgical: only records the deploy owns are replaced, so other apex TXT (Search Console, other verifications) survive.
|
|
@@ -248,7 +248,10 @@ User middleware in `app/Middleware/` always takes precedence over framework defa
|
|
|
248
248
|
The default `defaults/app/Middleware/Auth.ts` resolves a parsed bearer first,
|
|
249
249
|
then the configured token cookie, then `session_id`. It loads the user, calls
|
|
250
250
|
`Auth.setUser`, stamps `_authenticatedUser`, and stamps `_currentAccessToken`
|
|
251
|
-
for token authentication.
|
|
251
|
+
for token authentication. Both read back typed, with no cast:
|
|
252
|
+
`_authenticatedUser` is the User row (`AuthenticatedUser`, which
|
|
253
|
+
`@stacksjs/auth` registers through the router's `RequestTypeRegistry`), and
|
|
254
|
+
`_currentAccessToken` is an `AccessToken`, whose `scopes` say what it grants. The following is only a minimal custom bearer guard:
|
|
252
255
|
|
|
253
256
|
```typescript
|
|
254
257
|
export default new Middleware({
|
|
@@ -115,7 +115,7 @@ Limitations:
|
|
|
115
115
|
- SQLite SQL over Hrana HTTP: each statement outside a transaction is one request, and a transaction holds one server stream for its duration.
|
|
116
116
|
- sqld refuses VACUUM, ATTACH, temporary tables and every PRAGMA except the read-only ones and foreign_keys.
|
|
117
117
|
- Embedded replicas are not supported; the connection is always remote.
|
|
118
|
-
-
|
|
118
|
+
- Model writes inside transaction() have not been measured on libSQL: on SQLite, PostgreSQL and MySQL they are part of the transaction (stacksjs/stacks#3269), but here write through the tx handle until a live sqld test shows the same.
|
|
119
119
|
- Scheduler onOneServer() locks stay per-host, as they are on SQLite.
|
|
120
120
|
- `buddy db:backup` does not dump a Turso database; rely on Turso's own point-in-time restore.
|
|
121
121
|
|
|
@@ -21,7 +21,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
|
|
|
21
21
|
| `@stacksjs/auth` | [`stacks-auth`](../stacks-auth/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/index.ts) | 136 |
|
|
22
22
|
| `@stacksjs/browser` | [`stacks-browser`](../stacks-browser/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/index.ts) | 10 |
|
|
23
23
|
| `@stacksjs/browser-extension` | [`stacks-browser-extension`](../stacks-browser-extension/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser-extension/src/index.ts) | 9 |
|
|
24
|
-
| `@stacksjs/buddy` | [`stacks-buddy`](../stacks-buddy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/index.ts) |
|
|
24
|
+
| `@stacksjs/buddy` | [`stacks-buddy`](../stacks-buddy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/index.ts) | 212 |
|
|
25
25
|
| `@stacksjs/build` | [`stacks-build`](../stacks-build/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/build/src/index.ts) | 7 |
|
|
26
26
|
| `@stacksjs/cache` | [`stacks-cache`](../stacks-cache/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/cache/src/index.ts) | 24 |
|
|
27
27
|
| `@stacksjs/calendar-api` | [`stacks-calendar`](../stacks-calendar/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/calendar-api/src/index.ts) | 5 |
|
|
@@ -33,7 +33,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
|
|
|
33
33
|
| `@stacksjs/collections` | [`stacks-collections`](../stacks-collections/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/collections/src/index.ts) | 2 |
|
|
34
34
|
| `@stacksjs/commerce` | [`stacks-commerce`](../stacks-commerce/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/commerce/src/index.ts) | 15 |
|
|
35
35
|
| `@stacksjs/composables` | [`stacks-composables`](../stacks-composables/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/composables/src/index.ts) | 18 |
|
|
36
|
-
| `@stacksjs/config` | [`stacks-config`](../stacks-config/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/index.ts) |
|
|
36
|
+
| `@stacksjs/config` | [`stacks-config`](../stacks-config/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/index.ts) | 17 |
|
|
37
37
|
| `@stacksjs/cron` | [`stacks-cron`](../stacks-cron/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/cron/src/index.ts) | 6 |
|
|
38
38
|
| `@stacksjs/database` | [`stacks-database`](../stacks-database/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/index.ts) | 147 |
|
|
39
39
|
| `@stacksjs/datetime` | [`stacks-datetime`](../stacks-datetime/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/datetime/src/index.ts) | 22 |
|
|
@@ -66,7 +66,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
|
|
|
66
66
|
| `@stacksjs/newsletter` | [`stacks-newsletter`](../stacks-newsletter/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/index.ts) | 10 |
|
|
67
67
|
| `@stacksjs/notifications` | [`stacks-notifications`](../stacks-notifications/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/notifications/src/index.ts) | 18 |
|
|
68
68
|
| `@stacksjs/objects` | [`stacks-objects`](../stacks-objects/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/objects/src/index.ts) | 10 |
|
|
69
|
-
| `@stacksjs/orm` | [`stacks-orm`](../stacks-orm/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/index.ts) |
|
|
69
|
+
| `@stacksjs/orm` | [`stacks-orm`](../stacks-orm/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/index.ts) | 79 |
|
|
70
70
|
| `@stacksjs/pagination` | [`stacks-pagination`](../stacks-pagination/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/pagination/src/index.ts) | 1 |
|
|
71
71
|
| `@stacksjs/path` | [`stacks-path`](../stacks-path/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/path/src/index.ts) | 13 |
|
|
72
72
|
| `@stacksjs/payments` | [`stacks-payments`](../stacks-payments/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/index.ts) | 40 |
|
|
@@ -76,7 +76,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
|
|
|
76
76
|
| `@stacksjs/realtime` | [`stacks-realtime`](../stacks-realtime/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/index.ts) | 21 |
|
|
77
77
|
| `@stacksjs/registry` | [`stacks-registry`](../stacks-registry/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/registry/src/index.ts) | 1 |
|
|
78
78
|
| `@stacksjs/repl` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/repl/src/index.ts) | 2 |
|
|
79
|
-
| `@stacksjs/router` | [`stacks-router`](../stacks-router/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/index.ts) |
|
|
79
|
+
| `@stacksjs/router` | [`stacks-router`](../stacks-router/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/index.ts) | 112 |
|
|
80
80
|
| `@stacksjs/scheduler` | [`stacks-scheduler`](../stacks-scheduler/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/scheduler/src/index.ts) | 19 |
|
|
81
81
|
| `@stacksjs/search-engine` | [`stacks-search-engine`](../stacks-search-engine/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/search-engine/src/index.ts) | 11 |
|
|
82
82
|
| `@stacksjs/security` | [`stacks-security`](../stacks-security/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/security/src/index.ts) | 12 |
|
|
@@ -222,7 +222,7 @@ Read the entrypoint and package export map for re-exported or type-only surfaces
|
|
|
222
222
|
|
|
223
223
|
Local source modules: [src/commands/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/commands/index.ts).
|
|
224
224
|
|
|
225
|
-
Evidence directory: [
|
|
225
|
+
Evidence directory: [212 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
|
|
226
226
|
|
|
227
227
|
### @stacksjs/build
|
|
228
228
|
|
|
@@ -336,11 +336,11 @@ Evidence directory: [18 retained tests](https://github.com/stacksjs/stacks/blob/
|
|
|
336
336
|
|
|
337
337
|
Guidance: [`stacks-config`](../stacks-config/SKILL.md). Source: [storage/framework/core/config/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/index.ts).
|
|
338
338
|
|
|
339
|
-
Declared runtime exports: `DEFAULT_VIEWS_ALWAYS`, `DEFAULT_VIEW_ROUTE_BUNDLES`, `DEFAULT_VIEW_TEMPLATES`, `FRAMEWORK_DEFAULTS`, `createRequestContext`, `disableFeature`, `enableFeature`, `enterRequestScope`, `feature`, `installRequestContext`, `installRequestScope`, `listFeatures`, `packageComponentRoots`, `packageJobRoots`, `packageMigrationRoots`, `packageModelRoots`, `packageViewRoots`, `parseCookieHeader`, `reportConfigIssues`, `resetFeature`, `resolveViewPatterns`, `scopeStxServeContext`, `scopedRequestSnapshot`, `useRequestEvent`, `validateConfig`, `withheldDefaultViews`.
|
|
339
|
+
Declared runtime exports: `DEFAULT_VIEWS_ALWAYS`, `DEFAULT_VIEW_ROUTE_BUNDLES`, `DEFAULT_VIEW_TEMPLATES`, `FORM_FLASH_COOKIE`, `FORM_FLASH_MAX_BYTES`, `FORM_FLASH_SECONDS`, `FRAMEWORK_DEFAULTS`, `clearShownFormFlash`, `createRequestContext`, `disableFeature`, `enableFeature`, `enterRequestScope`, `expiredFormFlashCookie`, `feature`, `flashableField`, `flashableInput`, `formFlashCookie`, `installRequestContext`, `installRequestScope`, `listFeatures`, `openFormFlash`, `packageComponentRoots`, `packageJobRoots`, `packageMigrationRoots`, `packageModelRoots`, `packageViewRoots`, `parseCookieHeader`, `reportConfigIssues`, `resetFeature`, `resolveViewPatterns`, `scopeStxServeContext`, `scopedRequestSnapshot`, `sealFormFlash`, `useRequestEvent`, `validateConfig`, `withheldDefaultViews`.
|
|
340
340
|
|
|
341
|
-
Local source modules: [src/capabilities.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/capabilities.ts), [src/config.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/config.ts), [src/defaults.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/defaults.ts), [src/discovered-resources.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/discovered-resources.ts), [src/features.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/features.ts), [src/request-context.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/request-context.ts), [src/validators.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/validators.ts), [src/views.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/views.ts).
|
|
341
|
+
Local source modules: [src/capabilities.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/capabilities.ts), [src/config.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/config.ts), [src/defaults.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/defaults.ts), [src/discovered-resources.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/discovered-resources.ts), [src/features.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/features.ts), [src/form-flash.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/form-flash.ts), [src/request-context.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/request-context.ts), [src/validators.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/validators.ts), [src/views.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/views.ts).
|
|
342
342
|
|
|
343
|
-
Evidence directory: [
|
|
343
|
+
Evidence directory: [17 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
|
|
344
344
|
|
|
345
345
|
### @stacksjs/cron
|
|
346
346
|
|
|
@@ -654,7 +654,7 @@ Declared runtime exports: `Activity`, `AnalyticsEvent`, `Auction`, `AuctionItem`
|
|
|
654
654
|
|
|
655
655
|
Local source modules: [src/auto-crud.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/auto-crud.ts), [src/batch-loader.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/batch-loader.ts), [src/db.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/db.ts), [src/define-model.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/define-model.ts), [src/extend-model.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/extend-model.ts), [src/gdpr/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/gdpr/index.ts), [src/generate-database-schema.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/generate-database-schema.ts), [src/locked-row.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/locked-row.ts), [src/messaging.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/messaging.ts), [src/model-types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/model-types.ts), [src/ownership.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/ownership.ts), [src/paginator-request.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/paginator-request.ts), [src/row-token.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/row-token.ts), [src/subquery.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/subquery.ts), [src/traits/audit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/audit.ts), [src/traits/billable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/billable.ts), [src/traits/categorizable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/categorizable.ts), [src/traits/commentable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/commentable.ts), [src/traits/likeable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/likeable.ts), [src/traits/taggable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/taggable.ts), [src/transaction.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/transaction.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/types.ts), [src/utils/encrypted.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/utils/encrypted.ts), [src/utils/prunable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/utils/prunable.ts).
|
|
656
656
|
|
|
657
|
-
Evidence directory: [
|
|
657
|
+
Evidence directory: [79 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
|
|
658
658
|
|
|
659
659
|
### @stacksjs/pagination
|
|
660
660
|
|
|
@@ -744,11 +744,11 @@ Evidence directory: [2 retained tests](https://github.com/stacksjs/stacks/blob/m
|
|
|
744
744
|
|
|
745
745
|
Guidance: [`stacks-router`](../stacks-router/SKILL.md). Source: [storage/framework/core/router/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/index.ts).
|
|
746
746
|
|
|
747
|
-
Declared runtime exports: `DASHBOARD_ROUTE_GROUPS`, `DEFAULT_ROUTE_BUNDLE_FEATURES`, `DEFAULT_ROUTE_REGISTRY`, `DatabaseSessionStore`, `EncryptedSessionStore`, `FileSessionStore`, `JSON_CONTENT_TYPE`, `MemorySessionStore`, `Middleware`, `PathParamError`, `RedisSessionStore`, `RequestBodyError`, `appRouteRegistry`, `assertRouteMiddlewareResolvable`, `bundleMounts`, `cacheRedisConnection`, `cacheRequestQuery`, `checkApplicationHealth`, `clearCsrfModuleCache`, `clearCurrentRequest`, `clearMiddlewareCache`, `clearRateLimit`, `clearRouteModelBindings`, `clearTrackedQueries`, `clientAddress`, `configureViewDirectories`, `createErrorResponse`, `createMiddlewareErrorResponse`, `createNotFoundResponse`, `createSessionStore`, `createStacksRouter`, `createStacksSessionStore`, `createTypedRouter`, `createValidationErrorResponse`, `dashboardGroupMiddleware`, `defineMiddleware`, `defineRouteModelBinding`, `describeUnknownDashboardGroups`, `disableViewRouting`, `enhanceRequest`, `fallbackStorage`, `findUnresolvableRouteMiddleware`, `getCurrentRequest`, `getQueryShapeCounts`, `getTraceId`, `installMiddlewareHotReload`, `isApiRequest`, `isRouterAction`, `listNamedRoutes`, `listRedirectRoutes`, `listRegisteredRoutes`, `listRootMountedAppRoutes`, `loadMiddlewareHandlers`, `loadRoutes`, `mountedDefaultRouteBundles`, `parseJsonText`, `provideActions`, `provideMiddleware`, `rateLimit`, `rateLimitScale`, `rateLimitStatus`, `readJsonBody`, `readTextBody`, `request`, `resetBootHooks`, `resetRateLimiters`, `resetSharedRateLimitStorage`, `resetShutdownHooks`, `resolveActionHandler`, `resolveActionValidations`, `resolveDashboardAccess`, `resolveRouteModel`, `route`, `routeModelBindings`, `routeParams`, `runBootHooks`, `runHealthProbes`, `runShutdownHooks`, `runWithRequest`, `safePathParam`, `sanitizePathParam`, `scaledLimit`, `serve`, `serverResponse`, `setCurrentRequest`, `setRouteModelFallback`, `sharedRateLimitStorage`, `signUrl`, `signedUrl`, `stream`, `trackQuery`, `trustedProxies`, `url`, `useRateLimitStorage`, `verifySignedUrl`, `verifySignedUrlMiddleware`, `warnOnMultipleRouterInstances`, `withRouteAdmission`, `withTraceId`, `wrapAction`.
|
|
747
|
+
Declared runtime exports: `DASHBOARD_ROUTE_GROUPS`, `DEFAULT_ROUTE_BUNDLE_FEATURES`, `DEFAULT_ROUTE_REGISTRY`, `DatabaseSessionStore`, `EncryptedSessionStore`, `FORM_REFUSAL`, `FileSessionStore`, `JSON_CONTENT_TYPE`, `MemorySessionStore`, `Middleware`, `PathParamError`, `RedisSessionStore`, `RequestBodyError`, `appRouteRegistry`, `assertRouteMiddlewareResolvable`, `bundleMounts`, `cacheRedisConnection`, `cacheRequestQuery`, `checkApplicationHealth`, `clearCsrfModuleCache`, `clearCurrentRequest`, `clearMiddlewareCache`, `clearRateLimit`, `clearRouteModelBindings`, `clearTrackedQueries`, `clientAddress`, `configureViewDirectories`, `createErrorResponse`, `createMiddlewareErrorResponse`, `createNotFoundResponse`, `createSessionStore`, `createStacksRouter`, `createStacksSessionStore`, `createTypedRouter`, `createValidationErrorResponse`, `dashboardGroupMiddleware`, `defineMiddleware`, `defineRouteModelBinding`, `describeUnknownDashboardGroups`, `disableViewRouting`, `enhanceRequest`, `fallbackStorage`, `findUnresolvableRouteMiddleware`, `formRefusalOf`, `getCurrentRequest`, `getQueryShapeCounts`, `getTraceId`, `installMiddlewareHotReload`, `isApiRequest`, `isRouterAction`, `listNamedRoutes`, `listRedirectRoutes`, `listRegisteredRoutes`, `listRootMountedAppRoutes`, `loadMiddlewareHandlers`, `loadRoutes`, `mountedDefaultRouteBundles`, `parseJsonText`, `provideActions`, `provideMiddleware`, `rateLimit`, `rateLimitScale`, `rateLimitStatus`, `readJsonBody`, `readTextBody`, `refuse`, `request`, `resetBootHooks`, `resetRateLimiters`, `resetSharedRateLimitStorage`, `resetShutdownHooks`, `resolveActionHandler`, `resolveActionValidations`, `resolveDashboardAccess`, `resolveRouteModel`, `route`, `routeModelBindings`, `routeParams`, `runBootHooks`, `runHealthProbes`, `runShutdownHooks`, `runWithRequest`, `safePathParam`, `sanitizePathParam`, `scaledLimit`, `serve`, `serverResponse`, `setCurrentRequest`, `setRouteModelFallback`, `sharedRateLimitStorage`, `signUrl`, `signedUrl`, `stream`, `trackQuery`, `trustedProxies`, `url`, `useRateLimitStorage`, `verifySignedUrl`, `verifySignedUrlMiddleware`, `warnOnMultipleRouterInstances`, `withRouteAdmission`, `withTraceId`, `wrapAction`.
|
|
748
748
|
|
|
749
|
-
Local source modules: [src/api-shape.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/api-shape.ts), [src/body.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/body.ts), [src/dashboard-access.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/dashboard-access.ts), [src/encrypted-session-store.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/encrypted-session-store.ts), [src/error-handler.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/error-handler.ts), [src/health.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/health.ts), [src/json.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/json.ts), [src/middleware.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/middleware.ts), [src/path-sanitize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/path-sanitize.ts), [src/rate-limit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/rate-limit.ts), [src/request-augmentation.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/request-augmentation.ts), [src/request-context.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/request-context.ts), [src/route-loader.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/route-loader.ts), [src/route-model-binding.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/route-model-binding.ts), [src/security-settings.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/security-settings.ts), [src/session-factory.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/session-factory.ts), [src/signed-url.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/signed-url.ts), [src/stacks-router.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/stacks-router.ts), [src/typed-router.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/typed-router.ts).
|
|
749
|
+
Local source modules: [src/api-shape.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/api-shape.ts), [src/body.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/body.ts), [src/dashboard-access.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/dashboard-access.ts), [src/encrypted-session-store.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/encrypted-session-store.ts), [src/error-handler.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/error-handler.ts), [src/health.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/health.ts), [src/json.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/json.ts), [src/middleware.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/middleware.ts), [src/path-sanitize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/path-sanitize.ts), [src/rate-limit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/rate-limit.ts), [src/refuse.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/refuse.ts), [src/request-augmentation.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/request-augmentation.ts), [src/request-context.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/request-context.ts), [src/route-loader.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/route-loader.ts), [src/route-model-binding.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/route-model-binding.ts), [src/security-settings.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/security-settings.ts), [src/session-factory.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/session-factory.ts), [src/signed-url.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/signed-url.ts), [src/stacks-router.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/stacks-router.ts), [src/typed-router.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/typed-router.ts).
|
|
750
750
|
|
|
751
|
-
Evidence directory: [
|
|
751
|
+
Evidence directory: [112 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
|
|
752
752
|
|
|
753
753
|
### @stacksjs/scheduler
|
|
754
754
|
|
|
@@ -435,6 +435,13 @@ and validateFieldAsync support application async validation. These helpers propa
|
|
|
435
435
|
instead of approving unchecked values. Keep operational failures separate from invalid input. Validate
|
|
436
436
|
uniqueness at the durable write boundary and handle a uniqueness violation there.
|
|
437
437
|
|
|
438
|
+
A refused request is answered by what the caller asked for: a script or an API
|
|
439
|
+
client gets the 422 body, and a browser that submitted an HTML form is sent
|
|
440
|
+
back to its page with the messages and what it posted, which the page reads
|
|
441
|
+
with `requestContext.error(field)` and `requestContext.old(field)`
|
|
442
|
+
(stacksjs/stacks#3309). The whole of it is in the stacks-actions skill, under
|
|
443
|
+
"A refused form goes back to its page".
|
|
444
|
+
|
|
438
445
|
Local is.ts helpers and legacy rules/type declarations are not
|
|
439
446
|
automatically all public exports from the root.
|
|
440
447
|
|