@terreno/mcp 57.21.0 → 58.0.0-beta.1
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 +43 -0
- package/README.md +57 -3
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +17 -16
- package/dist/bootstrap.js.map +1 -1
- package/dist/docs/guidelines/admin-frontend/guidelines/core.md +6 -5
- package/dist/docs/guidelines/ui/guidelines/core.md +1 -1
- package/dist/docs/prompts/debug.md +6 -4
- package/dist/docs/prompts/screen.md +11 -17
- package/dist/docs/resources/overview.md +5 -3
- package/dist/docs/resources/patterns.md +157 -238
- package/dist/docs/resources/syncdb.md +44 -16
- package/dist/docs/templates/bootstrap/CLAUDE.template.md +2 -2
- package/dist/docs/templates/bootstrap/cursorrules.template.md +7 -5
- package/dist/docs/templates/bootstrap/frontend/app/(tabs)/profile.template.tsx +8 -12
- package/dist/docs/templates/bootstrap/frontend/app/_layout.template.tsx +75 -52
- package/dist/docs/templates/bootstrap/frontend/app/login.template.tsx +46 -108
- package/dist/docs/templates/bootstrap/frontend/app/signup.template.tsx +53 -0
- package/dist/docs/templates/bootstrap/frontend/lib/betterAuth.template.md +18 -0
- package/dist/docs/templates/bootstrap/frontend/store/apiClient.template.md +33 -0
- package/dist/docs/templates/bootstrap/frontend/store/apiSdk.template.md +76 -0
- package/dist/docs/templates/bootstrap/frontend/store/syncdb.template.md +56 -0
- package/dist/docs/templates/bootstrap/frontend/utils/index.template.md +0 -4
- package/dist/docs/upgrades/58.0.0-beta.1.md +504 -0
- package/dist/docs/upgrades/58.0.0.md +495 -4
- package/dist/docs/versioned/next/README.md +2 -2
- package/dist/docs/versioned/next/approval-rubric.md +2 -2
- package/dist/docs/versioned/next/explanation/admin-interface.md +6 -5
- package/dist/docs/versioned/next/explanation/admin-plugin-frontend.md +1 -1
- package/dist/docs/versioned/next/explanation/ai-workflows.md +5 -3
- package/dist/docs/versioned/next/explanation/announcements/rtk-deprecation.md +16 -11
- package/dist/docs/versioned/next/explanation/authentication.md +62 -43
- package/dist/docs/versioned/next/explanation/dependency-management.md +1 -1
- package/dist/docs/versioned/next/explanation/deployment-baseline.md +1 -1
- package/dist/docs/versioned/next/explanation/example-coverage.md +2 -2
- package/dist/docs/versioned/next/explanation/explicit-any-policy.md +5 -6
- package/dist/docs/versioned/next/explanation/gcp-hosting-architecture.md +1 -1
- package/dist/docs/versioned/next/explanation/local-first-data.md +11 -9
- package/dist/docs/versioned/next/explanation/model-router-actions.md +1 -1
- package/dist/docs/versioned/next/explanation/modular-api-design.md +2 -2
- package/dist/docs/versioned/next/explanation/no-barrel-imports.md +5 -5
- package/dist/docs/versioned/next/explanation/roadmap-seed-issues.md +4 -3
- package/dist/docs/versioned/next/explanation/source-rules.md +2 -2
- package/dist/docs/versioned/next/explanation/typescript-configuration.md +2 -4
- package/dist/docs/versioned/next/explanation/versioning-policy.md +3 -3
- package/dist/docs/versioned/next/how-to/README.md +3 -2
- package/dist/docs/versioned/next/how-to/add-feature-flags.md +50 -25
- package/dist/docs/versioned/next/how-to/add-organizations.md +2 -1
- package/dist/docs/versioned/next/how-to/admin-custom-home.md +8 -2
- package/dist/docs/versioned/next/how-to/admin-custom-widget.md +0 -1
- package/dist/docs/versioned/next/how-to/agent-ui-asks.md +6 -6
- package/dist/docs/versioned/next/how-to/build-admin-screens.md +10 -8
- package/dist/docs/versioned/next/how-to/build-for-web.md +1 -1
- package/dist/docs/versioned/next/how-to/call-external-apis.md +2 -2
- package/dist/docs/versioned/next/how-to/circleci.md +12 -6
- package/dist/docs/versioned/next/how-to/configure-better-auth.md +114 -60
- package/dist/docs/versioned/next/how-to/connect-mcp-service-token.md +10 -4
- package/dist/docs/versioned/next/how-to/create-a-terreno-app.md +14 -2
- package/dist/docs/versioned/next/how-to/debug-with-mcp.md +8 -13
- package/dist/docs/versioned/next/how-to/expose-mcp-tools.md +15 -4
- package/dist/docs/versioned/next/how-to/generate-the-client-sdk.md +33 -0
- package/dist/docs/versioned/next/how-to/github-actions-ci.md +2 -2
- package/dist/docs/versioned/next/how-to/in-app-notifications.md +1 -1
- package/dist/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +318 -447
- package/dist/docs/versioned/next/how-to/password-reset.md +1 -1
- package/dist/docs/versioned/next/how-to/product-announcements.md +6 -3
- package/dist/docs/versioned/next/how-to/rate-limiting.md +38 -16
- package/dist/docs/versioned/next/how-to/run-mongodb-migrations.md +19 -0
- package/dist/docs/versioned/next/how-to/run-tests-locally.md +2 -3
- package/dist/docs/versioned/next/how-to/set-up-social-login.md +1 -1
- package/dist/docs/versioned/next/how-to/set-up-terreno-mcp.md +2 -2
- package/dist/docs/versioned/next/how-to/track-upstream-expo.md +1 -1
- package/dist/docs/versioned/next/how-to/upgrade-banner.md +5 -3
- package/dist/docs/versioned/next/how-to/upgrade-terreno.md +5 -5
- package/dist/docs/versioned/next/how-to/use-syncdb-correctly.md +1 -1
- package/dist/docs/versioned/next/how-to/websocket-integration.md +113 -402
- package/dist/docs/versioned/next/implementationPlans/b2b-platform-program.md +1 -1
- package/dist/docs/versioned/next/implementationPlans/migrate-admin-to-syncdb.md +5 -0
- package/dist/docs/versioned/next/implementationPlans/native-module-baseline.md +29 -5
- package/dist/docs/versioned/next/implementationPlans/remove-legacy-realtime.md +1 -1
- package/dist/docs/versioned/next/implementationPlans/remove-rtk.md +185 -0
- package/dist/docs/versioned/next/reference/README.md +1 -1
- package/dist/docs/versioned/next/reference/admin-frontend.md +85 -70
- package/dist/docs/versioned/next/reference/admin-spa.md +10 -4
- package/dist/docs/versioned/next/reference/ai.md +36 -4
- package/dist/docs/versioned/next/reference/announcements.md +3 -3
- package/dist/docs/versioned/next/reference/api.md +39 -24
- package/dist/docs/versioned/next/reference/cli.md +3 -4
- package/dist/docs/versioned/next/reference/environment-variables.md +16 -16
- package/dist/docs/versioned/next/reference/feature-flags.md +48 -7
- package/dist/docs/versioned/next/reference/jobs.md +2 -2
- package/dist/docs/versioned/next/reference/legacy/rtk.md +25 -600
- package/dist/docs/versioned/next/reference/mcp-server.md +441 -1158
- package/dist/docs/versioned/next/reference/syncdb.md +426 -16
- package/dist/docs/versioned/next/reference/test.md +28 -3
- package/dist/docs/versioned/next/reference/ui.md +132 -19
- package/dist/docs/versioned/next/tasks/native-module-baseline.md +8 -4
- package/dist/docs/versioned/next/tasks/rate-limiting.md +9 -2
- package/dist/docs/versioned/next/tasks/remove-legacy-realtime.md +5 -5
- package/dist/docs/versioned/next/tasks/remove-rtk.md +155 -0
- package/dist/local/localTools.d.ts.map +1 -1
- package/dist/local/localTools.js +3 -54
- package/dist/local/localTools.js.map +1 -1
- package/dist/local/tools/runtime.d.ts +0 -21
- package/dist/local/tools/runtime.d.ts.map +1 -1
- package/dist/local/tools/runtime.js +0 -176
- package/dist/local/tools/runtime.js.map +1 -1
- package/dist/local/tools/syncDb.d.ts +0 -11
- package/dist/local/tools/syncDb.d.ts.map +1 -1
- package/dist/local/tools/syncDb.js +1 -5
- package/dist/local/tools/syncDb.js.map +1 -1
- package/dist/packageGuidelines.d.ts +3 -2
- package/dist/packageGuidelines.d.ts.map +1 -1
- package/dist/packageGuidelines.js +4 -11
- package/dist/packageGuidelines.js.map +1 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +17 -18
- package/dist/prompts.js.map +1 -1
- package/dist/resources.d.ts.map +1 -1
- package/dist/resources.js +1 -8
- package/dist/resources.js.map +1 -1
- package/dist/search/chunker.d.ts +1 -1
- package/dist/search/chunker.d.ts.map +1 -1
- package/dist/search/inferPackages.d.ts +1 -1
- package/dist/search/inferPackages.js +5 -5
- package/dist/search/inferPackages.js.map +1 -1
- package/dist/tools.d.ts +6 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +126 -119
- package/dist/tools.js.map +1 -1
- package/package.json +6 -6
- package/src/docs/guidelines/admin-frontend/guidelines/core.md +6 -5
- package/src/docs/guidelines/ui/guidelines/core.md +1 -1
- package/src/docs/prompts/debug.md +6 -4
- package/src/docs/prompts/screen.md +11 -17
- package/src/docs/resources/overview.md +5 -3
- package/src/docs/resources/patterns.md +157 -238
- package/src/docs/resources/syncdb.md +44 -16
- package/src/docs/templates/bootstrap/CLAUDE.template.md +2 -2
- package/src/docs/templates/bootstrap/cursorrules.template.md +7 -5
- package/src/docs/templates/bootstrap/frontend/app/(tabs)/profile.template.tsx +8 -12
- package/src/docs/templates/bootstrap/frontend/app/_layout.template.tsx +75 -52
- package/src/docs/templates/bootstrap/frontend/app/login.template.tsx +46 -108
- package/src/docs/templates/bootstrap/frontend/app/signup.template.tsx +53 -0
- package/src/docs/templates/bootstrap/frontend/lib/betterAuth.template.md +18 -0
- package/src/docs/templates/bootstrap/frontend/store/apiClient.template.md +33 -0
- package/src/docs/templates/bootstrap/frontend/store/apiSdk.template.md +76 -0
- package/src/docs/templates/bootstrap/frontend/store/syncdb.template.md +56 -0
- package/src/docs/templates/bootstrap/frontend/utils/index.template.md +0 -4
- package/src/docs/upgrades/58.0.0-beta.1.md +504 -0
- package/src/docs/upgrades/58.0.0.md +495 -4
- package/src/docs/versioned/next/README.md +2 -2
- package/src/docs/versioned/next/approval-rubric.md +2 -2
- package/src/docs/versioned/next/explanation/admin-interface.md +6 -5
- package/src/docs/versioned/next/explanation/admin-plugin-frontend.md +1 -1
- package/src/docs/versioned/next/explanation/ai-workflows.md +5 -3
- package/src/docs/versioned/next/explanation/announcements/rtk-deprecation.md +16 -11
- package/src/docs/versioned/next/explanation/authentication.md +62 -43
- package/src/docs/versioned/next/explanation/dependency-management.md +1 -1
- package/src/docs/versioned/next/explanation/deployment-baseline.md +1 -1
- package/src/docs/versioned/next/explanation/example-coverage.md +2 -2
- package/src/docs/versioned/next/explanation/explicit-any-policy.md +5 -6
- package/src/docs/versioned/next/explanation/gcp-hosting-architecture.md +1 -1
- package/src/docs/versioned/next/explanation/local-first-data.md +11 -9
- package/src/docs/versioned/next/explanation/model-router-actions.md +1 -1
- package/src/docs/versioned/next/explanation/modular-api-design.md +2 -2
- package/src/docs/versioned/next/explanation/no-barrel-imports.md +5 -5
- package/src/docs/versioned/next/explanation/roadmap-seed-issues.md +4 -3
- package/src/docs/versioned/next/explanation/source-rules.md +2 -2
- package/src/docs/versioned/next/explanation/typescript-configuration.md +2 -4
- package/src/docs/versioned/next/explanation/versioning-policy.md +3 -3
- package/src/docs/versioned/next/how-to/README.md +3 -2
- package/src/docs/versioned/next/how-to/add-feature-flags.md +50 -25
- package/src/docs/versioned/next/how-to/add-organizations.md +2 -1
- package/src/docs/versioned/next/how-to/admin-custom-home.md +8 -2
- package/src/docs/versioned/next/how-to/admin-custom-widget.md +0 -1
- package/src/docs/versioned/next/how-to/agent-ui-asks.md +6 -6
- package/src/docs/versioned/next/how-to/build-admin-screens.md +10 -8
- package/src/docs/versioned/next/how-to/build-for-web.md +1 -1
- package/src/docs/versioned/next/how-to/call-external-apis.md +2 -2
- package/src/docs/versioned/next/how-to/circleci.md +12 -6
- package/src/docs/versioned/next/how-to/configure-better-auth.md +114 -60
- package/src/docs/versioned/next/how-to/connect-mcp-service-token.md +10 -4
- package/src/docs/versioned/next/how-to/create-a-terreno-app.md +14 -2
- package/src/docs/versioned/next/how-to/debug-with-mcp.md +8 -13
- package/src/docs/versioned/next/how-to/expose-mcp-tools.md +15 -4
- package/src/docs/versioned/next/how-to/generate-the-client-sdk.md +33 -0
- package/src/docs/versioned/next/how-to/github-actions-ci.md +2 -2
- package/src/docs/versioned/next/how-to/in-app-notifications.md +1 -1
- package/src/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +318 -447
- package/src/docs/versioned/next/how-to/password-reset.md +1 -1
- package/src/docs/versioned/next/how-to/product-announcements.md +6 -3
- package/src/docs/versioned/next/how-to/rate-limiting.md +38 -16
- package/src/docs/versioned/next/how-to/run-mongodb-migrations.md +19 -0
- package/src/docs/versioned/next/how-to/run-tests-locally.md +2 -3
- package/src/docs/versioned/next/how-to/set-up-social-login.md +1 -1
- package/src/docs/versioned/next/how-to/set-up-terreno-mcp.md +2 -2
- package/src/docs/versioned/next/how-to/track-upstream-expo.md +1 -1
- package/src/docs/versioned/next/how-to/upgrade-banner.md +5 -3
- package/src/docs/versioned/next/how-to/upgrade-terreno.md +5 -5
- package/src/docs/versioned/next/how-to/use-syncdb-correctly.md +1 -1
- package/src/docs/versioned/next/how-to/websocket-integration.md +113 -402
- package/src/docs/versioned/next/implementationPlans/b2b-platform-program.md +1 -1
- package/src/docs/versioned/next/implementationPlans/migrate-admin-to-syncdb.md +5 -0
- package/src/docs/versioned/next/implementationPlans/native-module-baseline.md +29 -5
- package/src/docs/versioned/next/implementationPlans/remove-legacy-realtime.md +1 -1
- package/src/docs/versioned/next/implementationPlans/remove-rtk.md +185 -0
- package/src/docs/versioned/next/reference/README.md +1 -1
- package/src/docs/versioned/next/reference/admin-frontend.md +85 -70
- package/src/docs/versioned/next/reference/admin-spa.md +10 -4
- package/src/docs/versioned/next/reference/ai.md +36 -4
- package/src/docs/versioned/next/reference/announcements.md +3 -3
- package/src/docs/versioned/next/reference/api.md +39 -24
- package/src/docs/versioned/next/reference/cli.md +3 -4
- package/src/docs/versioned/next/reference/environment-variables.md +16 -16
- package/src/docs/versioned/next/reference/feature-flags.md +48 -7
- package/src/docs/versioned/next/reference/jobs.md +2 -2
- package/src/docs/versioned/next/reference/legacy/rtk.md +25 -600
- package/src/docs/versioned/next/reference/mcp-server.md +441 -1158
- package/src/docs/versioned/next/reference/syncdb.md +426 -16
- package/src/docs/versioned/next/reference/test.md +28 -3
- package/src/docs/versioned/next/reference/ui.md +132 -19
- package/src/docs/versioned/next/tasks/native-module-baseline.md +8 -4
- package/src/docs/versioned/next/tasks/rate-limiting.md +9 -2
- package/src/docs/versioned/next/tasks/remove-legacy-realtime.md +5 -5
- package/src/docs/versioned/next/tasks/remove-rtk.md +155 -0
- package/dist/docs/guidelines/rtk/guidelines/core.md +0 -26
- package/dist/docs/resources/rtk.md +0 -181
- package/dist/docs/templates/bootstrap/frontend/openapi-config.template.md +0 -16
- package/dist/docs/templates/bootstrap/frontend/scripts/generate-sdk.template.md +0 -49
- package/dist/docs/templates/bootstrap/frontend/store/appState.template.md +0 -45
- package/dist/docs/templates/bootstrap/frontend/store/errors.template.md +0 -51
- package/dist/docs/templates/bootstrap/frontend/store/index.template.md +0 -86
- package/dist/docs/templates/bootstrap/frontend/store/openApiSdk.template.md +0 -49
- package/dist/docs/templates/bootstrap/frontend/store/sdk.template.md +0 -80
- package/src/docs/guidelines/rtk/guidelines/core.md +0 -26
- package/src/docs/resources/rtk.md +0 -181
- package/src/docs/templates/bootstrap/frontend/openapi-config.template.md +0 -16
- package/src/docs/templates/bootstrap/frontend/scripts/generate-sdk.template.md +0 -49
- package/src/docs/templates/bootstrap/frontend/store/appState.template.md +0 -45
- package/src/docs/templates/bootstrap/frontend/store/errors.template.md +0 -51
- package/src/docs/templates/bootstrap/frontend/store/index.template.md +0 -86
- package/src/docs/templates/bootstrap/frontend/store/openApiSdk.template.md +0 -49
- package/src/docs/templates/bootstrap/frontend/store/sdk.template.md +0 -80
|
@@ -69,7 +69,7 @@ On `BetterAuthConfig` set the same `publicAppUrl`, `sendMail`, and `renderAuthMa
|
|
|
69
69
|
|
|
70
70
|
1. Pass `onForgotPassword` (or `onForgotPasswordPress`) to `LoginScreen`.
|
|
71
71
|
2. Add `/forgotPassword` (email form) and `/resetPassword` that reads `token` from the query string.
|
|
72
|
-
3. On Better Auth apps, request reset with `authClient.requestPasswordReset` and submit with `authClient.resetPassword({newPassword, token})`. JWT apps
|
|
72
|
+
3. On Better Auth apps, request reset with `authClient.requestPasswordReset` and submit with `authClient.resetPassword({newPassword, token})`. JWT apps call `POST /auth/forgotPassword` and `POST /resetPassword` through the generated `usePostAuthForgotPasswordMutation` / `usePostResetPasswordMutation` hooks (`store/apiSdk.ts`), or `useJwtAuth().resetPassword` from `@terreno/syncdb/auth`. The example app falls back to the JWT request or reset route when Better Auth rejects the operation, so either auth mode can complete.
|
|
73
73
|
4. Show a profile banner when `emailVerified` is false, with Resend calling `POST /auth/sendVerification`.
|
|
74
74
|
5. Add `/verifyEmail` that reads `token` from the query string. JWT apps call `POST /auth/verifyEmail`. Better Auth apps try `GET /verify-email?token=...` first, then the JWT route so either token type can complete.
|
|
75
75
|
|
|
@@ -64,7 +64,7 @@ For release-driven batches, use an [announcement release pack](../reference/anno
|
|
|
64
64
|
|
|
65
65
|
### Admin overview
|
|
66
66
|
|
|
67
|
-
`AnnouncementOverview` calls `GET /announcements/overview` (
|
|
67
|
+
`AnnouncementOverview` calls `GET /announcements/overview` (through the `AdminProvider` fetch client) and shows:
|
|
68
68
|
|
|
69
69
|
- Launch workflow guidance (draft → targeting → preview → publish) with a primary **Create announcement** action
|
|
70
70
|
- Summary cards for published, drafts, impressions, acknowledgements, and CTA clicks
|
|
@@ -87,12 +87,15 @@ Wrap authenticated app content:
|
|
|
87
87
|
|
|
88
88
|
```tsx
|
|
89
89
|
import {AnnouncementNavigator} from "@terreno/ui";
|
|
90
|
+
import {apiClient} from "@/store/apiClient"; // @terreno/syncdb/api createApiClient(...)
|
|
90
91
|
|
|
91
|
-
<AnnouncementNavigator
|
|
92
|
+
<AnnouncementNavigator client={apiClient}>
|
|
92
93
|
<AppTabs />
|
|
93
94
|
</AnnouncementNavigator>
|
|
94
95
|
```
|
|
95
96
|
|
|
97
|
+
`client` is the app's request client (see [`TerrenoRequestClient`](../reference/ui.md#terrenorequestclient)); the RTK `api` prop was removed in Terreno 58.
|
|
98
|
+
|
|
96
99
|
Place it after consent/onboarding wrappers if you use `ConsentNavigator`. The navigator sends the native platform (`ios` / `android` / `web`) and, when available, the app build number from `Constants.expoConfig.extra.buildNumber` (same source as `useUpgradeCheck`) on pending and feed requests. Only pending failures block the app — changelog feed errors are non-fatal. These surfaces are not in the `@terreno/ui` component demo; wire them in the app (`example-frontend`) the same way.
|
|
97
100
|
|
|
98
101
|
## Modal vs banner
|
|
@@ -120,7 +123,7 @@ Interrupt frequency is enforced **client-side** in `AnnouncementNavigator` befor
|
|
|
120
123
|
|
|
121
124
|
```tsx
|
|
122
125
|
<AnnouncementNavigator
|
|
123
|
-
|
|
126
|
+
client={apiClient}
|
|
124
127
|
frequency={{
|
|
125
128
|
cooldownHours: 24,
|
|
126
129
|
skipFirstLaunch: false,
|
|
@@ -1,37 +1,62 @@
|
|
|
1
1
|
# Rate limiting
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`TerrenoApp` turns on HTTP rate limiting by default (Terreno 58 and later). Omitting `rateLimit` mounts the limiter with the memory store and the default limits. The framework does **not** read `RATE_LIMIT_ENABLED`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Default (memory)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```typescript
|
|
8
|
+
new TerrenoApp({userModel: User});
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
That is the same as `rateLimit: {}` or `rateLimit: {store: "memory"}`: auth 20 / 15 min, api 600 / 15 min, one bucket per Node process.
|
|
12
|
+
|
|
13
|
+
## Cloud Run
|
|
14
|
+
|
|
15
|
+
Cloud Run sits behind one Google Front End hop. Without `trustProxy`, every unauthenticated request shares the front end's address, so all users share one auth bucket (20 logins per 15 minutes for the whole service). Pass `trustProxy: 1`:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
new TerrenoApp({
|
|
19
|
+
userModel: User,
|
|
20
|
+
rateLimit: {trustProxy: 1},
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The limiter sets Express `trust proxy` from `rateLimit.trustProxy` when it mounts. Set it there, not with `app.set("trust proxy", …)` before `build()`.
|
|
8
25
|
|
|
9
|
-
|
|
26
|
+
## Turn it off
|
|
10
27
|
|
|
11
|
-
|
|
28
|
+
Pass `false`:
|
|
12
29
|
|
|
13
30
|
```typescript
|
|
14
31
|
new TerrenoApp({
|
|
15
32
|
userModel: User,
|
|
16
|
-
rateLimit:
|
|
33
|
+
rateLimit: false,
|
|
17
34
|
});
|
|
18
35
|
```
|
|
19
36
|
|
|
20
|
-
|
|
37
|
+
Apps that want an env toggle own it:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
new TerrenoApp({
|
|
41
|
+
userModel: User,
|
|
42
|
+
rateLimit: process.env.RATE_LIMIT_DISABLED === "true" ? false : {trustProxy: 1},
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Tests
|
|
47
|
+
|
|
48
|
+
Each `build()` creates a fresh memory store, so most suites never reach a limit. A suite that logs in more than 20 times or sends more than 600 requests against one app instance should pass `rateLimit: false` in its shared app helper, or raise `limits`.
|
|
21
49
|
|
|
22
50
|
## Redis on Cloud Run
|
|
23
51
|
|
|
24
52
|
1. Add a Valkey or Redis instance (Memorystore or equivalent).
|
|
25
53
|
2. Set `VALKEY_URL` (preferred) or `REDIS_URL` on the Cloud Run service. Same URL as realtime Redis.
|
|
26
|
-
3. Pass `store: "redis"
|
|
54
|
+
3. Pass `store: "redis"`:
|
|
27
55
|
|
|
28
56
|
```typescript
|
|
29
57
|
new TerrenoApp({
|
|
30
58
|
userModel: User,
|
|
31
|
-
rateLimit:
|
|
32
|
-
process.env.RATE_LIMIT_ENABLED === "true"
|
|
33
|
-
? {store: "redis", trustProxy: 1}
|
|
34
|
-
: undefined,
|
|
59
|
+
rateLimit: {store: "redis", trustProxy: 1},
|
|
35
60
|
});
|
|
36
61
|
```
|
|
37
62
|
|
|
@@ -50,7 +75,7 @@ new TerrenoApp({
|
|
|
50
75
|
|
|
51
76
|
Pass `{store: "mongo"}`. Hits live in `rateLimitHits` on the same mongoose connection as the app. A TTL index on `expiresAt` expires windows. This collection is not a `modelRouter` resource.
|
|
52
77
|
|
|
53
|
-
Unauthenticated keys use `req.ip`. Express `trust proxy` defaults to **off** so a client cannot rotate `X-Forwarded-For` to bypass the auth bucket. On Cloud Run (one hop via GFE), pass `trustProxy: 1
|
|
78
|
+
Unauthenticated keys use `req.ip`. Express `trust proxy` defaults to **off** so a client cannot rotate `X-Forwarded-For` to bypass the auth bucket. On Cloud Run (one hop via GFE), pass `trustProxy: 1` (see [Cloud Run](#cloud-run)). Extra proxies: hop count or a subnet list. `trustProxy: false` is the same as the default.
|
|
54
79
|
|
|
55
80
|
## Limit one route
|
|
56
81
|
|
|
@@ -90,6 +115,3 @@ JWT login/signup/refresh and password-reset paths skip access-token verification
|
|
|
90
115
|
Auth-bucket keys are always the client IP, even if a Better Auth session already set `req.user`. API traffic still keys by user when authenticated.
|
|
91
116
|
|
|
92
117
|
When `BetterAuthApp` is registered, TerrenoApp copies its `config.basePath` into the limiter unless you set `rateLimit.betterAuthBasePath`.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
@@ -30,6 +30,25 @@ export const down = async ({dryRun, mongoose}): Promise<void> => {
|
|
|
30
30
|
};
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
## Framework migrations
|
|
34
|
+
|
|
35
|
+
Some Terreno releases ship a data migration in a package. Wire it in with a one-line wrapper file, so it runs, dry-runs, and records history like your own files:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// migrations/20261022120000-mcp-service-token-string-ids.ts
|
|
39
|
+
import {mcpServiceTokenStringIdsMigration} from "@terreno/api";
|
|
40
|
+
|
|
41
|
+
export const id = "20261022120000-mcp-service-token-string-ids";
|
|
42
|
+
export const up = mcpServiceTokenStringIdsMigration.up;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
| Package | Export | Since | What it does |
|
|
46
|
+
| --- | --- | --- | --- |
|
|
47
|
+
| `@terreno/api` | `mcpServiceTokenStringIdsMigration` | 58.0.0 | Re-keys ObjectId `McpServiceToken` rows to hex-string `_id`s. Idempotent; no `down`. |
|
|
48
|
+
| `@terreno/ai` | `gptHistoryStringIdsMigration` | 58.0.0 | Re-keys ObjectId `GptHistory` rows to hex-string `_id`s and rewrites `AIDataset.historyId`. Idempotent; no `down`. |
|
|
49
|
+
|
|
50
|
+
The upgrade note for each release says which framework migrations to add.
|
|
51
|
+
|
|
33
52
|
## First apply
|
|
34
53
|
|
|
35
54
|
1. Generate a draft from the current models vs the last `schemaAfter` snapshot:
|
|
@@ -21,7 +21,7 @@ with `origin/master`. It applies the CircleCI path-filter mapping in
|
|
|
21
21
|
`.circleci/config.yml`, then runs the local command for each triggered job: package
|
|
22
22
|
`test:coverage` plus the 90% new-file LCOV gate, `ui` types, demo typecheck,
|
|
23
23
|
example-backend and example-frontend tests, every `repo-policies` step, rulesync drift,
|
|
24
|
-
and the typedoc API reference when `api/src`
|
|
24
|
+
and the typedoc API reference when `api/src` changes. Every step runs even
|
|
25
25
|
after a failure, so a single pass lists every problem. Fix them all, then push once.
|
|
26
26
|
|
|
27
27
|
Jobs that need infrastructure (Playwright e2e, Maestro, admin-spa integration, Docker)
|
|
@@ -64,7 +64,6 @@ bun test --only-failures <path>
|
|
|
64
64
|
| `ai-ci` | `cd ai && bun run test:ci` |
|
|
65
65
|
| `blocks-ci` | `bun run blocks:test` |
|
|
66
66
|
| `ui-ci` | `bun run ui:test` |
|
|
67
|
-
| `rtk-ci` | `bun run rtk:test` |
|
|
68
67
|
| `syncdb-ci` | `bun run syncdb:test` |
|
|
69
68
|
| `comms-ci` | `bun run comms:test` |
|
|
70
69
|
| `jobs-ci` / jobs package | `bun run jobs:test` |
|
|
@@ -124,7 +123,7 @@ MONGO_URI="mongodb://127.0.0.1:27017/terreno-e2e?replicaSet=rs0" \
|
|
|
124
123
|
| CircleCI shard | Specs |
|
|
125
124
|
| --- | --- |
|
|
126
125
|
| `e2e` `auth` | `login` `signup` `consents` `forgot-password` `reset-password` `verify-email` `two-factor` |
|
|
127
|
-
| `e2e` `app` | `todos` `profile` `realtime` `ai-chat` `pdf` |
|
|
126
|
+
| `e2e` `app` | `todos` `todo-windows` `todo-browser` `profile` `realtime` `ai-chat` `pdf` `notifications` `socket-flags` `mcp-tokens` |
|
|
128
127
|
| `e2e` `admin-core` | `admin` `admin-home` `admin-form` `admin-todo-crud` `admin-title-update-depth` `org-admin-security` `admin-user-security` |
|
|
129
128
|
| `e2e-cross-site` (not required) | the cross-site specs below, then `account-linking` with `E2E_ACCOUNT_LINKING=explicit` |
|
|
130
129
|
| `e2e` `admin-table` | `admin-table-search-filter` `admin-table-bulk-actions` `admin-custom-screens` `admin-comms-back` `harness-approvals` `harness-intake` |
|
|
@@ -317,7 +317,7 @@ Expo plugin. The provider still returns to the backend's own
|
|
|
317
317
|
`@better-auth/expo`, which serves `GET {basePath}/expo-authorization-proxy`. The app opens
|
|
318
318
|
that URL in the browser; it sets the OAuth state cookie there and redirects to the provider.
|
|
319
319
|
2. **Give the app a scheme.** Set `expo.scheme` in `app.json` (`frontend` in the example) and
|
|
320
|
-
pass the same value to `createBetterAuthClient({scheme})` from `@terreno/
|
|
320
|
+
pass the same value to `createBetterAuthClient({scheme})` from `@terreno/syncdb/auth`.
|
|
321
321
|
3. **List the scheme in `trustedOrigins`**, as `frontend://`. After the callback, the backend
|
|
322
322
|
redirects the browser to the app's `callbackURL` (`frontend://.../login`), with the session in
|
|
323
323
|
a `cookie` query parameter. Better Auth refuses a callback URL that matches no trusted origin.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Set up Terreno MCP
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Configure both Terreno servers: the hosted server supplies documentation and generators; the local
|
|
4
|
+
stdio server inspects the app, database, logs, Metro, and SyncDB state.
|
|
5
5
|
- **`terreno`** (hosted, Streamable HTTP) supplies documentation search and code generators.
|
|
6
6
|
- **`terreno-local`** (stdio, runs in your repository) reads the app's packages, database, logs,
|
|
7
7
|
Metro, and client state.
|
|
@@ -33,7 +33,7 @@ State files (in the repo, not linked from this page):
|
|
|
33
33
|
|
|
34
34
|
## 2. Branch name
|
|
35
35
|
|
|
36
|
-
Expo `58.0.0-preview.
|
|
36
|
+
Expo `58.0.0-preview.2` → `release-58.0.0`. Create from `origin/master` the
|
|
37
37
|
first day. Later days check it out, merge `master`, and either bump to a
|
|
38
38
|
newer preview or resume **Open** items from the log.
|
|
39
39
|
|
|
@@ -25,10 +25,10 @@ This adds the public `GET /version-check` endpoint. The admin routes (`GET/PUT /
|
|
|
25
25
|
|
|
26
26
|
### 2. Frontend: Add build number injection
|
|
27
27
|
|
|
28
|
-
Create or update `app.config.ts` in your Expo app root. Use the `resolveBuildNumber` helper from `@terreno/
|
|
28
|
+
Create or update `app.config.ts` in your Expo app root. Use the `resolveBuildNumber` helper from `@terreno/syncdb/buildNumber` (node-only, so import it only from `app.config.ts`):
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
|
-
import {resolveBuildNumber} from "@terreno/
|
|
31
|
+
import {resolveBuildNumber} from "@terreno/syncdb/buildNumber";
|
|
32
32
|
import type {ConfigContext, ExpoConfig} from "expo/config";
|
|
33
33
|
|
|
34
34
|
export default ({config}: ConfigContext): ExpoConfig => ({
|
|
@@ -54,10 +54,12 @@ This sets `Constants.expoConfig.extra.buildNumber` when Metro loads the config.
|
|
|
54
54
|
|
|
55
55
|
### 3. Frontend: Wire up the hook
|
|
56
56
|
|
|
57
|
+
`useUpgradeCheck` calls `/version-check` through the `@terreno/syncdb/api` request client,
|
|
58
|
+
so render it inside `<ApiClientProvider client={apiClient}>` (or pass `{client: apiClient}`).
|
|
57
59
|
In your root layout:
|
|
58
60
|
|
|
59
61
|
```typescript
|
|
60
|
-
import {useUpgradeCheck} from "@terreno/
|
|
62
|
+
import {useUpgradeCheck} from "@terreno/syncdb/app";
|
|
61
63
|
import {UpgradeRequiredScreen} from "@terreno/ui";
|
|
62
64
|
|
|
63
65
|
function RootLayoutNav() {
|
|
@@ -31,8 +31,8 @@ Or browse [`mcp-server/src/docs/upgrades/`](../../mcp-server/src/docs/upgrades/)
|
|
|
31
31
|
| Clean git tree, work on a branch | Rollback is `git checkout -- .` / `git reset --hard` on that branch. |
|
|
32
32
|
| Backend `@terreno/*` first | `/openapi.json` is the contract the frontend typed client is generated from. Regenerating against an old backend omits new routes; screens fail at compile. |
|
|
33
33
|
| Backend compile + tests | Catch API breaks before touching Expo or UI. |
|
|
34
|
-
| Expo SDK (if the Terreno major tracks a new Expo) | `@terreno/ui` pins `react-native` (for example
|
|
35
|
-
| Frontend `@terreno/*` | UI, syncdb, admin-frontend, admin-spa
|
|
34
|
+
| Expo SDK (if the Terreno major tracks a new Expo) | `@terreno/ui` pins `react-native` (for example `0.88.0-rc.1` on the 58 line in `ui/package.json` `peerDependencies`). Installing Terreno frontend packages before Expo leaves unmet peers. |
|
|
35
|
+
| Frontend `@terreno/*` | UI, syncdb, admin-frontend, admin-spa. |
|
|
36
36
|
| Regenerate typed client | Only after the **upgraded** backend is running. |
|
|
37
37
|
| Compile, lint, tests | Whole app. |
|
|
38
38
|
| Run the app | UI verification. |
|
|
@@ -42,11 +42,11 @@ Maintainers watching the next SDK beta use `track-upstream-expo` / [`track-upstr
|
|
|
42
42
|
|
|
43
43
|
### Backend vs frontend packages
|
|
44
44
|
|
|
45
|
-
From `publish-on-tag.yml`: **backend** `api`, `test`, `admin-backend`, `blocks`, `ai`, `api-health`, `comms`, `feature-flags`, `mcp`. **frontend** `ui`, `
|
|
45
|
+
From `publish-on-tag.yml`: **backend** `api`, `test`, `admin-backend`, `blocks`, `ai`, `api-health`, `comms`, `feature-flags`, `mcp`. **frontend** `ui`, `syncdb`, `admin-frontend`, `admin-spa`. `blocks` holds contracts that both `ai` and `ui` depend on, so it moves with the backend step.
|
|
46
46
|
|
|
47
|
-
## 4.
|
|
47
|
+
## 4. Crossing 58 removes `@terreno/rtk`
|
|
48
48
|
|
|
49
|
-
If the range
|
|
49
|
+
If the range crosses `58.0.0`, the app must drop `@terreno/rtk` and Redux: there is no 58 release of `@terreno/rtk`. Follow [How to upgrade from @terreno/rtk to @terreno/syncdb (Terreno 58)](migrate-rtk-to-syncdb.md) as part of the upgrade. Run the 58 data migrations before deploying 58 frontends.
|
|
50
50
|
|
|
51
51
|
## 5. Manual steps
|
|
52
52
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This page lists `@terreno/syncdb` behavior that a working app has to account for. Each entry says what the library does today, what breaks if you ignore it, and what to do instead. It was checked against `syncdb/src` and `api/src/sync` at 57.13.0. Several entries are library gaps rather than intended behavior. Delete an entry when its gap is fixed.
|
|
4
4
|
|
|
5
|
-
Read [Local-first data](../explanation/local-first-data.md) and [
|
|
5
|
+
Read [Local-first data](../explanation/local-first-data.md) and [How to upgrade from @terreno/rtk to @terreno/syncdb](migrate-rtk-to-syncdb.md) first.
|
|
6
6
|
|
|
7
7
|
## Startup and snapshots
|
|
8
8
|
|