@somewhere-cloud/cli 0.38.180 → 0.38.182
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 +11 -0
- package/dist/commands/init.js +1 -1
- package/dist/lib/bundle.js +157 -154
- package/dist/lib/bundle.js.map +2 -2
- package/dist/types/lib/client.d.ts +6 -1
- package/dist/types/lib/test-control.d.ts +1 -1
- package/dist/types/lib/test-session.d.ts +3 -1
- package/dist/types/lib/testing-app.d.ts +11 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
- package/runtime/DECLARED-DATA-VENDOR.json +7 -7
- package/runtime/PLATFORM-SOURCE.json +1 -1
- package/runtime/declared-data.cjs +5 -3
package/dist/lib/bundle.js
CHANGED
|
@@ -34013,13 +34013,15 @@ var init_client = __esm({
|
|
|
34013
34013
|
static {
|
|
34014
34014
|
__name(this, "ApiClient");
|
|
34015
34015
|
}
|
|
34016
|
+
linkedProjectId;
|
|
34016
34017
|
/** Mutable: the refresh-on-401 path swaps in a fresh access key in place so
|
|
34017
34018
|
* the retry (and every later call on this instance) uses the new token. */
|
|
34018
34019
|
/** null: an unauthenticated client (no Authorization header, never a
|
|
34019
34020
|
* stored-login refresh), for the public anonymous-deploy routes. */
|
|
34020
34021
|
token;
|
|
34021
34022
|
temporaryConfig;
|
|
34022
|
-
constructor(token) {
|
|
34023
|
+
constructor(token, linkedProjectId) {
|
|
34024
|
+
this.linkedProjectId = linkedProjectId;
|
|
34023
34025
|
this.token = token;
|
|
34024
34026
|
const saved = token === null ? null : loadConfig();
|
|
34025
34027
|
this.temporaryConfig = saved?.temporary && saved.token === token ? saved : null;
|
|
@@ -34033,6 +34035,25 @@ var init_client = __esm({
|
|
|
34033
34035
|
this.checkTemporaryExpiry();
|
|
34034
34036
|
return this.token === null ? {} : { Authorization: `Bearer ${this.token}` };
|
|
34035
34037
|
}
|
|
34038
|
+
/** A refusal for a target selected from .somewhere.json may identify only
|
|
34039
|
+
* the caller. Its status and code cannot distinguish a missing project
|
|
34040
|
+
* from one the caller cannot access. Explicit project refs omit this context. */
|
|
34041
|
+
async linkedProjectError(error3, path3, body, query) {
|
|
34042
|
+
const id = this.linkedProjectId;
|
|
34043
|
+
if (!id || this.token === null || !(error3 instanceof CliApiError) || error3.statusCode !== 404 || error3.code !== "PROJECT_NOT_FOUND")
|
|
34044
|
+
return error3;
|
|
34045
|
+
const target = `/projects/${encodeURIComponent(id)}`;
|
|
34046
|
+
if (path3 !== target && !path3.startsWith(target + "/") && query?.project_id !== id && !(body && typeof body === "object" && "project_id" in body && body.project_id === id))
|
|
34047
|
+
return error3;
|
|
34048
|
+
const identity = await this.call("GET", "/auth/whoami", void 0, void 0, { timeoutMs: 3e3, refresh: false }).then((answer) => {
|
|
34049
|
+
if (typeof answer?.user?.email !== "string")
|
|
34050
|
+
return "";
|
|
34051
|
+
const match = /^([a-z0-9])[^@\s]*@([a-z0-9])[^@\s]*$/i.exec(answer.user.email);
|
|
34052
|
+
return match ? ` Signed in as ${match[1]}\u2026@${match[2]}\u2026.` : "";
|
|
34053
|
+
}).catch(() => "");
|
|
34054
|
+
error3.message = `This sign-in cannot open the project in this folder's .somewhere.json.${identity} Check whether the folder was linked with a different account or CLI configuration.`;
|
|
34055
|
+
return error3;
|
|
34056
|
+
}
|
|
34036
34057
|
/** Run a one-off script against the project's live DEV bindings via the
|
|
34037
34058
|
* dedicated runner worker. Same auth + `{ ok, data }` envelope as call(), but
|
|
34038
34059
|
* rooted at RUNNER_BASE_URL instead of the /v1 API (see that constant for the
|
|
@@ -34067,11 +34088,13 @@ var init_client = __esm({
|
|
|
34067
34088
|
if (err instanceof CliApiError && err.statusCode === 401)
|
|
34068
34089
|
this.checkTemporaryExpiry();
|
|
34069
34090
|
if (!(err instanceof CliApiError) || err.code !== "API_KEY_EXPIRED" || opts?.refresh === false || this.token === null)
|
|
34070
|
-
throw err;
|
|
34091
|
+
throw await this.linkedProjectError(err, path3, body, query);
|
|
34071
34092
|
const refreshed = await this.refreshAccessKey(opts?.timeoutMs);
|
|
34072
34093
|
if (!refreshed)
|
|
34073
34094
|
throw err;
|
|
34074
|
-
return await this.request(method, path3, body, query, opts)
|
|
34095
|
+
return await this.request(method, path3, body, query, opts).catch(async (retryError) => {
|
|
34096
|
+
throw await this.linkedProjectError(retryError, path3, body, query);
|
|
34097
|
+
});
|
|
34075
34098
|
}
|
|
34076
34099
|
}
|
|
34077
34100
|
/** Authenticated request whose body and response remain streams. The body is
|
|
@@ -44243,7 +44266,8 @@ var init_init_agent_guide = __esm({
|
|
|
44243
44266
|
| Yes, staff by domain | Use \`appRole()\` and \`appRoles: { staff: { emailDomain: 'staff.example' } }\`. The address must be verified. |
|
|
44244
44267
|
| 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\`. |
|
|
44245
44268
|
| Either, personal rows | Use \`owner()\`. The platform stamps the owner from the signed-in user. |
|
|
44246
|
-
| Either, shared private row | Use a read-only \`grant()\` for a known app-user ID.
|
|
44269
|
+
| 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\`. |
|
|
44270
|
+
| 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\`. |
|
|
44247
44271
|
| Either, public pages from private drafts | Use conditional \`client.publicRead\`. Anonymous results can be cached for up to 120 seconds. For fresh pages, read with \`sw.db.server.from\` in a page handler, filter for published rows, select public fields, and set \`Cache-Control: no-store\`. |
|
|
44248
44272
|
|
|
44249
44273
|
### Schema and data
|
|
@@ -44253,8 +44277,8 @@ New \`id()\` keys are text. Reference them with \`text({ references: 'table_name
|
|
|
44253
44277
|
Existing integer IDs stay integers. Declare composite uniqueness with \`unique: [['a', 'b']]\`.
|
|
44254
44278
|
|
|
44255
44279
|
- 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).
|
|
44256
|
-
- \`anyOf()\` grants access through either branch. \`allOf()\` requires both the membership gate and the action rule. \`parent()\` inherits the parent row's access.
|
|
44257
|
-
- \`sw.db.from/insert/update/remove\` apply the caller's scope and return \`{ data, count, changes }\`. Use \`where\`, \`columns\`, \`order\`, \`limit\` and \`offset\` for server reads. \`sw.db.tx\` takes an array of write intents. Supply related IDs up front.
|
|
44280
|
+
- \`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\`.
|
|
44281
|
+
- \`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.
|
|
44258
44282
|
- 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.
|
|
44259
44283
|
- For booking and help desk schemas, see \`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\`.
|
|
44260
44284
|
|
|
@@ -44263,17 +44287,24 @@ Use \`client.intake\` for public submissions to a private parent row. See
|
|
|
44263
44287
|
|
|
44264
44288
|
### Routes and auth
|
|
44265
44289
|
|
|
44266
|
-
-
|
|
44290
|
+
- Add React pages where your app handles navigation. To serve a dynamic endpoint such as \`/api/notes/:id\`, create \`api/notes/[id].ts\`. A root \`[...path].ts\` handles document routes, including \`/\`. Underscore-prefixed files are import-only helpers.
|
|
44267
44291
|
- 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\`.
|
|
44268
|
-
- Keep \`api/auth/[...path].ts\`
|
|
44292
|
+
- 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\`.
|
|
44269
44293
|
- 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.
|
|
44270
|
-
- 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.
|
|
44294
|
+
- 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 } })\`.
|
|
44271
44295
|
|
|
44272
44296
|
### Run and verify
|
|
44273
44297
|
|
|
44274
|
-
Prove the brief in \`tests/starter.mjs\` (\`npm test\`, from the app folder, after deploy)
|
|
44298
|
+
Prove the brief in \`tests/starter.mjs\` (\`npm test\`, from the app folder, after deploy), and add new checks to that file rather than writing a new test file. It needs no sign-up form, session code or browser launch:
|
|
44275
44299
|
|
|
44276
|
-
|
|
44300
|
+
- \`app.users('owner', 'member', 'outsider')\` makes signed-in test users. \`app.users({ agent: { roles: ['staff'] } })\` gives a role your schema declares with \`assignedBy: 'server'\`.
|
|
44301
|
+
- Each user, and \`app.signedOut\`, has \`get\`, \`post\`, \`put\`, \`patch\`, \`delete\` and \`data(table, request)\`, each answering \`{ status, body, text, requestId }\`. \`data()\` is the app data endpoint (\`somewhere:data\` in the browser); there is no \`/api/data\` route.
|
|
44302
|
+
- \`app.expect(reply, 403, label)\` and \`app.check(label, ok)\` print PASS or FAIL without stopping the run.
|
|
44303
|
+
- \`await app.refuse([outsider, app.signedOut], [['GET', path], ['DELETE', path]], { lacks: secretText })\` proves each of them is refused each request, all at once. For data endpoint refusals use \`outsider.session.expectRefused('notes', { operation: 'get', id }, { allowed: owner.session })\`.
|
|
44304
|
+
- \`app.page(user, path)\` opens a Playwright page already signed in as that user, for the few checks that need the screen.
|
|
44305
|
+
- \`app.done()\` deletes the test users and sets the exit code.
|
|
44306
|
+
|
|
44307
|
+
If the folder already has Playwright tests, keep running them; put new checks in \`tests/starter.mjs\`. Tests that write change rows in the live app: for an app with real customers, test on a preview (\`somewhere preview\`, then \`openTestApp({ preview: true })\`). After every deploy the platform runs its own smoke check, plus any check lists saved in \`checks/\`; \`somewhere test\` shows the result.
|
|
44277
44308
|
|
|
44278
44309
|
Run \`somewhere typecheck\` before deploying. \`somewhere deploy-check\` checks compilation and schema without publishing. \`somewhere deploy\` uploads raw source directly to production. When testing changes with real users or data, use \`somewhere preview\`, test with \`somewhere test --preview\`, then promote. See \`somewhere docs dev-environments\`. Inspect failures with \`somewhere errors\` and \`somewhere logs\`. Keep test IDs when restyling. See \`somewhere docs test\`.
|
|
44279
44310
|
|
|
@@ -44334,7 +44365,9 @@ try {
|
|
|
44334
44365
|
// Your routes, for example:
|
|
44335
44366
|
// const note = app.expect(await owner.post('/api/notes', { title: 'Draft' }), 200, 'owner adds a note');
|
|
44336
44367
|
// await app.refuse([outsider, app.signedOut], [['GET', \`/api/notes/\${note.id}\`], ['DELETE', \`/api/notes/\${note.id}\`]], { label: 'only the owner' });
|
|
44337
|
-
//
|
|
44368
|
+
// Data endpoint: await app.refuse(outsider, [['DATA', 'notes', { operation: 'get', id: note.id }]], { control: owner });
|
|
44369
|
+
// Screen checks: const page = await app.page(owner, '/'); Playwright comes from this folder, or from
|
|
44370
|
+
// openTestApp({ playwright: '/path/to/node_modules/playwright' }) when it is installed elsewhere.
|
|
44338
44371
|
} catch (error) {
|
|
44339
44372
|
app.check('test ran to the end', false, error);
|
|
44340
44373
|
} finally {
|
|
@@ -44576,16 +44609,12 @@ function createGreenTemplate(appName = "somewhere-starter") {
|
|
|
44576
44609
|
},
|
|
44577
44610
|
{ path: "src/App.tsx", content: APP },
|
|
44578
44611
|
{ path: "src/main.tsx", content: MAIN },
|
|
44579
|
-
{ path: "src/services/greeting.ts", content: SERVICE },
|
|
44580
44612
|
{ path: "src/styles.css", content: STYLES },
|
|
44581
|
-
{ path: "api/greeting.ts", content: API },
|
|
44582
44613
|
{ path: "api/auth/[...path].ts", content: "export { somewhereAuth as default } from '@somewhere-cloud/sdk/server';\n" },
|
|
44583
|
-
{ path: "db/schema.ts", content: SCHEMA },
|
|
44584
|
-
{ path: "types/app.ts", content: APP_TYPES },
|
|
44585
44614
|
ASSET_TYPES_FILE
|
|
44586
44615
|
];
|
|
44587
44616
|
}
|
|
44588
|
-
var packageJson, TSCONFIG,
|
|
44617
|
+
var packageJson, TSCONFIG, APP, MAIN, STYLES, README;
|
|
44589
44618
|
var init_init_green_template = __esm({
|
|
44590
44619
|
"dist/lib/init-green-template.js"() {
|
|
44591
44620
|
"use strict";
|
|
@@ -44638,67 +44667,11 @@ var init_init_green_template = __esm({
|
|
|
44638
44667
|
"include": ["src", "api", "db", "types", "*.ts"]
|
|
44639
44668
|
}
|
|
44640
44669
|
`;
|
|
44641
|
-
|
|
44642
|
-
message: string;
|
|
44643
|
-
}
|
|
44644
|
-
`;
|
|
44645
|
-
SCHEMA = `// Starter table. To replace the greeting with your app, declare your own tables here
|
|
44646
|
-
// (a schema needs at least one) and delete the greeting files: api/greeting.ts,
|
|
44647
|
-
// src/services/greeting.ts, types/app.ts and the greeting code in src/App.tsx. Then:
|
|
44648
|
-
// - Never deployed: delete the greetings table below.
|
|
44649
|
-
// - Already deployed: replace it with \`greetings: removedTable()\` (import removedTable
|
|
44650
|
-
// from 'somewhere/db'). The deploy retires it and keeps its rows for 30 days;
|
|
44651
|
-
// declaring it again within 30 days restores them. Leave it declared to keep it.
|
|
44652
|
-
// - Unsure: delete it and run \`somewhere deploy-check .\`. A deployed table is refused
|
|
44653
|
-
// with SCHEMA_DEPLOY_REFUSED naming it and nothing changes; then use removedTable().
|
|
44654
|
-
import { id, schema, serverOnly, table, text } from 'somewhere/db';
|
|
44655
|
-
|
|
44656
|
-
export default schema({
|
|
44657
|
-
greetings: table({
|
|
44658
|
-
id: id(),
|
|
44659
|
-
message: text({ default: 'Your full-stack app is ready.' }),
|
|
44660
|
-
}, {
|
|
44661
|
-
scope: serverOnly(),
|
|
44662
|
-
}),
|
|
44663
|
-
});
|
|
44664
|
-
`;
|
|
44665
|
-
API = `// Starter endpoint. To remove the greeting, follow the steps at the top of db/schema.ts.
|
|
44666
|
-
export default sw.endpoint({
|
|
44667
|
-
auth: 'none', // deliberate: public and read-only; anyone can fetch the greeting
|
|
44668
|
-
handler: async (_input, sw) => {
|
|
44669
|
-
const result = await sw.db.from('greetings', { limit: 1 });
|
|
44670
|
-
const message = result.data[0]?.message;
|
|
44671
|
-
return { message: typeof message === 'string' ? message : 'Your full-stack app is ready.' };
|
|
44672
|
-
},
|
|
44673
|
-
});
|
|
44674
|
-
`;
|
|
44675
|
-
SERVICE = `import type { GreetingResponse } from '../../types/app';
|
|
44676
|
-
|
|
44677
|
-
export async function loadGreeting(): Promise<GreetingResponse> {
|
|
44678
|
-
const response = await fetch('/api/greeting');
|
|
44679
|
-
if (!response.ok) throw new Error(\`Request failed (\${response.status})\`);
|
|
44680
|
-
return response.json() as Promise<GreetingResponse>;
|
|
44681
|
-
}
|
|
44682
|
-
`;
|
|
44683
|
-
APP = `import { useEffect, useState } from 'react';
|
|
44684
|
-
import { loadGreeting } from './services/greeting';
|
|
44685
|
-
|
|
44686
|
-
export function App() {
|
|
44687
|
-
const [message, setMessage] = useState('Connecting frontend, function, and database\u2026');
|
|
44688
|
-
|
|
44689
|
-
useEffect(() => {
|
|
44690
|
-
void loadGreeting()
|
|
44691
|
-
.then((result) => setMessage(result.message))
|
|
44692
|
-
.catch((error: unknown) => {
|
|
44693
|
-
setMessage(error instanceof Error ? error.message : 'Could not load the greeting.');
|
|
44694
|
-
});
|
|
44695
|
-
}, []);
|
|
44696
|
-
|
|
44670
|
+
APP = `export function App() {
|
|
44697
44671
|
return (
|
|
44698
44672
|
<main>
|
|
44699
44673
|
<p className="eyebrow">somewhere.cloud starter</p>
|
|
44700
|
-
<h1>Start
|
|
44701
|
-
<p className="message">{message}</p>
|
|
44674
|
+
<h1>Start building your app.</h1>
|
|
44702
44675
|
<p className="hint">Edit <code>src/App.tsx</code>, then deploy the raw source.</p>
|
|
44703
44676
|
</main>
|
|
44704
44677
|
);
|
|
@@ -44726,7 +44699,6 @@ body { margin: 0; min-width: 320px; }
|
|
|
44726
44699
|
main { width: min(720px, calc(100% - 32px)); margin: 14vh auto; }
|
|
44727
44700
|
h1 { max-width: 660px; margin: 12px 0 24px; font-size: clamp(2.7rem, 8vw, 5.5rem); line-height: .94; letter-spacing: -.06em; }
|
|
44728
44701
|
.eyebrow { color: #14734c; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; }
|
|
44729
|
-
.message { padding: 20px 22px; border: 1px solid #c6d8ce; border-radius: 16px; background: rgba(255, 255, 255, .82); }
|
|
44730
44702
|
.hint { color: #4f665b; }
|
|
44731
44703
|
code { color: #0e6542; }
|
|
44732
44704
|
`;
|
|
@@ -44734,19 +44706,11 @@ code { color: #0e6542; }
|
|
|
44734
44706
|
|
|
44735
44707
|
${PROJECT_LINK_README}
|
|
44736
44708
|
|
|
44737
|
-
|
|
44738
|
-
|
|
44739
|
-
|
|
44740
|
-
the greeting message; add caller authorization before serving private data.
|
|
44741
|
-
The SDK and \`api/auth/[...path].ts\` are included; add your sign-in UI or use
|
|
44742
|
-
\`somewhere init --template auth\` for the complete sign-in screens.
|
|
44743
|
-
|
|
44744
|
-
To replace the greeting, follow the steps at the top of \`db/schema.ts\`;
|
|
44745
|
-
they cover a table that was never deployed, one that was, and not knowing
|
|
44746
|
-
which. A missing optional include directory is harmless.
|
|
44709
|
+
Start with a React page and the SDK auth route at \`api/auth/[...path].ts\`.
|
|
44710
|
+
Edit \`src/App.tsx\` to build your UI, or choose \`somewhere init --template auth\`
|
|
44711
|
+
when you want generated sign-in screens.
|
|
44747
44712
|
|
|
44748
|
-
|
|
44749
|
-
it is not the default for your app's data. Choose fitting declared access
|
|
44713
|
+
Choose fitting declared access
|
|
44750
44714
|
before the first deploy: \`owner()\` for personal rows, \`group()\` for teams,
|
|
44751
44715
|
and \`anyOf()\` for combined access. For booking and help-desk rules, read:
|
|
44752
44716
|
\`somewhere docs sw.db --section provider-or-booker-and-owner-or-staff-recipes\`
|
|
@@ -44779,8 +44743,8 @@ var init_skills_pack_generated = __esm({
|
|
|
44779
44743
|
BUNDLED_SKILLS_PACK = {
|
|
44780
44744
|
"schema": 1,
|
|
44781
44745
|
"name": "somewhere-skills",
|
|
44782
|
-
"version": "1+
|
|
44783
|
-
"sha256": "
|
|
44746
|
+
"version": "1+1e0c3eaa6dc4",
|
|
44747
|
+
"sha256": "1e0c3eaa6dc4845dd123571f032574719560336e5e097641958e556a2c4dfe7d",
|
|
44784
44748
|
"files": [
|
|
44785
44749
|
{
|
|
44786
44750
|
"path": "adopt/SKILL.md",
|
|
@@ -44789,13 +44753,13 @@ var init_skills_pack_generated = __esm({
|
|
|
44789
44753
|
},
|
|
44790
44754
|
{
|
|
44791
44755
|
"path": "deploy-verify-loop/SKILL.md",
|
|
44792
|
-
"sha256": "
|
|
44793
|
-
"content":
|
|
44756
|
+
"sha256": "9052b1165f2d5707d3cd13193422bbdfad5b43b854f899aaa027ba60c7e1abcd",
|
|
44757
|
+
"content": "---\nname: deploy-verify-loop\ndescription: After edits: typecheck, deploy, and prove the change as each kind of user in the starter test file (npm test).\n---\n\n# Deploy, verify, read the failure\n\n## The loop\n\nAsk before destructive or paid actions unless the user already authorized them.\n\n```bash\nnpx somewhere typecheck\nnpx somewhere deploy\n```\n\nDon't bundle the source yourself; the platform runs the frontend build.\n\nRun `somewhere claim` and open its link to keep a temporary app.\n\n```bash\nsomewhere deploy-check --run /api/hello -X POST -d '{\"name\":\"Ada\"}'\n```\n\n| Step | Command | What it tells you |\n|---|---|---|\n| Verify | `somewhere verify [--flow flow.json]` | Runs the live app at desktop and phone sizes: named steps, console/network health, both screenshots. |\n| Inspect | `somewhere browser [target]` | One page: screenshot, snapshot, DOM, network, or an evaluated expression. |\n| Diagnose | `somewhere logs --tail 10`, `somewhere errors` | Recent function output, then failures split into refused and exception. `errors` also works on a temporary project. |\n\n## Test as each kind of user\n\n```js\nimport { openTestApp } from '@somewhere-cloud/cli/testing';\n\nconst app = await openTestApp();\ntry {\n const { owner, member, outsider } = await app.users('owner', 'member', 'outsider');\n const team = app.expect(await owner.post('/api/teams', { name: 'T' }), 200, 'owner creates a team');\n app.expect(await owner.post(`/api/teams/${team.id}/members`, { email: member.email }), 200, 'owner adds member');\n app.expect(await member.get(`/api/teams/${team.id}/tasks`), 200, 'member reads tasks');\n await app.refuse([outsider, app.signedOut], [['GET', `/api/teams/${team.id}/tasks`],\n ['DELETE', `/api/teams/${team.id}`]], { lacks: member.email, label: 'only the team' });\n const page = await app.page(member, `/teams/${team.id}`);\n app.check('member sees the team on screen', await page.getByText('T').first().isVisible());\n} catch (error) {\n app.check('test ran to the end', false, error);\n} finally {\n await app.done();\n}\n```\n\nAlready have Playwright tests in the folder? Keep running them, and put new checks in this file: `app.page(user, path)` replaces the sign-up and sign-in steps they repeat.\n\n## Failure 1: the live site still shows the old version\n\nBrowser or CDN cache. Hard-reload (Cmd-Shift-R), or check with `curl -sI https://{subdomain}.somewhere.site`.\n\n## Failure 2: a route fails\n\nShow recent failures with a `kind` column: **refused** for a 4xx your own handler returned on purpose, **exception** for an uncaught throw or a 5xx.\n\nThe `stack` field is the single most useful field for debugging \u2014 it tells you the exact file + line in your code where the throw originated.\n\n| `somewhere rollback [project]` | `-y, --yes`, `--json` | Select the previous retained production release. By default this changes code without restoring data. |\n\nSources (`somewhere docs <topic>`): cli, common-mistakes, deploy, getting-started, test, troubleshooting.\n"
|
|
44794
44758
|
},
|
|
44795
44759
|
{
|
|
44796
44760
|
"path": "schema-changes/SKILL.md",
|
|
44797
|
-
"sha256": "
|
|
44798
|
-
"content": "---\nname: schema-changes\ndescription: Before adding, changing, or removing a table or column in db/schema.ts.\n---\n\n# Change the database schema safely\n\n## The file is the contract\n\nThe default `somewhere init` starter has no `db/schema.ts`: create it at the project root, or run `somewhere init --name my-app --features private-data` to start with a schema.\n\n```ts\n// db/schema.ts\nimport { id, owner, schema, table, text, timestamp } from 'somewhere/db';\n\nexport default schema({\n notes: table(\n {\n id: id(),\n title: text(),\n body: text({ default: '' }),\n created_at: timestamp({ default: 'now' }),\n },\n {\n scope: owner(),\n client: {\n read: ['id', 'title', 'body', 'created_at'],\n create: ['title', 'body'],\n update: ['title', 'body'],\n delete: true,\n },\n },\n ),\n});\n```\n\nA table without a `client` block can't be reached from the browser at all.\n\nDelete a never-deployed starter table's declaration and references. A `removedTable()` marker for it is a no-op. **Removing a table** is `old_table: removedTable()`. The deploy keeps the table while your previous version is still serving; once the new version is live it retires the table and keeps its data for 30 days.\n\nRun `somewhere typecheck` before deploying schema changes.\n\n## What a deploy does with it\n\n- **Additive changes apply**: a new table, a new nullable-or-defaulted column, a new index, a new unique group. Unchanged schema is a no-op.\n- **Unmarked removals and shape changes refuse** with `409 SCHEMA_DEPLOY_REFUSED` and a message naming the change.\n- **
|
|
44761
|
+
"sha256": "05a028ec47a901a07151b912e4ac967e3535a10163a3ffdb83c9ec2bd5a48a1a",
|
|
44762
|
+
"content": "---\nname: schema-changes\ndescription: Before adding, changing, or removing a table or column in db/schema.ts.\n---\n\n# Change the database schema safely\n\n## The file is the contract\n\nThe default `somewhere init` starter has no `db/schema.ts`: create it at the project root, or run `somewhere init --name my-app --features private-data` to start with a schema.\n\n```ts\n// db/schema.ts\nimport { id, owner, schema, table, text, timestamp } from 'somewhere/db';\n\nexport default schema({\n notes: table(\n {\n id: id(),\n title: text(),\n body: text({ default: '' }),\n created_at: timestamp({ default: 'now' }),\n },\n {\n scope: owner(),\n client: {\n read: ['id', 'title', 'body', 'created_at'],\n create: ['title', 'body'],\n update: ['title', 'body'],\n delete: true,\n },\n },\n ),\n});\n```\n\nA table without a `client` block can't be reached from the browser at all.\n\nChoose the `parent({ author })` column and its author permissions in the table's first deploy. To change them on a deployed table, declare a new table with the desired rule and move the rows from server code.\n\nDelete a never-deployed starter table's declaration and references. A `removedTable()` marker for it is a no-op. **Removing a table** is `old_table: removedTable()`. The deploy keeps the table while your previous version is still serving; once the new version is live it retires the table and keeps its data for 30 days.\n\nRun `somewhere typecheck` before deploying schema changes.\n\n## What a deploy does with it\n\n- **Additive changes apply**: a new table, a new nullable-or-defaulted column, a new index, a new unique group. Unchanged schema is a no-op.\n- **Unmarked removals and shape changes refuse** with `409 SCHEMA_DEPLOY_REFUSED` and a message naming the change.\n- **Supported table scope changes apply in place.** See Two worlds for the supported transitions, including role-list edits on an existing `group()` or `appRole()` rule.\n- **Column rules and child author rules are set on a new table.** A deploy refuses additions, edits or removals of `columns` rules (`write` and `memberOf`) or `parent({ author })` rules on a deployed table. Keep its current declaration and handle the operation in an authorized server endpoint, closing any direct browser write path that could bypass the endpoint. To change the declared rule, create a new table with the desired rule and migrate the rows from server code.\n- a production deploy or a promotion that would remove or rename a column is refused before anything changes, so a running release never loses a column it uses. Keep the column declared and leave its data in place.\n\n## Failure: raw SQL refused after the schema file deploys\n\nOn an older shared database, ordinary `sw.db.query` / `sw.db.batch` fail before transport with `MANAGED_RAW_SQL_REQUIRES_SERVER_AUTHORITY`, including in job, queue, and cron handlers; with a separate SQL database they run there and never see declared tables. Fix: write with `sw.db.insert` / `sw.db.update` / `sw.db.remove` (the table needs a declared intent)\n\nSources (`somewhere docs <topic>`): declared-data, getting-started, sw.db, troubleshooting.\n"
|
|
44799
44763
|
},
|
|
44800
44764
|
{
|
|
44801
44765
|
"path": "sign-in-setup/SKILL.md",
|
|
@@ -48631,13 +48595,13 @@ export const SHOW_EMAIL_VERIFICATION = false;
|
|
|
48631
48595
|
}
|
|
48632
48596
|
function schemaTs(privateData, agent) {
|
|
48633
48597
|
if (!agent)
|
|
48634
|
-
return
|
|
48598
|
+
return SCHEMA;
|
|
48635
48599
|
const imports = `import { id, owner, schema, table, text, timestamp } from 'somewhere/db';
|
|
48636
48600
|
|
|
48637
48601
|
`;
|
|
48638
48602
|
if (!privateData)
|
|
48639
48603
|
return imports + AGENT_SCHEMA_NOTE + "export default schema({\n" + AGENT_TABLES + "});\n";
|
|
48640
|
-
const notes =
|
|
48604
|
+
const notes = SCHEMA.slice(SCHEMA.indexOf("// notes:"));
|
|
48641
48605
|
return imports + AGENT_SCHEMA_NOTE + notes.replace(/\n\}\);\n$/, "\n" + AGENT_TABLES + "});\n");
|
|
48642
48606
|
}
|
|
48643
48607
|
function homePage(privateData, agent) {
|
|
@@ -48867,7 +48831,7 @@ function createFeatureTemplate(selection, options2) {
|
|
|
48867
48831
|
}
|
|
48868
48832
|
return files;
|
|
48869
48833
|
}
|
|
48870
|
-
var packageJson2, TSCONFIG2, AUTH_API, AUTH_TYPES, PROVIDER_SIGN_IN_HOOK, AUTH_CALLBACK_PAGE, AUTH_SERVICE, AUTH_HOOKS, ROUTES, APP2,
|
|
48834
|
+
var packageJson2, TSCONFIG2, AUTH_API, AUTH_TYPES, PROVIDER_SIGN_IN_HOOK, AUTH_CALLBACK_PAGE, AUTH_SERVICE, AUTH_HOOKS, ROUTES, APP2, SCHEMA, NOTES_TYPES, NOTES_SERVICE, USE_NOTES, AGENT_TABLES, AGENT_SCHEMA_NOTE, CHAT_API, PROPOSALS_API, ASSISTANT_TYPES, ASSISTANT_SERVICE, USE_ASSISTANT, ASSISTANT_FIXTURES, ASSISTANT_FIXTURES_PAGE, ASSISTANT_FIXTURES_FLOW, STYLED_ASSISTANT_PANEL, PLAIN_ASSISTANT_PANEL, MFA_HOOK, MFA_VIEW, SIGN_IN_PAGE, SIGNED_IN_LAYOUT, NOTE_DETAIL_PAGE, DETAIL_PAGE, NOT_FOUND_PAGE, STYLED_FEEDBACK, STYLED_APP_SHELL, STYLED_NOTES_BOARD, PLAIN_FEEDBACK, PLAIN_APP_SHELL, PLAIN_NOTES_BOARD, NOTES_CSS, ASSISTANT_CSS, MAGIC_LINK_TYPES, MAGIC_LINK_HOOKS, CONNECTION_RETURN, MAGIC_LINK_PAGE, MAGIC_SIGN_IN_PAGE, STYLED_MAGIC_LINK, PLAIN_MAGIC_LINK, FORGOT_PASSWORD_API, RESET_PASSWORD_API, PASSWORD_RESET_PAGE, VERIFY_EMAIL_HOOK, PLAIN_VERIFY_EMAIL;
|
|
48871
48835
|
var init_init_feature_template = __esm({
|
|
48872
48836
|
"dist/lib/init-feature-template.js"() {
|
|
48873
48837
|
"use strict";
|
|
@@ -49370,7 +49334,7 @@ function PrivateRoutes({ user }: { user: User }) {
|
|
|
49370
49334
|
__name(mainTsx, "mainTsx");
|
|
49371
49335
|
__name(mainTsxWithFixtures, "mainTsxWithFixtures");
|
|
49372
49336
|
__name(configTs, "configTs");
|
|
49373
|
-
|
|
49337
|
+
SCHEMA = `import { id, owner, schema, table, text } from 'somewhere/db';
|
|
49374
49338
|
|
|
49375
49339
|
// notes: owner() gives each signed-in user their own rows through the
|
|
49376
49340
|
// generated somewhere:data client, so the browser code sends no user filter.
|
|
@@ -51970,10 +51934,10 @@ the SDK client in src/services/auth.ts, hooks in src/auth/, pages in src/pages/,
|
|
|
51970
51934
|
replaceable views in src/ui/ and styles in src/styles/, plus an AGENTS.md workflow
|
|
51971
51935
|
(deploy, then test). Sign-in and invitation links (sw.auth.invite) open
|
|
51972
51936
|
/auth/magic, which the starter routes before the sign-in gate.
|
|
51973
|
-
\`--template minimal\` includes the SDK and auth route without sign-in screens.
|
|
51937
|
+
\`--template minimal\` includes the SDK and auth route without sign-in screens. Add the notes example with --features auth,private-data.
|
|
51974
51938
|
Init installs React, the SDK and editor types. The platform builds your source when you deploy.
|
|
51975
51939
|
TypeScript is fetched when first needed. Vite and Playwright are installed only if you choose to use them.
|
|
51976
|
-
New starters and --bare also install
|
|
51940
|
+
New starters and --bare also install agent skills in .agents/skills, pinned by skills-lock.json.
|
|
51977
51941
|
|
|
51978
51942
|
For a live app, run \`${cliInvocation()} pull <app>\` to get its source.
|
|
51979
51943
|
|
|
@@ -52079,7 +52043,7 @@ async function runInit(opts, command) {
|
|
|
52079
52043
|
}
|
|
52080
52044
|
try {
|
|
52081
52045
|
const scaffold = writeInitScaffold(dir, scaffoldFiles(localName));
|
|
52082
|
-
const skills = writeInitSkills(dir);
|
|
52046
|
+
const skills = await writeInitSkills(dir);
|
|
52083
52047
|
const next = [`${cliInvocation()} deploy`, `${cliInvocation()} docs start`];
|
|
52084
52048
|
if (!opts.json)
|
|
52085
52049
|
info(INSTALL_STARTER_MESSAGE);
|
|
@@ -52130,7 +52094,7 @@ async function runInit(opts, command) {
|
|
|
52130
52094
|
try {
|
|
52131
52095
|
await linkExisting(client, dir, opts.project, Boolean(opts.json), false, shouldScaffold ? async (project) => {
|
|
52132
52096
|
writeInitScaffold(dir, scaffoldFiles(project.name));
|
|
52133
|
-
writeInitSkills(dir);
|
|
52097
|
+
await writeInitSkills(dir);
|
|
52134
52098
|
await installInitDependencies({ cwd: dir, quiet: Boolean(opts.json) });
|
|
52135
52099
|
} : void 0);
|
|
52136
52100
|
} catch (err) {
|
|
@@ -52184,11 +52148,11 @@ async function runInit(opts, command) {
|
|
|
52184
52148
|
});
|
|
52185
52149
|
if (shouldScaffold) {
|
|
52186
52150
|
writeInitScaffold(dir, scaffoldFiles(project.name));
|
|
52187
|
-
writeInitSkills(dir);
|
|
52151
|
+
await writeInitSkills(dir);
|
|
52188
52152
|
await installInitDependencies({ cwd: dir, quiet: true });
|
|
52189
52153
|
} else if (opts.bare) {
|
|
52190
52154
|
writeBareGuide(dir);
|
|
52191
|
-
writeInitSkills(dir);
|
|
52155
|
+
await writeInitSkills(dir);
|
|
52192
52156
|
}
|
|
52193
52157
|
recordPinIfMissing(dir, CLI_VERSION2);
|
|
52194
52158
|
printJson({
|
|
@@ -52210,7 +52174,7 @@ async function runInit(opts, command) {
|
|
|
52210
52174
|
if (shouldScaffold) {
|
|
52211
52175
|
const scaffold = writeInitScaffold(dir, scaffoldFiles(project.name));
|
|
52212
52176
|
success(`Full-stack starter written to ${dir} (${scaffold.created.length} files)`);
|
|
52213
|
-
reportSkills(writeInitSkills(dir));
|
|
52177
|
+
reportSkills(await writeInitSkills(dir));
|
|
52214
52178
|
if (template !== "minimal" || plan) {
|
|
52215
52179
|
const selection = plan?.selection ?? DEFAULT_AUTH_SELECTION;
|
|
52216
52180
|
info(`Modules: ${describeSelection(selection)}`);
|
|
@@ -52223,7 +52187,7 @@ async function runInit(opts, command) {
|
|
|
52223
52187
|
} else if (opts.bare) {
|
|
52224
52188
|
info("Bare project: no starter source or dependencies were added.");
|
|
52225
52189
|
const guide = writeBareGuide(dir);
|
|
52226
|
-
reportSkills(writeInitSkills(dir));
|
|
52190
|
+
reportSkills(await writeInitSkills(dir));
|
|
52227
52191
|
if (guide.created.length)
|
|
52228
52192
|
success(`Agent workflow guide written (${guide.created.join(", ")})`);
|
|
52229
52193
|
if (guide.kept.length)
|
|
@@ -52373,13 +52337,18 @@ async function linkExisting(client, dir, projectRef3, json = false, configureMcp
|
|
|
52373
52337
|
console.log("");
|
|
52374
52338
|
printNext({ stage: "init", scaffolded: false });
|
|
52375
52339
|
}
|
|
52376
|
-
function writeInitSkills(dir) {
|
|
52340
|
+
async function writeInitSkills(dir) {
|
|
52377
52341
|
if (readLock(dir))
|
|
52378
52342
|
return { kept: `${SKILLS_LOCK} already present` };
|
|
52379
|
-
const
|
|
52343
|
+
const latest = await fetchLatestPack().catch((err) => {
|
|
52344
|
+
warn(`Could not fetch the latest skills pack: ${err instanceof Error ? err.message : String(err)} Using this CLI's bundled pack.`);
|
|
52345
|
+
return null;
|
|
52346
|
+
});
|
|
52347
|
+
const pack = latest ?? BUNDLED_SKILLS_PACK;
|
|
52348
|
+
const taken = skillNames(pack).filter((name) => existsSync9(join10(dir, SKILLS_DIR, name)) || existsSync9(join10(dir, CLAUDE_SKILLS_DIR, name)));
|
|
52380
52349
|
if (taken.length)
|
|
52381
52350
|
return { kept: `Project skills ${taken.join(", ")} already exist` };
|
|
52382
|
-
return installSkills(dir,
|
|
52351
|
+
return installSkills(dir, pack, { cli: CLI_VERSION2, source: latest ? "docs-host" : "bundled" });
|
|
52383
52352
|
}
|
|
52384
52353
|
function reportPin(dir) {
|
|
52385
52354
|
recordPinIfMissing(dir, CLI_VERSION2);
|
|
@@ -52431,7 +52400,7 @@ var init_init = __esm({
|
|
|
52431
52400
|
init_output();
|
|
52432
52401
|
INSTALL_STARTER_MESSAGE = "Installing the starter's pinned dependencies with `npm install` (downloads from npm and runs package install scripts)\u2026";
|
|
52433
52402
|
INIT_TEMPLATES = ["auth", "minimal", "bare"];
|
|
52434
|
-
DEFAULT_AUTH_SELECTION = { requested: ["auth"
|
|
52403
|
+
DEFAULT_AUTH_SELECTION = { requested: ["auth"], added: [], modules: ["auth"], ui: "styled" };
|
|
52435
52404
|
__name(registerInit, "registerInit");
|
|
52436
52405
|
__name(runInit, "runInit");
|
|
52437
52406
|
__name(planFeatures, "planFeatures");
|
|
@@ -75189,7 +75158,7 @@ var init_typecheck = __esm({
|
|
|
75189
75158
|
PAGE_LIMIT_EXPLANATION = "A data list call reads at most 100 rows: limit must be a number from 1 to 100. Read further pages with { after: page.next } while page.has_more is true.";
|
|
75190
75159
|
__name(explainPageLimit, "explainPageLimit");
|
|
75191
75160
|
DIAGNOSTIC_HINTS = [
|
|
75192
|
-
{ matches: /SomewhereDb(?:Caller)?WriteIntent|__SomewhereDbIntentFor|readonly.*WriteIntent/, hint: `sw.db.
|
|
75161
|
+
{ matches: /SomewhereDb(?:Caller)?WriteIntent|__SomewhereDbIntentFor|readonly.*WriteIntent/, hint: `Pass write intents as an array, e.g. sw.db.tx([{ op: "insert", table: "notes", values: { title } }]). For a separately declared array, use satisfies Parameters<typeof sw.db.tx>[0] to check the operation, table and columns where you declare it. An inline array or an explicit as const also preserves literal operation and table names. Use the type of sw.db.server.tx for server writes. ${cliInvocation()} docs sw.db --section swdbtxintents-all-or-nothing-composed-writes` },
|
|
75193
75162
|
{ matches: /Expected 2 arguments, but got 3/, hint: `Database update shape: sw.db.update(table, { where: { id }, set: { title } }). ${cliInvocation()} docs sw.db --section builder-verbs-and-where-shapes` },
|
|
75194
75163
|
{ matches: /\border\b.*does not exist|limit\?: undefined|A data list call reads at most 100/, hint: "Browser list: limit 1\u2013100; paginate with after. Sort in the client or use a server endpoint." },
|
|
75195
75164
|
{ matches: /`\$\{number\}\/second`/, hint: "rateLimit is text: rateLimit: '30/minute' (per second, minute, hour or day), not an object." },
|
|
@@ -78744,18 +78713,18 @@ function formatChecksReport(check) {
|
|
|
78744
78713
|
const coverage = check?.not_checked ?? null;
|
|
78745
78714
|
if (coverage) {
|
|
78746
78715
|
if (typeof check?.routes_discovered === "number")
|
|
78747
|
-
lines.push(`${check.routes_checked
|
|
78716
|
+
lines.push(check.routes_checked ? `${check.routes_checked} of ${check.routes_discovered} app routes had a completed read check.` : `Your ${check.routes_discovered} app routes are checked by your own tests (npm test), not here: this check covers your tables, pages and saved checks/ lists.`);
|
|
78748
78717
|
const { routes_without_read_check: reads, routes_without_write_check: writes, schedules_not_run: schedules, other } = coverage;
|
|
78749
78718
|
if (reads === null || writes === null)
|
|
78750
78719
|
lines.push("App route coverage could not be listed.");
|
|
78751
|
-
if (reads?.length)
|
|
78720
|
+
if (reads?.length && check?.routes_checked)
|
|
78752
78721
|
lines.push(`${reads.length} ${reads.length === 1 ? "route" : "routes"} without a read check (${reads.join(", ")}).`);
|
|
78753
|
-
if (writes?.length)
|
|
78722
|
+
if (writes?.length && check?.routes_checked)
|
|
78754
78723
|
lines.push(`${writes.length} ${writes.length === 1 ? "route" : "routes"} without a write check (${writes.join(", ")}).`);
|
|
78755
78724
|
if (schedules === null)
|
|
78756
78725
|
lines.push("Registered schedules could not be listed.");
|
|
78757
78726
|
if (schedules?.length)
|
|
78758
|
-
lines.push(
|
|
78727
|
+
lines.push(`This check skips scheduled tasks (${schedules.join(", ")}). To verify one on your preview, use ${cliInvocation()} cron run <name> --preview --wait.`);
|
|
78759
78728
|
if (other.length)
|
|
78760
78729
|
lines.push(`Other checks skipped or out of scope: ${other.join(", ")}.`);
|
|
78761
78730
|
} else {
|
|
@@ -80103,8 +80072,8 @@ function productionControl(client, target, options2 = {}) {
|
|
|
80103
80072
|
}
|
|
80104
80073
|
};
|
|
80105
80074
|
}
|
|
80106
|
-
async function openProductionControl(projectId, target) {
|
|
80107
|
-
const client = new ApiClient(getToken());
|
|
80075
|
+
async function openProductionControl(projectId, target, fromProjectFile = false) {
|
|
80076
|
+
const client = new ApiClient(getToken(), fromProjectFile ? projectId : void 0);
|
|
80108
80077
|
return productionControl(client, target ?? await loadTestTarget(client, projectId));
|
|
80109
80078
|
}
|
|
80110
80079
|
function previewFailure(error3, what) {
|
|
@@ -85109,7 +85078,7 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
|
|
|
85109
85078
|
} else {
|
|
85110
85079
|
token = getToken();
|
|
85111
85080
|
}
|
|
85112
|
-
const client = new ApiClient(token);
|
|
85081
|
+
const client = new ApiClient(token, !opts.project && !besideRealLogin ? foundProjectEntry?.config.project_id : void 0);
|
|
85113
85082
|
let scope;
|
|
85114
85083
|
if (opts.scope !== void 0) {
|
|
85115
85084
|
if (opts.scope !== "functions" && opts.scope !== "static") {
|
|
@@ -85749,7 +85718,7 @@ ${dim("Build")}`);
|
|
|
85749
85718
|
process.exit(1);
|
|
85750
85719
|
}
|
|
85751
85720
|
if (err instanceof CliApiError && targetFromLink && !deployAnswered && (err.code === "PROJECT_NOT_FOUND" || err.code === "FORBIDDEN" && err.statusCode === 403)) {
|
|
85752
|
-
const message3 = formatLinkedProjectAccessRefusal(!tempSession, dir);
|
|
85721
|
+
const message3 = err.statusCode === 404 ? `${err.message} To publish a new project instead and update .somewhere.json, run \`${newProjectCommand(dir)}\`.` : formatLinkedProjectAccessRefusal(!tempSession, dir);
|
|
85753
85722
|
if (opts.json) {
|
|
85754
85723
|
printJsonError(err.code, message3, {
|
|
85755
85724
|
...platformErrorEnvelope(err)?.extra ?? {},
|
|
@@ -86337,7 +86306,7 @@ function registerDeploys(program2) {
|
|
|
86337
86306
|
const deploys = program2.command("deploys").description("List recent deploys with their time, note and restore command.").option("--project <ref>", "Project ID or subdomain (defaults to the linked project)").option("--json", "Print deploy history as JSON").action(async (options2) => {
|
|
86338
86307
|
try {
|
|
86339
86308
|
const project = projectRef(options2.project);
|
|
86340
|
-
const result = await new ApiClient(getToken()).call("GET", `/projects/${encodeURIComponent(project)}/deploys`);
|
|
86309
|
+
const result = await new ApiClient(getToken(), options2.project ? void 0 : project).call("GET", `/projects/${encodeURIComponent(project)}/deploys`);
|
|
86341
86310
|
if (options2.json)
|
|
86342
86311
|
return printJson(result);
|
|
86343
86312
|
if (result.deploys.length === 0)
|
|
@@ -86359,8 +86328,9 @@ function registerDeploys(program2) {
|
|
|
86359
86328
|
const options2 = command.optsWithGlobals();
|
|
86360
86329
|
try {
|
|
86361
86330
|
const version2 = deployVersion(versionArg);
|
|
86362
|
-
const
|
|
86363
|
-
|
|
86331
|
+
const project = projectRef(options2.project);
|
|
86332
|
+
const result = await new ApiClient(getToken(), options2.project ? void 0 : project).call("PATCH", "/deploy/note", {
|
|
86333
|
+
project_id: project,
|
|
86364
86334
|
version: version2,
|
|
86365
86335
|
message: message3
|
|
86366
86336
|
});
|
|
@@ -86374,7 +86344,7 @@ function registerDeploys(program2) {
|
|
|
86374
86344
|
program2.command("file <path>").description("Print one deployed source file. Redirect stdout to save it.").requiredOption("--version <number>", "Retained production version to read (required)").option("--project <ref>", "Project ID or subdomain (defaults to the linked project)").action(async (path3, options2) => {
|
|
86375
86345
|
const project = projectRef(options2.project);
|
|
86376
86346
|
const version2 = deployVersion(options2.version);
|
|
86377
|
-
const file = await new ApiClient(getToken()).call("GET", "/deploy/file", void 0, { project_id: project, path: path3, version: version2 });
|
|
86347
|
+
const file = await new ApiClient(getToken(), options2.project ? void 0 : project).call("GET", "/deploy/file", void 0, { project_id: project, path: path3, version: version2 });
|
|
86378
86348
|
process.stdout.write(Buffer.from(file.content, file.encoding));
|
|
86379
86349
|
});
|
|
86380
86350
|
}
|
|
@@ -89634,7 +89604,6 @@ function registerLogs(program2) {
|
|
|
89634
89604
|
process.exit(1);
|
|
89635
89605
|
}
|
|
89636
89606
|
const token = getToken();
|
|
89637
|
-
const client = new ApiClient(token);
|
|
89638
89607
|
const chosen = chooseProjectRef(project, opts.project);
|
|
89639
89608
|
if (chosen.kind === "conflict") {
|
|
89640
89609
|
error(projectRefConflictMessage(chosen));
|
|
@@ -89649,6 +89618,7 @@ function registerLogs(program2) {
|
|
|
89649
89618
|
}
|
|
89650
89619
|
projectId = config2.project_id;
|
|
89651
89620
|
}
|
|
89621
|
+
const client = new ApiClient(token, chosen.kind === "none" ? projectId : void 0);
|
|
89652
89622
|
if (opts.function && opts.endpoint && opts.function !== opts.endpoint) {
|
|
89653
89623
|
error("--function and --endpoint cannot specify different paths.");
|
|
89654
89624
|
process.exit(1);
|
|
@@ -89854,7 +89824,7 @@ var init_logs = __esm({
|
|
|
89854
89824
|
// dist/commands/errors.js
|
|
89855
89825
|
function registerErrors(program2) {
|
|
89856
89826
|
program2.command("errors [project]").description("Show what recently went wrong in a project \u2014 the curated 24h view (endpoint, status, error, time). The fastest way to see what is breaking in production without digging through raw logs. Rows are split into EXCEPTIONS (nobody chose it \u2014 an uncaught throw or a 5xx) and REFUSALS (your handler answered 4xx on purpose, e.g. a 401 from your own auth gate). Platform-generated diagnostics are labeled separately. Use --exceptions to hide your handler's deliberate refusals.").option("--project <ref>", "Project ID, name, slug, or subdomain \u2014 the same flag every other command takes. The positional form still works.").option("--limit <n>", "Max rows to show (default 20, max 100)", "20").option("--exceptions", "Hide the 4xx your own handlers returned on purpose; keep exceptions and platform diagnostics.").option("--json", "Print rows as JSON; platform-generated diagnostics include diagnostic_origin.").action(async (projectArg, opts) => {
|
|
89857
|
-
const
|
|
89827
|
+
const token = getToken();
|
|
89858
89828
|
const chosen = chooseProjectRef(projectArg, opts.project);
|
|
89859
89829
|
if (chosen.kind === "conflict") {
|
|
89860
89830
|
error(projectRefConflictMessage(chosen));
|
|
@@ -89869,6 +89839,7 @@ function registerErrors(program2) {
|
|
|
89869
89839
|
}
|
|
89870
89840
|
projectId = config2.project_id;
|
|
89871
89841
|
}
|
|
89842
|
+
const client = new ApiClient(token, chosen.kind === "none" ? projectId : void 0);
|
|
89872
89843
|
const limit = Math.min(parseInt(String(opts.limit), 10) || 20, 100);
|
|
89873
89844
|
let rows;
|
|
89874
89845
|
try {
|
|
@@ -90278,7 +90249,7 @@ function registerRun(program2) {
|
|
|
90278
90249
|
error("This command sends one script. Inline local helpers or bundle them into a single ES module, then run that file.");
|
|
90279
90250
|
process.exit(1);
|
|
90280
90251
|
}
|
|
90281
|
-
const client = new ApiClient(getToken());
|
|
90252
|
+
const client = new ApiClient(getToken(), opts.project ? void 0 : projectId);
|
|
90282
90253
|
let timeoutMs;
|
|
90283
90254
|
if (opts.timeout !== void 0) {
|
|
90284
90255
|
timeoutMs = parseInt(String(opts.timeout), 10);
|
|
@@ -90444,7 +90415,6 @@ function printProductionDeployment(deployment) {
|
|
|
90444
90415
|
function registerStatus(program2) {
|
|
90445
90416
|
program2.command("status [project]").description("Show project and workspace status").option("--project <ref>", "Project ID, name, slug, or subdomain \u2014 the same flag every other command takes. The positional form still works.").option("--json", "Print the raw status responses as JSON").action(async (projectArg, opts) => {
|
|
90446
90417
|
const token = getToken();
|
|
90447
|
-
const client = new ApiClient(token);
|
|
90448
90418
|
const claimConnection = Boolean(loadConfig()?.claim_access);
|
|
90449
90419
|
const chosen = chooseProjectRef(projectArg, opts.project);
|
|
90450
90420
|
if (chosen.kind === "conflict") {
|
|
@@ -90460,6 +90430,7 @@ function registerStatus(program2) {
|
|
|
90460
90430
|
}
|
|
90461
90431
|
projectId = config2.project_id;
|
|
90462
90432
|
}
|
|
90433
|
+
const client = new ApiClient(token, chosen.kind === "none" ? projectId : void 0);
|
|
90463
90434
|
let projectStatus = null;
|
|
90464
90435
|
let projectError = null;
|
|
90465
90436
|
let deploymentStatus = null;
|
|
@@ -90618,7 +90589,6 @@ function registerOpen(program2) {
|
|
|
90618
90589
|
return;
|
|
90619
90590
|
}
|
|
90620
90591
|
const token = getToken();
|
|
90621
|
-
const client = new ApiClient(token);
|
|
90622
90592
|
const chosen = chooseProjectRef(project, opts.project);
|
|
90623
90593
|
if (chosen.kind === "conflict") {
|
|
90624
90594
|
error(projectRefConflictMessage(chosen));
|
|
@@ -90633,6 +90603,7 @@ function registerOpen(program2) {
|
|
|
90633
90603
|
error("No project linked. Pass a project name (positionally or with --project) or run from a linked directory." + unlinkedFolderHint());
|
|
90634
90604
|
process.exit(1);
|
|
90635
90605
|
}
|
|
90606
|
+
const client = new ApiClient(token, chosen.kind === "none" ? projectRef3 : void 0);
|
|
90636
90607
|
try {
|
|
90637
90608
|
const servingUrl = await getProjectServingUrl(client, projectRef3);
|
|
90638
90609
|
if (!servingUrl)
|
|
@@ -92376,7 +92347,7 @@ function registerCheck(program2) {
|
|
|
92376
92347
|
}
|
|
92377
92348
|
projectId = config2.project_id;
|
|
92378
92349
|
}
|
|
92379
|
-
const client = new ApiClient(getToken());
|
|
92350
|
+
const client = new ApiClient(getToken(), opts.project ? void 0 : projectId);
|
|
92380
92351
|
const collected = collectFiles(targetDir);
|
|
92381
92352
|
const sensitiveRefusal = sensitiveReferenceRefusal(collected);
|
|
92382
92353
|
if (sensitiveRefusal) {
|
|
@@ -134836,11 +134807,25 @@ async function findNamedCronRow(target, explicit, signal) {
|
|
|
134836
134807
|
return matchNamedCron(target, project, rows);
|
|
134837
134808
|
}
|
|
134838
134809
|
async function resolveRunCronId(client, target, explicit) {
|
|
134839
|
-
if (target
|
|
134810
|
+
if (target?.startsWith("cron_"))
|
|
134840
134811
|
return target;
|
|
134841
134812
|
const project = cronProjectScope(explicit);
|
|
134813
|
+
if (target === void 0 && !project) {
|
|
134814
|
+
throw new Error("CRON_PROJECT_REQUIRED: Run this in a linked project, pass --project, or supply a task name or cron ID.");
|
|
134815
|
+
}
|
|
134842
134816
|
const rows = cronRows(await client.call("GET", "/cron", void 0, { project_id: project }));
|
|
134843
|
-
|
|
134817
|
+
if (target !== void 0)
|
|
134818
|
+
return matchNamedCron(target, project, rows).cron_id;
|
|
134819
|
+
if (!rows.length)
|
|
134820
|
+
throw new Error("CRON_NOT_FOUND: This project has no scheduled tasks.");
|
|
134821
|
+
if (rows.length > 1) {
|
|
134822
|
+
const names = rows.map((row) => JSON.stringify(row.name ?? cronRowId(row))).join(", ");
|
|
134823
|
+
throw new Error(`CRON_NAME_REQUIRED: Pass a task name or cron ID. Scheduled tasks: ${names}.`);
|
|
134824
|
+
}
|
|
134825
|
+
const id = cronRowId(rows[0]);
|
|
134826
|
+
if (!id)
|
|
134827
|
+
throw new Error("cron_list returned a scheduled task without a cron_id.");
|
|
134828
|
+
return id;
|
|
134844
134829
|
}
|
|
134845
134830
|
async function resolveCronId(target, explicit) {
|
|
134846
134831
|
if (target.startsWith("cron_"))
|
|
@@ -134993,7 +134978,7 @@ zone each trigger is stored in, and \`cron update --schedule\` keeps that zone u
|
|
|
134993
134978
|
console.log(dim(policy));
|
|
134994
134979
|
});
|
|
134995
134980
|
});
|
|
134996
|
-
cron.command("run
|
|
134981
|
+
cron.command("run [cron-id-or-name]").description("Run a scheduled task now without changing its schedule; omit the name when your project has exactly one task").option("-p, --project <project>", "Project slug or ID used to resolve a task name; defaults to the linked project").option("--wait", "Wait for the queued job to finish and print its result; exits non-zero on failure or timeout").option("--preview", "Run the task's handler and payload once in this folder's open preview instead (its code, data, files and mail); the production schedule never changes").option("--twice", "With --preview, wait for each of two runs and report declared table row count changes").option("--timeout <seconds>", `With --wait, how long to wait before giving up (default ${DEFAULT_WAIT_TIMEOUT_SECONDS})`).option("--json", "Print the complete response as JSON").addHelpText("after", "\nWithout --wait the command returns as soon as the job is queued; the task has not run yet,\nso anything it writes may not be visible for a few seconds. Pass --wait before reading its effects.\n").action(async (target, opts) => {
|
|
134997
134982
|
let queued = false;
|
|
134998
134983
|
try {
|
|
134999
134984
|
if (opts.twice && (!opts.preview || opts.timeout !== void 0)) {
|
|
@@ -136117,7 +136102,7 @@ var init_app_test = __esm({
|
|
|
136117
136102
|
if (!projectId)
|
|
136118
136103
|
throw new Error(`${root} is not a linked Somewhere project (no .somewhere.json with a project_id).`);
|
|
136119
136104
|
const preview = options2.preview !== void 0 && options2.preview !== false;
|
|
136120
|
-
const control = preview ? await openPreviewControl({ root, projectId, ...typeof options2.preview === "string" ? { previewSessionId: options2.preview } : {} }) : await openProductionControl(projectId);
|
|
136105
|
+
const control = preview ? await openPreviewControl({ root, projectId, ...typeof options2.preview === "string" ? { previewSessionId: options2.preview } : {} }) : await openProductionControl(projectId, void 0, true);
|
|
136121
136106
|
const target = control.target;
|
|
136122
136107
|
if ((options2.undeployed ?? "refuse") === "refuse") {
|
|
136123
136108
|
const local = undeployedChanges(root, projectId, preview);
|
|
@@ -137110,7 +137095,7 @@ function registerTest(program2) {
|
|
|
137110
137095
|
throw new Error(`${unsupported.join(", ")} apply to Playwright specs and scripts; the platform runs checks/*.json as saved.`);
|
|
137111
137096
|
let check;
|
|
137112
137097
|
try {
|
|
137113
|
-
check = await runChecksNow(new ApiClient(getToken()), projectId, { again: opts.again === true, only: opts.only });
|
|
137098
|
+
check = await runChecksNow(new ApiClient(getToken(), projectId), projectId, { again: opts.again === true, only: opts.only });
|
|
137114
137099
|
} catch (cause) {
|
|
137115
137100
|
const sentence = cause instanceof Error ? cause.message : "The platform could not start the checks.";
|
|
137116
137101
|
check = opts.only ? partialCheckUnavailable(opts.only, sentence) : { status: "unavailable", sentence };
|
|
@@ -137152,7 +137137,7 @@ function registerTest(program2) {
|
|
|
137152
137137
|
}
|
|
137153
137138
|
if (opts.failFast)
|
|
137154
137139
|
throw new Error("--fail-fast applies to app-check scripts (tests/*.mjs or *.cjs).");
|
|
137155
|
-
const outcome2 = await runTests({ root, ...opts.preview ? {} : { client: new ApiClient(getToken()) }, projectId, prepared: prepareRunner(root), options: { ...opts, files } });
|
|
137140
|
+
const outcome2 = await runTests({ root, ...opts.preview ? {} : { client: new ApiClient(getToken(), projectId) }, projectId, prepared: prepareRunner(root), options: { ...opts, files } });
|
|
137156
137141
|
await note;
|
|
137157
137142
|
mark("cli:exit");
|
|
137158
137143
|
process.exitCode = outcome2.exitCode;
|
|
@@ -138931,7 +138916,7 @@ var init_playwright_fixtures = __esm({
|
|
|
138931
138916
|
return this.loading ??= (async () => {
|
|
138932
138917
|
const control = this.preview ?? await timed(this.info, "target snapshot", async () => {
|
|
138933
138918
|
const projectId = linkedProject();
|
|
138934
|
-
return openProductionControl(projectId, runTarget(projectId) ?? void 0);
|
|
138919
|
+
return openProductionControl(projectId, runTarget(projectId) ?? void 0, true);
|
|
138935
138920
|
});
|
|
138936
138921
|
diagnostics(this.info).release = control.target.releaseId;
|
|
138937
138922
|
return { control };
|
|
@@ -139131,7 +139116,7 @@ async function openTestApp(options2 = {}) {
|
|
|
139131
139116
|
throw new Error("Run the test from a linked Somewhere app folder.");
|
|
139132
139117
|
const setup = options2.preview ? previewCredentialFor(root, projectId) : void 0;
|
|
139133
139118
|
const tool = setup && previewToolClient(setup.credential);
|
|
139134
|
-
const client = tool ? void 0 : new ApiClient(testingDeveloperToken());
|
|
139119
|
+
const client = tool ? void 0 : new ApiClient(testingDeveloperToken(), projectId);
|
|
139135
139120
|
const target = tool && setup ? await readPreviewTarget(tool, projectId, setup.previewSessionId) : await loadTestTarget(client, projectId);
|
|
139136
139121
|
const control = tool ? previewControl(tool, target) : void 0;
|
|
139137
139122
|
const inbox2 = control ?? productionControl(client, target, { liveInboxOnly: true });
|
|
@@ -139168,7 +139153,7 @@ async function openTestApp(options2 = {}) {
|
|
|
139168
139153
|
throw new Error("This test app has already been cleaned up.");
|
|
139169
139154
|
}, "open");
|
|
139170
139155
|
const results = new Results();
|
|
139171
|
-
const pages = new Pages(root, origin);
|
|
139156
|
+
const pages = new Pages(root, origin, options2.playwright);
|
|
139172
139157
|
const add = /* @__PURE__ */ __name((id, email2, session, roles = [], name = `user ${actors.size + 1}`) => {
|
|
139173
139158
|
const actor = { name, id, email: email2, roles, session, ...callerOf(session, () => {
|
|
139174
139159
|
routeWrites++;
|
|
@@ -139367,22 +139352,23 @@ async function openTestApp(options2 = {}) {
|
|
|
139367
139352
|
const allowed = options3.status === void 0 ? [401, 403, 404] : typeof options3.status === "number" ? [options3.status] : options3.status;
|
|
139368
139353
|
const lacks = options3.lacks === void 0 ? [] : typeof options3.lacks === "string" ? [options3.lacks] : options3.lacks;
|
|
139369
139354
|
const label = options3.label ?? "refused";
|
|
139370
|
-
const
|
|
139371
|
-
const
|
|
139372
|
-
|
|
139373
|
-
|
|
139374
|
-
}));
|
|
139355
|
+
const send = /* @__PURE__ */ __name((caller, request2) => request2[0] === "DATA" ? caller.data(request2[1], request2[2]) : caller[request2[0].toLowerCase()](request2[1], request2[2]), "send");
|
|
139356
|
+
const named2 = /* @__PURE__ */ __name((request2) => request2[0] === "DATA" ? `data ${request2[1]} ${request2[2].operation}` : `${request2[0]} ${request2[1]}`, "named");
|
|
139357
|
+
const empty = /* @__PURE__ */ __name((reply) => reply.status === 200 && reply.body && typeof reply.body === "object" && (reply.body.data === null || Array.isArray(reply.body.data) && reply.body.data.length === 0), "empty");
|
|
139358
|
+
const pairs = callers.flatMap((caller) => requests.map((request2) => ({ caller, request: request2 })));
|
|
139359
|
+
const replies = await Promise.allSettled(pairs.map(({ caller, request: request2 }) => send(caller, request2)));
|
|
139375
139360
|
let all = true;
|
|
139376
139361
|
replies.forEach((settled, i) => {
|
|
139377
|
-
const { caller,
|
|
139378
|
-
const line = `${label}: ${nameOf(caller)} ${
|
|
139362
|
+
const { caller, request: request2 } = pairs[i];
|
|
139363
|
+
const line = `${label}: ${nameOf(caller)} ${named2(request2)}`;
|
|
139379
139364
|
if (settled.status === "rejected") {
|
|
139380
139365
|
all = results.check(line, false, settled.reason) && all;
|
|
139381
139366
|
return;
|
|
139382
139367
|
}
|
|
139383
139368
|
const reply = settled.value;
|
|
139384
139369
|
const leaked = lacks.findIndex((text) => text && reply.text.includes(text));
|
|
139385
|
-
|
|
139370
|
+
const refused = allowed.includes(reply.status) || request2[0] === "DATA" && options3.status === void 0 && empty(reply);
|
|
139371
|
+
if (!refused) {
|
|
139386
139372
|
results.expect(reply, allowed, line);
|
|
139387
139373
|
all = false;
|
|
139388
139374
|
return;
|
|
@@ -139390,6 +139376,20 @@ async function openTestApp(options2 = {}) {
|
|
|
139390
139376
|
if (!results.check(line, leaked < 0, `answered ${reply.status} but contains lacks[${leaked}]`))
|
|
139391
139377
|
all = false;
|
|
139392
139378
|
});
|
|
139379
|
+
if (options3.control) {
|
|
139380
|
+
const reads = requests.filter((request2) => request2[0] === "GET" || request2[0] === "DATA" && (request2[2].operation === "get" || request2[2].operation === "list"));
|
|
139381
|
+
const controls = await Promise.allSettled(reads.map((request2) => send(options3.control, request2)));
|
|
139382
|
+
controls.forEach((settled, i) => {
|
|
139383
|
+
const line = `${label}: control ${options3.control.name} ${named2(reads[i])}`;
|
|
139384
|
+
if (settled.status === "rejected") {
|
|
139385
|
+
all = results.check(line, false, settled.reason) && all;
|
|
139386
|
+
return;
|
|
139387
|
+
}
|
|
139388
|
+
const ok = settled.value.ok && !empty(settled.value);
|
|
139389
|
+
if (!results.check(line, ok, ok ? void 0 : settled.value))
|
|
139390
|
+
all = false;
|
|
139391
|
+
});
|
|
139392
|
+
}
|
|
139393
139393
|
return all;
|
|
139394
139394
|
},
|
|
139395
139395
|
async page(user, path3 = "/") {
|
|
@@ -139405,7 +139405,7 @@ async function openTestApp(options2 = {}) {
|
|
|
139405
139405
|
} catch (error3) {
|
|
139406
139406
|
left = error3 instanceof Error ? error3.message : String(error3);
|
|
139407
139407
|
}
|
|
139408
|
-
const rows = routeWrites ? " Rows your app's routes created during the run stay in its tables unless removed in app.onCleanup()." : "";
|
|
139408
|
+
const rows = routeWrites ? " Rows your app's routes created during the run, if any, stay in its tables unless removed in app.onCleanup()." : "";
|
|
139409
139409
|
console.log(`${results.passed} passed, ${results.failed} failed${left ? `. ${left}` : ". Test users deleted."}${rows}`);
|
|
139410
139410
|
process.exitCode = left ? 2 : results.failed ? 1 : 0;
|
|
139411
139411
|
},
|
|
@@ -139617,24 +139617,27 @@ var init_testing_app = __esm({
|
|
|
139617
139617
|
}
|
|
139618
139618
|
root;
|
|
139619
139619
|
origin;
|
|
139620
|
+
playwright;
|
|
139620
139621
|
browser;
|
|
139621
|
-
constructor(root, origin) {
|
|
139622
|
+
constructor(root, origin, playwright) {
|
|
139622
139623
|
this.root = root;
|
|
139623
139624
|
this.origin = origin;
|
|
139625
|
+
this.playwright = playwright;
|
|
139624
139626
|
}
|
|
139625
139627
|
async open(state, path3) {
|
|
139626
139628
|
this.browser ??= (() => {
|
|
139627
139629
|
const require6 = createRequire12(join56(this.root, "package.json"));
|
|
139628
|
-
let pw;
|
|
139629
|
-
|
|
139630
|
-
pw = require6("playwright");
|
|
139631
|
-
} catch {
|
|
139630
|
+
let pw = typeof this.playwright === "object" ? this.playwright : void 0;
|
|
139631
|
+
for (const name of pw ? [] : [...typeof this.playwright === "string" ? [this.playwright] : [], "playwright", "@playwright/test"]) {
|
|
139632
139632
|
try {
|
|
139633
|
-
pw = require6(
|
|
139633
|
+
pw = require6(name);
|
|
139634
|
+
break;
|
|
139634
139635
|
} catch {
|
|
139635
|
-
throw new Error("app.page() uses Playwright from this folder: npm install -D playwright && npx playwright install chromium");
|
|
139636
139636
|
}
|
|
139637
139637
|
}
|
|
139638
|
+
if (!pw?.chromium) {
|
|
139639
|
+
throw new Error("app.page() needs Playwright. If it is installed outside this folder, pass its path: openTestApp({ playwright: '/path/to/node_modules/playwright' }). Otherwise: npm install -D playwright && npx playwright install chromium");
|
|
139640
|
+
}
|
|
139638
139641
|
return pw.chromium.launch();
|
|
139639
139642
|
})();
|
|
139640
139643
|
const context = await (await this.browser).newContext({ baseURL: this.origin, storageState: state });
|