@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.
- package/dist/commands/check.js +15 -0
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/deploy.js +8 -0
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/docs.js +10 -1
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/declared-data.d.ts +2 -0
- package/dist/lib/declared-data.js +7 -0
- package/dist/lib/declared-data.js.map +1 -1
- package/dist/lib/init-agent-guide.d.ts +4 -4
- package/dist/lib/init-agent-guide.js +138 -111
- package/dist/lib/init-agent-guide.js.map +1 -1
- package/dist/lib/init-test-template.js +2 -7
- package/dist/lib/init-test-template.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/runtime/DECLARED-DATA-VENDOR.json +1 -1
- package/runtime/PLATFORM-SOURCE.json +1 -1
- package/runtime/declared-data.cjs +8 -0
|
@@ -1,155 +1,182 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
8
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
27
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
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: {
|
|
73
|
-
handler: async ({ body }, sw) =>
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
159
|
+
Browser: fetch(path, { method: 'POST', credentials: 'same-origin',
|
|
117
160
|
headers: { 'content-type': 'application/json' }, body: JSON.stringify(values) }).
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
-
-
|
|
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 = `
|
|
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 = '
|
|
151
|
-
|
|
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,
|
|
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,
|
|
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 :
|
|
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,
|
|
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"}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@somewhere-cloud/cli",
|
|
3
|
-
"version": "0.38.
|
|
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.
|
|
9
|
+
"version": "0.38.70",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@modelcontextprotocol/sdk",
|
|
12
12
|
"chokidar",
|
package/package.json
CHANGED
|
@@ -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": "
|
|
61
|
+
"sha256": "b5ba85458713c213a22156fb7577d13a38d8fec2bc2ce587f5f8fd484342bd4b"
|
|
62
62
|
}
|
|
@@ -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,
|