@somewhere-cloud/cli 0.38.68 → 0.38.69
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 +134 -108
- 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,181 @@
|
|
|
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
|
+
This core holds the call shapes and access patterns for a typical app; docs are for
|
|
7
|
+
exceptions. Declare access and use the generated browser client. Pick your shape:
|
|
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; per-row creator rights | teams/team_members/tasks: member() + owner() |
|
|
13
|
+
| Owner and staff see a record; staff-only child notes | tickets: owner() or appRole(); messages: parent(); staff_notes: appRole() |
|
|
14
|
+
| Public pages from private drafts | pages: owner(), publicRead with published condition |
|
|
15
|
+
| Share one record read-only with another account | shared_notes + note_shares: owner() or read-only grant() |
|
|
16
|
+
|
|
17
|
+
db/schema.ts: declarations only (imports, constants/spreads, default schema); no
|
|
18
|
+
helpers/expressions. id() is random text; owner() stamps user_id. Include the key in
|
|
19
|
+
client.read. Also: timestamp({ default: 'now' }), text({ nullable: true }), indexes: [['team_id']].
|
|
15
20
|
|
|
16
21
|
\`\`\`ts
|
|
17
|
-
import { schema, table, id, text, owner } from 'somewhere/db';
|
|
22
|
+
import { schema, table, id, text, owner, member, anyOf, serverOnly, parent, appRole, boolean, grant } from 'somewhere/db';
|
|
18
23
|
export default schema({
|
|
19
|
-
notes: table({ id: id(), title: text() }, {
|
|
20
|
-
scope: owner(),
|
|
21
|
-
client: { read: ['id', 'title'], create: ['title'], update: ['title'], delete: true },
|
|
24
|
+
notes: table({ id: id(), title: text() }, { scope: owner(), client: { read: ['id', 'title'], create: ['title'], update: ['title'], delete: true },
|
|
22
25
|
}),
|
|
23
|
-
}
|
|
26
|
+
teams: table({ id: id(), name: text(), owner_id: text() }, {
|
|
27
|
+
scope: member({ group: 'id', membership: 'team_members', member_user: 'user_id', member_group: 'team_id' }),
|
|
28
|
+
client: { read: ['id', 'name'] },
|
|
29
|
+
}),
|
|
30
|
+
team_members: table({ id: id(), team_id: text(), user_id: text() }, {
|
|
31
|
+
scope: serverOnly(), unique: [['team_id', 'user_id']],
|
|
32
|
+
}),
|
|
33
|
+
tasks: table({ id: id(), team_id: text({ references: 'teams' }), title: text() }, {
|
|
34
|
+
scope: anyOf(owner(), member({ group: 'team_id', membership: 'team_members',
|
|
35
|
+
member_user: 'user_id', member_group: 'team_id', operations: ['read', 'create', 'update'] })),
|
|
36
|
+
client: { read: ['id', 'team_id', 'title'], create: ['team_id', 'title'], update: ['title'], delete: true },
|
|
37
|
+
}),
|
|
38
|
+
tickets: table({ id: id(), subject: text() }, {
|
|
39
|
+
scope: anyOf(owner(), appRole({ roles: { read: ['staff'], create: ['staff'], update: ['staff'] } })),
|
|
40
|
+
client: { read: ['id', 'subject'], create: ['subject'], update: ['subject'] },
|
|
41
|
+
}),
|
|
42
|
+
messages: table({ id: id(), ticket_id: text({ references: 'tickets' }), body: text() }, {
|
|
43
|
+
scope: parent({ via: 'ticket_id' }),
|
|
44
|
+
client: { read: ['id', 'ticket_id', 'body'], create: ['ticket_id', 'body'] },
|
|
45
|
+
}),
|
|
46
|
+
staff_notes: table({ id: id(), ticket_id: text({ references: 'tickets' }), body: text() }, {
|
|
47
|
+
scope: appRole({ roles: { read: ['staff'], create: ['staff'] } }),
|
|
48
|
+
client: { read: ['id', 'ticket_id', 'body'], create: ['ticket_id', 'body'] },
|
|
49
|
+
}),
|
|
50
|
+
pages: table({ id: id(), title: text(), published: boolean({ default: false }) }, {
|
|
51
|
+
scope: owner(), client: { read: ['id', 'title'], create: ['title'], update: ['title'],
|
|
52
|
+
publicRead: { where: { published: true } } },
|
|
53
|
+
}),
|
|
54
|
+
note_shares: table({ id: id(), grantee_id: text(), note_id: text({ references: 'shared_notes', onDelete: 'cascade' }) }, {
|
|
55
|
+
scope: owner(), unique: [['note_id', 'grantee_id']],
|
|
56
|
+
}),
|
|
57
|
+
shared_notes: table({ id: id(), title: text() }, {
|
|
58
|
+
scope: anyOf(owner(), grant({ table: 'note_shares', grantee: 'grantee_id', row: 'note_id', operations: ['read'] })),
|
|
59
|
+
client: { read: ['id', 'title'], create: ['title'], update: ['title'] },
|
|
60
|
+
}),
|
|
61
|
+
}, { appRoles: { staff: { emailDomain: 'staff.example.com' } } });
|
|
24
62
|
\`\`\`
|
|
25
63
|
|
|
26
|
-
|
|
27
|
-
|
|
64
|
+
messages inherit ticket access: owner() would hide a staff reply from the customer.
|
|
65
|
+
Staff roles here require verified domain email; never infer roles from unverified email.
|
|
66
|
+
Publish pages through an owner-checked endpoint setting published; not a browser write.
|
|
67
|
+
Share through an endpoint using caller-scoped sw.db.insert('note_shares', { grantee_id,
|
|
68
|
+
note_id }); the declaration checks ownership. Never grant browser writes to ledgers.
|
|
69
|
+
|
|
70
|
+
Browser data comes from the schema. list: max 100, after cursor, no order; sort
|
|
71
|
+
in the browser or an endpoint.
|
|
28
72
|
|
|
29
73
|
\`\`\`ts
|
|
30
74
|
import { data } from 'somewhere:data';
|
|
31
|
-
async function
|
|
75
|
+
async function notes() {
|
|
32
76
|
const { data: note } = await data.notes.create({ title: 'Hello' });
|
|
33
77
|
if (note) await data.notes.update(note.id, { title: 'Updated' });
|
|
34
78
|
const page = await data.notes.list({ limit: 100 });
|
|
35
|
-
if (page.has_more && page.next) return data.notes.list({
|
|
79
|
+
if (page.has_more && page.next) return data.notes.list({ after: page.next });
|
|
36
80
|
return page;
|
|
37
81
|
}
|
|
38
82
|
\`\`\`
|
|
39
83
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
the
|
|
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.
|
|
84
|
+
Teams without verification: own membership table + member(); sw.groups and domain
|
|
85
|
+
roles need VERIFIED emails. Members read/create/update tasks; creators delete while
|
|
86
|
+
members. A team-owner delete is one checked endpoint; keep other access declared.
|
|
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 } },
|
|
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,
|
|
116
|
+
}, { onConflict: 'ignore' });
|
|
117
|
+
return { ok: true };
|
|
118
|
+
},
|
|
78
119
|
});
|
|
79
120
|
\`\`\`
|
|
80
121
|
|
|
122
|
+
Do not mark app-read/write data serverOnly() and hand-write access checks: declare
|
|
123
|
+
who may read/write it; the platform enforces it. Server-only fits job/import/audit/
|
|
124
|
+
counter state, membership ledgers, and undeclarable rules: arbitrary predicates
|
|
125
|
+
(e.g. expiry), or different writable fields per role (split tables or check that write).
|
|
126
|
+
Grant ledgers need owner() scope and no browser writes. Keep other access declared.
|
|
81
127
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
-
|
|
85
|
-
|
|
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.
|
|
128
|
+
Starter: src/pages/HomePage.tsx; routes src/App.tsx + src/routes.ts; layout
|
|
129
|
+
src/pages/SignedInLayout.tsx. Auth hooks: src/auth/hooks.ts; useAuth from
|
|
130
|
+
@somewhere-cloud/sdk/react: signIn/signUp({ email, password }); sign-up signs in.
|
|
131
|
+
Keep api/auth/[...path].ts. src/config.ts controls providers/verification.
|
|
89
132
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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.
|
|
133
|
+
Files: api/notes.ts → /api/notes; api/notes/[id]/sub.ts → /api/notes/:id/sub
|
|
134
|
+
(params.id). Underscore-prefixed files are helpers. GET/DELETE: named exports;
|
|
135
|
+
POST: default export. Objects return JSON 200; Response.json sets other statuses.
|
|
96
136
|
|
|
97
137
|
\`\`\`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
|
-
}
|
|
138
|
+
export const GET = sw.endpoint({
|
|
139
|
+
auth: 'required',
|
|
140
|
+
handler: async (_, sw) => sw.db.from('notes', { limit: 100 }),
|
|
141
|
+
});
|
|
142
|
+
export const DELETE = sw.endpoint({
|
|
143
|
+
auth: 'required',
|
|
144
|
+
handler: async ({ params }, sw) => sw.db.remove('notes', { where: { id: params.id } }),
|
|
145
|
+
});
|
|
113
146
|
\`\`\`
|
|
114
147
|
|
|
148
|
+
Structured sw.db calls apply caller scopes; sw.db.server bypasses them: authorize first.
|
|
149
|
+
Reads: from(table, { where, columns, order: [['id', 'asc']], limit, offset }).
|
|
150
|
+
Filters include { id: { in: ids } }; schema uniqueness is unique: [['a', 'b']].
|
|
151
|
+
Writes: insert(table, values), update(table, { where, set }), remove(table, { where }).
|
|
152
|
+
Transactions are ARRAYs of write intents (above), never callbacks; pre-generate
|
|
153
|
+
IDs.
|
|
115
154
|
|
|
116
|
-
|
|
155
|
+
Browser: fetch(path, { method: 'POST', credentials: 'same-origin',
|
|
117
156
|
headers: { 'content-type': 'application/json' }, body: JSON.stringify(values) }).
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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.
|
|
157
|
+
Access cookies refresh automatically. Cookie-auth POST/PATCH/DELETE from scripts
|
|
158
|
+
need Origin equal to the app URL.
|
|
159
|
+
|
|
160
|
+
Publish: somewhere typecheck → npx @somewhere-cloud/cli deploy → somewhere verify → somewhere test.
|
|
161
|
+
Deploy raw source, no frontend build. Type errors stop before upload; explicit
|
|
162
|
+
override: somewhere deploy --allow-type-errors.
|
|
163
|
+
Tests: newUser() gives a signed-in user with its own browser page and API request client; call as many times as needed (owner, member, outsider).
|
|
164
|
+
newUser() accepts no chosen email; grant roles or insert memberships in test setup through your app's own authorized server endpoint.
|
|
165
|
+
Diagnose with somewhere errors and somewhere logs.
|
|
130
166
|
|
|
131
167
|
On demand:
|
|
132
168
|
- Membership/parent: \`somewhere docs sw.db --section owner-or-member-and-parent-access\`
|
|
133
|
-
-
|
|
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\`
|
|
169
|
+
- Server paging: \`somewhere docs sw.db --section server-read-paging\`
|
|
137
170
|
- Direct HTTP data tests: \`somewhere docs declared-data --section calling-the-data-endpoint-directly\`
|
|
138
|
-
-
|
|
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\`
|
|
171
|
+
- Endpoint inputs: \`somewhere docs sw.endpoint --section what-your-handler-receives\`
|
|
142
172
|
`;
|
|
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.';
|
|
173
|
+
export const SKILLS_POINTER = `Task-specific skills: \`${SKILLS_DIR}/\`. Inspect/update with somewhere skills status/update.`;
|
|
146
174
|
export const DECLARED_ACCESS_POINTER = '';
|
|
147
175
|
/** One line telling agents the app's data and code can leave:
|
|
148
176
|
* an evaluating agent concluded the platform had no exits. Kept outside
|
|
149
177
|
* 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`;
|
|
178
|
+
export const PORTABILITY_POINTER = 'Data/code export limits: `somewhere docs portability`.';
|
|
179
|
+
export const INIT_AGENTS_MD = `# somewhere.cloud project contract\n${AGENT_WORKFLOW}\n${SKILLS_POINTER}\n${PORTABILITY_POINTER}\n`;
|
|
154
180
|
export const INIT_CLAUDE_MD = 'Read AGENTS.md for project instructions.\n';
|
|
155
181
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwK7B,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.69",
|
|
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.69",
|
|
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,
|