@orieljs/framework 0.1.0-alpha.13 → 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-OTCTQVDQ.js → chunk-7GPMFMS7.js} +349 -67
- package/dist/chunk-7GPMFMS7.js.map +1 -0
- package/dist/{chunk-CKH4KCYF.js → chunk-BKA5F3TH.js} +1 -1
- package/dist/{chunk-CKH4KCYF.js.map → chunk-BKA5F3TH.js.map} +1 -1
- package/dist/{chunk-6GMXKQ6O.js → chunk-FVI6X3VJ.js} +55 -2
- package/dist/chunk-FVI6X3VJ.js.map +1 -0
- package/dist/{chunk-ZRTWDJKD.js → chunk-GCMPAXIK.js} +98 -4
- package/dist/chunk-GCMPAXIK.js.map +1 -0
- package/dist/contracts.d.ts +4 -1
- package/dist/contracts.js +1 -1
- package/dist/{index.d-WQpfdIbG.d.ts → index.d-lffxurFs.d.ts} +10 -1
- package/dist/index.d.ts +233 -37
- package/dist/index.js +823 -307
- package/dist/index.js.map +1 -1
- package/dist/{jsx-runtime-6um4Mwfb.d.ts → jsx-runtime-Bc5KJzwb.d.ts} +1 -1
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +3 -3
- package/dist/{testing-B8NOiQC9.d.ts → testing-CVpo7aRl.d.ts} +41 -7
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +5 -3
- package/docs/authentication.md +40 -1
- package/docs/console.md +16 -5
- package/docs/database-testing.md +21 -0
- package/docs/database.md +17 -2
- package/docs/deployment.md +12 -3
- 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/encryption.md +2 -0
- package/docs/export.md +3 -3
- package/docs/inertia.md +2 -1
- package/docs/installation.md +4 -1
- package/docs/lifecycle.md +5 -4
- package/docs/live-tests.md +20 -0
- package/docs/live.md +2 -0
- package/docs/mail.md +4 -2
- package/docs/navigation.json +4 -0
- package/docs/pagination.md +10 -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/session.md +19 -2
- package/docs/starter-kits.md +4 -0
- package/docs/storage.md +21 -3
- package/docs/testing.md +9 -6
- package/docs/two-factor.md +14 -4
- package/docs/upgrade.md +73 -0
- package/docs/views.md +2 -0
- package/docs/vite.md +19 -1
- package/package.json +54 -38
- package/dist/chunk-6GMXKQ6O.js.map +0 -1
- package/dist/chunk-OTCTQVDQ.js.map +0 -1
- package/dist/chunk-ZRTWDJKD.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Htmlable, OrielError, ErrorKind, View as View$1, ViewFactory } from './contracts.js';
|
|
2
|
-
import { F as Facade, S as ServiceProvider } from './index.d-
|
|
2
|
+
import { F as Facade, S as ServiceProvider } from './index.d-lffxurFs.js';
|
|
3
3
|
|
|
4
4
|
/** Marks the objects jsx() returns (Symbol.for, so two copies of the package agree). */
|
|
5
5
|
declare const ELEMENT: unique symbol;
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { a as Fragment, H as HtmlAttributes, J as JSX, u as jsx, w as jsxs } from './jsx-runtime-
|
|
1
|
+
export { a as Fragment, H as HtmlAttributes, J as JSX, u as jsx, w as jsxs } from './jsx-runtime-Bc5KJzwb.js';
|
|
2
2
|
import './contracts.js';
|
|
3
|
-
import './index.d-
|
|
3
|
+
import './index.d-lffxurFs.js';
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BusDispatcher, Job, PendingBatchOptions, Class, PendingChain, PendingBatch, Batch, EventDispatcher, Listener, MailManager, Mailable, Address, MailRecipient, Mailer, PendingMail, SentMessage, MailTransport, NotificationDispatcher, Notifiable, Notification, NotificationChannel, QueueManager, QueuePayload, Queue, QueueJob, FilesystemManager, Filesystem, PutOptions, UploadedFile, Application, Session, View, Authenticatable, Container, AuthFactory, InertiaPage, ServiceProvider, ServiceProviderClass, DatabaseManager, ModelInstance, Row, Encrypter, Token, ExceptionHandler, ViewFactory, RouteName, RouteArguments, Rules, InferValidatedType, MessageBag, LiveSnapshot, LiveEffects, OrielError, ErrorKind, Htmlable, LiveManager, HttpRequest, LiveUpdateRequest, LiveUpdateResponse, MiddlewareClass, Router } from './contracts.js';
|
|
2
|
-
import { S as ServiceProvider$1 } from './index.d-
|
|
2
|
+
import { S as ServiceProvider$1 } from './index.d-lffxurFs.js';
|
|
3
3
|
|
|
4
4
|
/** A date the tests travel to: a Date, an ISO string or milliseconds since the epoch. */
|
|
5
5
|
type TravelDate = Date | string | number;
|
|
@@ -77,6 +77,7 @@ declare class PendingCommand implements PromiseLike<number> {
|
|
|
77
77
|
private readonly app;
|
|
78
78
|
readonly command: string;
|
|
79
79
|
readonly parameters: Record<string, unknown>;
|
|
80
|
+
private readonly answers;
|
|
80
81
|
private readonly checks;
|
|
81
82
|
private result;
|
|
82
83
|
constructor(app: Application, command: string, parameters?: Record<string, unknown>);
|
|
@@ -91,6 +92,8 @@ declare class PendingCommand implements PromiseLike<number> {
|
|
|
91
92
|
assertSuccessful(): this;
|
|
92
93
|
assertOk(): this;
|
|
93
94
|
assertFailed(): this;
|
|
95
|
+
/** Answers the command's questions (ask(), secret(), confirm(), choice()), in order. A question beyond them fails. */
|
|
96
|
+
withAnswers(...answers: string[]): this;
|
|
94
97
|
/** Runs the command once and checks the expectations; resolves to the exit code. */
|
|
95
98
|
run(): Promise<number>;
|
|
96
99
|
then<R1 = number, R2 = never>(onfulfilled?: ((value: number) => R1 | PromiseLike<R1>) | null, onrejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null): Promise<R1 | R2>;
|
|
@@ -455,6 +458,10 @@ declare class HttpClient {
|
|
|
455
458
|
protected scopeSession(scope: Container): Session | undefined;
|
|
456
459
|
buildRequest(method: string, uri: string, options: RequestOptions): Request;
|
|
457
460
|
protected baseUrl(): string;
|
|
461
|
+
/** The cookies as EncryptCookies would leave them, since no middleware runs for a Live test. */
|
|
462
|
+
protected plainCookies(): Record<string, string>;
|
|
463
|
+
/** A cookie kept from a response is as it was sent: encrypted, unless the app excepts it. */
|
|
464
|
+
protected decrypted(name: string, value: string): string | undefined;
|
|
458
465
|
protected cookieHeader(): string;
|
|
459
466
|
/** Like a browser: cookies the app sets are sent back on later requests in the same test; deleted ones are dropped. */
|
|
460
467
|
protected rememberCookies(response: Response): void;
|
|
@@ -637,6 +644,16 @@ declare abstract class TestCase extends InteractsWithTime {
|
|
|
637
644
|
* already set (the shell, CI, vitest.config) win, like phpunit's non-forced <env>.
|
|
638
645
|
*/
|
|
639
646
|
declare const TESTING_ENVIRONMENT: Readonly<Record<string, string>>;
|
|
647
|
+
/**
|
|
648
|
+
* What a test run's vitest.config.ts spreads into `test`: the testing environment, and whether files run at the same time.
|
|
649
|
+
* The tests run on SQLite in memory, or on TEST_DATABASE_URL's database, one file at a time, as they share it. DB_URL and
|
|
650
|
+
* DB_CONNECTION never count: RefreshDatabase wipes the database it runs on, and Bun loads .env before the tests start, so
|
|
651
|
+
* honouring them could wipe a production database. It prints which database the run is on.
|
|
652
|
+
*/
|
|
653
|
+
declare function testingConfig(env?: NodeJS.ProcessEnv, log?: (line: string) => void, cwd?: string): {
|
|
654
|
+
env: Record<string, string>;
|
|
655
|
+
fileParallelism: boolean;
|
|
656
|
+
};
|
|
640
657
|
declare function applyEnvironment(values: Record<string, string>, env?: NodeJS.ProcessEnv): void;
|
|
641
658
|
|
|
642
659
|
/** The request scope's ViewFactory: records every view made, so TestResponse can assert on it (assertViewIs/Has). */
|
|
@@ -671,7 +688,7 @@ declare const RefreshDatabaseState: {
|
|
|
671
688
|
};
|
|
672
689
|
/** Runs a console command through the ConsoleKernel contract; a non-zero exit fails the test with its output. */
|
|
673
690
|
declare function runCommand(app: Application, command: string, parameters?: Record<string, unknown>): Promise<void>;
|
|
674
|
-
/** Laravel's usingInMemoryDatabase()
|
|
691
|
+
/** Laravel's usingInMemoryDatabase(), by the driver too: only SQLite has a database in memory, whatever DB_DATABASE says. */
|
|
675
692
|
declare function usingInMemoryDatabase(app: Application): boolean;
|
|
676
693
|
/**
|
|
677
694
|
* Laravel's RefreshDatabase.
|
|
@@ -1215,6 +1232,8 @@ declare class Testable<C extends Component = Component> {
|
|
|
1215
1232
|
html(): string;
|
|
1216
1233
|
/** The effects of the last request. */
|
|
1217
1234
|
effects(): LiveEffects;
|
|
1235
|
+
/** The cookies the last request queued, by name; null for one it deleted. */
|
|
1236
|
+
cookies(): Record<string, string | null>;
|
|
1218
1237
|
/**
|
|
1219
1238
|
* Sets public properties through an update. A file (a FakeFile) or an array of files is uploaded as `o:model` on a
|
|
1220
1239
|
* file input does it: the upload rules, the temporary disk, then a TemporaryUploadedFile (or an array) in the
|
|
@@ -1435,6 +1454,12 @@ declare class FileNotPreviewableError extends LiveError {
|
|
|
1435
1454
|
readonly name: string;
|
|
1436
1455
|
constructor(extension: string);
|
|
1437
1456
|
}
|
|
1457
|
+
/** store() or temporaryUrl() on an upload that was stored already, so its temporary file has gone. */
|
|
1458
|
+
declare class UploadAlreadyStoredError extends LiveError {
|
|
1459
|
+
readonly path: string;
|
|
1460
|
+
readonly name: string;
|
|
1461
|
+
constructor(path: string);
|
|
1462
|
+
}
|
|
1438
1463
|
/** The errors an upload came back with (`_uploadErrored`): the component re-renders with them on the property. */
|
|
1439
1464
|
declare class UploadValidationError extends LiveError {
|
|
1440
1465
|
readonly errors: Record<string, string[]>;
|
|
@@ -1499,11 +1524,15 @@ declare class TemporaryUploadedFile implements UploadedFile {
|
|
|
1499
1524
|
text(): Promise<string>;
|
|
1500
1525
|
/** The file's bytes from the temporary disk, opened on the first read. */
|
|
1501
1526
|
stream(): ReadableStream<Uint8Array>;
|
|
1502
|
-
/**
|
|
1527
|
+
/**
|
|
1528
|
+
* Moves the file under a random name to `directory`, on `disk` (by default the temporary disk, as Livewire's), so no
|
|
1529
|
+
* temporary copy is left behind: on a public disk it could be fetched at its address. An upload stores once.
|
|
1530
|
+
*/
|
|
1503
1531
|
store(directory: string, disk?: string): Promise<string>;
|
|
1532
|
+
/** store(), under the name you give it. */
|
|
1504
1533
|
storeAs(directory: string, name: string, disk?: string): Promise<string>;
|
|
1505
1534
|
exists(): Promise<boolean>;
|
|
1506
|
-
/** Removes the temporary file
|
|
1535
|
+
/** Removes the temporary file, if it hasn't been stored. */
|
|
1507
1536
|
delete(): Promise<boolean>;
|
|
1508
1537
|
/** Whether temporaryUrl() serves this file: its type is in `live.temporary_file_upload.preview_mimes`. */
|
|
1509
1538
|
isPreviewable(): boolean;
|
|
@@ -1579,13 +1608,18 @@ interface PaginationProps {
|
|
|
1579
1608
|
paginator: PaginationSource;
|
|
1580
1609
|
/** Classes for the <nav>, such as its layout ("flex gap-2"); in your file, so Tailwind generates them. */
|
|
1581
1610
|
class?: string;
|
|
1611
|
+
/** Classes for Previous, Next and the page buttons, the kits' `btn btn-secondary` unless you say; '' for none. */
|
|
1612
|
+
buttonClass?: string;
|
|
1613
|
+
/** Classes for the current page's button, the kits' `btn` unless you say; '' for none. */
|
|
1614
|
+
currentClass?: string;
|
|
1582
1615
|
}
|
|
1583
1616
|
/**
|
|
1584
1617
|
* Livewire's pagination links for a WithPagination component: `<Pagination paginator={posts} />` in render(). A
|
|
1585
1618
|
* <nav aria-label="Pagination"> with « Previous, the page buttons and Next » as Live actions (previousPage,
|
|
1586
1619
|
* gotoPage(n), nextPage), the current page marked aria-current="page", the ends disabled, the kits' theme classes
|
|
1587
|
-
* (btn, btn-secondary). Nothing when everything fits on one page.
|
|
1620
|
+
* (btn, btn-secondary) unless `buttonClass` and `currentClass` say otherwise. Nothing when everything fits on one page.
|
|
1621
|
+
* The address bar is left alone.
|
|
1588
1622
|
*/
|
|
1589
|
-
declare function Pagination({ paginator, class: className }: PaginationProps): Htmlable;
|
|
1623
|
+
declare function Pagination({ paginator, class: className, buttonClass, currentClass }: PaginationProps): Htmlable;
|
|
1590
1624
|
|
|
1591
|
-
export {
|
|
1625
|
+
export { type CountOrFilter as $, UPLOAD_URI as A, BusFake as B, Component as C, UploadAlreadyStoredError as D, EventFake as E, FileNotPreviewableError as F, UploadValidationError as G, WithPagination as H, InvalidLiveRequestError as I, componentName as J, live as K, Live as L, MailFake as M, NotificationFake as N, On as O, PERSISTENT_MIDDLEWARE as P, QueueFake as Q, persistentMiddleware as R, StorageFake as S, TEMPORARY_UPLOAD_DEFAULTS as T, UPDATE_URI as U, AnonymousNotifiable as V, WithFileUploads as W, AssertableInertia as X, AssertableJson as Y, type BatchRecord as Z, type BootOptions as _, type ComponentResult as a, DatabaseMigrations as a0, type DatabaseTestOptions as a1, DatabaseTransactions as a2, type DispatchedEvent as a3, type ExpectedErrors as a4, type ExpectedListener as a5, FakeDisk as a6, FakeFile as a7, HttpClient as a8, InteractsWithApplication as a9, applyEnvironment as aA, cookieHeader as aB, cookiePrefix as aC, decryptCookie as aD, encryptCookie as aE, flatten as aF, freezeSecond as aG, freezeTime as aH, guessMimeType as aI, inertiaPageOf as aJ, install as aK, isExpired as aL, matches as aM, nameOf as aN, recordingExceptionHandler as aO, recordingViewFactory as aP, responseCookies as aQ, runCommand as aR, testingConfig as aS, travel as aT, travelBack as aU, travelTo as aV, usingInMemoryDatabase as aW, InteractsWithConsole as aa, InteractsWithDatabase as ab, InteractsWithTime as ac, type JsonStructure as ad, MailRecord as ae, MakesHttpRequests as af, PendingCommand as ag, type PushedJob as ah, RefreshDatabase as ai, RefreshDatabaseState as aj, type RequestData as ak, type RequestOptions as al, type ResponseContext as am, type ResponseCookie as an, type SentNotification as ao, TESTING_ENVIRONMENT as ap, type TableOrModel as aq, type Target as ar, TestCase as as, type TestHooks as at, TestResponse as au, type TestTrait as av, type TravelDate as aw, Wormhole as ax, actingAsAuthFactory as ay, addresses as az, Computed as b, CorruptComponentPayloadError as c, ErrorBag as d, InvalidUploadSignatureError as e, LiveComponentManager as f, LiveComponentNotFoundError as g, LiveError as h, type LiveProps as i, LiveServiceProvider as j, Locked as k, MethodNotCallableError as l, PREVIEW_URI as m, type Paginated as n, Pagination as o, type PaginationProps as p, type PaginationSource as q, PendingEvent as r, type PersistentMiddleware as s, PropertyNotUpdatableError as t, SESSION_URI as u, type TemporaryFileData as v, TemporaryFileNotFoundError as w, TemporaryUploadedFile as x, TestRequestScope as y, Testable as z };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { V as AnonymousNotifiable, X as AssertableInertia, Y as AssertableJson, Z as BatchRecord, _ as BootOptions, B as BusFake, $ as CountOrFilter, a0 as DatabaseMigrations, a1 as DatabaseTestOptions, a2 as DatabaseTransactions, a3 as DispatchedEvent, E as EventFake, a4 as ExpectedErrors, a5 as ExpectedListener, a6 as FakeDisk, a7 as FakeFile, a8 as HttpClient, a9 as InteractsWithApplication, aa as InteractsWithConsole, ab as InteractsWithDatabase, ac as InteractsWithTime, ad as JsonStructure, L as Live, M as MailFake, ae as MailRecord, af as MakesHttpRequests, N as NotificationFake, ag as PendingCommand, ah as PushedJob, Q as QueueFake, ai as RefreshDatabase, aj as RefreshDatabaseState, ak as RequestData, al as RequestOptions, am as ResponseContext, an as ResponseCookie, ao as SentNotification, S as StorageFake, ap as TESTING_ENVIRONMENT, aq as TableOrModel, ar as Target, as as TestCase, at as TestHooks, au as TestResponse, av as TestTrait, z as Testable, aw as TravelDate, ax as Wormhole, ay as actingAsAuthFactory, az as addresses, aA as applyEnvironment, aB as cookieHeader, aC as cookiePrefix, aD as decryptCookie, aE as encryptCookie, aF as flatten, aG as freezeSecond, aH as freezeTime, aI as guessMimeType, aJ as inertiaPageOf, aK as install, aL as isExpired, aM as matches, aN as nameOf, aO as recordingExceptionHandler, aP as recordingViewFactory, aQ as responseCookies, aR as runCommand, aS as testingConfig, aT as travel, aU as travelBack, aV as travelTo, aW as usingInMemoryDatabase } from './testing-CVpo7aRl.js';
|
|
2
2
|
import './contracts.js';
|
|
3
|
-
import './index.d-
|
|
3
|
+
import './index.d-lffxurFs.js';
|
package/dist/testing.js
CHANGED
|
@@ -48,13 +48,14 @@ import {
|
|
|
48
48
|
recordingViewFactory,
|
|
49
49
|
responseCookies,
|
|
50
50
|
runCommand,
|
|
51
|
+
testingConfig,
|
|
51
52
|
travel,
|
|
52
53
|
travelBack,
|
|
53
54
|
travelTo,
|
|
54
55
|
usingInMemoryDatabase
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import "./chunk-
|
|
57
|
-
import "./chunk-
|
|
56
|
+
} from "./chunk-7GPMFMS7.js";
|
|
57
|
+
import "./chunk-FVI6X3VJ.js";
|
|
58
|
+
import "./chunk-BKA5F3TH.js";
|
|
58
59
|
export {
|
|
59
60
|
AnonymousNotifiable,
|
|
60
61
|
AssertableInertia,
|
|
@@ -105,6 +106,7 @@ export {
|
|
|
105
106
|
recordingViewFactory,
|
|
106
107
|
responseCookies,
|
|
107
108
|
runCommand,
|
|
109
|
+
testingConfig,
|
|
108
110
|
travel,
|
|
109
111
|
travelBack,
|
|
110
112
|
travelTo,
|
package/docs/authentication.md
CHANGED
|
@@ -300,7 +300,44 @@ export class LogoutController extends Controller {
|
|
|
300
300
|
```
|
|
301
301
|
|
|
302
302
|
> [!NOTE]
|
|
303
|
-
> Laravel's
|
|
303
|
+
> Laravel's password confirmation pages (`password.confirm`) aren't in Oriel.
|
|
304
|
+
|
|
305
|
+
### Invalidating sessions on other devices
|
|
306
|
+
|
|
307
|
+
A new password usually means someone else may have the old one, so it should end the user's other sessions. The
|
|
308
|
+
`auth.session` middleware does that, on every session driver. It keeps a keyed hash of the user's password in the session
|
|
309
|
+
and signs the session out when the password no longer matches. The starter kits add it to the `web` group, so Live updates
|
|
310
|
+
are covered too. An existing app adds one line, in `bootstrap/app.ts`:
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
import { dirname } from 'node:path'
|
|
314
|
+
import { Application, AuthenticateSession } from '@orieljs/framework'
|
|
315
|
+
|
|
316
|
+
Application.configure({ basePath: dirname(import.meta.dirname) })
|
|
317
|
+
.withMiddleware((middleware) => {
|
|
318
|
+
middleware.web({ append: [AuthenticateSession] })
|
|
319
|
+
})
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
With it in place:
|
|
323
|
+
|
|
324
|
+
- A new password or a password reset ends the user's other sessions, on their next request.
|
|
325
|
+
- The session that changes the password stays signed in, and so does that device's "Remember me" cookie.
|
|
326
|
+
- A session from before you added the middleware has no hash yet. It stores one and carries on, so nobody is signed out by
|
|
327
|
+
upgrading, and rotating the app key signs nobody out either.
|
|
328
|
+
- A page cached [without a session](live.md#pages-cached-without-a-session) passes straight through.
|
|
329
|
+
|
|
330
|
+
To end the other sessions without a new password, such as for a "Sign out everywhere else" button, ask for the current
|
|
331
|
+
password and pass it to `logoutOtherDevices()`. It throws `InvalidPasswordError` when the password is wrong:
|
|
332
|
+
|
|
333
|
+
```ts
|
|
334
|
+
import { Auth, request } from '@orieljs/framework'
|
|
335
|
+
|
|
336
|
+
await Auth.logoutOtherDevices(String(request().input('password')))
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
It works by rehashing the password, so it needs the middleware to take effect. `Auth.logoutCurrentDevice()` signs out here
|
|
340
|
+
only: unlike `logout()`, it leaves the remember token alone, so the user's other remembered devices keep working.
|
|
304
341
|
|
|
305
342
|
## API tokens
|
|
306
343
|
|
|
@@ -483,6 +520,8 @@ Signing in and out dispatches these events, which you can [listen](events.md) fo
|
|
|
483
520
|
| `Failed` | The credentials didn't match |
|
|
484
521
|
| `Login` | A user signed in with `attempt()`, `login()`, `loginUsingId()` or the "Remember me" cookie (`once()` dispatches none) |
|
|
485
522
|
| `Logout` | A user signed out |
|
|
523
|
+
| `CurrentDeviceLogout` | `logoutCurrentDevice()` or `auth.session` signed a user out on this device |
|
|
524
|
+
| `OtherDeviceLogout` | `logoutOtherDevices()` rehashed the password, which ends the other sessions |
|
|
486
525
|
| `Lockout` | The kits' login throttle stopped a user |
|
|
487
526
|
| `Registered` | The kits registered a user (it sends the verification mail) |
|
|
488
527
|
| `Verified` | A user verified their email address |
|
package/docs/console.md
CHANGED
|
@@ -192,6 +192,8 @@ export class SendEmails extends Command {
|
|
|
192
192
|
}
|
|
193
193
|
```
|
|
194
194
|
|
|
195
|
+
Each run gets a new instance of your class, so its fields start fresh and `#private` members work.
|
|
196
|
+
|
|
195
197
|
Each run of a command has its own scope, as a request does, so `inject()`, the helpers and the facades work inside
|
|
196
198
|
`handle()`, and a scoped service lasts for that one run.
|
|
197
199
|
|
|
@@ -434,9 +436,8 @@ declare const command: Command
|
|
|
434
436
|
const password = await command.secret('What is the password?')
|
|
435
437
|
```
|
|
436
438
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
> terminal shows it as it is typed.
|
|
439
|
+
Nothing typed appears in a terminal, and the answer isn't trimmed, as a secret may start or end with a space. When the
|
|
440
|
+
input is a pipe, `secret()` takes the next line, as `ask()` does. Ctrl-C at any question ends the command with exit code 130.
|
|
440
441
|
|
|
441
442
|
#### Asking for confirmation
|
|
442
443
|
|
|
@@ -647,8 +648,18 @@ test('the mail is sent', async () => {
|
|
|
647
648
|
it; `doesntExpectOutput()` and `doesntExpectOutputToContain()` want the opposite. `assertSuccessful()` and
|
|
648
649
|
`assertFailed()` check the exit code is `0`, or isn't.
|
|
649
650
|
|
|
651
|
+
A command that asks questions gets its answers from `withAnswers()`, in order, whichever way it asks. A question beyond
|
|
652
|
+
them fails the test:
|
|
653
|
+
|
|
654
|
+
```ts
|
|
655
|
+
import { TestCase } from '@orieljs/framework/testing'
|
|
656
|
+
declare const t: TestCase
|
|
657
|
+
// ---cut---
|
|
658
|
+
await t.artisan('admin:create').withAnswers('a-password', 'a-password').assertExitCode(0)
|
|
659
|
+
```
|
|
660
|
+
|
|
650
661
|
> [!NOTE]
|
|
651
|
-
> Laravel's `expectsQuestion()` and `expectsConfirmation()` aren't in Oriel:
|
|
652
|
-
>
|
|
662
|
+
> Laravel's `expectsQuestion()` and `expectsConfirmation()` aren't in Oriel: `withAnswers()` gives the answers without
|
|
663
|
+
> checking how the questions are worded.
|
|
653
664
|
|
|
654
665
|
The [Testing](testing.md) pages cover the rest.
|
package/docs/database-testing.md
CHANGED
|
@@ -60,6 +60,27 @@ export class TestCase extends BaseTestCase {
|
|
|
60
60
|
> [!NOTE]
|
|
61
61
|
> Laravel's traits are PHP traits, added with `use RefreshDatabase;`. Oriel's are objects you list in `uses`.
|
|
62
62
|
|
|
63
|
+
### Running the tests on another database
|
|
64
|
+
|
|
65
|
+
`TEST_DATABASE_URL` runs the tests on a PostgreSQL or MySQL database, with its driver installed, one file at a time, as they
|
|
66
|
+
share it:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
TEST_DATABASE_URL=postgres://oriel:secret@127.0.0.1:5432/oriel_test npm test
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The run prints `Tests run on pgsql at 127.0.0.1:5432/oriel_test (TEST_DATABASE_URL), one file at a time.`, without the user or
|
|
73
|
+
the password.
|
|
74
|
+
|
|
75
|
+
> [!WARNING]
|
|
76
|
+
> `RefreshDatabase` empties the database it runs on, so give the tests a database of their own. `DB_URL` and `DB_CONNECTION`
|
|
77
|
+
> never count for tests, so a production address in `.env` can't reach them, and `TEST_DATABASE_URL` is refused when it
|
|
78
|
+
> points at the app's own database, from `DB_URL` or from `DB_HOST`, `DB_PORT` and `DB_DATABASE`, in the environment or in
|
|
79
|
+
> `.env`. `localhost`, `127.0.0.1` and `::1` count as one host.
|
|
80
|
+
>
|
|
81
|
+
> As a last check, `RefreshDatabase` and `DatabaseMigrations` refuse to empty the database your `.env` points at, even
|
|
82
|
+
> when a `vitest.config.ts` of your own doesn't use `testingConfig()`.
|
|
83
|
+
|
|
63
84
|
## Model factories
|
|
64
85
|
|
|
65
86
|
[Factories](eloquent-factories.md) make the rows a test needs:
|
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
|
|
|
@@ -152,6 +153,18 @@ const users = await DB.table('users').select(DB.raw('count(*) as user_count, sta
|
|
|
152
153
|
|
|
153
154
|
A raw expression is SQL you write, so never put a user's input in it: bind it with `?` instead.
|
|
154
155
|
|
|
156
|
+
|
|
157
|
+
### Drivers
|
|
158
|
+
|
|
159
|
+
Each connection's driver is a package of its own: `better-sqlite3` for SQLite on Node, which a new app has (Bun has SQLite
|
|
160
|
+
built in), `pg` for PostgreSQL and `mysql2` for MySQL. Install the one you use:
|
|
161
|
+
|
|
162
|
+
```sh
|
|
163
|
+
npm install pg
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
A driver that isn't installed says so the first time the connection is used: `The pgsql connection needs the pg package.
|
|
167
|
+
Install it with: npm install pg`, with the command for your package manager.
|
|
155
168
|
### Values in bindings
|
|
156
169
|
|
|
157
170
|
Oriel turns some values into what the database stores: `true` and `false` become `1` and `0` (except on PostgreSQL,
|
|
@@ -175,7 +188,9 @@ await DB.transaction(async () => {
|
|
|
175
188
|
|
|
176
189
|
The queries your function runs, through the facade, the query builder or your models, are in the transaction, and
|
|
177
190
|
those of other requests running at the same time aren't. A transaction inside another uses a savepoint, so an inner
|
|
178
|
-
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:
|
|
179
194
|
|
|
180
195
|
```ts
|
|
181
196
|
const user = await DB.transaction(async () => {
|
package/docs/deployment.md
CHANGED
|
@@ -19,7 +19,10 @@ when requests come: see [Deploying to Vercel](#deploying-to-vercel).
|
|
|
19
19
|
Your server needs **Node 22** or later, or **Bun 1.2** or later. On Node, your app's TypeScript runs through `tsx`,
|
|
20
20
|
which every app has as a dependency; Bun runs it as it is. There is no compile step for your server code.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Each database and disk needs its driver in your dependencies: `better-sqlite3` for SQLite on Node (a new Node app has it,
|
|
23
|
+
and Bun has SQLite built in), `pg` for PostgreSQL, `mysql2` for MySQL, `@aws-sdk/client-s3` and `@aws-sdk/s3-request-presigner`
|
|
24
|
+
for an `s3` disk, `@vercel/blob` for a `blob` disk. A driver that's missing says so the first time it's used, with the
|
|
25
|
+
command that installs it.
|
|
23
26
|
|
|
24
27
|
## Building your application
|
|
25
28
|
|
|
@@ -114,7 +117,9 @@ Point your container's health check at the [health route](#the-health-route), `/
|
|
|
114
117
|
|
|
115
118
|
The server sends a file that exists in `public` before your routes run, so `public/build` and your icons need no
|
|
116
119
|
other web server. The built assets, under `/build/assets/`, are sent with a year-long, immutable cache header, as
|
|
117
|
-
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).
|
|
118
123
|
|
|
119
124
|
A web server or a CDN in front of your app can serve `public` itself; then pass `publicPath: false` to `serve()`.
|
|
120
125
|
|
|
@@ -311,6 +316,8 @@ and each instance has its own, so:
|
|
|
311
316
|
- **Files your app stores** go on the `blob` disk, a Vercel Blob store, or an `s3` disk (see
|
|
312
317
|
[The Vercel Blob driver](storage.md#the-vercel-blob-driver)): the `local` and `public` disks write into `storage`,
|
|
313
318
|
which the function can't.
|
|
319
|
+
- **The function carries your `dependencies`**, so list `pg` (or `mysql2`) and `@vercel/blob` there, and move
|
|
320
|
+
`better-sqlite3` to `devDependencies` when your tests use it: then the function holds only the drivers it uses.
|
|
314
321
|
- **No queue worker runs.** With `QUEUE_CONNECTION=sync`, a job runs during the request that dispatches it. Your
|
|
315
322
|
scheduled tasks run through Vercel Cron (see [Scheduled tasks](#scheduled-tasks)).
|
|
316
323
|
- **Inertia pages render in the browser**, as they do when no SSR server answers: the SSR server doesn't run on
|
|
@@ -343,7 +350,9 @@ environment variables (a long random string): Vercel sends it with every call, a
|
|
|
343
350
|
so nobody else can run your tasks.
|
|
344
351
|
|
|
345
352
|
Each call runs every task that fell due since the previous call, once, however often it fell due in between: a task
|
|
346
|
-
scheduled every five minutes runs once a day, and a task at 04:00 runs at the next morning's call.
|
|
353
|
+
scheduled every five minutes runs once a day, and a task at 04:00 runs at the next morning's call. The first call after
|
|
354
|
+
a deploy, with no earlier call recorded, covers one full period of the cron back, as every later call does: for a daily
|
|
355
|
+
cron, from the day before's run time. So a task due just before you deploy still runs. `vercel:build` names
|
|
347
356
|
the tasks due more often than the cron. Vercel's Hobby plan runs a cron at most once a day, sometime within the hour
|
|
348
357
|
you chose; a paid plan can call more often:
|
|
349
358
|
|
|
@@ -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/encryption.md
CHANGED
|
@@ -15,6 +15,8 @@ The encrypter's key is `key` in `config/app.ts`, which reads `APP_KEY` from `.en
|
|
|
15
15
|
`node oriel key:generate` writes a new one: a random key for your cipher, written as `base64:` and its bytes (see
|
|
16
16
|
[The application key](configuration.md#the-application-key)).
|
|
17
17
|
|
|
18
|
+
A page that reads and writes no cookies works without a key, such as a page cached [without a session](live.md#pages-cached-without-a-session). A cookie that needs decrypting then reads as absent, and writing an encrypted cookie throws `MissingAppKeyError`.
|
|
19
|
+
|
|
18
20
|
`cipher` in `config/app.ts` names the cipher, `AES-256-GCM` in a new app. `AES-128-GCM`, `AES-256-CBC` and `AES-128-CBC`
|
|
19
21
|
are the others, in upper or lower case. The key must have the length the cipher takes: 32 bytes for AES-256 and 16 for
|
|
20
22
|
AES-128.
|
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
|
|
@@ -171,7 +173,8 @@ come from the `.env` file at the root of your app, which the config files read w
|
|
|
171
173
|
|
|
172
174
|
### Databases and migrations
|
|
173
175
|
|
|
174
|
-
A new app uses SQLite, in `database/database.sqlite`, which the installer created and migrated.
|
|
176
|
+
A new app uses SQLite, in `database/database.sqlite`, which the installer created and migrated. On Node it uses the
|
|
177
|
+
`better-sqlite3` package, which a new app has in its dependencies; Bun has SQLite built in, so a Bun app doesn't. To use PostgreSQL or
|
|
175
178
|
MySQL instead, install its driver, `pg` or `mysql2`:
|
|
176
179
|
|
|
177
180
|
```sh
|
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/live-tests.md
CHANGED
|
@@ -189,6 +189,26 @@ component.assertRedirect('/posts').assertDispatched('post-created', { title: 'He
|
|
|
189
189
|
`assertRedirect()` with no URL passes on any redirect. `effects().redirectUsingNavigate` is `true` when the action
|
|
190
190
|
asked for `{ navigate: true }`.
|
|
191
191
|
|
|
192
|
+
## Testing cookies
|
|
193
|
+
|
|
194
|
+
A component sees the cookies you give the test, and `cookies()` shows what the last call queued, by name, with `null` for
|
|
195
|
+
one it deleted. Cookies it queues are sent on later requests in the test, as a browser would:
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
import { Live, Component } from '@orieljs/framework'
|
|
199
|
+
import { TestCase } from '@orieljs/framework/testing'
|
|
200
|
+
import { expect } from 'vitest'
|
|
201
|
+
declare const t: TestCase
|
|
202
|
+
declare const Theme: new () => Component
|
|
203
|
+
// ---cut---
|
|
204
|
+
t.withCookie('theme', 'dark')
|
|
205
|
+
|
|
206
|
+
const component = await Live.test(Theme)
|
|
207
|
+
await component.call('remember')
|
|
208
|
+
|
|
209
|
+
expect(component.cookies()).toEqual({ seen: '1' })
|
|
210
|
+
```
|
|
211
|
+
|
|
192
212
|
## Testing file uploads
|
|
193
213
|
|
|
194
214
|
In a `WithFileUploads` component, `set()` with a `FakeFile` uploads it as the browser would: through the upload rules,
|
package/docs/live.md
CHANGED
|
@@ -784,6 +784,8 @@ export default class ProfilePhoto extends WithFileUploads(Component) {
|
|
|
784
784
|
With `multiple`, the field is an array of files. A temporary file has the methods of an [uploaded
|
|
785
785
|
file](requests.md#files), such as `store()` and `storeAs()`, and `temporaryUrl()`, a signed link that previews an image,
|
|
786
786
|
audio or video.
|
|
787
|
+
`store()` moves the temporary file, so reset the property afterwards, as above: a second `store()`, or `temporaryUrl()`
|
|
788
|
+
after it, throws `UploadAlreadyStoredError`.
|
|
787
789
|
|
|
788
790
|
Temporary files go in `live-tmp` on your default disk, and [Storage](storage.md#live-uploads) explains how they are
|
|
789
791
|
cleaned up. `o:loading` shows while a file uploads, and these browser events follow it, on the input:
|
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)).
|