@somewhere-cloud/cli 0.38.155 → 0.38.157

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 (142) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/dist/commands/docs.js +1 -1
  3. package/dist/lib/bundle.js +286 -188
  4. package/dist/lib/bundle.js.map +3 -3
  5. package/npm-shrinkwrap.json +2 -2
  6. package/package.json +2 -3
  7. package/dist/docs/adopt.md +0 -39
  8. package/dist/docs/analytics.md +0 -161
  9. package/dist/docs/api-reference.md +0 -339
  10. package/dist/docs/api-surface.md +0 -2067
  11. package/dist/docs/app-mcp.md +0 -162
  12. package/dist/docs/architecture-patterns.md +0 -334
  13. package/dist/docs/auth-client.md +0 -531
  14. package/dist/docs/billing.md +0 -76
  15. package/dist/docs/browser.md +0 -639
  16. package/dist/docs/calendar.md +0 -298
  17. package/dist/docs/changes.md +0 -323
  18. package/dist/docs/cli.md +0 -407
  19. package/dist/docs/common-mistakes.md +0 -199
  20. package/dist/docs/connect-agent.md +0 -72
  21. package/dist/docs/cors.md +0 -114
  22. package/dist/docs/cron.md +0 -167
  23. package/dist/docs/database-engine.md +0 -167
  24. package/dist/docs/declared-data.md +0 -1656
  25. package/dist/docs/declared-files.md +0 -475
  26. package/dist/docs/deploy-intelligence.md +0 -188
  27. package/dist/docs/deploy.md +0 -733
  28. package/dist/docs/design-system.md +0 -273
  29. package/dist/docs/dev-environments.md +0 -496
  30. package/dist/docs/domain-ownership.md +0 -31
  31. package/dist/docs/domains.md +0 -370
  32. package/dist/docs/feedback.md +0 -88
  33. package/dist/docs/file-tools.md +0 -116
  34. package/dist/docs/functions.md +0 -489
  35. package/dist/docs/getting-started.md +0 -238
  36. package/dist/docs/github.md +0 -95
  37. package/dist/docs/google-calendar.md +0 -212
  38. package/dist/docs/groups.md +0 -836
  39. package/dist/docs/guarantees.md +0 -58
  40. package/dist/docs/handled-for-you.md +0 -224
  41. package/dist/docs/inspect.md +0 -171
  42. package/dist/docs/limits.md +0 -68
  43. package/dist/docs/live-data.md +0 -197
  44. package/dist/docs/live.md +0 -92
  45. package/dist/docs/local-dev.md +0 -30
  46. package/dist/docs/migration-supabase.md +0 -58
  47. package/dist/docs/payments.md +0 -1102
  48. package/dist/docs/portability.md +0 -194
  49. package/dist/docs/postgres.md +0 -301
  50. package/dist/docs/pricing-comparison.md +0 -42
  51. package/dist/docs/pricing.md +0 -39
  52. package/dist/docs/project-groups.md +0 -107
  53. package/dist/docs/projects.md +0 -380
  54. package/dist/docs/recipe-ai-agent.md +0 -112
  55. package/dist/docs/recipe-ai-features.md +0 -227
  56. package/dist/docs/recipe-ai-receipts.md +0 -783
  57. package/dist/docs/recipe-background-jobs.md +0 -369
  58. package/dist/docs/recipe-booking.md +0 -348
  59. package/dist/docs/recipe-csv-import.md +0 -390
  60. package/dist/docs/recipe-ecommerce.md +0 -127
  61. package/dist/docs/recipe-email.md +0 -282
  62. package/dist/docs/recipe-escalation.md +0 -133
  63. package/dist/docs/recipe-file-uploads.md +0 -159
  64. package/dist/docs/recipe-import-app.md +0 -110
  65. package/dist/docs/recipe-login.md +0 -457
  66. package/dist/docs/recipe-multi-chat.md +0 -198
  67. package/dist/docs/recipe-paid-api.md +0 -161
  68. package/dist/docs/recipe-pdfs.md +0 -205
  69. package/dist/docs/recipe-push-notifications.md +0 -107
  70. package/dist/docs/recipe-seo.md +0 -200
  71. package/dist/docs/recipe-signed-in-app.md +0 -330
  72. package/dist/docs/render.md +0 -99
  73. package/dist/docs/rooms.md +0 -554
  74. package/dist/docs/sdk.md +0 -287
  75. package/dist/docs/sdks.md +0 -24
  76. package/dist/docs/search.md +0 -199
  77. package/dist/docs/security-model.md +0 -168
  78. package/dist/docs/setup.md +0 -212
  79. package/dist/docs/smoke.md +0 -102
  80. package/dist/docs/speed.md +0 -298
  81. package/dist/docs/sql-compatibility.md +0 -96
  82. package/dist/docs/sw.agent.md +0 -248
  83. package/dist/docs/sw.ai.md +0 -1291
  84. package/dist/docs/sw.auth.md +0 -1811
  85. package/dist/docs/sw.billing.md +0 -171
  86. package/dist/docs/sw.db.md +0 -2128
  87. package/dist/docs/sw.email.md +0 -661
  88. package/dist/docs/sw.endpoint.md +0 -187
  89. package/dist/docs/sw.env.md +0 -303
  90. package/dist/docs/sw.fetch.md +0 -115
  91. package/dist/docs/sw.fs.md +0 -424
  92. package/dist/docs/sw.groups.md +0 -836
  93. package/dist/docs/sw.image.md +0 -69
  94. package/dist/docs/sw.jobs.md +0 -520
  95. package/dist/docs/sw.logs.md +0 -61
  96. package/dist/docs/sw.mail.md +0 -106
  97. package/dist/docs/sw.notifications.md +0 -78
  98. package/dist/docs/sw.push.md +0 -161
  99. package/dist/docs/sw.rateLimit.md +0 -67
  100. package/dist/docs/sw.web.md +0 -128
  101. package/dist/docs/tasks.md +0 -269
  102. package/dist/docs/test.md +0 -220
  103. package/dist/docs/tool-reference-account.md +0 -7
  104. package/dist/docs/tool-reference-ai.md +0 -121
  105. package/dist/docs/tool-reference-analytics.md +0 -37
  106. package/dist/docs/tool-reference-api.md +0 -19
  107. package/dist/docs/tool-reference-artifacts.md +0 -35
  108. package/dist/docs/tool-reference-auth.md +0 -163
  109. package/dist/docs/tool-reference-browser.md +0 -114
  110. package/dist/docs/tool-reference-code.md +0 -26
  111. package/dist/docs/tool-reference-connect.md +0 -21
  112. package/dist/docs/tool-reference-cron.md +0 -48
  113. package/dist/docs/tool-reference-db.md +0 -282
  114. package/dist/docs/tool-reference-domains.md +0 -107
  115. package/dist/docs/tool-reference-email.md +0 -55
  116. package/dist/docs/tool-reference-env.md +0 -19
  117. package/dist/docs/tool-reference-feedback.md +0 -56
  118. package/dist/docs/tool-reference-fs.md +0 -265
  119. package/dist/docs/tool-reference-github.md +0 -57
  120. package/dist/docs/tool-reference-groups.md +0 -85
  121. package/dist/docs/tool-reference-help.md +0 -29
  122. package/dist/docs/tool-reference-jobs.md +0 -39
  123. package/dist/docs/tool-reference-live.md +0 -48
  124. package/dist/docs/tool-reference-logs.md +0 -16
  125. package/dist/docs/tool-reference-payments.md +0 -44
  126. package/dist/docs/tool-reference-project.md +0 -706
  127. package/dist/docs/tool-reference-push.md +0 -78
  128. package/dist/docs/tool-reference-rate-limit.md +0 -18
  129. package/dist/docs/tool-reference-search.md +0 -68
  130. package/dist/docs/tool-reference-security.md +0 -42
  131. package/dist/docs/tool-reference-smoke.md +0 -17
  132. package/dist/docs/tool-reference-stock-photos.md +0 -20
  133. package/dist/docs/tool-reference-tasks.md +0 -73
  134. package/dist/docs/tool-reference-telegram.md +0 -32
  135. package/dist/docs/tool-reference-usage.md +0 -9
  136. package/dist/docs/tool-reference-web.md +0 -71
  137. package/dist/docs/tool-reference-webhooks.md +0 -9
  138. package/dist/docs/troubleshooting.md +0 -411
  139. package/dist/docs/typed-functions.md +0 -94
  140. package/dist/docs/verify-before-deploy.md +0 -67
  141. package/dist/docs/vs-supabase.md +0 -75
  142. package/dist/docs/vs-vercel.md +0 -103
@@ -1,197 +0,0 @@
1
- # Live data — one poller, fan out to every client
2
-
3
- **A recipe, not a separate primitive.** It combines a `cron` schedule (or a
4
- job), a function that writes with `sw.db.server`, and a declared live view
5
- (`docs({ topic: 'live' })`). You write the poller.
6
-
7
- The golden path for any app that shows the SAME live value to many
8
- viewers at once: live scores, a price ticker, a leaderboard, an auction
9
- count, a status board. There is a right way and a wrong way, and the
10
- wrong way is the one most agents reach for first.
11
-
12
- **Anti-pattern (don't): per-client polling.** Every viewer hits the
13
- source on a timer. A World-Cup-style live-scores page where 5,000
14
- viewers each poll the source every 12 seconds makes ~25,000 calls/minute
15
- to that source — your rate limits trip, the source may ban you, and the
16
- cost scales with your audience. Worse with every viewer you add.
17
-
18
- **Pattern (do): one server-side poller, one declared live view.** Fetch
19
- the source ONCE on the server per tick, write the snapshot to your
20
- database, and let every client's declared live view re-read it. Load on
21
- the source is O(1) — the same single fetch whether one person or a
22
- million are watching.
23
-
24
- ## Step 0 — taking over a project you didn't build
25
-
26
- Adding live data usually means editing an app you didn't write. Orient
27
- first, with the dependable sequence:
28
-
29
- 1. project_files_list { project_id } — the file tree (paths only).
30
- 2. project_grep { project_id, pattern } — find where things live
31
- (e.g. the polling code, the page that renders the value).
32
- 3. project_file_read { project_id, path } — read the few files that
33
- matched.
34
-
35
- ## The pattern, end to end
36
-
37
- 1. A scheduled function (cron) fetches the live source ONCE per tick.
38
- 2. It writes the snapshot to a table with the structured builder, so a
39
- client connecting mid-stream reads the current value immediately and
40
- the write invalidates every subscribed view.
41
- 3. A second function DECLARES the live view over that table.
42
- 4. Each client calls that function once for first paint, then re-reads
43
- it on every invalidation. No client ever polls the source.
44
-
45
- Declare the snapshot table in `db/schema.ts` — it is the same value for
46
- everyone, so `shared()`. `players` is the reference table the roster job
47
- below fills; only your functions touch it, so `serverOnly()`:
48
-
49
- ```typescript
50
- // db/schema.ts
51
- import { schema, table, id, text, integer, timestamp, shared, serverOnly } from 'somewhere/db'
52
-
53
- export default schema({
54
- live_snapshot: table({
55
- id: id(), key: text({ unique: true }), json: text(),
56
- updated_at: timestamp({ default: 'now' }),
57
- }, { scope: shared() }),
58
- players: table({
59
- id: id(), key: text({ unique: true }), team: text(), name: text(),
60
- number: integer({ nullable: true }), position: text({ nullable: true }),
61
- }, { scope: serverOnly() }),
62
- })
63
- ```
64
-
65
- ## Server — the poller (a scheduled function)
66
-
67
- ```typescript
68
- // api/poll-scores.ts — fetch once, write the snapshot. Runs only when the scheduler calls it.
69
- export default async function (req: Request, sw: SomewhereRuntimeContext): Promise<Response> {
70
- if (!(await sw.jobs.verifyInvocation(req))) return new Response('forbidden', { status: 403 })
71
-
72
- const res = await fetch('https://example.com/api/scores/live')
73
- if (!res.ok) return new Response('source returned ' + res.status, { status: 502 })
74
- const scores = await res.json()
75
-
76
- // A scheduled run has no signed-in user, so it writes with server authority
77
- // and names the author explicitly: null marks a system row no app user wrote.
78
- // The composed write is what invalidates every live view over this table;
79
- // onConflict: 'update' replaces the row for the same key instead of adding one.
80
- // Raw sw.db.query never feeds a live view — and on a project with a
81
- // db/schema.ts it cannot write at all.
82
- await sw.db.server.insert('live_snapshot',
83
- { key: 'scores', json: JSON.stringify(scores), _sw_author_id: null },
84
- { onConflict: 'update' })
85
- return Response.json({ ok: true })
86
- }
87
- ```
88
-
89
- ## Server — the declared view the browser subscribes to
90
-
91
- ```typescript
92
- // api/scores.ts
93
- export default async function (_req: Request, sw: SomewhereRuntimeContext) {
94
- return Response.json(await sw.rooms.live('scores.current', sw.db.from('live_snapshot', {
95
- where: { key: 'scores' },
96
- columns: ['id', 'key', 'json'],
97
- order: [['id', 'asc']],
98
- limit: 1,
99
- })))
100
- }
101
- ```
102
-
103
- Viewers read this as signed-in users: a `shared()` read with no signed-in
104
- user is refused `401 AUTH_REQUIRED`, and live views are the signed-in
105
- browser path (`docs({ topic: 'live' })`).
106
-
107
- Schedule the poller to refresh once a minute:
108
-
109
- ```text
110
- cron_create({ project_id: "my-app", schedule: "*/5 * * * *", handler: "/api/poll-scores" })
111
- ```
112
-
113
- ## Client — read once, then subscribe (never poll)
114
-
115
- ```js
116
- import { watchLive } from '/__sw/rooms/client.js'
117
-
118
- // First paint AND every update come from the same call: watchLive loads
119
- // through your function, then re-loads whenever the platform says the
120
- // declared view may be stale. The source is never touched from the browser.
121
- watchLive(
122
- () => fetch('/api/scores', { credentials: 'include' }).then(r => r.json()),
123
- (rows) => render(JSON.parse(rows[0].json)),
124
- )
125
- ```
126
-
127
- Every frame on that socket is control only — "this view may now be stale" —
128
- so the browser always re-reads through your function and never applies a row
129
- off the wire. `watchLive` also refreshes on reconnect, on tab focus, when the network
130
- comes back and every 60 seconds, so a lost notice self-heals.
131
-
132
- Caller-chosen channels are not an option here. The supported browser
133
- path is the signed invalidation channel created by `sw.rooms.live`; see
134
- `docs({ topic: 'rooms' })` under "Live lists".
135
-
136
- ## Sub-minute updates (live sports, finance)
137
-
138
- **Cron cannot go sub-minute — a hard floor.** A 5-field cron expression has
139
- no seconds field, so you cannot schedule "every 10 seconds," and your plan
140
- may set a wider minimum than a minute on top of that (`cron_list` reports
141
- it as `policy.min_interval_minutes`). For sub-minute live data you do NOT
142
- lean on cron for the cadence:
143
-
144
- - If you RECEIVE the data (a webhook, an inbound feed, a user action),
145
- write the snapshot the instant it arrives — the composed write
146
- invalidates every subscribed view immediately, with no schedule at all.
147
- - If you must PULL it, run the cron poller at the tightest interval your
148
- plan allows to keep the snapshot fresh; anything arriving faster is
149
- written from wherever it enters your system.
150
-
151
- Either way the rule holds: every viewer re-reads one snapshot through your
152
- own function — the source is hit O(1), never once-per-viewer.
153
-
154
- ## Reference data: enrich into a table, don't hardcode it
155
-
156
- Seed/reference data — a squad roster, a product catalog, a venue list —
157
- does NOT belong inline in your frontend. Hardcoding it means every
158
- correction is a redeploy. Instead, write a RE-RUNNABLE job that builds
159
- the dataset into `sw.db` (or a `sw.fs` JSON file), and have the page
160
- read it at runtime:
161
-
162
- ```typescript
163
- // api/jobs/build-rosters.ts — fetch sources, extract to a schema, store. Re-runnable.
164
- export default async function (req: Request, sw: SomewhereRuntimeContext): Promise<Response> {
165
- if (!(await sw.jobs.verifyInvocation(req))) return new Response('forbidden', { status: 403 })
166
- const res = await fetch('https://example.com/teams')
167
- if (!res.ok) return new Response('source returned ' + res.status, { status: 502 })
168
- const raw = await res.text()
169
- const result = await sw.ai.chat({
170
- messages: [{ role: 'user', content:
171
- `Extract every player from this page as a JSON array of
172
- {team, name, number, position}. Return ONLY the JSON.\n\n${raw}` }],
173
- })
174
- const players = JSON.parse(result.text)
175
- if (!Array.isArray(players)) return new Response('extraction did not return a list', { status: 502 })
176
- // players is the serverOnly() table in db/schema.ts above; a job has no
177
- // signed-in user, so it writes with server authority. The upsert on the
178
- // unique key replaces a player's row on the next run instead of adding one.
179
- let upserted = 0
180
- for (const p of players) {
181
- if (typeof p?.team !== 'string' || typeof p?.name !== 'string') continue
182
- await sw.db.server.insert('players', {
183
- key: `${p.team}:${p.name}`, team: p.team, name: p.name,
184
- number: Number.isInteger(p.number) ? p.number : null,
185
- position: typeof p.position === 'string' ? p.position : null,
186
- }, { onConflict: 'update' })
187
- upserted++
188
- }
189
- return Response.json({ upserted })
190
- }
191
- ```
192
-
193
- Run it as a job (`sw.jobs.create({ handler: '/api/jobs/build-rosters' })`) or
194
- on a cron (`cron_create`) to refresh. The frontend
195
- fetches `/api/players`, so correcting a roster updates the live app
196
- with NO redeploy. Same shape for any "fetch sources → extract to a
197
- schema → serve" job.
package/dist/docs/live.md DELETED
@@ -1,92 +0,0 @@
1
- # Live updates — rooms and live lists
2
-
3
- Realtime in an app is one surface, rooms (`docs({ topic: 'rooms' })`):
4
-
5
- - a room is one row that people change together (shared state, who is here,
6
- quick messages);
7
- - a live list keeps a list of rows fresh in every open tab.
8
-
9
- There is no caller-named channel API: nothing publishes or broadcasts on a
10
- channel you pick. Application state and events belong in the database.
11
-
12
- ## Live lists
13
-
14
- Declare the list in a function with `sw.rooms.live(name, sw.db.from(...))`
15
- and follow it with `watchLive` from `/__sw/rooms/client.js`. Each change to
16
- the list's rows sends a "refresh now" notice, and the browser re-calls your
17
- function for fresh rows, so every access rule applies. No row, SQL, table
18
- name, predicate or owner travels on the connection.
19
-
20
- | Table rule | Who can follow the list |
21
- |---|---|
22
- | `owner()` | the signed-in user, for their own rows; with `owner({ visitors: true })`, an anonymous visitor for their own rows |
23
- | `shared()`, `member()`, `group()`, `appRole()` | signed-in users who may read the rows |
24
- | `serverOnly()` | nobody: deploy refuses the list |
25
-
26
- The list below reads an `owner()` table, so each refresh returns only the
27
- signed-in user's notes:
28
-
29
- ```ts
30
- // db/schema.ts
31
- import { schema, table, id, text, boolean, timestamp, owner } from 'somewhere/db'
32
-
33
- export default schema({
34
- notes: table({
35
- id: id(), title: text(), done: boolean({ default: false }),
36
- created_at: timestamp({ default: 'now' }),
37
- }, { scope: owner() }),
38
- })
39
- ```
40
-
41
- ```ts
42
- // api/open-notes.ts
43
- export default async function (_req: Request, sw: SomewhereRuntimeContext) {
44
- return Response.json(await sw.rooms.live('notes.open', sw.db.from('notes', {
45
- where: { done: false },
46
- columns: ['id', 'title', 'done', 'created_at'],
47
- order: [['created_at', 'desc'], ['id', 'asc']],
48
- limit: 20,
49
- })))
50
- }
51
- ```
52
-
53
- ```js
54
- // browser
55
- import { watchLive } from '/__sw/rooms/client.js'
56
-
57
- const stop = watchLive(
58
- () => fetch('/api/open-notes', { credentials: 'include' }).then((r) => {
59
- if (!r.ok) throw new Error('Could not load notes (' + r.status + ').')
60
- return r.json()
61
- }),
62
- (rows) => render(rows),
63
- (err) => showProblem(err.message), // optional; console.error otherwise
64
- )
65
- ```
66
-
67
- Anonymous visitors sharing one row (a game between two people with links, a
68
- public board) use a room on that row instead of a list.
69
-
70
- The declaration rules, what triggers a refresh, recovery after a dropped
71
- connection, and `live_delivery` are in `docs({ topic: 'rooms' })` under
72
- "Live lists".
73
-
74
- ## Platform system events
75
-
76
- Two reserved, signed channels carry platform lifecycle events to developer
77
- tooling. They are subscribe-only, developer-authority only, and carry no
78
- application data — an app-user or visitor session is never admitted:
79
-
80
- events_subscribe_project({ project_id: 'my-app' })
81
- // → { channel: 'system:project', websocket_url, event_types: [...] }
82
-
83
- events_subscribe_user({})
84
- // → { channel: 'system:user', websocket_url, event_types: ['feedback_resolved'] }
85
-
86
- The `system:project` channel emits deploy lifecycle, database health, quota
87
- warning, and auth administration events. The `system:user` channel emits
88
- `feedback_resolved` for tickets submitted by the authenticated developer.
89
- The returned WebSocket URLs authenticate as that developer; keep them private.
90
- On close code 4001 (`reauthorize`), reconnect with `since=<last received seq>`
91
- so the new connection checks your current access and resumes available events.
92
- A replay gap means you should reload the current state before continuing.
@@ -1,30 +0,0 @@
1
- # Local dev — `somewhere dev`
2
-
3
- # somewhere dev — the frontend loop
4
-
5
- `somewhere dev` serves your browser application on localhost with hot
6
- reload while you shape the UI. If the frontend doesn't already have Vite,
7
- install it with `npm install -D vite`. The backend you rely on is the deployed one:
8
- `api/` functions, `sw.*` calls, the database and files are reached
9
- through your project's live URL. Deploying is how you see the real app —
10
- the platform compiles raw source on deploy — so for anything behind an API
11
- call the loop is `somewhere deploy` then `somewhere verify`.
12
-
13
- Data the local app saves goes to the project's own database and files, the
14
- same ones your users' app reads, so local writes change production data.
15
-
16
- somewhere dev # serve the frontend on http://localhost:8787
17
- somewhere deploy # publish; the platform compiles
18
- somewhere verify # prove the live app in a real browser
19
-
20
- If port 8787 is in use, run `somewhere dev --port 8788` and open the URL it prints.
21
-
22
- Do not run a build step before `somewhere dev` or `somewhere deploy`;
23
- the platform compiles raw source. Local dev never needs a developer key or
24
- a browser database client.
25
-
26
- To try changes without touching production data, `somewhere preview` runs
27
- the whole app hosted on a private URL against an isolated, populated copy of
28
- your production database; nothing your users see changes until you promote
29
- that preview. Which plans include it, and how to start one:
30
- docs({ topic: 'dev-environments' }).
@@ -1,58 +0,0 @@
1
- # Migrating a Supabase app
2
-
3
- Somewhere is not a drop-in Supabase replacement. Migrate the app's data and
4
- access contract; changing an import does not migrate queries, permissions,
5
- authentication, files, or live-update behavior.
6
-
7
- If you would rather keep your data in PostgreSQL than port it to the managed
8
- database, you can: attach your own database and query it with the provider's
9
- driver (`docs({ topic: 'postgres' })`). That decision is only about the
10
- data layer — auth, files, functions and live updates are still the separate
11
- moves described below, and an attached database gets none of the declared
12
- permissions this page is about.
13
-
14
- ## Declare the data contract
15
-
16
- Declare tables, fields, access scopes, relations, and browser operation grants
17
- in `db/schema.ts`. The platform generates the typed `somewhere:data` client
18
- for permitted browser operations. Use `sw.db` inside functions for business
19
- logic. A foreign key describes a relationship; it does not grant access.
20
-
21
- An existing `from().select()` call is not the new browser data API. Rewrite
22
- ordinary browser reads and writes against the generated operations. See
23
- docs({ topic: 'declared-data' }) and docs({ topic: 'sw.db' }) for exact syntax,
24
- supported relations, and the rules for adopting existing tables.
25
-
26
- ## Keep authentication and files explicit
27
-
28
- Use same-origin cookie sessions for browser authentication. The optional
29
- `@somewhere-cloud/sdk` auth and function helpers do not make an existing
30
- Supabase app source-compatible. Never put a developer key in browser code.
31
- See docs({ topic: 'auth-client' }) for setup and docs({ topic: 'sw.auth' })
32
- for session behavior.
33
-
34
- Copy files with their intended visibility; private files need authenticated
35
- access or signed URLs. Review old public URLs rather than assuming they keep
36
- working. See docs({ topic: 'sw.fs' }).
37
-
38
- ## Users
39
-
40
- Importing users with their existing passwords is not available
41
- (`POST /v1/auth/import` answers 501 `AUTH_FEATURE_UNAVAILABLE`). Today each
42
- user creates their account again with the same email address: password
43
- sign-up, a sign-in link, or Google, GitHub or Discord sign-in. New accounts get
44
- new user IDs, so map each old ID to the new one by email and rewrite every
45
- ownership column and foreign key that pointed at it. Sessions do not carry
46
- over.
47
-
48
- ## Move data before switching traffic
49
-
50
- Keep a verified export before modifying the source app. Map old user IDs,
51
- row ownership, and foreign keys explicitly. Test the imported app with two
52
- users and a signed-out visitor, including denied access and writes, before
53
- switching traffic. A column named `user_id` does not declare its policy.
54
- See docs({ topic: 'portability' }) for export and import capabilities.
55
-
56
- Supabase channels are not the browser live-data contract. Use the supported
57
- named live-view path described in docs({ topic: 'live' }); its scope
58
- limits apply. Do not assume every declared table supports subscriptions.