@somewhere-cloud/cli 0.38.185 → 0.38.186
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 +6 -0
- package/README.md +1 -1
- package/dist/lib/bundle.js +15 -11
- package/dist/lib/bundle.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.38.186
|
|
4
|
+
|
|
5
|
+
- The starter guide explains team access, publishing drafts and handling updates that change no rows.
|
|
6
|
+
- `somewhere privacy` explains who can see each table and file, and which server calls can bypass those rules.
|
|
7
|
+
- When a test, `somewhere data`, `somewhere test` or `somewhere support` runs in a folder that is not linked to a project, the error names the folder and the command that links it.
|
|
8
|
+
|
|
3
9
|
## 0.38.185
|
|
4
10
|
|
|
5
11
|
- `env set --stdin`, `ai keys set --stdin`, `auth set` and the Postgres key read a pipe written by another program, such as `somewhere call … | somewhere env set KEY --stdin`. A piped value that is not set is kept in a file only you can read, with the command to finish.
|
package/README.md
CHANGED
|
@@ -105,7 +105,7 @@ For optional after-edit checking, explicitly run `somewhere hooks install --host
|
|
|
105
105
|
| `somewhere dev` | Frontend hot reload on localhost with your project's own Vite; API requests go to your deployed project |
|
|
106
106
|
| `somewhere preview` | Run your whole app on the platform — every save goes to a private URL, and production is untouched until you promote |
|
|
107
107
|
| `somewhere deploy` | Deploy current directory to linked project |
|
|
108
|
-
| `somewhere privacy` |
|
|
108
|
+
| `somewhere privacy` | Who can see what in the live app: each table and file rule in words, server code that goes beyond them, and outside domains |
|
|
109
109
|
| `somewhere deploy --dry-run` | Upload source to compute the deploy diff without publishing |
|
|
110
110
|
| `somewhere deploy --scope functions` | Deploy backend only (leave the site untouched) |
|
|
111
111
|
| `somewhere deploy --force` | Intentionally overwrite remote changes made since this machine last deployed |
|
package/dist/lib/bundle.js
CHANGED
|
@@ -44302,13 +44302,13 @@ var init_init_agent_guide = __esm({
|
|
|
44302
44302
|
| Does your app verify emails? | Choose the declared access rule |
|
|
44303
44303
|
| --- | --- |
|
|
44304
44304
|
| Yes, invited teams | Use \`group()\` and \`sw.groups\` for invitations, membership and owner/admin permissions. See \`somewhere docs sw.groups --section team-example\`. |
|
|
44305
|
-
| No, app-managed teams | Use \`member()\` over
|
|
44305
|
+
| No, app-managed teams | Use \`member()\` over your own roster table. Scope the roster and the team table with \`member()\` as well, so members read both without server code. For "author or team owner edits", add a second \`member()\` branch with \`where: { role: 'owner' }\`. Creating a team and changing its roster still need a function with \`sw.db.server\`. See \`somewhere docs declared-data --section teams-without-email-verification\`. |
|
|
44306
44306
|
| Yes, staff by domain | Use \`appRole()\` and \`appRoles: { staff: { emailDomain: 'staff.example' } }\`. The address must be verified. |
|
|
44307
44307
|
| No, staff by invitation | Use \`appRole()\` and \`assignedBy: 'server'\`. Redeem an app-issued invitation and call \`sw.auth.server.setRoles\` inside the sign-up route. See \`somewhere docs sw.auth --section server-assigned-app-roles-setroles\`. |
|
|
44308
44308
|
| Either, personal rows | Use \`owner()\`. The platform stamps the owner from the signed-in user. |
|
|
44309
44309
|
| Either, shared private row | Use a read-only \`grant()\` for a known app-user ID. Adding the grant widens existing caller-scoped reads. See \`somewhere docs declared-data --section read-only-sharing-without-email-verification\`. |
|
|
44310
44310
|
| No, share by email address | Without verification, whoever signs up first with an address owns it. Match the existing account, tell the sharer plainly when none exists, and show the sharer that the recipient's address is unverified so they can revoke. For private data, grant the share only after the recipient opens an \`sw.auth.invite\` link sent to that address. See \`somewhere docs declared-data --section sharing-by-email-without-verification\`. |
|
|
44311
|
-
| Either, public pages from private drafts | Use conditional \`client.publicRead\`. Anonymous
|
|
44311
|
+
| Either, public pages from private drafts | Use conditional \`client.publicRead: { where: { published: true } }\`. Anonymous reads come from the database, so an unpublish holds on the next read for anyone reading through \`publicRead\` alone (from the app's next deploy after this change); the row's owner and share-link holders keep their own access. Publish from a function with caller-scoped \`sw.db.update\`, so the table's update rule decides who may publish. |
|
|
44312
44312
|
|
|
44313
44313
|
### Schema and data
|
|
44314
44314
|
|
|
@@ -44318,9 +44318,9 @@ Existing integer IDs stay integers. Declare composite uniqueness with \`unique:
|
|
|
44318
44318
|
|
|
44319
44319
|
- Browser reads and writes use generated \`somewhere:data\`. \`client\` sets allowed operations and fields. Include the key in explicit read lists. Browser calls throw errors, and list pages use the returned \`next\` as \`after\` (at most 100 rows per page).
|
|
44320
44320
|
- \`anyOf()\` grants access through either branch. \`allOf()\` requires both the membership gate and the action rule. \`parent()\` inherits the parent row's access. Declare \`parent({ author, update, delete })\` on the child table's first deploy. If you display the author's email, use a signed-in creation endpoint that takes the address from the session and leave browser create disabled. For staff replies through \`parent()\`, grant staff create permission on the ticket's rule. See \`somewhere docs declared-data --section comments-that-their-author-may-edit\`.
|
|
44321
|
-
- \`sw.db.from/insert/update/remove\` apply the caller's scope and return \`{ data, count, changes }\`. An insert puts the new row in \`data[0]\`. Use \`where\`, \`columns\`, \`order\`, \`limit\` and \`offset\` for server reads. \`sw.db.tx\` takes an array of write intents. Supply related IDs up front.
|
|
44322
|
-
- Authorize before \`sw.db.server\` calls, which bypass the caller's scope. Keep declared scopes on records users work with, even when an exceptional write needs server authority. Use \`serverOnly()\` for protected ledgers and job state. Raw SQL uses a separate raw database.
|
|
44323
|
-
-
|
|
44321
|
+
- \`sw.db.from/insert/update/remove\` apply the caller's scope and return \`{ data, count, changes }\`. An insert puts the new row in \`data[0]\`. An update or remove that matches no row the caller may change does not throw: it returns \`changes: 0\`, the same for a missing row and a refused one, so an endpoint answers 404 when \`changes\` is 0 instead of reporting success. Use \`where\`, \`columns\`, \`order\`, \`limit\` and \`offset\` for server reads. \`sw.db.tx\` takes an array of write intents. Supply related IDs up front.
|
|
44322
|
+
- Authorize before \`sw.db.server\` calls, which bypass the caller's scope. Keep declared scopes on records users work with, even when an exceptional write needs server authority. Use \`serverOnly()\` for protected ledgers and job state, not to protect a field: a column left out of \`client.create\` and \`client.update\` stays out of the browser's reach, and your functions still write it as the caller. Raw SQL uses a separate raw database.
|
|
44323
|
+
- To find the declared rule for a need (a row two people share, a team's rows, something public that can be withdrawn, an action only one role may take, work with no signed-in user, a count or limit, an invite), see \`somewhere docs architecture-patterns --section access-rules-by-what-the-app-needs\`. Two parties on one row: \`somewhere docs sw.db --section provider-or-booker-and-owner-or-staff-recipes\`. For browser paging, server paging and transactions, see \`somewhere docs sw.db\`.
|
|
44324
44324
|
|
|
44325
44325
|
Use \`client.intake\` for public submissions to a private parent row. See
|
|
44326
44326
|
\`somewhere docs declared-data\` for intake, scoped writes and related rows.
|
|
@@ -44331,7 +44331,7 @@ Use \`client.intake\` for public submissions to a private parent row. See
|
|
|
44331
44331
|
- JSON routes use \`sw.endpoint({ auth, body, rateLimit, handler })\`. Set \`auth\` to \`'required'\`, \`'optional'\` or \`'none'\`. Use a limit like \`'30/minute'\`. Read route parameters from the handler's \`params\`. Use a default handler or named HTTP method exports. For streaming, webhooks or custom responses, use a bare \`(req, sw)\` handler and \`sw.params\`. See \`somewhere docs functions\`.
|
|
44332
44332
|
- Keep the SDK auth handler at \`api/auth/[...path].ts\` when your app uses sign-in. Gate private UI on auth state. Password sign-up starts unverified, and signed-in unverified users pass \`auth: 'required'\`. See \`somewhere docs auth-client\`.
|
|
44333
44333
|
- Mail from the app's built-in address reaches only the owner and app users who verified their email and signed in. Password sign-up starts unverified: if the app emails its users (confirmations, reminders), keep the starter's "Verify your email" step, or verify your own sender domain. See \`somewhere docs sw.email\`.
|
|
44334
|
-
- When users must see each other's changes without reloading (a queue, chat or status board), do not poll. Return the list through \`sw.rooms.live\` and follow it in the page with \`watchLive\`. See \`somewhere docs live --section realtime-live-updates-two-users-see-the-same-change\`.
|
|
44334
|
+
- When users must see each other's changes without reloading (a queue, chat or status board), do not poll. Return the list through \`sw.rooms.live\` and follow it in the page with \`watchLive\`. See \`somewhere docs live --section realtime-live-updates-two-users-see-the-same-change\`. Live updates need a claimed app: on a temporary app, poll a function every few seconds until it is claimed.
|
|
44335
44335
|
- Render a view when the reads it depends on finish. Keep inputs disabled until their initial data and identity are ready, and preserve edits when a late response arrives.
|
|
44336
44336
|
- Browser requests use same-origin cookies. For scripted writes with a cookie session, send the app's origin in the \`Origin\` header. Use the CLI test helper to send data endpoint calls with the deployed contract digest. For an update, use \`data(table, { operation: 'update', id, values: { title } })\`.
|
|
44337
44337
|
|
|
@@ -74199,7 +74199,7 @@ var init_platform_tools = __esm({
|
|
|
74199
74199
|
|
|
74200
74200
|
// dist/commands/privacy.js
|
|
74201
74201
|
function registerPrivacy(program2) {
|
|
74202
|
-
program2.command("privacy").description("
|
|
74202
|
+
program2.command("privacy").description("Who can see what in the live app: each table and file rule in words, server code that goes beyond them, and outside domains").option("-p, --project <project>", "Project slug or ID").option("--json", "Print the release record as JSON").action(async (opts) => {
|
|
74203
74203
|
try {
|
|
74204
74204
|
const data2 = unwrapPlatformData(await callPlatformTool("project_privacy_facts", {
|
|
74205
74205
|
project_id: resolveProjectRef(opts.project)
|
|
@@ -136982,7 +136982,7 @@ function registerData(program2) {
|
|
|
136982
136982
|
}
|
|
136983
136983
|
const projectId = loadProjectConfig()?.project_id;
|
|
136984
136984
|
if (!projectId)
|
|
136985
|
-
throw new Error("Run somewhere data from a linked project folder.");
|
|
136985
|
+
throw new Error("Run somewhere data from a linked project folder." + unlinkedFolderHint());
|
|
136986
136986
|
const target = await loadTestTarget(new ApiClient(getToken()), projectId);
|
|
136987
136987
|
const origin = new URL(target.origin);
|
|
136988
136988
|
if (origin.protocol !== "https:" && !["localhost", "127.0.0.1", "[::1]"].includes(origin.hostname)) {
|
|
@@ -137013,6 +137013,7 @@ var init_data = __esm({
|
|
|
137013
137013
|
init_config();
|
|
137014
137014
|
init_prepared_actor_session();
|
|
137015
137015
|
init_test_target();
|
|
137016
|
+
init_link_hint();
|
|
137016
137017
|
__name(parseJson, "parseJson");
|
|
137017
137018
|
__name(registerData, "registerData");
|
|
137018
137019
|
}
|
|
@@ -137231,7 +137232,7 @@ function registerTest(program2) {
|
|
|
137231
137232
|
const root = process.cwd();
|
|
137232
137233
|
const projectId = loadProjectConfig()?.project_id;
|
|
137233
137234
|
if (!projectId)
|
|
137234
|
-
throw new Error("Run somewhere test from a linked project folder");
|
|
137235
|
+
throw new Error("Run somewhere test from a linked project folder." + unlinkedFolderHint());
|
|
137235
137236
|
if (opts.only !== void 0 && (files.length || opts.preview || opts.failed)) {
|
|
137236
137237
|
throw new Error("--only runs a single part of the hosted smoke check. Use it without file arguments, --preview, or --failed.");
|
|
137237
137238
|
}
|
|
@@ -137297,6 +137298,7 @@ var init_test = __esm({
|
|
|
137297
137298
|
"use strict";
|
|
137298
137299
|
init_client();
|
|
137299
137300
|
init_config();
|
|
137301
|
+
init_link_hint();
|
|
137300
137302
|
init_test_run();
|
|
137301
137303
|
init_test_timeline();
|
|
137302
137304
|
init_reference_check_note();
|
|
@@ -137716,7 +137718,7 @@ async function tracePacket(opts) {
|
|
|
137716
137718
|
throw new Error(projectRefConflictMessage(chosen));
|
|
137717
137719
|
const projectId = chosen.kind === "ref" ? chosen.ref : loadProjectConfig()?.project_id;
|
|
137718
137720
|
if (!projectId)
|
|
137719
|
-
throw new Error("No project. Pass --project <ref> or run from a linked directory.");
|
|
137721
|
+
throw new Error("No project. Pass --project <ref> or run from a linked directory." + unlinkedFolderHint());
|
|
137720
137722
|
const result = await new ApiClient(getToken()).call("GET", "/logs", void 0, { project_id: projectId, trace_id: traceId, limit: 50 });
|
|
137721
137723
|
const record3 = buildCrashRecord(result.logs, { cliVersion: CLI_VERSION2, traceId, projectId });
|
|
137722
137724
|
if (!record3) {
|
|
@@ -137770,6 +137772,7 @@ var init_support = __esm({
|
|
|
137770
137772
|
init_cli_invocation();
|
|
137771
137773
|
init_client();
|
|
137772
137774
|
init_config();
|
|
137775
|
+
init_link_hint();
|
|
137773
137776
|
init_output();
|
|
137774
137777
|
init_project_ref();
|
|
137775
137778
|
init_repro_packet();
|
|
@@ -139285,7 +139288,7 @@ async function openTestApp(options2 = {}) {
|
|
|
139285
139288
|
const root = resolve26(options2.projectDir ?? process.cwd());
|
|
139286
139289
|
const projectId = loadProjectConfig(root)?.project_id;
|
|
139287
139290
|
if (!projectId)
|
|
139288
|
-
throw new Error(
|
|
139291
|
+
throw new Error(`No linked Somewhere app in ${root} (no .somewhere.json): run the test from the folder you deploy from, or pass projectDir.` + unlinkedFolderHint());
|
|
139289
139292
|
const setup = options2.preview ? previewCredentialFor(root, projectId) : void 0;
|
|
139290
139293
|
const tool = setup && previewToolClient(setup.credential);
|
|
139291
139294
|
const client = tool ? void 0 : new ApiClient(testingDeveloperToken(), projectId);
|
|
@@ -139778,6 +139781,7 @@ var init_testing_app = __esm({
|
|
|
139778
139781
|
init_client();
|
|
139779
139782
|
init_form_accounts();
|
|
139780
139783
|
init_config();
|
|
139784
|
+
init_link_hint();
|
|
139781
139785
|
init_preview_credential();
|
|
139782
139786
|
init_test_control();
|
|
139783
139787
|
init_test_identities();
|