@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.
Files changed (160) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +21 -0
  3. package/README.md +67 -0
  4. package/api-surface.md +283 -0
  5. package/docs/about.md +676 -0
  6. package/docs/admin/actions.md +183 -0
  7. package/docs/admin/auth.md +89 -0
  8. package/docs/admin/dashboard.md +155 -0
  9. package/docs/admin/extending-ui.md +229 -0
  10. package/docs/admin/extending.md +205 -0
  11. package/docs/admin/forms.md +155 -0
  12. package/docs/admin/index.md +144 -0
  13. package/docs/admin/operations.md +224 -0
  14. package/docs/admin/references.md +174 -0
  15. package/docs/admin/resources.md +132 -0
  16. package/docs/admin/structure.md +158 -0
  17. package/docs/admin/tables.md +185 -0
  18. package/docs/admin/testing.md +138 -0
  19. package/docs/ai.md +373 -0
  20. package/docs/application.md +435 -0
  21. package/docs/arch.md +263 -0
  22. package/docs/assets.md +755 -0
  23. package/docs/audit.md +367 -0
  24. package/docs/authentication.md +1000 -0
  25. package/docs/authorization.md +529 -0
  26. package/docs/broadcasting/channels.md +170 -0
  27. package/docs/broadcasting/client.md +108 -0
  28. package/docs/broadcasting/events.md +190 -0
  29. package/docs/broadcasting/index.md +163 -0
  30. package/docs/broadcasting/references.md +84 -0
  31. package/docs/broadcasting/testing.md +132 -0
  32. package/docs/cache.md +387 -0
  33. package/docs/carbon.md +830 -0
  34. package/docs/changelog.md +465 -0
  35. package/docs/client/auth.md +113 -0
  36. package/docs/client/errors.md +139 -0
  37. package/docs/client/files.md +118 -0
  38. package/docs/client/index.md +128 -0
  39. package/docs/client/references.md +58 -0
  40. package/docs/client/requests.md +131 -0
  41. package/docs/client/resilience.md +141 -0
  42. package/docs/client/testing.md +146 -0
  43. package/docs/commands.md +450 -0
  44. package/docs/components.md +2427 -0
  45. package/docs/config-system.md +258 -0
  46. package/docs/container.md +596 -0
  47. package/docs/context.md +579 -0
  48. package/docs/contributing.md +164 -0
  49. package/docs/controllers.md +354 -0
  50. package/docs/conventions.md +466 -0
  51. package/docs/cookies.md +101 -0
  52. package/docs/csrf.md +206 -0
  53. package/docs/database.md +476 -0
  54. package/docs/deployment.md +434 -0
  55. package/docs/devtools.md +1013 -0
  56. package/docs/email-verification.md +320 -0
  57. package/docs/encryption.md +380 -0
  58. package/docs/errors.md +317 -0
  59. package/docs/events.md +420 -0
  60. package/docs/flow/components.md +846 -0
  61. package/docs/flow/decorators.md +458 -0
  62. package/docs/flow/events.md +420 -0
  63. package/docs/flow/forms.md +551 -0
  64. package/docs/flow/index.md +568 -0
  65. package/docs/flow/layouts.md +793 -0
  66. package/docs/flow/lifecycle.md +336 -0
  67. package/docs/flow/pagination.md +402 -0
  68. package/docs/flow/performance.md +262 -0
  69. package/docs/flow/references.md +317 -0
  70. package/docs/flow/routing.md +550 -0
  71. package/docs/flow/testing.md +447 -0
  72. package/docs/getting-started.md +286 -0
  73. package/docs/health.md +269 -0
  74. package/docs/helpers.md +423 -0
  75. package/docs/i18n.md +414 -0
  76. package/docs/index.md +65 -0
  77. package/docs/inertia/build.md +95 -0
  78. package/docs/inertia/devtools.md +197 -0
  79. package/docs/inertia/index.md +267 -0
  80. package/docs/inertia/middleware.md +81 -0
  81. package/docs/inertia/props.md +507 -0
  82. package/docs/inertia/references.md +144 -0
  83. package/docs/inertia/rendering.md +189 -0
  84. package/docs/inertia/ssr.md +102 -0
  85. package/docs/inspirations.md +257 -0
  86. package/docs/lifecycle.md +331 -0
  87. package/docs/lock.md +454 -0
  88. package/docs/logger.md +517 -0
  89. package/docs/media.md +582 -0
  90. package/docs/middleware.md +509 -0
  91. package/docs/migrations.md +529 -0
  92. package/docs/monitor.md +377 -0
  93. package/docs/notifications.md +848 -0
  94. package/docs/orm/casts.md +365 -0
  95. package/docs/orm/factories.md +231 -0
  96. package/docs/orm/index.md +663 -0
  97. package/docs/orm/lifecycle.md +421 -0
  98. package/docs/orm/queries.md +692 -0
  99. package/docs/orm/relationships.md +440 -0
  100. package/docs/orm/serialization.md +251 -0
  101. package/docs/package-development.md +536 -0
  102. package/docs/pagination.md +340 -0
  103. package/docs/password-reset.md +335 -0
  104. package/docs/providers.md +447 -0
  105. package/docs/query-builder.md +465 -0
  106. package/docs/queue.md +549 -0
  107. package/docs/rate-limiting.md +253 -0
  108. package/docs/responses.md +336 -0
  109. package/docs/roles-and-2fa.md +418 -0
  110. package/docs/routing.md +1008 -0
  111. package/docs/scaffolding.md +335 -0
  112. package/docs/scheduler.md +533 -0
  113. package/docs/seeding.md +229 -0
  114. package/docs/session.md +451 -0
  115. package/docs/social.md +524 -0
  116. package/docs/storage.md +622 -0
  117. package/docs/structure.md +230 -0
  118. package/docs/support-policy.md +114 -0
  119. package/docs/telemetry.md +505 -0
  120. package/docs/tenancy.md +608 -0
  121. package/docs/testing/browser.md +153 -0
  122. package/docs/testing/console.md +130 -0
  123. package/docs/testing/database.md +238 -0
  124. package/docs/testing/flow-browser.md +216 -0
  125. package/docs/testing/http.md +441 -0
  126. package/docs/testing/index.md +240 -0
  127. package/docs/testing/mocking.md +410 -0
  128. package/docs/upgrade.md +192 -0
  129. package/docs/validator.md +549 -0
  130. package/docs/view.md +453 -0
  131. package/package.json +60 -0
  132. package/src/bin/mcp.ts +73 -0
  133. package/src/config.ts +63 -0
  134. package/src/errors.ts +27 -0
  135. package/src/index.ts +56 -0
  136. package/src/install/ArchInstallCommand.ts +189 -0
  137. package/src/install/detect.ts +98 -0
  138. package/src/install/guidelines.ts +290 -0
  139. package/src/install/markers.ts +77 -0
  140. package/src/install/mcpConfig.ts +81 -0
  141. package/src/mcp/index.ts +27 -0
  142. package/src/mcp/jsonrpc.ts +133 -0
  143. package/src/mcp/server.ts +307 -0
  144. package/src/mcp/stdio.ts +111 -0
  145. package/src/mcp/types.ts +146 -0
  146. package/src/probe/ArchProbeCommand.ts +48 -0
  147. package/src/probe/sentinel.ts +13 -0
  148. package/src/probe/topics.ts +291 -0
  149. package/src/provider/ArchProvider.ts +101 -0
  150. package/src/tools/_probe.ts +164 -0
  151. package/src/tools/apiSurface.ts +241 -0
  152. package/src/tools/appInfo.ts +88 -0
  153. package/src/tools/baselines.ts +210 -0
  154. package/src/tools/context.ts +37 -0
  155. package/src/tools/doctor.ts +93 -0
  156. package/src/tools/index.ts +50 -0
  157. package/src/tools/logs.ts +265 -0
  158. package/src/tools/routes.ts +133 -0
  159. package/src/tools/schema.ts +119 -0
  160. package/src/tools/searchDocs.ts +345 -0
@@ -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.