@somewhere-tech/cli 0.37.15 → 0.37.16
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.
|
@@ -51,9 +51,31 @@ Functions: a bare \`export default async function (req, sw)\` returning a
|
|
|
51
51
|
\`params.id\` there, \`sw.params.id\` bare. \`somewhere typecheck\` types bare
|
|
52
52
|
handlers as \`(req: Request, sw: SomewhereRuntimeContext)\`.
|
|
53
53
|
|
|
54
|
-
Data: tables in \`db/schema.ts
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
Data: declare tables in \`db/schema.ts\`; pages use the generated
|
|
55
|
+
\`somewhere:data\` client (\`data.notes.list()\`, \`.create()\`, \`.update(id, …)\`), so
|
|
56
|
+
normal data needs no API file. Scope: \`owner()\` per user, \`group()\` per team,
|
|
57
|
+
\`appRole()\` for staff; \`client\` names the browser's columns, and
|
|
58
|
+
\`publicRead: { where }\` opens rows to visitors. When one write does not fit,
|
|
59
|
+
such as a public form filing a row for an owner, keep the client and add one
|
|
60
|
+
function for that write; do not make every table \`serverOnly()\`. Validate
|
|
61
|
+
the body, then take the ownership step; \`handle\` is the public intake address
|
|
62
|
+
an owner opted into by claiming it (a private profile is not a recipient):
|
|
63
|
+
|
|
64
|
+
\`\`\`ts
|
|
65
|
+
const { handle, title, from_email } = body as { handle?: unknown; title?: unknown; from_email?: unknown };
|
|
66
|
+
if (typeof handle !== 'string' || typeof title !== 'string' || typeof from_email !== 'string'
|
|
67
|
+
|| !title.trim() || title.length > 200 || /[\\r\\n]/.test(title)
|
|
68
|
+
|| from_email.length > 254 || !/^[^\\s@]+@[^\\s@]+$/.test(from_email)) return Response.json({ error: 'bad input' }, { status: 400 });
|
|
69
|
+
const { data: [profile] } = await sw.db.server.from('profiles', { where: { handle }, limit: 1 });
|
|
70
|
+
if (!profile) return Response.json({ error: 'unknown handle' }, { status: 404 });
|
|
71
|
+
await sw.db.server.insert('entries', { user_id: profile.user_id, owner_email: profile.owner_email,
|
|
72
|
+
title: title.trim(), from_email, created_ms: Date.now() });
|
|
73
|
+
\`\`\`
|
|
74
|
+
|
|
75
|
+
The owner comes from that lookup, never the body; the sender is not the
|
|
76
|
+
owner. Rate limits and the alert are in \`somewhere docs recipe-signed-in-app\`.
|
|
77
|
+
Use \`serverOnly()\` only when every operation needs a function's own access
|
|
78
|
+
check.
|
|
57
79
|
Structured queries: \`sw.db.from\` / \`insert\` / \`update\` / \`remove\` return \`{ data: rows[], count,
|
|
58
80
|
changes }\`; \`where: { a: 1, b: { in: ids }, c: { gte: 2 }, d: null }\` (one
|
|
59
81
|
operator per column). Raw SQL \`sw.db.query(sql, params)\` runs as written (add \`WHERE
|
|
@@ -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,0EAA0E;AAC1E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,cAAc,GAAG
|
|
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,0EAA0E;AAC1E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oFA8EsD,CAAC;AAErF,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,cAAc,GAAG,sCAAsC,cAAc,KAAK,cAAc,IAAI,CAAC;AAC1G,MAAM,CAAC,MAAM,cAAc,GAAG,4CAA4C,CAAC"}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@somewhere-tech/cli",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.16",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@somewhere-tech/cli",
|
|
9
|
-
"version": "0.37.
|
|
9
|
+
"version": "0.37.16",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@modelcontextprotocol/sdk",
|
|
12
12
|
"chokidar",
|