@orieljs/framework 0.1.0-alpha.14 → 0.1.0-alpha.15
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/dist/{chunk-UBSIBGXR.js → chunk-7GPMFMS7.js} +119 -16
- package/dist/chunk-7GPMFMS7.js.map +1 -0
- package/dist/{chunk-4NCMY3ZS.js → chunk-FVI6X3VJ.js} +8 -1
- package/dist/chunk-FVI6X3VJ.js.map +1 -0
- package/dist/{chunk-X4N74JDO.js → chunk-GCMPAXIK.js} +2 -2
- package/dist/index.d.ts +113 -19
- package/dist/index.js +418 -127
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime.js +2 -2
- package/dist/testing.js +2 -2
- package/docs/database.md +5 -2
- package/docs/deployment.md +3 -1
- package/docs/eloquent-factories.md +3 -0
- package/docs/eloquent-observers.md +2 -0
- package/docs/eloquent-relationships.md +8 -0
- package/docs/eloquent.md +6 -0
- package/docs/export.md +3 -3
- package/docs/inertia.md +2 -1
- package/docs/installation.md +2 -0
- package/docs/lifecycle.md +5 -4
- package/docs/mail.md +4 -2
- package/docs/navigation.json +4 -0
- package/docs/providers.md +1 -1
- package/docs/queues.md +6 -0
- package/docs/responses.md +2 -1
- package/docs/routing.md +33 -0
- package/docs/scheduling.md +2 -0
- package/docs/two-factor.md +4 -3
- package/docs/upgrade.md +73 -0
- package/docs/vite.md +18 -0
- package/package.json +32 -32
- package/dist/chunk-4NCMY3ZS.js.map +0 -1
- package/dist/chunk-UBSIBGXR.js.map +0 -1
- /package/dist/{chunk-X4N74JDO.js.map → chunk-GCMPAXIK.js.map} +0 -0
package/dist/jsx-runtime.js
CHANGED
package/dist/testing.js
CHANGED
|
@@ -53,8 +53,8 @@ import {
|
|
|
53
53
|
travelBack,
|
|
54
54
|
travelTo,
|
|
55
55
|
usingInMemoryDatabase
|
|
56
|
-
} from "./chunk-
|
|
57
|
-
import "./chunk-
|
|
56
|
+
} from "./chunk-7GPMFMS7.js";
|
|
57
|
+
import "./chunk-FVI6X3VJ.js";
|
|
58
58
|
import "./chunk-BKA5F3TH.js";
|
|
59
59
|
export {
|
|
60
60
|
AnonymousNotifiable,
|
package/docs/database.md
CHANGED
|
@@ -8,7 +8,8 @@ your models.
|
|
|
8
8
|
Oriel reaches your database through [Kysely](https://kysely.dev), with three drivers:
|
|
9
9
|
|
|
10
10
|
- **SQLite**, with `better-sqlite3` on Node and Bun's own `bun:sqlite` on Bun. A new app uses it, so you need no
|
|
11
|
-
database server to start.
|
|
11
|
+
database server to start. On Bun, SQLite reads a column name it doesn't know as a string, so a mistyped column
|
|
12
|
+
in a query gives back its own name instead of an error; Node's SQLite refuses it, so your tests there catch it.
|
|
12
13
|
- **PostgreSQL**, with `pg`.
|
|
13
14
|
- **MySQL**, with `mysql2`.
|
|
14
15
|
|
|
@@ -187,7 +188,9 @@ await DB.transaction(async () => {
|
|
|
187
188
|
|
|
188
189
|
The queries your function runs, through the facade, the query builder or your models, are in the transaction, and
|
|
189
190
|
those of other requests running at the same time aren't. A transaction inside another uses a savepoint, so an inner
|
|
190
|
-
one that throws rolls back only its own work.
|
|
191
|
+
one that throws rolls back only its own work. Inner transactions started at once, with `Promise.all()`, take turns: each
|
|
192
|
+
waits for the one before it to end, since rolling one back on the shared connection would undo the others' work too. So
|
|
193
|
+
an inner transaction mustn't wait on a sibling started beside it. The function's result is `transaction()`'s:
|
|
191
194
|
|
|
192
195
|
```ts
|
|
193
196
|
const user = await DB.transaction(async () => {
|
package/docs/deployment.md
CHANGED
|
@@ -117,7 +117,9 @@ Point your container's health check at the [health route](#the-health-route), `/
|
|
|
117
117
|
|
|
118
118
|
The server sends a file that exists in `public` before your routes run, so `public/build` and your icons need no
|
|
119
119
|
other web server. The built assets, under `/build/assets/`, are sent with a year-long, immutable cache header, as
|
|
120
|
-
their names change with their content. TypeScript files and dotfiles in `public` are never sent
|
|
120
|
+
their names change with their content. TypeScript files and dotfiles in `public` are never sent, by `serve()`,
|
|
121
|
+
`vercel:build` or an export, except the `.well-known` folder at its top (app links, `security.txt`, domain
|
|
122
|
+
verification).
|
|
121
123
|
|
|
122
124
|
A web server or a CDN in front of your app can serve `public` itself; then pass `publicPath: false` to `serve()`.
|
|
123
125
|
|
|
@@ -219,6 +219,9 @@ const user = await User.factory().createOne()
|
|
|
219
219
|
const posts = await Post.factory().count(3).for(user, 'author').create()
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
+
A parent's factory creates it again at each `create()`, so a factory you keep in a variable and use in several tests
|
|
223
|
+
never points at a parent an earlier test rolled back.
|
|
224
|
+
|
|
222
225
|
An attribute of a factory can also be another factory: the factory creates that model, and the attribute takes its
|
|
223
226
|
key, as `author_id: UserFactory.new()` does in a post's definition.
|
|
224
227
|
|
|
@@ -19,6 +19,8 @@ A model dispatches these events, each with the model:
|
|
|
19
19
|
|
|
20
20
|
Creating a model dispatches `saving`, `creating`, `created`, then `saved`; updating one dispatches `saving`,
|
|
21
21
|
`updating`, `updated`, then `saved`. Saving a model with no changes dispatches only `saving` and `saved`.
|
|
22
|
+
`increment()` and `decrement()` on a model dispatch `updating` and `updated`, as in Laravel, with the new value already on
|
|
23
|
+
the model; an `updating` listener that returns `false` stops them.
|
|
22
24
|
|
|
23
25
|
A listener of a `-ing` event that returns `false` stops the operation: the model isn't saved, deleted or restored.
|
|
24
26
|
|
|
@@ -446,6 +446,14 @@ Give `with()` an object to add conditions to a relation's query:
|
|
|
446
446
|
const posts = await Post.with({ comments: (query) => query.where('body', 'like', '%code%') }).get()
|
|
447
447
|
```
|
|
448
448
|
|
|
449
|
+
A `limit()` or `offset()` there applies to each model, as in Laravel 11: each post below gets its own three latest
|
|
450
|
+
comments. It works for `hasOne`, `hasMany`, their morph forms and `belongsToMany`, with the window functions of SQLite
|
|
451
|
+
3.25+, MySQL 8 and PostgreSQL.
|
|
452
|
+
|
|
453
|
+
```ts
|
|
454
|
+
const posts = await Post.with({ comments: (query) => query.latest().limit(3) }).get()
|
|
455
|
+
```
|
|
456
|
+
|
|
449
457
|
### Lazy eager loading
|
|
450
458
|
|
|
451
459
|
`load()` loads relations on a model you already have, and `loadMissing()` loads only those that aren't loaded yet:
|
package/docs/eloquent.md
CHANGED
|
@@ -220,6 +220,12 @@ const active = await Flight.where('active', 1).first()
|
|
|
220
220
|
const first = await Flight.firstWhere('active', 1)
|
|
221
221
|
```
|
|
222
222
|
|
|
223
|
+
Given an array of keys, `find()` returns the models it found, as a collection:
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
const flights = await Flight.find([1, 2, 3])
|
|
227
|
+
```
|
|
228
|
+
|
|
223
229
|
#### Not found exceptions
|
|
224
230
|
|
|
225
231
|
`findOrFail()` and `firstOrFail()` throw a `ModelNotFoundError` when there is no model. Uncaught, it answers 404:
|
package/docs/export.md
CHANGED
|
@@ -47,7 +47,7 @@ site, a `mailto:` or `tel:` link, or a link to a file in `public/` is left alone
|
|
|
47
47
|
ignored, so `/docs/routing?tab=1#named` exports `/docs/routing`.
|
|
48
48
|
|
|
49
49
|
Pages nothing links to, such as a feed, are listed in `paths`. Pages to leave out are listed in `exclude`, where `*`
|
|
50
|
-
matches anything. A redirect is listed in the command's output and not written;
|
|
50
|
+
matches anything. A redirect is listed in the command's output and not written; the page it points at is exported, even when nothing else
|
|
51
51
|
links to it.
|
|
52
52
|
|
|
53
53
|
A page that answers with an error (4xx or 5xx) stops the export and names the page. The site is written into a
|
|
@@ -80,8 +80,8 @@ assets among them, are copied into the folder first.
|
|
|
80
80
|
|
|
81
81
|
## The 404 page
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
and GitHub Pages show that file for an address that doesn't exist.
|
|
83
|
+
The export writes your app's 404 page as `404.html`: yours (`resources/views/errors/404.tsx`), or Oriel's own when you
|
|
84
|
+
have none. Vercel, Netlify and GitHub Pages show that file for an address that doesn't exist.
|
|
85
85
|
|
|
86
86
|
## Hosting the files
|
|
87
87
|
|
package/docs/inertia.md
CHANGED
|
@@ -48,7 +48,8 @@ export class PostController extends Controller {
|
|
|
48
48
|
|
|
49
49
|
The component's name is its path under `resources/js/pages`, without the extension: `Posts/Index` is
|
|
50
50
|
`resources/js/pages/Posts/Index.tsx` (or `.vue`, `.svelte`, `.component.ts`). Models in the props reach the page as
|
|
51
|
-
their JSON, so their `hidden` attributes stay on the server.
|
|
51
|
+
their JSON, so their `hidden` attributes stay on the server, and the page's prop types leave them out too. A column
|
|
52
|
+
made visible at run time with `makeVisible()` arrives on the page, but isn't in its types.
|
|
52
53
|
|
|
53
54
|
A page with no data of its own needs no controller: `Route.inertia()` routes a URI to it.
|
|
54
55
|
|
package/docs/installation.md
CHANGED
|
@@ -35,6 +35,8 @@ yarn create @orieljs blog
|
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
`npm create oriel-app` is the same installer under another name: both run `create-oriel-app` at the same version.
|
|
38
|
+
A new app takes each Oriel package at that exact version, so a later release changes nothing until you move to it, as
|
|
39
|
+
the [upgrade guide](upgrade.md) says.
|
|
38
40
|
|
|
39
41
|
The installer asks for the app's name, unless you gave one, then for a stack (Inertia, Live or an API) and, for Inertia,
|
|
40
42
|
its framework, and last whether to install the dependencies and start a git repository. The name is the last part of the
|
package/docs/lifecycle.md
CHANGED
|
@@ -65,10 +65,10 @@ request, then it shuts down, and the process exits with the command's exit code.
|
|
|
65
65
|
### Service providers
|
|
66
66
|
|
|
67
67
|
Service providers set up every part of the framework: the database, the queue, validation, routing and the rest.
|
|
68
|
-
`create()` calls each provider's `register()`, in order. The framework has
|
|
68
|
+
`create()` calls each provider's `register()`, in order. The framework has 24, registered first, in this order:
|
|
69
69
|
Pipeline, Encryption, Cookie, Session, Hashing, Log, Event, Cache, Filesystem, Database, Queue, Bus, Mail,
|
|
70
|
-
Notifications, Validation, Auth, View, Inertia, Live, Routing, Http and
|
|
71
|
-
by `ServiceProvider`). Each may rely on the ones before it. Yours come next, in the order `bootstrap/providers.ts`
|
|
70
|
+
Notifications, Validation, Auth, View, Inertia, Live, Routing, Http, Console, Ide and Vercel (each one's class is its
|
|
71
|
+
name followed by `ServiceProvider`). Each may rely on the ones before it. Yours come next, in the order `bootstrap/providers.ts`
|
|
72
72
|
lists them.
|
|
73
73
|
|
|
74
74
|
`create()` registers the providers but doesn't boot them. The app boots once, the first time something needs it:
|
|
@@ -106,7 +106,8 @@ Application.configure({ basePath: '.' })
|
|
|
106
106
|
|
|
107
107
|
`app.handle()` opens a request scope, and the kernel binds the request in it: everything resolved for this request,
|
|
108
108
|
such as the request, its session and its cookie jar, lives in the scope and is dropped with it. The global middleware
|
|
109
|
-
run first: `
|
|
109
|
+
run first: `RenameClasses`, outermost, which renames the classes of a [scrambled](vite.md#class-name-scrambling) build
|
|
110
|
+
in the pages that leave, then `TrimStrings`, `ConvertEmptyStringsToNull`, and those you add with
|
|
110
111
|
[`withMiddleware()`](middleware.md#global-middleware).
|
|
111
112
|
|
|
112
113
|
The router then finds the route. A path no route matches is a 404, and a path whose routes don't take the request's
|
package/docs/mail.md
CHANGED
|
@@ -23,6 +23,7 @@ export default {
|
|
|
23
23
|
transport: 'smtp',
|
|
24
24
|
host: env('MAIL_HOST', '127.0.0.1'),
|
|
25
25
|
port: Number(env('MAIL_PORT', 2525)),
|
|
26
|
+
encryption: env('MAIL_ENCRYPTION'),
|
|
26
27
|
username: env('MAIL_USERNAME'),
|
|
27
28
|
password: env('MAIL_PASSWORD'),
|
|
28
29
|
},
|
|
@@ -37,8 +38,9 @@ export default {
|
|
|
37
38
|
Oriel has four transports:
|
|
38
39
|
|
|
39
40
|
- `smtp` sends the mail to an SMTP server: `host`, `port`, and `username` and `password` when the server asks for
|
|
40
|
-
them.
|
|
41
|
-
`encryption: 'tls'` to
|
|
41
|
+
them. On port 465 it speaks TLS from the start, and elsewhere it uses STARTTLS when the server offers it, with no
|
|
42
|
+
setting. `encryption` (`MAIL_ENCRYPTION`) overrides that: `'ssl'` for TLS from the start on another port, `'tls'` to
|
|
43
|
+
refuse a server that doesn't offer STARTTLS.
|
|
42
44
|
- `log` writes each mail to your log, through the channel `channel` names, or your default channel.
|
|
43
45
|
- `array` keeps the mails in memory, in the app's process, and sends nothing.
|
|
44
46
|
- `failover` tries the mailers of its `mailers` list in turn (see [Failover configuration](#failover-configuration)).
|
package/docs/navigation.json
CHANGED
package/docs/providers.md
CHANGED
|
@@ -9,7 +9,7 @@ Service providers are the central place of your app's setup. Your own app, and e
|
|
|
9
9
|
through them. Setting up here means registering things: bindings in the [service container](container.md), event
|
|
10
10
|
listeners, view composers, route patterns and bindings.
|
|
11
11
|
|
|
12
|
-
Oriel uses
|
|
12
|
+
Oriel uses 24 service providers of its own, for the mailer, the queue, the cache and the rest. [Request
|
|
13
13
|
lifecycle](lifecycle.md#service-providers) lists them, and shows where providers fit in how your app starts. Your own
|
|
14
14
|
providers are listed in `bootstrap/providers.ts`. This page shows how to write them and register them.
|
|
15
15
|
|
package/docs/queues.md
CHANGED
|
@@ -306,6 +306,12 @@ process manager such as systemd or Supervisor, and after each deploy run `node o
|
|
|
306
306
|
worker to stop after its current job so the process manager starts it again on the new code
|
|
307
307
|
([Deployment](deployment.md#queue-workers) shows a Supervisor program).
|
|
308
308
|
|
|
309
|
+
A queued job stores the names of the classes it carries, and the worker finds them again in `app/Jobs`, `app/Events`,
|
|
310
|
+
`app/Listeners`, `app/Mail` and `app/Notifications`. A class keeps its own name, unless two classes there share it, an
|
|
311
|
+
`OrderShipped` event and an `OrderShipped` mailable: then each is stored by its folder, `Events.OrderShipped` and
|
|
312
|
+
`Mail.OrderShipped`. Your app and its workers find the same names, so deploy them together, and restart the workers
|
|
313
|
+
when you add a class whose name another one already has.
|
|
314
|
+
|
|
309
315
|
`queue:restart` leaves its signal in your default cache store, which each worker reads after every job. While the
|
|
310
316
|
cache can't be read, a worker goes on working and reports the error once per outage; it sees the next signal once
|
|
311
317
|
the cache is back.
|
package/docs/responses.md
CHANGED
|
@@ -107,7 +107,8 @@ export class AddFrameOptions implements Middleware {
|
|
|
107
107
|
}
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
Set `Cache-Control` as any other header, or let the `cache.headers` middleware set it for a route, as
|
|
111
|
+
`cache.headers:public;max_age=3600;etag` ([the middleware aliases](middleware.md#middleware-aliases) list its options).
|
|
111
112
|
|
|
112
113
|
### Attaching cookies to responses
|
|
113
114
|
|
package/docs/routing.md
CHANGED
|
@@ -494,6 +494,39 @@ if (request().routeIs('admin.*')) {
|
|
|
494
494
|
}
|
|
495
495
|
```
|
|
496
496
|
|
|
497
|
+
#### Signed URLs
|
|
498
|
+
|
|
499
|
+
A signed URL carries a signature in its query string, made with your app key, so your app can tell that nobody changed
|
|
500
|
+
it: a link to unsubscribe from a list, or to confirm something, sent by email to someone who isn't signed in.
|
|
501
|
+
`url().signedRoute()` signs a named route's URL, and `temporarySignedRoute()` one that expires, at a `Date` or a number
|
|
502
|
+
of seconds from now:
|
|
503
|
+
|
|
504
|
+
```ts
|
|
505
|
+
import { Route, url } from '@orieljs/framework'
|
|
506
|
+
|
|
507
|
+
Route.get('/unsubscribe/{user}', () => 'Unsubscribed').middleware('signed').name('unsubscribe')
|
|
508
|
+
|
|
509
|
+
const link = url().signedRoute('unsubscribe', { user: 1 })
|
|
510
|
+
|
|
511
|
+
const forAnHour = url().temporarySignedRoute('unsubscribe', 3600, { user: 1 })
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
The `signed` middleware answers a request whose signature is missing, wrong or expired with a 403, so the route only
|
|
515
|
+
runs for a URL your app signed. To check one yourself, for a response of your own:
|
|
516
|
+
|
|
517
|
+
```ts
|
|
518
|
+
import { abort, request, Route, url } from '@orieljs/framework'
|
|
519
|
+
|
|
520
|
+
Route.get('/unsubscribe/{user}', () => {
|
|
521
|
+
if (!url().hasValidSignature(request())) abort(401)
|
|
522
|
+
return 'Unsubscribed'
|
|
523
|
+
}).name('unsubscribe')
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
A URL signed with `false` as the last argument signs only its path, so it works behind any host; check it with
|
|
527
|
+
`signed:relative`. A signature made with your previous app key (`APP_PREVIOUS_KEYS`) still checks out after you rotate
|
|
528
|
+
the key.
|
|
529
|
+
|
|
497
530
|
## Route groups
|
|
498
531
|
|
|
499
532
|
A group shares middleware, a controller, a URI prefix or a name prefix between its routes. Groups can be nested: a
|
package/docs/scheduling.md
CHANGED
|
@@ -252,6 +252,8 @@ node oriel schedule:work
|
|
|
252
252
|
```
|
|
253
253
|
|
|
254
254
|
When one minute's run fails, as when the cache can't be read, it reports the error and goes on with the next minute.
|
|
255
|
+
Ctrl-C, or a `SIGTERM` from a deploy, stops it: no task starts after that, and the tasks still running give up their
|
|
256
|
+
`withoutOverlapping()` locks, so their next run isn't blocked.
|
|
255
257
|
[Deployment](deployment.md#task-scheduling) shows both ways in production.
|
|
256
258
|
|
|
257
259
|
## Task hooks
|
package/docs/two-factor.md
CHANGED
|
@@ -57,8 +57,9 @@ A user is asked only by a method open to them: email, or an app they have set up
|
|
|
57
57
|
hasn't set up an app has no method open, so their password alone signs them in, as in Fortify, where two-factor is each
|
|
58
58
|
user's choice. Keep `'email'` in `methods` to ask every user for a second factor.
|
|
59
59
|
|
|
60
|
-
The secret and the recovery codes are encrypted with your app key; emailed codes are kept hashed, in the cache, so
|
|
61
|
-
cache must be shared by your servers (`database` or `redis`, as on Vercel).
|
|
60
|
+
The secret and the recovery codes are encrypted with your app key; emailed codes are kept hashed, in the cache, and so
|
|
61
|
+
is the count of wrong codes, so the cache must be shared by your servers (`database` or `redis`, as on Vercel). With
|
|
62
|
+
`file` or `array` on several servers, each one would count on its own.
|
|
62
63
|
|
|
63
64
|
## Signing in
|
|
64
65
|
|
|
@@ -103,7 +104,7 @@ Route.middleware('two-factor.challenge').group(() => {
|
|
|
103
104
|
return redirect().intended('dashboard')
|
|
104
105
|
}
|
|
105
106
|
return back().withErrors({ code: 'That code is not right.' })
|
|
106
|
-
})
|
|
107
|
+
}).middleware('throttle:5,1')
|
|
107
108
|
|
|
108
109
|
Route.post('/two-factor-challenge/email', async () => {
|
|
109
110
|
await TwoFactor.useMethod('email')
|
package/docs/upgrade.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Upgrade guide
|
|
2
|
+
|
|
3
|
+
Oriel is in alpha, so a release can change something your app relies on. Each release's breaking changes are listed
|
|
4
|
+
below, newest first, each with what to do about it.
|
|
5
|
+
|
|
6
|
+
## Moving to a new version
|
|
7
|
+
|
|
8
|
+
A new app takes each Oriel package at the exact version of the installer that made it, so a later release changes
|
|
9
|
+
nothing in your app until you move to it. To move, set every `@orieljs/*` package in your `package.json` to the same
|
|
10
|
+
new version, exactly:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install --save-exact @orieljs/framework@0.1.0-alpha.15 @orieljs/vite@0.1.0-alpha.15
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
List your kit's own packages in the same command: `@orieljs/inertia-client` and your framework's adapter
|
|
17
|
+
(`@orieljs/inertia-react`, `-vue`, `-svelte`, `-solid` or `-angular`), or `@orieljs/live-client`. With the other
|
|
18
|
+
package managers, `-E` pins the version the same way: `pnpm add -E …`, `yarn add -E …`, `bun add -E …`. Then run your
|
|
19
|
+
migrations and work through the sections below, from the version you had to the one you moved to:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
node oriel migrate
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
An app made before 0.1.0-alpha.15 has `^` ranges, which take a later release by themselves the next time the
|
|
26
|
+
dependencies are installed without a lockfile. Pinning its packages as above stops that.
|
|
27
|
+
|
|
28
|
+
## 0.1.0-alpha.15
|
|
29
|
+
|
|
30
|
+
- **Oriel's packages are pinned in new apps.** Nothing to do in an existing app, but you can pin it the same way
|
|
31
|
+
(above).
|
|
32
|
+
- **`find()` with an array returns a collection** of the models it found, as Laravel's does. Code that called
|
|
33
|
+
`find([1, 2])` expecting one model takes `.first()` of the result.
|
|
34
|
+
- **Two app classes with the same name are stored in a queued job by their folder**, as `Events.OrderShipped` and
|
|
35
|
+
`Mail.OrderShipped`. A class whose name is its own keeps it. Deploy your app and its workers together.
|
|
36
|
+
- **A `limit()` in an eager-load constraint applies to each model**, as in Laravel 11: `Post.with({ comments: (q) =>
|
|
37
|
+
q.limit(3) })` gives each post three comments. It needs SQLite 3.25, MySQL 8 or PostgreSQL.
|
|
38
|
+
- **`increment()` and `decrement()` on a model dispatch `updating` and `updated`.** An observer that should ignore them
|
|
39
|
+
checks `wasChanged()` for the columns it cares about.
|
|
40
|
+
- **Two-factor counts wrong codes in the cache.** On several servers, or on Vercel, the cache store must be shared:
|
|
41
|
+
`database` or `redis`.
|
|
42
|
+
- **`public/` publishes the same files everywhere:** `serve()`, `vercel:build` and `oriel export` leave out TypeScript
|
|
43
|
+
files and dotfiles, except `.well-known/` and `.nojekyll`. `serve()` now serves `.well-known/`; the builds no longer
|
|
44
|
+
copy other dotfiles, such as `.htaccess`, or `public/index.ts`.
|
|
45
|
+
- **Inner transactions started at once under one transaction run one after the other.** One that waits for a sibling
|
|
46
|
+
started beside it never finishes: await them in turn, or start them from separate transactions.
|
|
47
|
+
- **Two-factor sign-in rehashes the password** when your hashing settings changed, as `Auth.attempt()` does, so with
|
|
48
|
+
`auth.session` the user's other sessions end at their next sign-in after the change.
|
|
49
|
+
- **A chain's `catch` jobs and a batch's `then`, `catch` and `finally` go to the chain's or batch's connection and
|
|
50
|
+
queue**, not the default: run a worker there.
|
|
51
|
+
- **`where(column, 'like', …)` on PostgreSQL compares the column as text**, as Laravel does, so it works on numbers and
|
|
52
|
+
dates; a `citext` column compares case-sensitively there, so use `whereLike()` or `ilike` for those.
|
|
53
|
+
- **Page prop types leave out a model's hidden columns**, which never reached the page: code reading
|
|
54
|
+
`props.user.password` no longer typechecks.
|
|
55
|
+
- **`inertia:stop-ssr` exits 1** with "Unable to connect to Inertia SSR server." when none is running, and
|
|
56
|
+
**`inertia:start-ssr` exits 1** when its server is killed by a signal: a deploy script that stops SSR before starting
|
|
57
|
+
it should allow the first to fail.
|
|
58
|
+
|
|
59
|
+
## 0.1.0-alpha.14
|
|
60
|
+
|
|
61
|
+
- **Database sessions keep no IP address or browser.** Set `client_details: true` in `config/session.ts` to keep
|
|
62
|
+
storing them; the columns are already there.
|
|
63
|
+
- **Drivers are installed separately:** `better-sqlite3` for SQLite on Node, `@aws-sdk/client-s3` and
|
|
64
|
+
`@aws-sdk/s3-request-presigner` for an `s3` disk, `@vercel/blob` for a `blob` disk. A missing one says which package
|
|
65
|
+
to install.
|
|
66
|
+
- **A Live upload's `store()` moves the file.** Reset the property after storing it: a second `store()`, or
|
|
67
|
+
`temporaryUrl()` after it, throws `UploadAlreadyStoredError`.
|
|
68
|
+
- **`TwoFactor.enableApp()` refuses an app that already works,** with `TwoFactorAppAlreadyEnabledError`: call
|
|
69
|
+
`disableApp()` first.
|
|
70
|
+
- **`DB_URL` and `DB_CONNECTION` no longer reach your tests.** Use `TEST_DATABASE_URL` to test on PostgreSQL or MySQL.
|
|
71
|
+
- **A command registered as a class gets a new instance for each run.**
|
|
72
|
+
- Add `AuthenticateSession` to the `web` group in `bootstrap/app.ts` to end other sessions on a new password, and in
|
|
73
|
+
`vitest.config.ts` replace `env: { ...TESTING_ENVIRONMENT }` with `...testingConfig()`.
|
package/docs/vite.md
CHANGED
|
@@ -197,6 +197,12 @@ In your scripts, the names in class positions: `class` and `className` props, pr
|
|
|
197
197
|
`classList`, Angular's `[class.name]`. A string anywhere else keeps its words, so `type: 'hidden'` is still a hidden
|
|
198
198
|
input, and a name your CSS doesn't define keeps its name.
|
|
199
199
|
|
|
200
|
+
In the HTML your views render, Oriel renames the `class` attributes, and Alpine's too: the names in a `:class` or
|
|
201
|
+
`x-bind:class` expression (in its strings and as the keys of an object) and the class lists of `x-transition:enter`,
|
|
202
|
+
`-start`, `-end` and their `leave` forms. In a template literal, its whole words and the strings inside each `${…}` are
|
|
203
|
+
renamed. A string an expression compares, `tab === 'hidden'`, keeps its words, and so does a class a function returns.
|
|
204
|
+
A class glued to a `${…}`, `` `text-${tone}` ``, can't be renamed: the build lists it, like the classes below.
|
|
205
|
+
|
|
200
206
|
The build follows a class value back to its strings when they're in the same file: a variable, a list you join
|
|
201
207
|
yourself, a value standing alone in a template, a function's result, a table of classes, and a memo or a ref:
|
|
202
208
|
|
|
@@ -260,6 +266,18 @@ import { oriel } from '@orieljs/vite'
|
|
|
260
266
|
oriel({ input: ['resources/css/app.css', 'resources/js/app.ts'], obfuscate: { keep: ['btn-primary', 'btn-danger'] } })
|
|
261
267
|
```
|
|
262
268
|
|
|
269
|
+
Two kinds of class names reach the browser without going through the build or the HTML Oriel renames: a class your
|
|
270
|
+
server code sends as data, such as an Inertia prop (`statusClass: 'text-green-600'`), and one an inline `<script>` in a
|
|
271
|
+
view adds. The production build reads your `app` and `routes` folders and your views' inline scripts for strings made of
|
|
272
|
+
your CSS's class names, and lists each one with its file and line:
|
|
273
|
+
|
|
274
|
+
```text
|
|
275
|
+
These class names reach the browser where scrambling can't rename them:
|
|
276
|
+
The class "text-green-600" in app/Http/Controllers/OrderController.ts:14 is renamed in the CSS but not there. Add it to obfuscate.keep in vite.config.ts.
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Add those names to `keep`, as above.
|
|
280
|
+
|
|
263
281
|
`keep` is also for a class something outside the build looks for, such as a script on another site. Browser tests
|
|
264
282
|
that run against a production build see the short names, so find elements by role, label or text, as Playwright
|
|
265
283
|
recommends, rather than by class.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orieljs/framework",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.15",
|
|
4
4
|
"description": "Oriel: a Laravel-style, full-stack TypeScript framework for Node.js and Bun.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -60,37 +60,37 @@
|
|
|
60
60
|
"@aws-sdk/client-s3": "3.1139.0",
|
|
61
61
|
"@aws-sdk/s3-request-presigner": "3.1139.0",
|
|
62
62
|
"@vercel/blob": "2.8.2",
|
|
63
|
-
"@orieljs/collections": "0.1.0-alpha.
|
|
64
|
-
"@orieljs/config": "0.1.0-alpha.
|
|
65
|
-
"@orieljs/
|
|
66
|
-
"@orieljs/
|
|
67
|
-
"@orieljs/
|
|
68
|
-
"@orieljs/
|
|
69
|
-
"@orieljs/
|
|
70
|
-
"@orieljs/
|
|
71
|
-
"@orieljs/
|
|
72
|
-
"@orieljs/
|
|
73
|
-
"@orieljs/
|
|
74
|
-
"@orieljs/events": "0.1.0-alpha.
|
|
75
|
-
"@orieljs/filesystem": "0.1.0-alpha.
|
|
76
|
-
"@orieljs/hashing": "0.1.0-alpha.
|
|
77
|
-
"@orieljs/
|
|
78
|
-
"@orieljs/
|
|
79
|
-
"@orieljs/
|
|
80
|
-
"@orieljs/mail": "0.1.0-alpha.
|
|
81
|
-
"@orieljs/notifications": "0.1.0-alpha.
|
|
82
|
-
"@orieljs/
|
|
83
|
-
"@orieljs/
|
|
84
|
-
"@orieljs/
|
|
85
|
-
"@orieljs/
|
|
86
|
-
"@orieljs/
|
|
87
|
-
"@orieljs/
|
|
88
|
-
"@orieljs/
|
|
89
|
-
"@orieljs/
|
|
90
|
-
"@orieljs/
|
|
91
|
-
"@orieljs/
|
|
92
|
-
"@orieljs/
|
|
93
|
-
"@orieljs/
|
|
63
|
+
"@orieljs/collections": "0.1.0-alpha.15",
|
|
64
|
+
"@orieljs/config": "0.1.0-alpha.15",
|
|
65
|
+
"@orieljs/cache": "0.1.0-alpha.15",
|
|
66
|
+
"@orieljs/auth": "0.1.0-alpha.15",
|
|
67
|
+
"@orieljs/console": "0.1.0-alpha.15",
|
|
68
|
+
"@orieljs/bus": "0.1.0-alpha.15",
|
|
69
|
+
"@orieljs/contracts": "0.1.0-alpha.15",
|
|
70
|
+
"@orieljs/cookie": "0.1.0-alpha.15",
|
|
71
|
+
"@orieljs/container": "0.1.0-alpha.15",
|
|
72
|
+
"@orieljs/encryption": "0.1.0-alpha.15",
|
|
73
|
+
"@orieljs/database": "0.1.0-alpha.15",
|
|
74
|
+
"@orieljs/events": "0.1.0-alpha.15",
|
|
75
|
+
"@orieljs/filesystem": "0.1.0-alpha.15",
|
|
76
|
+
"@orieljs/hashing": "0.1.0-alpha.15",
|
|
77
|
+
"@orieljs/inertia": "0.1.0-alpha.15",
|
|
78
|
+
"@orieljs/http": "0.1.0-alpha.15",
|
|
79
|
+
"@orieljs/live": "0.1.0-alpha.15",
|
|
80
|
+
"@orieljs/mail": "0.1.0-alpha.15",
|
|
81
|
+
"@orieljs/notifications": "0.1.0-alpha.15",
|
|
82
|
+
"@orieljs/log": "0.1.0-alpha.15",
|
|
83
|
+
"@orieljs/obfuscate": "0.1.0-alpha.15",
|
|
84
|
+
"@orieljs/pipeline": "0.1.0-alpha.15",
|
|
85
|
+
"@orieljs/queue": "0.1.0-alpha.15",
|
|
86
|
+
"@orieljs/support": "0.1.0-alpha.15",
|
|
87
|
+
"@orieljs/foundation": "0.1.0-alpha.15",
|
|
88
|
+
"@orieljs/session": "0.1.0-alpha.15",
|
|
89
|
+
"@orieljs/routing": "0.1.0-alpha.15",
|
|
90
|
+
"@orieljs/validation": "0.1.0-alpha.15",
|
|
91
|
+
"@orieljs/testing": "0.1.0-alpha.15",
|
|
92
|
+
"@orieljs/view": "0.1.0-alpha.15",
|
|
93
|
+
"@orieljs/vercel": "0.1.0-alpha.15"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"pg": "^8.23.0",
|