@tallpond/cli 0.0.2 → 0.0.3
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/README.md +14 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,12 +58,24 @@ handler:
|
|
|
58
58
|
|
|
59
59
|
```ts
|
|
60
60
|
// functions/submitMove.ts — invoked as tallpond.functions.invoke('submitMove', args)
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
import type { FunctionContext } from '@tallpond/sdk' // type-only; nothing bundled
|
|
62
|
+
|
|
63
|
+
export default async (ctx: FunctionContext, args: { resourceId: string; move: unknown }) => {
|
|
64
|
+
await ctx.db.query({
|
|
65
|
+
scope: { kind: 'resource', resourceId: args.resourceId },
|
|
66
|
+
table: 'moves',
|
|
67
|
+
op: 'insert',
|
|
68
|
+
values: { move: args.move },
|
|
69
|
+
})
|
|
63
70
|
return { ok: true }
|
|
64
71
|
}
|
|
65
72
|
```
|
|
66
73
|
|
|
74
|
+
The ctx surface is exactly `userId`, `resourceId`, `fn`, `invocationId`,
|
|
75
|
+
`db.query`/`db.batch` (raw `/v1/db` wire shape), and `gateway(path, body)` —
|
|
76
|
+
annotate with `FunctionContext` so the compiler enforces it. Full contract:
|
|
77
|
+
<https://tallpond.com/docs/functions/>.
|
|
78
|
+
|
|
67
79
|
File names must be identifiers (letters/digits/underscores). Shared helpers and
|
|
68
80
|
types belong in a subdirectory (e.g. `functions/lib/`) — subdirectories aren't
|
|
69
81
|
scanned, and handlers can import from them freely (everything is bundled). A
|