@zerotal/arch 1.7.0
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/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/api-surface.md +283 -0
- package/docs/about.md +676 -0
- package/docs/admin/actions.md +183 -0
- package/docs/admin/auth.md +89 -0
- package/docs/admin/dashboard.md +155 -0
- package/docs/admin/extending-ui.md +229 -0
- package/docs/admin/extending.md +205 -0
- package/docs/admin/forms.md +155 -0
- package/docs/admin/index.md +144 -0
- package/docs/admin/operations.md +224 -0
- package/docs/admin/references.md +174 -0
- package/docs/admin/resources.md +132 -0
- package/docs/admin/structure.md +158 -0
- package/docs/admin/tables.md +185 -0
- package/docs/admin/testing.md +138 -0
- package/docs/ai.md +373 -0
- package/docs/application.md +435 -0
- package/docs/arch.md +263 -0
- package/docs/assets.md +755 -0
- package/docs/audit.md +367 -0
- package/docs/authentication.md +1000 -0
- package/docs/authorization.md +529 -0
- package/docs/broadcasting/channels.md +170 -0
- package/docs/broadcasting/client.md +108 -0
- package/docs/broadcasting/events.md +190 -0
- package/docs/broadcasting/index.md +163 -0
- package/docs/broadcasting/references.md +84 -0
- package/docs/broadcasting/testing.md +132 -0
- package/docs/cache.md +387 -0
- package/docs/carbon.md +830 -0
- package/docs/changelog.md +465 -0
- package/docs/client/auth.md +113 -0
- package/docs/client/errors.md +139 -0
- package/docs/client/files.md +118 -0
- package/docs/client/index.md +128 -0
- package/docs/client/references.md +58 -0
- package/docs/client/requests.md +131 -0
- package/docs/client/resilience.md +141 -0
- package/docs/client/testing.md +146 -0
- package/docs/commands.md +450 -0
- package/docs/components.md +2427 -0
- package/docs/config-system.md +258 -0
- package/docs/container.md +596 -0
- package/docs/context.md +579 -0
- package/docs/contributing.md +164 -0
- package/docs/controllers.md +354 -0
- package/docs/conventions.md +466 -0
- package/docs/cookies.md +101 -0
- package/docs/csrf.md +206 -0
- package/docs/database.md +476 -0
- package/docs/deployment.md +434 -0
- package/docs/devtools.md +1013 -0
- package/docs/email-verification.md +320 -0
- package/docs/encryption.md +380 -0
- package/docs/errors.md +317 -0
- package/docs/events.md +420 -0
- package/docs/flow/components.md +846 -0
- package/docs/flow/decorators.md +458 -0
- package/docs/flow/events.md +420 -0
- package/docs/flow/forms.md +551 -0
- package/docs/flow/index.md +568 -0
- package/docs/flow/layouts.md +793 -0
- package/docs/flow/lifecycle.md +336 -0
- package/docs/flow/pagination.md +402 -0
- package/docs/flow/performance.md +262 -0
- package/docs/flow/references.md +317 -0
- package/docs/flow/routing.md +550 -0
- package/docs/flow/testing.md +447 -0
- package/docs/getting-started.md +286 -0
- package/docs/health.md +269 -0
- package/docs/helpers.md +423 -0
- package/docs/i18n.md +414 -0
- package/docs/index.md +65 -0
- package/docs/inertia/build.md +95 -0
- package/docs/inertia/devtools.md +197 -0
- package/docs/inertia/index.md +267 -0
- package/docs/inertia/middleware.md +81 -0
- package/docs/inertia/props.md +507 -0
- package/docs/inertia/references.md +144 -0
- package/docs/inertia/rendering.md +189 -0
- package/docs/inertia/ssr.md +102 -0
- package/docs/inspirations.md +257 -0
- package/docs/lifecycle.md +331 -0
- package/docs/lock.md +454 -0
- package/docs/logger.md +517 -0
- package/docs/media.md +582 -0
- package/docs/middleware.md +509 -0
- package/docs/migrations.md +529 -0
- package/docs/monitor.md +377 -0
- package/docs/notifications.md +848 -0
- package/docs/orm/casts.md +365 -0
- package/docs/orm/factories.md +231 -0
- package/docs/orm/index.md +663 -0
- package/docs/orm/lifecycle.md +421 -0
- package/docs/orm/queries.md +692 -0
- package/docs/orm/relationships.md +440 -0
- package/docs/orm/serialization.md +251 -0
- package/docs/package-development.md +536 -0
- package/docs/pagination.md +340 -0
- package/docs/password-reset.md +335 -0
- package/docs/providers.md +447 -0
- package/docs/query-builder.md +465 -0
- package/docs/queue.md +549 -0
- package/docs/rate-limiting.md +253 -0
- package/docs/responses.md +336 -0
- package/docs/roles-and-2fa.md +418 -0
- package/docs/routing.md +1008 -0
- package/docs/scaffolding.md +335 -0
- package/docs/scheduler.md +533 -0
- package/docs/seeding.md +229 -0
- package/docs/session.md +451 -0
- package/docs/social.md +524 -0
- package/docs/storage.md +622 -0
- package/docs/structure.md +230 -0
- package/docs/support-policy.md +114 -0
- package/docs/telemetry.md +505 -0
- package/docs/tenancy.md +608 -0
- package/docs/testing/browser.md +153 -0
- package/docs/testing/console.md +130 -0
- package/docs/testing/database.md +238 -0
- package/docs/testing/flow-browser.md +216 -0
- package/docs/testing/http.md +441 -0
- package/docs/testing/index.md +240 -0
- package/docs/testing/mocking.md +410 -0
- package/docs/upgrade.md +192 -0
- package/docs/validator.md +549 -0
- package/docs/view.md +453 -0
- package/package.json +60 -0
- package/src/bin/mcp.ts +73 -0
- package/src/config.ts +63 -0
- package/src/errors.ts +27 -0
- package/src/index.ts +56 -0
- package/src/install/ArchInstallCommand.ts +189 -0
- package/src/install/detect.ts +98 -0
- package/src/install/guidelines.ts +290 -0
- package/src/install/markers.ts +77 -0
- package/src/install/mcpConfig.ts +81 -0
- package/src/mcp/index.ts +27 -0
- package/src/mcp/jsonrpc.ts +133 -0
- package/src/mcp/server.ts +307 -0
- package/src/mcp/stdio.ts +111 -0
- package/src/mcp/types.ts +146 -0
- package/src/probe/ArchProbeCommand.ts +48 -0
- package/src/probe/sentinel.ts +13 -0
- package/src/probe/topics.ts +291 -0
- package/src/provider/ArchProvider.ts +101 -0
- package/src/tools/_probe.ts +164 -0
- package/src/tools/apiSurface.ts +241 -0
- package/src/tools/appInfo.ts +88 -0
- package/src/tools/baselines.ts +210 -0
- package/src/tools/context.ts +37 -0
- package/src/tools/doctor.ts +93 -0
- package/src/tools/index.ts +50 -0
- package/src/tools/logs.ts +265 -0
- package/src/tools/routes.ts +133 -0
- package/src/tools/schema.ts +119 -0
- package/src/tools/searchDocs.ts +345 -0
package/docs/upgrade.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Upgrade Guide
|
|
3
|
+
description: Move a Zerotal app to a newer release safely by bumping packages, applying breaking changes, and migrating.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Upgrade Guide
|
|
7
|
+
|
|
8
|
+
This guide explains how to move a Zerotal app to a newer release. For the list of
|
|
9
|
+
what changed in each version, see the [Release Notes](/docs/changelog).
|
|
10
|
+
|
|
11
|
+
## Versioning
|
|
12
|
+
|
|
13
|
+
Zerotal follows semantic versioning across its `@zerotal/*` packages, which share a
|
|
14
|
+
version line:
|
|
15
|
+
|
|
16
|
+
- **Patch** (`x.y.Z`) — bug fixes, safe to take anytime.
|
|
17
|
+
- **Minor** (`x.Y.z`) — new features, backward compatible.
|
|
18
|
+
- **Major** (`X.y.z`) — breaking changes; read the version's section in the
|
|
19
|
+
[Release Notes](/docs/changelog) before upgrading.
|
|
20
|
+
|
|
21
|
+
> **Warning** — always upgrade the `@zerotal/*` packages together. Mixing versions across core, ORM, and feature packages leads to type and runtime mismatches.
|
|
22
|
+
|
|
23
|
+
## Upgrade steps
|
|
24
|
+
|
|
25
|
+
1. **Bump the packages.** Update every `@zerotal/*` dependency to the target
|
|
26
|
+
version, then reinstall:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bun update # within the ranges in package.json
|
|
30
|
+
# or pin exact versions, then:
|
|
31
|
+
bun install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
2. **Review the breaking changes.** For a major release, work through its section in
|
|
35
|
+
the [Release Notes](/docs/changelog) and apply each migration note.
|
|
36
|
+
|
|
37
|
+
3. **Run migrations.** A release may add framework tables or columns:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
bun zt migrate
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
4. **Type-check and test.** The fastest way to surface breaking API changes:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
bun run typecheck
|
|
47
|
+
bun test
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
5. **Boot it.** Start the dev server and exercise the main flows:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
bun dev
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Pre-release checkout to 1.0
|
|
57
|
+
|
|
58
|
+
1.0 is the first public release, so there is no earlier published version to move
|
|
59
|
+
from. If you have been building against a pre-release checkout of the source,
|
|
60
|
+
these are the changes that need action. Full detail is in the
|
|
61
|
+
[1.0.0 release notes](/docs/changelog).
|
|
62
|
+
|
|
63
|
+
1. **Import storage from `@zerotal/core/storage`.** The separate
|
|
64
|
+
`@zerotal/storage` package is gone — file storage ships inside core, as a
|
|
65
|
+
subpath beside `core/logger` and `core/http`. Drop the dependency from
|
|
66
|
+
`package.json` and update the imports:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
// before
|
|
70
|
+
import { Storage, StorageProvider } from "@zerotal/storage";
|
|
71
|
+
// after
|
|
72
|
+
import { Storage, StorageProvider } from "zerotal/storage";
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Nothing else changes: the same `StorageProvider`, the same `config/storage.ts`,
|
|
76
|
+
the same disks and driver API.
|
|
77
|
+
|
|
78
|
+
1. **Move public files to `storage/public`.** The public disk's root changed
|
|
79
|
+
from `storage/app/public` to `storage/public`, and it is served at
|
|
80
|
+
`/storage/public` rather than `/storage`. Everything else under the storage
|
|
81
|
+
root is private: a local disk outside `storage/public` can only be served
|
|
82
|
+
with `serve: { signed: true }`, and serving one openly now fails at boot.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
mv storage/app/public storage/public
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Any hardcoded `/storage/...` link becomes `/storage/public/...`. Better, ask
|
|
89
|
+
for the URL instead: `await Storage.publicUrl(path, { disk: "public" })`.
|
|
90
|
+
|
|
91
|
+
1. **Expect logs on disk.** Every entry now goes to the terminal _and_ a
|
|
92
|
+
date-rotated file under `./storage/logs`, kept 14 days. If you ship stdout to
|
|
93
|
+
a collector and want no files, set `file: false` in `config/logging.ts`. If
|
|
94
|
+
you had a `default: "daily"` channel to get files, you can delete it — and
|
|
95
|
+
your terminal output comes back, since console is no longer a channel that
|
|
96
|
+
`default` can point away from.
|
|
97
|
+
|
|
98
|
+
1. **Add a `fillable` (or `guarded`) list to every model written from user input.**
|
|
99
|
+
Models now guard mass assignment by default — a model declaring neither rejects
|
|
100
|
+
every attribute passed to `create()`/`fill()` with a `MassAssignmentError`. For
|
|
101
|
+
trusted, non-user writes use `forceFill()`/`forceCreate()`, wrap a block in
|
|
102
|
+
`Model.withoutGuard(fn)`, or set `static unguarded = true`.
|
|
103
|
+
|
|
104
|
+
1. **Ensure `APP_KEY` is set in every environment.** `local` storage
|
|
105
|
+
`temporaryUrl()` now throws `StorageKeyMissingError` instead of falling back to a
|
|
106
|
+
hard-coded key, and a key under 32 bytes now throws at boot in production-like
|
|
107
|
+
environments (`APP_ENV` = `production`/`prod`/`staging`). Generate one with
|
|
108
|
+
`bun zt key:generate`.
|
|
109
|
+
|
|
110
|
+
1. **Update merged-package imports.** `@zerotal/lock` → `@zerotal/core/lock` and
|
|
111
|
+
`@zerotal/logger` → `@zerotal/core/logger`; remove both from `package.json`.
|
|
112
|
+
No API changes.
|
|
113
|
+
|
|
114
|
+
1. **Re-check ops-surface gates.** The devtools inspector, the monitor panel's
|
|
115
|
+
default open access, and the dev error page now key off `APP_ENV` and **fail
|
|
116
|
+
closed** — an unset or `staging` `APP_ENV` no longer exposes them. The admin
|
|
117
|
+
panel and the monitor `/metrics` endpoint are now default-deny/opt-in. Set an
|
|
118
|
+
explicit `middleware`/`auth` in `config/admin.ts` and `config/monitor.ts`, and
|
|
119
|
+
set `APP_ENV=development` locally if you relied on the previous open-in-dev
|
|
120
|
+
behaviour with an unset value.
|
|
121
|
+
|
|
122
|
+
1. **Redis cache prefix moved to `zerotal:cache:`.** If you run cache and queue on
|
|
123
|
+
the same Redis DB, `Cache.flush()` no longer deletes queued jobs. Existing cache
|
|
124
|
+
entries under the old `zerotal:` prefix are effectively invalidated on upgrade
|
|
125
|
+
(they are simply not read again) — no action needed beyond expecting a cold cache.
|
|
126
|
+
|
|
127
|
+
## 1.4 to 1.5
|
|
128
|
+
|
|
129
|
+
1. **Move query values into `route()`'s third argument.** A param that matches no
|
|
130
|
+
`:segment` used to be appended to the query string, so a typo'd param name produced
|
|
131
|
+
a wrong URL instead of an error. Params are now exact, and an unknown key throws:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
route("search", { q: "zerotal", page: 2 }); // before
|
|
135
|
+
route("search", {}, { q: "zerotal", page: 2 }); // now
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The same applies anywhere params are passed on their own — `redirect().to(name, params)`,
|
|
139
|
+
`redirectTo()`, `Url.route()`, `Uri.route()`, and Flow's `redirectRoute()`. Where those
|
|
140
|
+
need a query string, build the URL with `route()` and redirect to it.
|
|
141
|
+
|
|
142
|
+
To find them: search for `route(` calls whose second argument holds a key that is not a
|
|
143
|
+
`:segment` of that route. `bun zt route:list` prints the patterns to check against, and
|
|
144
|
+
after step 2 the type-checker finds the rest for you.
|
|
145
|
+
|
|
146
|
+
2. **Generate and commit the route types** — this is what turns the change above from a
|
|
147
|
+
runtime error into a compile error, and it is the point of the release:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
bun zt route:types # writes types/routes.generated.ts
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Commit the file. `zt dev` refreshes it on every restart; add
|
|
154
|
+
`bun zt route:types --check` to CI so it cannot go stale. Skipping this step is
|
|
155
|
+
supported — `route()` then behaves exactly as it did, minus the query-param change.
|
|
156
|
+
|
|
157
|
+
3. **Rebuild the Inertia page registry** to get typed page names and props:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
bun zt inertia:build
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Then fix what it finds. Two are worth expecting: a page whose component declares a prop
|
|
164
|
+
the controller never passes (add it, or make the prop optional), and a `defer()`/
|
|
165
|
+
`optional()` prop the component declares as required (make it `?` — it really is absent
|
|
166
|
+
on first paint). Declare any `Inertia.share()` keys of your own on the `SharedProps`
|
|
167
|
+
interface so pages that read them do not look unpassed; see
|
|
168
|
+
[Typed props](/docs/inertia/props#typed-props).
|
|
169
|
+
|
|
170
|
+
## The managed zt.ts
|
|
171
|
+
|
|
172
|
+
`zt.ts` is framework-managed — the header says _do not modify_. If a release
|
|
173
|
+
changes the CLI entry point, re-scaffold it rather than hand-editing. Because you
|
|
174
|
+
never customized it, replacing the file is safe; your app lives in `app/`,
|
|
175
|
+
`bootstrap/`, `config/`, and `routes/`.
|
|
176
|
+
|
|
177
|
+
## Things to check after a major upgrade
|
|
178
|
+
|
|
179
|
+
- **Config shapes** — a `*Config()` factory may have new or renamed fields. Your
|
|
180
|
+
editor's types will flag mismatches; re-check `config/*.ts` against the
|
|
181
|
+
[Configuration](/docs/config-system) docs.
|
|
182
|
+
- **Provider registration** — confirm any package providers you list in
|
|
183
|
+
`bootstrap/providers.ts` still export the same names.
|
|
184
|
+
- **Deprecations** — a minor release may log deprecation warnings for APIs removed in
|
|
185
|
+
the next major. Resolve them before taking the major.
|
|
186
|
+
- **Lockfile** — commit the updated `bun.lock` so deploys install the same versions.
|
|
187
|
+
|
|
188
|
+
## Next steps
|
|
189
|
+
|
|
190
|
+
- [Release Notes](/docs/changelog) — per-version changes and migration notes.
|
|
191
|
+
- [Configuration](/docs/config-system) — config factories whose shapes may change.
|
|
192
|
+
- [Getting Started](/docs/getting-started) — the baseline project layout.
|