@somewhere-cloud/cli 0.38.68 → 0.38.70

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.
@@ -1,155 +1,182 @@
1
- import { BUNDLED_SKILLS_PACK } from './skills-pack.generated.js';
2
- import { SKILLS_DIR, skillNames } from './skills-pack.js';
1
+ import { SKILLS_DIR } from './skills-pack.js';
3
2
  // Generated mirror of somewhere.cloud/docs/agent-workflow.md. The platform
4
3
  // docs lint byte-compares this value when SOMEWHERE_CLI_REPO points here.
5
4
  export const AGENT_WORKFLOW = `## Build, deploy, test
6
5
 
7
- Declare access rules in db/schema.ts; use the schema-generated browser client
8
- for ordinary app reads and writes. The platform enforces those rules on every call.
9
- Start with owner() for personal rows:
6
+ Enough to start a typical app: declare access, use the generated browser client;
7
+ docs are for exceptions. Complete schema and calls below.
10
8
 
11
- Schema: db/schema.ts is declaration only: imports and a default schema export.
12
- No helper functions or arbitrary TypeScript expressions. Named declarative
13
- constants and spreads of those constants are supported.
14
- id() is a random text key; references use text(). owner() adds/fills user_id.
9
+ | Requirement | Declaration below |
10
+ | --- | --- |
11
+ | Each user sees only their own rows | notes: owner() |
12
+ | Team: owner adds members; members read/write; creator rights | teams/team_members/tasks: owner() + member(); role-owner delete branch |
13
+ | Owner/staff record with staff-only child notes | tickets: owner() or server-assigned appRole(); messages: parent(); staff_notes: appRole() |
14
+ | Public pages from private drafts | pages: conditional publicRead |
15
+ | Share one record read-only with another account | shared_notes/note_shares: read-only grant() |
16
+
17
+ db/schema.ts is declaration only: imports, constants/spreads, default schema;
18
+ no helpers/expressions. id() is random text; owner() stamps user_id. client.read
19
+ includes the key. Other fields: timestamp({ default: 'now' }), text({ nullable: true });
20
+ indexes: [['team_id']].
15
21
 
16
22
  \`\`\`ts
17
- import { schema, table, id, text, owner } from 'somewhere/db';
23
+ import { schema, table, id, text, owner, member, anyOf, serverOnly, parent, appRole, boolean, grant } from 'somewhere/db';
18
24
  export default schema({
19
- notes: table({ id: id(), title: text() }, {
20
- scope: owner(),
21
- client: { read: ['id', 'title'], create: ['title'], update: ['title'], delete: true },
25
+ notes: table({ id: id(), title: text() }, { scope: owner(), client: { read: ['id', 'title'], create: ['title'], update: ['title'], delete: true },
22
26
  }),
23
- });
27
+ teams: table({ id: id(), name: text(), owner_id: text() }, {
28
+ scope: member({ group: 'id', membership: 'team_members', member_user: 'user_id', member_group: 'team_id' }),
29
+ client: { read: ['id', 'name'] },
30
+ }),
31
+ team_members: table({ id: id(), team_id: text(), user_id: text(), role: text() }, {
32
+ scope: serverOnly(), unique: [['team_id', 'user_id']],
33
+ }),
34
+ tasks: table({ id: id(), team_id: text({ references: 'teams' }), title: text() }, {
35
+ scope: anyOf(owner(), member({ group: 'team_id', membership: 'team_members',
36
+ member_user: 'user_id', member_group: 'team_id', operations: ['read', 'create', 'update'] }),
37
+ member({ group: 'team_id', membership: 'team_members', member_user: 'user_id',
38
+ member_group: 'team_id', where: { role: 'owner' }, operations: ['delete'] })),
39
+ client: { read: ['id', 'team_id', 'title'], create: ['team_id', 'title'], update: ['title'], delete: true },
40
+ }),
41
+ tickets: table({ id: id(), subject: text() }, {
42
+ scope: anyOf(owner(), appRole({ roles: { read: ['staff'], create: ['staff'], update: ['staff'] } })),
43
+ client: { read: ['id', 'subject'], create: ['subject'], update: ['subject'] },
44
+ }),
45
+ messages: table({ id: id(), ticket_id: text({ references: 'tickets' }), body: text() }, {
46
+ scope: parent({ via: 'ticket_id' }),
47
+ client: { read: ['id', 'ticket_id', 'body'], create: ['ticket_id', 'body'] },
48
+ }),
49
+ staff_notes: table({ id: id(), ticket_id: text({ references: 'tickets' }), body: text() }, {
50
+ scope: appRole({ roles: { read: ['staff'], create: ['staff'] } }),
51
+ client: { read: ['id', 'ticket_id', 'body'], create: ['ticket_id', 'body'] },
52
+ }),
53
+ pages: table({ id: id(), title: text(), published: boolean({ default: false }) }, {
54
+ scope: owner(), client: { read: ['id', 'title'], create: ['title'], update: ['title'],
55
+ publicRead: { where: { published: true } } },
56
+ }),
57
+ note_shares: table({ id: id(), grantee_id: text(), note_id: text({ references: 'shared_notes', onDelete: 'cascade' }) }, {
58
+ scope: owner(), unique: [['note_id', 'grantee_id']],
59
+ }),
60
+ shared_notes: table({ id: id(), title: text() }, {
61
+ scope: anyOf(owner(), grant({ table: 'note_shares', grantee: 'grantee_id', row: 'note_id', operations: ['read'] })),
62
+ client: { read: ['id', 'title'], create: ['title'], update: ['title'] },
63
+ }),
64
+ }, { appRoles: { staff: { assignedBy: 'server' } } });
24
65
  \`\`\`
25
66
 
26
- Browser data is generated from the schema. list returns at most 100 rows, no
27
- order option: sort in the client or use a server endpoint for ordered queries.
67
+ messages use parent(): owner() would hide staff replies from the customer.
68
+ Use emailDomain for staff at your verified domain; assignedBy: 'server' when the
69
+ app decides (admin promotion, payment, invitation); never use an unverified email ending.
70
+ Publish pages in an owner-checked endpoint. Share with caller-scoped
71
+ sw.db.insert('note_shares', { grantee_id, note_id }); it checks row ownership.
72
+ Browser list: max 100, paginate after; no order (sort locally or in an endpoint).
28
73
 
29
74
  \`\`\`ts
30
75
  import { data } from 'somewhere:data';
31
- async function useNotesData() {
76
+ async function notes(after?: string) {
32
77
  const { data: note } = await data.notes.create({ title: 'Hello' });
33
78
  if (note) await data.notes.update(note.id, { title: 'Updated' });
34
- const page = await data.notes.list({ limit: 100 });
35
- if (page.has_more && page.next) return data.notes.list({ limit: 100, after: page.next });
36
- return page;
79
+ return data.notes.list({ limit: 100, after }); // next page: after = previous.next
37
80
  }
38
81
  \`\`\`
39
82
 
40
-
41
- Use serverOnly() and endpoint checks only when a required rule cannot be expressed
42
- by the declared scopes: compare the required identities and relationships with
43
- the supported owner, membership, parent and role policies before choosing the fallback.
44
- Built-in groups and email-domain roles require VERIFIED email. If the app must
45
- work before verification, use its own membership/role table and server checks.
46
- Never grant privilege solely because an unverified address claims a domain.
47
-
48
- Starter map:
49
- - src/App.tsx + src/routes.ts: route selection, including a detail path parameter;
50
- navigate/linkTo accept string paths. Extensionless paths serve index.html.
51
- - src/pages/HomePage.tsx: build here; src/pages/SignedInLayout.tsx: signed-in layout;
52
- src/ui/AppShell.tsx: account/sign-out; src/ui/layout.tsx: PageHeader (React-node title).
53
- - src/auth/hooks.ts: existing useAuthState/useSignOut; src/services/auth.ts: errors.
54
- In components, useAuth from @somewhere-cloud/sdk/react exposes signIn/signUp
55
- ({ email, password }); both throw readable errors. Sign-up signs in immediately;
56
- unverified users pass auth: 'required'. Keep api/auth/[...path].ts and the session gate.
57
- - src/config.ts: app name, SIGN_IN_PROVIDERS, SHOW_EMAIL_VERIFICATION.
58
-
59
- Endpoint files: api/notes.ts → /api/notes; api/notes/[id].ts → params.id;
60
- api/notes/[id]/sub.ts → /api/notes/:id/sub; underscore-prefixed files are helpers.
61
- The global sw only declares endpoints; the handler's second argument is the runtime.
62
- Method-named exports select GET/DELETE; default export handles POST with a body.
63
- Declare auth on every endpoint; declare body fields before reading JSON. GET has no body.
64
- Plain objects become JSON 200; return Response.json(value, { status }) for other statuses.
83
+ Teams without verification: own membership table + member(); sw.groups and domain
84
+ roles need VERIFIED emails. Members read/create/update tasks; creators or team owners delete while members.
85
+ A restriction only narrows who may do its operations; it never grants read.
86
+ Comment-author-or-team-owner deletion stays a small endpoint.
87
+ Create the team and its owner membership atomically:
65
88
 
66
89
  \`\`\`ts
67
- export const GET = sw.endpoint({
68
- auth: 'required',
69
- handler: async ({ params }, sw) => sw.db.from('notes', { limit: 100 }),
70
- });
90
+ // api/teams.ts
71
91
  export default sw.endpoint({
72
- auth: 'required', body: { title: 'string' },
73
- handler: async ({ body }, sw) => sw.db.insert('notes', { title: body.title }),
92
+ auth: 'required', body: { name: 'string' },
93
+ handler: async ({ user, params, body }, sw) => {
94
+ const creatorEmail = user.email; // required auth supplies id and email
95
+ const id = crypto.randomUUID();
96
+ await sw.db.server.tx([
97
+ { op: 'insert', table: 'teams', values: { id, name: body.name, owner_id: user.id } },
98
+ { op: 'insert', table: 'team_members', values: { id: crypto.randomUUID(), team_id: id, user_id: user.id, role: 'owner' } },
99
+ ]);
100
+ return { id, creatorEmail };
101
+ },
74
102
  });
75
- export const DELETE = sw.endpoint({
76
- auth: 'required',
77
- handler: async ({ params }, sw) => sw.db.remove('notes', { where: { id: params.id } }),
103
+ \`\`\`
104
+
105
+ \`\`\`ts
106
+ // api/teams/[id]/members.ts — only the team owner adds a member
107
+ export default sw.endpoint({
108
+ auth: 'required', body: { email: 'string' },
109
+ handler: async ({ user, params, body }, sw) => {
110
+ const { data: teams } = await sw.db.from('teams', { where: { id: params.id, owner_id: user.id }, limit: 1 });
111
+ if (!teams[0]) return Response.json({ error: 'Team owner required' }, { status: 403 });
112
+ const { users: [target] } = await sw.auth.server.listUsers({ emails: [body.email] });
113
+ if (!target) return Response.json({ error: 'Account not found' }, { status: 404 });
114
+ await sw.db.server.insert('team_members', {
115
+ id: crypto.randomUUID(), team_id: params.id, user_id: target.id, role: 'member',
116
+ }, { onConflict: 'ignore' });
117
+ return { ok: true };
118
+ },
78
119
  });
79
120
  \`\`\`
80
121
 
122
+ \`\`\`ts
123
+ // api/_roles.ts — called by a server endpoint AFTER it authorizes the promotion
124
+ export async function assignStaff(userId: string, sw: SomewhereRuntimeContext) {
125
+ await sw.auth.server.setRoles(userId, { add: ['staff'] });
126
+ }
127
+ \`\`\`
81
128
 
82
- Scopes:
83
- - owner(): personal rows, caller ownership applied by the platform.
84
- - member(): your membership table controls shared rows; parent(): inherit a related row's access.
85
- - serverOnly(): functions authorize every read/write; no browser data access.
86
- - publicRead: { where }: visitor reads of explicitly selected rows/columns.
87
- client grants browser operations/columns; read must include the primary key.
88
- Omitted browser write grants prevent direct writes; use endpoints for validation.
129
+ Do not mark app-read/write data serverOnly() and hand-write access checks: declare
130
+ who may read/write it; the platform enforces it. Server-only fits job/import/audit/
131
+ counter state, membership ledgers, and undeclarable rules: arbitrary predicates
132
+ (e.g. expiry), or different writable fields per role (split tables or check that write).
133
+ Grant ledgers need owner() scope and no browser writes. Keep other access declared.
89
134
 
90
- Server calls return { data: rows, count, changes }. sw.db applies caller scopes;
91
- sw.db.server bypasses them, so authorize first and supply trusted ownership on insert.
92
- update takes TWO arguments: table and { where, set }. Transactions take an ARRAY
93
- of write intents, never a callback; pre-generate related IDs. No reads or result
94
- references inside tx; a zero-match update does not abort it. Use unique constraints
95
- for concurrent uniqueness, not a read-then-insert check.
135
+ Starter: src/pages/HomePage.tsx; routes src/App.tsx + src/routes.ts; auth hooks
136
+ src/auth/hooks.ts. useAuth from @somewhere-cloud/sdk/react: signIn/signUp({ email,
137
+ password }); sign-up signs in. Keep api/auth/[...path].ts; src/config.ts controls providers.
138
+ api/notes/[id]/sub.ts → /api/notes/:id/sub (params.id); underscore files are helpers.
139
+ POST: default export; GET/DELETE: named exports. Objects return JSON 200;
140
+ Response.json sets status.
96
141
 
97
142
  \`\`\`ts
98
- async function writeNotes(sw: SomewhereRuntimeContext, ownerId: string) {
99
- // ownerId must come from the caller or an authorized lookup, never unchecked input.
100
- const id = crypto.randomUUID();
101
- await sw.db.server.tx([
102
- { op: 'insert', table: 'notes', values: { id, user_id: ownerId, title: 'Hello' } },
103
- { op: 'update', table: 'notes', where: { id }, set: { title: 'Updated' } },
104
- ]);
105
- await sw.db.from('notes', { where: { id }, limit: 1 });
106
- await sw.db.insert('notes', { title: 'Hello' });
107
- await sw.db.update('notes', { where: { id }, set: { title: 'Updated' } });
108
- await sw.db.remove('notes', { where: { id } });
109
- // Server directory: authorize the caller before looking up another account.
110
- const { users: [user] } = await sw.auth.server.listUsers({ emails: ['person@example.com'] });
111
- return user; // undefined when no eligible account matches
112
- }
143
+ export const GET = sw.endpoint({
144
+ auth: 'required',
145
+ handler: async (_, sw) => sw.db.from('notes', { limit: 100 }),
146
+ });
147
+ export const DELETE = sw.endpoint({
148
+ auth: 'required',
149
+ handler: async ({ params }, sw) => sw.db.remove('notes', { where: { id: params.id } }),
150
+ });
113
151
  \`\`\`
114
152
 
153
+ sw.db applies caller scopes; sw.db.server bypasses them: authorize first.
154
+ Reads: from(table, { where, columns, order: [['id', 'asc']], limit, offset }).
155
+ Filter: { id: { in: ids } }; unique: [['a', 'b']] in schema.
156
+ Writes: insert(table, values), update(table, { where, set }), remove(table, { where }).
157
+ tx takes an ARRAY of write intents, never a callback; pre-generate related IDs.
115
158
 
116
- Call your API with fetch(path, { method: 'POST', credentials: 'same-origin',
159
+ Browser: fetch(path, { method: 'POST', credentials: 'same-origin',
117
160
  headers: { 'content-type': 'application/json' }, body: JSON.stringify(values) }).
118
- The short-lived access cookie refreshes automatically; do not store tokens.
119
- Scripts sending cookie-authenticated POST/PATCH/DELETE must send Origin equal to
120
- the app URL. UI rendering/session checks are asynchronous: wait for loaded UI.
121
- Test with throwaway users at <name>@<subdomain>.test.somewhere.site.
122
-
123
- Publish: somewhere typecheck → somewhere deploy → somewhere test.
124
- Deploy raw source; do not run a frontend build. Type errors stop before upload;
125
- explicit override: somewhere deploy --allow-type-errors. Deploy applies the schema.
126
- somewhere test runs project tests against production; also test each table's
127
- access and the affected journey. Diagnose with somewhere errors and somewhere logs.
128
- RATE_LIMIT_UNAVAILABLE is temporary platform unavailability: the request was not
129
- admitted; retry it and keep rateLimit protection.
161
+ Access cookies refresh automatically. Cookie-auth POST/PATCH/DELETE from scripts
162
+ need Origin equal to the app URL.
163
+
164
+ Publish: somewhere typecheck → npx @somewhere-cloud/cli deploy → somewhere verify → somewhere test.
165
+ Deploy raw source, no frontend build. Type errors stop upload; override: somewhere deploy --allow-type-errors.
166
+ Tests: newUser() gives its own signed-in browser page and API request client; call N times (owner, member, outsider).
167
+ No chosen email argument: grant roles or insert memberships in setup through your app's authorized server endpoint.
168
+ Diagnose with somewhere errors and somewhere logs.
130
169
 
131
170
  On demand:
132
- - Membership/parent: \`somewhere docs sw.db --section owner-or-member-and-parent-access\`
133
- - Groups: \`somewhere docs sw.groups --section create-a-group\`
134
- - Transactions: \`somewhere docs sw.db --section transaction-intents\`
135
- - Updates: \`somewhere docs sw.db --section update-shape\`
136
- - Browser limits: \`somewhere docs sw.db --section browser-list-limits\`
171
+ - Server paging: \`somewhere docs sw.db --section server-read-paging\`
137
172
  - Direct HTTP data tests: \`somewhere docs declared-data --section calling-the-data-endpoint-directly\`
138
- - Auth hooks: \`somewhere docs auth-client --section react-auth-state\`
139
- - Files/background import: \`somewhere docs recipe-csv-import --section larger-files\`
140
- - Scheduled work: \`somewhere docs cron --section create-a-schedule\`
141
- - Server-rendered pages: \`somewhere docs recipe-seo --section 5-server-rendered-pages-and-redirects\`
142
173
  `;
143
- export const SKILLS_POINTER = `Skills: \`${SKILLS_DIR}/\` — `
144
- + skillNames(BUNDLED_SKILLS_PACK).map((name) => `\`${name}\``).join(', ')
145
- + '. Read the skill that matches the task. `somewhere skills status` inspects the installed pack; `somewhere skills update` updates unmodified files.';
174
+ export const SKILLS_POINTER = `Task-specific skills: \`${SKILLS_DIR}/\`. Inspect/update with somewhere skills status/update.`;
146
175
  export const DECLARED_ACCESS_POINTER = '';
147
176
  /** One line telling agents the app's data and code can leave:
148
177
  * an evaluating agent concluded the platform had no exits. Kept outside
149
178
  * AGENT_WORKFLOW, which is a byte mirror of the platform's agent workflow. */
150
- export const PORTABILITY_POINTER = 'Your data and code are yours: `somewhere pull` (source), `somewhere db dump` (raw SQL database as one .sql file), '
151
- + 'one-table CSV export and attaching PostgreSQL in your own Neon account; managed-database tables are not in the dump or CSV yet. '
152
- + 'Limits per path: `somewhere docs portability`.';
153
- export const INIT_AGENTS_MD = `# somewhere.cloud project contract\n${SKILLS_POINTER}\n${DECLARED_ACCESS_POINTER}\n${PORTABILITY_POINTER}\n${AGENT_WORKFLOW}\n`;
179
+ export const PORTABILITY_POINTER = 'Data/code export limits: `somewhere docs portability`.';
180
+ export const INIT_AGENTS_MD = `# somewhere.cloud project contract\n${AGENT_WORKFLOW}\n${SKILLS_POINTER}\n${PORTABILITY_POINTER}\n`;
154
181
  export const INIT_CLAUDE_MD = 'Read AGENTS.md for project instructions.\n';
155
182
  //# sourceMappingURL=init-agent-guide.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init-agent-guide.js","sourceRoot":"","sources":["../../src/lib/init-agent-guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE1D,2EAA2E;AAC3E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyI7B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,UAAU,QAAQ;MACzD,UAAU,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;MACvE,oJAAoJ,CAAC;AAEzJ,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C;;+EAE+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,oHAAoH;MACnJ,kIAAkI;MAClI,gDAAgD,CAAC;AAErD,MAAM,CAAC,MAAM,cAAc,GAAG,uCAAuC,cAAc,KAAK,uBAAuB,KAAK,mBAAmB,KAAK,cAAc,IAAI,CAAC;AAC/J,MAAM,CAAC,MAAM,cAAc,GAAG,4CAA4C,CAAC"}
1
+ {"version":3,"file":"init-agent-guide.js","sourceRoot":"","sources":["../../src/lib/init-agent-guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,2EAA2E;AAC3E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyK7B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,2BAA2B,UAAU,0DAA0D,CAAC;AAE9H,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C;;+EAE+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,wDAAwD,CAAC;AAE5F,MAAM,CAAC,MAAM,cAAc,GAAG,uCAAuC,cAAc,KAAK,cAAc,KAAK,mBAAmB,IAAI,CAAC;AACnI,MAAM,CAAC,MAAM,cAAc,GAAG,4CAA4C,CAAC"}
@@ -1,4 +1,4 @@
1
- const session = `import { test, expect, data, expectRefused, ready } from '@somewhere-cloud/cli/testing';
1
+ const session = `import { test, expect, ready } from '@somewhere-cloud/cli/testing';
2
2
 
3
3
  test('session and sign-out', async ({ newUser }) => {
4
4
  const user = await newUser();
@@ -13,11 +13,6 @@ test('session and sign-out', async ({ newUser }) => {
13
13
  await ready(user.page, 'signed-out');
14
14
  });
15
15
  `;
16
- const closed = `
17
- test('browser data is closed', async ({ anonymous }) => {
18
- await expectRefused(await data(anonymous, 'notes', { operation: 'list' }), 403, 'DATA_ACCESS_DENIED');
19
- });
20
- `;
21
16
  const isolation = `
22
17
  test('owners can read only their own notes', async ({ newUser }) => {
23
18
  const owner = await newUser();
@@ -48,6 +43,6 @@ test('owners can read only their own notes', async ({ newUser }) => {
48
43
  });
49
44
  `;
50
45
  export function starterTests(privateData = false) {
51
- return [{ path: 'tests/app.spec.ts', content: session + (privateData ? isolation : closed) }];
46
+ return [{ path: 'tests/app.spec.ts', content: session.replace('test, expect, ready', privateData ? 'test, expect, ready, data, expectRefused' : 'test, expect, ready') + (privateData ? isolation : '') }];
52
47
  }
53
48
  //# sourceMappingURL=init-test-template.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init-test-template.js","sourceRoot":"","sources":["../../src/lib/init-test-template.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;CAcf,CAAC;AACF,MAAM,MAAM,GAAG;;;;CAId,CAAC;AACF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BjB,CAAC;AACF,MAAM,UAAU,YAAY,CAAC,WAAW,GAAG,KAAK;IAC9C,OAAO,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAChG,CAAC"}
1
+ {"version":3,"file":"init-test-template.js","sourceRoot":"","sources":["../../src/lib/init-test-template.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;CAcf,CAAC;AACF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BjB,CAAC;AACF,MAAM,UAAU,YAAY,CAAC,WAAW,GAAG,KAAK;IAC9C,OAAO,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC7M,CAAC"}
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@somewhere-cloud/cli",
3
- "version": "0.38.68",
3
+ "version": "0.38.70",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@somewhere-cloud/cli",
9
- "version": "0.38.68",
9
+ "version": "0.38.70",
10
10
  "bundleDependencies": [
11
11
  "@modelcontextprotocol/sdk",
12
12
  "chokidar",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@somewhere-cloud/cli",
3
- "version": "0.38.68",
3
+ "version": "0.38.70",
4
4
  "description": "CLI for somewhere.cloud — auth, projects, deploy, pull, promote, db, logs, env, MCP bridge.",
5
5
  "keywords": [
6
6
  "somewhere",
@@ -58,5 +58,5 @@
58
58
  "worker/src/utils/telegram-attempt-receipts.ts": "a9ba55ae71f63ada44a105f1ceae04b0491bda0d6e77e5762db2dbecdd2981dd",
59
59
  "worker/src/utils/telegram.ts": "dfbc9e756b44b445b3c3504c90a1094a94e6f9853ff9c0e0a84fba0e8c4518da"
60
60
  },
61
- "sha256": "a1a3866ff1f62695123354dfcd526881ee0252e9a0c8d18abe4d72a1f9bf1355"
61
+ "sha256": "b5ba85458713c213a22156fb7577d13a38d8fec2bc2ce587f5f8fd484342bd4b"
62
62
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "sha256": "65b14f1570316081e6e52937da07b73a157fbb5a1737e0555ea2ed106ae083f0"
2
+ "sha256": "6edf7964ba43090b85bbff144b73530e34f4e4271ea8cdc985d274ff659cebd0"
3
3
  }
@@ -4587,6 +4587,7 @@ __export(declared_data_vendor_entry_exports, {
4587
4587
  FILES_DECLARATION_FILE: () => import_typed_files2.CLIENT_FILE,
4588
4588
  RUNTIME_CONTEXT_DECLARATION: () => import_runtime_types3.RUNTIME_CONTEXT_DECLARATION,
4589
4589
  SCHEMA_DECLARATION: () => import_schema_types.SCHEMA_DECLARATION,
4590
+ allTablesServerOnlyWithoutClient: () => allTablesServerOnlyWithoutClient,
4590
4591
  checkerContract: () => checkerContract,
4591
4592
  consumerContractComponents: () => import_consumer_contract.consumerContractComponents,
4592
4593
  consumerContractFingerprint: () => import_consumer_contract.consumerContractFingerprint,
@@ -8306,6 +8307,12 @@ function isRuntimeEndpointGlobal(diag, functions) {
8306
8307
 
8307
8308
 
8308
8309
  var import_consumer_contract = __toESM(require_consumer_contract());
8310
+ function allTablesServerOnlyWithoutClient(files) {
8311
+ const source = files["db/schema.ts"];
8312
+ if (source === void 0) return false;
8313
+ const parsed = extractSchemaTs(source);
8314
+ return parsed.ok && parsed.declaration.tables.length > 0 && parsed.declaration.tables.every((table) => table.scope.kind === "server_only" && table.client === void 0);
8315
+ }
8309
8316
  function generateFromFiles(files) {
8310
8317
  const authority = clientAuthorityFromSource(files);
8311
8318
  return authority ? (0, import_typed_data.generateDataClient)(authority) : void 0;
@@ -8331,6 +8338,7 @@ function filesDeclarationFromFiles(files) {
8331
8338
  FILES_DECLARATION_FILE,
8332
8339
  RUNTIME_CONTEXT_DECLARATION,
8333
8340
  SCHEMA_DECLARATION,
8341
+ allTablesServerOnlyWithoutClient,
8334
8342
  checkerContract,
8335
8343
  consumerContractComponents,
8336
8344
  consumerContractFingerprint,