@palettelab/cli 0.3.66 → 0.3.67

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palettelab/cli",
3
- "version": "0.3.66",
3
+ "version": "0.3.67",
4
4
  "description": "Developer CLI for building Palette platform plugins — no platform source access required.",
5
5
  "bin": {
6
6
  "pltt": "bin/pltt.js"
@@ -1,7 +1,7 @@
1
1
  """Database plugin backend — org-scoped notes."""
2
2
 
3
- from fastapi import Depends, HTTPException
4
- from pydantic import BaseModel
3
+ from fastapi import Depends, HTTPException, Query
4
+ from pydantic import BaseModel, Field
5
5
  from palette_sdk import PluginRouter, PluginContext, get_plugin_context, require_permission
6
6
  from models import Note
7
7
 
@@ -9,12 +9,17 @@ router = PluginRouter(tags=["my-db-plugin"])
9
9
 
10
10
 
11
11
  class NoteIn(BaseModel):
12
- body: str
12
+ body: str = Field(max_length=4000)
13
13
 
14
14
 
15
15
  @router.get("/notes", dependencies=[require_permission("resources:read")])
16
- async def list_notes(ctx: PluginContext = Depends(get_plugin_context)) -> list[dict]:
17
- rows = await ctx.repo(Note).list(order_by="-id")
16
+ async def list_notes(
17
+ limit: int = Query(50, ge=1, le=500),
18
+ offset: int = Query(0, ge=0),
19
+ ctx: PluginContext = Depends(get_plugin_context),
20
+ ) -> list[dict]:
21
+ # One page per request: list() returns 100 rows unless told otherwise.
22
+ rows = await ctx.repo(Note).list(order_by="-id", limit=limit, offset=offset)
18
23
  return [{"id": r.id, "body": r.body} for r in rows]
19
24
 
20
25