@teable/create-app 1.0.3 → 1.0.5
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/template/AGENTS.md
CHANGED
|
@@ -42,6 +42,7 @@ teable-next push -m "<what changed>" # commit, and save the source to Teable
|
|
|
42
42
|
teable-next publish # check, build and deploy dist/ (methods and pages), with its commit, as the next version
|
|
43
43
|
teable-next versions # published versions, newest first: when, by whom, which commit
|
|
44
44
|
teable-next rollback --version <n> # deploy version n's code again, as the next version
|
|
45
|
+
teable-next rename "<name>" # name the project after the app, if it has no name yet
|
|
45
46
|
```
|
|
46
47
|
|
|
47
48
|
`teable-next <command> --help` lists every option; without the CLI
|
|
@@ -101,7 +102,8 @@ Also:
|
|
|
101
102
|
Renaming one or changing its input breaks its callers.
|
|
102
103
|
- Table names starting with `_teable_` are reserved.
|
|
103
104
|
- One app is one Durable Object: up to 10 GB, one thread, 128 MB of memory.
|
|
104
|
-
Keep each call small, and page through long lists (`limit
|
|
105
|
+
Keep each call small, and page through long lists (`cursor` and `limit`,
|
|
106
|
+
as in "Add a read or a write").
|
|
105
107
|
- Teable has no secrets store for apps yet. Never put keys or tokens in code
|
|
106
108
|
or git; ask the user.
|
|
107
109
|
- Pages are for the members of the app's space unless the app says
|
|
@@ -141,6 +143,26 @@ export const markPaid = app.write({
|
|
|
141
143
|
fail("NOT_FOUND", `No invoice ${input.id}`),
|
|
142
144
|
});
|
|
143
145
|
|
|
146
|
+
export const listInvoices = app.read({
|
|
147
|
+
description: "Invoices, oldest first",
|
|
148
|
+
input: z.object({
|
|
149
|
+
cursor: z.number().int().optional(), // the nextCursor of the page before; none for the first
|
|
150
|
+
limit: z.number().int().min(1).max(200).default(50),
|
|
151
|
+
}),
|
|
152
|
+
output: z.object({ invoices: z.array(schemaOf(invoices)), nextCursor: z.number().nullable() }),
|
|
153
|
+
handler: ({ db, input }) => {
|
|
154
|
+
const rows = db
|
|
155
|
+
.select()
|
|
156
|
+
.from(invoices)
|
|
157
|
+
.where(gt(invoices.id, input.cursor ?? 0))
|
|
158
|
+
.orderBy(invoices.id)
|
|
159
|
+
.limit(input.limit)
|
|
160
|
+
.all();
|
|
161
|
+
const full = rows.length === input.limit; // a shorter page is the last
|
|
162
|
+
return { invoices: rows, nextCursor: full ? (rows.at(-1)?.id ?? null) : null };
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
|
|
144
166
|
export const App = app.define({ listInvoices, markPaid });
|
|
145
167
|
```
|
|
146
168
|
|
|
@@ -151,6 +173,10 @@ export const App = app.define({ listInvoices, markPaid });
|
|
|
151
173
|
it from the tables: `schemaOf(table)` for a row (`.pick`, `.omit`,
|
|
152
174
|
`.extend`), `schemaOf(table.column)` for one value. They carry the column's
|
|
153
175
|
kind, so callers tell money (and its currency) from a number.
|
|
176
|
+
- A read of a long list returns it a page at a time, as `listInvoices` does:
|
|
177
|
+
it takes an optional `cursor` (and `limit`) and returns its rows in one
|
|
178
|
+
array beside `nextCursor`, the next page's `cursor` (null after the last).
|
|
179
|
+
The builder, and pages with `useInfiniteQuery`, read on from it.
|
|
154
180
|
- Return plain data: end Drizzle queries with `.all()`, `.get()` or `.run()`.
|
|
155
181
|
- `fail(code, message)` refuses the call with `BAD_INPUT`, `FORBIDDEN`,
|
|
156
182
|
`NOT_FOUND` or `CONFLICT`; nothing the write did is kept.
|
|
@@ -353,6 +379,12 @@ methods through the API (`/api/v4/apps/<appId>/methods/<name>`, described at
|
|
|
353
379
|
Teable previews the pages. A version is the server code and the pages
|
|
354
380
|
together: a rollback brings back both.
|
|
355
381
|
|
|
382
|
+
A project nobody named has no name: `teable-next publish` prints its
|
|
383
|
+
`projectName` as null (so do `init` and `clone`), and Teable lists it as
|
|
384
|
+
untitled. Once you know what the app is, name it after the app, in the
|
|
385
|
+
user's language: `teable-next rename "<name>"`. Never rename a project that
|
|
386
|
+
has a name unless the user asks.
|
|
387
|
+
|
|
356
388
|
`teable-next rollback` deploys an earlier version's code and pages again, as
|
|
357
389
|
the next version. It cannot go back past a migration: the live database has run it,
|
|
358
390
|
and code without it does not start, so the rollback is refused (`CONFLICT`);
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@fontsource-variable/inter": "5.3.0",
|
|
16
16
|
"@tanstack/react-query": "5.108.4",
|
|
17
17
|
"@tanstack/react-router": "1.170.46",
|
|
18
|
-
"@teable/app": "^6.0.
|
|
18
|
+
"@teable/app": "^6.0.1",
|
|
19
19
|
"@ui-sdk/core": "0.1.0-beta.24",
|
|
20
20
|
"@ui-sdk/react": "0.1.0-beta.24",
|
|
21
21
|
"class-variance-authority": "0.7.1",
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* it at runtime (hiding closed parts); tw-animate-css (enter and exit
|
|
8
8
|
* animations); shadcn/tailwind.css (the data-open: style variants that popups
|
|
9
9
|
* use); the font; and the tokens. Registry components style themselves with
|
|
10
|
-
* these.
|
|
10
|
+
* these. The `--choice-*` tokens are the ones the Teable grid's registry item
|
|
11
|
+
* adds (`cssVars`): the old Teable's single-select colours, light and dark.
|
|
11
12
|
*
|
|
12
13
|
* From this comment to the end, every Teable template's stylesheet and the
|
|
13
14
|
* builder's are identical, so the builder looks like the apps it builds.
|
|
@@ -54,6 +55,17 @@
|
|
|
54
55
|
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
55
56
|
--sidebar-border: oklch(0.922 0 0);
|
|
56
57
|
--sidebar-ring: oklch(0.708 0 0);
|
|
58
|
+
--choice-blue: rgb(194 212 255);
|
|
59
|
+
--choice-green: rgb(149 229 153);
|
|
60
|
+
--choice-orange: rgb(254 196 139);
|
|
61
|
+
--choice-purple: rgb(220 201 253);
|
|
62
|
+
--choice-red: rgb(253 198 196);
|
|
63
|
+
--choice-teal: rgb(111 232 216);
|
|
64
|
+
--choice-yellow: rgb(252 223 126);
|
|
65
|
+
--choice-pink: rgb(248 196 225);
|
|
66
|
+
--choice-cyan: rgb(151 220 252);
|
|
67
|
+
--choice-gray: rgb(229 230 235);
|
|
68
|
+
--choice-foreground: rgb(24 24 27);
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
.dark {
|
|
@@ -88,6 +100,17 @@
|
|
|
88
100
|
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
89
101
|
--sidebar-border: oklch(1 0 0 / 10%);
|
|
90
102
|
--sidebar-ring: oklch(0.556 0 0);
|
|
103
|
+
--choice-blue: rgb(37 65 131);
|
|
104
|
+
--choice-green: rgb(30 78 38);
|
|
105
|
+
--choice-orange: rgb(106 54 16);
|
|
106
|
+
--choice-purple: rgb(80 53 128);
|
|
107
|
+
--choice-red: rgb(121 35 33);
|
|
108
|
+
--choice-teal: rgb(16 76 70);
|
|
109
|
+
--choice-yellow: rgb(96 71 15);
|
|
110
|
+
--choice-pink: rgb(110 40 81);
|
|
111
|
+
--choice-cyan: rgb(14 73 99);
|
|
112
|
+
--choice-gray: rgb(77 82 89);
|
|
113
|
+
--choice-foreground: rgb(255 255 255);
|
|
91
114
|
}
|
|
92
115
|
|
|
93
116
|
@theme inline {
|
|
@@ -131,6 +154,17 @@
|
|
|
131
154
|
--color-sidebar-ring: var(--sidebar-ring);
|
|
132
155
|
--font-heading: var(--font-sans);
|
|
133
156
|
--font-sans: "Inter Variable", sans-serif;
|
|
157
|
+
--color-choice-blue: var(--choice-blue);
|
|
158
|
+
--color-choice-green: var(--choice-green);
|
|
159
|
+
--color-choice-orange: var(--choice-orange);
|
|
160
|
+
--color-choice-purple: var(--choice-purple);
|
|
161
|
+
--color-choice-red: var(--choice-red);
|
|
162
|
+
--color-choice-teal: var(--choice-teal);
|
|
163
|
+
--color-choice-yellow: var(--choice-yellow);
|
|
164
|
+
--color-choice-pink: var(--choice-pink);
|
|
165
|
+
--color-choice-cyan: var(--choice-cyan);
|
|
166
|
+
--color-choice-gray: var(--choice-gray);
|
|
167
|
+
--color-choice-foreground: var(--choice-foreground);
|
|
134
168
|
}
|
|
135
169
|
|
|
136
170
|
@layer base {
|
package/package.json
CHANGED
|
@@ -61,6 +61,12 @@ instructions, current for the SDK the app uses.
|
|
|
61
61
|
role in the app's space. Then tell the user what changed, with the URLs
|
|
62
62
|
it prints: the pages' address first.
|
|
63
63
|
|
|
64
|
+
A project nobody named has no name: `init`, `clone` and `publish` print its
|
|
65
|
+
`projectName` as null, and Teable lists it as untitled. Once you know what
|
|
66
|
+
the app is, name it after the app, in the user's language:
|
|
67
|
+
`teable-next rename "<name>"`. Never rename a project that has a name unless
|
|
68
|
+
the user asks.
|
|
69
|
+
|
|
64
70
|
`teable-next versions` lists published versions, with who published each and
|
|
65
71
|
from which commit. `teable-next rollback --version <n>` deploys an earlier
|
|
66
72
|
version's code and pages again, as the next version; it is refused past a
|