tansy 0.1.0 → 0.1.1
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 +129 -53
- package/core/auth/instance.d.ts +1 -0
- package/core/files/service.d.ts +1 -1
- package/core/files/service.js +2 -2
- package/core/scope/data.js +2 -1
- package/core/site/page.d.ts +1 -1
- package/core/theme/define.d.ts +1 -1
- package/core/version.d.ts +1 -1
- package/core/version.js +1 -1
- package/lib/auth-client.d.ts +1 -0
- package/package.json +16 -16
- package/sdk/index.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,45 +1,133 @@
|
|
|
1
1
|
<h1>
|
|
2
2
|
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="apps/docs/public/brand/logo-light.png">
|
|
4
|
-
<img src="apps/docs/public/brand/logo-dark.png" alt="Tansy" height="64">
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mhmdsalahsebai/tansy/main/apps/docs/public/brand/logo-light.png">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/mhmdsalahsebai/tansy/main/apps/docs/public/brand/logo-dark.png" alt="Tansy" height="64">
|
|
5
5
|
</picture>
|
|
6
6
|
</h1>
|
|
7
7
|
|
|
8
|
-
A self-hosted
|
|
8
|
+
**A self-hosted CMS for Next.js where collections, fields and access rules are defined in the dashboard, so they change without a deploy.**
|
|
9
|
+
|
|
10
|
+
[](https://www.npmjs.com/package/tansy)
|
|
11
|
+
[](https://github.com/mhmdsalahsebai/tansy/blob/main/LICENSE)
|
|
12
|
+
|
|
13
|
+
[Documentation](https://tansycms.vercel.app) · [Live demo](https://tansy-demo.vercel.app/dashboard) · [Plugins](https://tansycms.vercel.app/docs/plugins) · [Changelog](https://github.com/mhmdsalahsebai/tansy/blob/main/CHANGELOG.md)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm create tansy@latest
|
|
17
|
+
```
|
|
9
18
|
|
|
10
19
|
> **Beta.** Tansy is pre-1.0 and under active development. Any release can change anything — package
|
|
11
20
|
> names, commands, configuration keys, environment variables, database columns — in a patch release
|
|
12
|
-
> and without a deprecation period. Pin exact versions, read the [changelog](CHANGELOG.md) before
|
|
13
|
-
> every upgrade, and take a [backup](docs/guides/backups
|
|
14
|
-
> [upgrading](docs/guides/upgrading
|
|
21
|
+
> and without a deprecation period. Pin exact versions, read the [changelog](https://github.com/mhmdsalahsebai/tansy/blob/main/CHANGELOG.md) before
|
|
22
|
+
> every upgrade, and take a [backup](https://tansycms.vercel.app/docs/guides/backups) first. The compatibility promises in
|
|
23
|
+
> [upgrading](https://tansycms.vercel.app/docs/guides/upgrading) start at 1.0.
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
## Why Tansy
|
|
26
|
+
|
|
27
|
+
- **The schema lives in the database.** Editors add collections, fields and blocks from the dashboard while the site keeps serving. Export it as JSON when you want it in git.
|
|
28
|
+
- **One access model for everything.** Roles, permissions and per-collection rules decide what the REST API, realtime, the SDK, MCP and your theme may read or write, through the same check.
|
|
29
|
+
- **It runs inside your Next.js app.** `npm install tansy` and `tansy init` add the dashboard at `/dashboard` and the API at `/api` beside your own routes. Or run it headless and read it over HTTP.
|
|
30
|
+
- **SQLite or Postgres, your server or serverless.** One file to start. Every migration ships for both databases.
|
|
31
|
+
- **Features are plugins, and plugins use only public extension points.** The blog, shop and courses are built on the same API you get, so yours can do what they do.
|
|
17
32
|
|
|
18
33
|
## Try the demo
|
|
19
34
|
|
|
20
|
-
A live install with the blog, shop and
|
|
35
|
+
A live install with the blog, shop and AI plugins, the halo theme and some sample content:
|
|
21
36
|
**<https://tansy-demo.vercel.app/dashboard>**
|
|
22
37
|
|
|
23
38
|
| Email | Password |
|
|
24
39
|
| --- | --- |
|
|
25
40
|
| `demo@example.com` | `explore-tansy-demo` |
|
|
26
41
|
|
|
27
|
-
The demo account is shared by everyone
|
|
28
|
-
|
|
29
|
-
|
|
42
|
+
The demo account is shared by everyone. Write posts, publish them, upload images, add fields
|
|
43
|
+
and collections: the demo is put back as it was every hour, so change whatever you like. It can't
|
|
44
|
+
touch users, roles, settings, webhooks or API keys, or change its own password. To keep what you
|
|
45
|
+
build, run your own copy with `npm create tansy@latest`, which takes a minute.
|
|
30
46
|
|
|
31
|
-
##
|
|
47
|
+
## Features
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
**Content**
|
|
34
50
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
- Collections, fields and URL patterns defined at runtime, plus singletons and read-only view collections built from SQL.
|
|
52
|
+
- A block editor: stream fields made of blocks you define in the dashboard or ship in a plugin.
|
|
53
|
+
- Drafts, scheduled publishing, revisions with a diff, a review step before publishing, and a trash you can restore from.
|
|
54
|
+
- A media library on local disk, S3 or any S3-compatible service, Cloudinary, Bunny, Vercel Blob or Uploadthing, with focal points and alternative text.
|
|
55
|
+
- CSV and JSON import, and the whole schema exported or imported as JSON.
|
|
56
|
+
- Search in the database, or in [Meilisearch, Typesense or Algolia](https://tansycms.vercel.app/docs/guides/search), kept in step by a queue that retries.
|
|
39
57
|
|
|
40
|
-
|
|
58
|
+
**Access and sign-in**
|
|
59
|
+
|
|
60
|
+
- Users, roles and permissions managed from the dashboard, built on [better-auth](https://www.better-auth.com).
|
|
61
|
+
- Password, passkeys, magic links and email codes, authenticator-app MFA that can be required for the dashboard, and OAuth through `@tansy/social-sign-in`.
|
|
62
|
+
- Per-collection rules in one filter language, such as `status = "published" || owner = @request.auth.id`, compiled to SQL where they can be.
|
|
63
|
+
- Custom user fields that rules read, API keys with their own permissions, and an audit log of every write.
|
|
64
|
+
|
|
65
|
+
**APIs**
|
|
66
|
+
|
|
67
|
+
- REST with filters, sorting and relation expansion, `POST /api/batch`, and an OpenAPI 3.1 description.
|
|
68
|
+
- Realtime subscriptions, under the same rules as reads.
|
|
69
|
+
- A typed TypeScript SDK (`tansy/sdk`) with types generated from your schema by `tansy types`.
|
|
70
|
+
- Signed webhooks with retries.
|
|
71
|
+
- An MCP server at `/api/mcp`, so an AI agent can read and write content with an API key's permissions.
|
|
72
|
+
|
|
73
|
+
**Languages**
|
|
74
|
+
|
|
75
|
+
- Records translated per field, each language published on its own, with a fallback chain.
|
|
76
|
+
- An address per language (`/fr/...` or a domain per language), `hreflang`, and right-to-left pages.
|
|
77
|
+
- Translators limited to their own language, XLIFF export and import, and machine translation through a plugin.
|
|
78
|
+
- The dashboard in English and Arabic.
|
|
79
|
+
|
|
80
|
+
**Running it**
|
|
81
|
+
|
|
82
|
+
- `tansy backup` and `tansy restore`: one encrypted archive of the database and uploads, by hand or on a schedule.
|
|
83
|
+
- Background work (scheduled publishing, webhooks, the search queue, plugins' jobs) kept in the database, on a server or serverless.
|
|
84
|
+
- Health and readiness checks, Prometheus metrics, and `tansy doctor` to check an install.
|
|
85
|
+
- A Docker image and a `docker compose` file for Postgres.
|
|
86
|
+
|
|
87
|
+
**Extending it**
|
|
41
88
|
|
|
42
|
-
|
|
89
|
+
- [Plugins](https://tansycms.vercel.app/docs/guides/plugins) add collections, field types, blocks, permissions, routes, jobs, dashboard pages and agent tools.
|
|
90
|
+
- [Hook files](https://tansycms.vercel.app/docs/extending) in `cms_hooks/` add record hooks, routes and jobs without a rebuild.
|
|
91
|
+
- [Themes](https://tansycms.vercel.app/docs/guides/themes) render the public site, in the same app or headless over the API.
|
|
92
|
+
- `tansy plugin new`, `tansy field new` and `tansy theme new` scaffold each of them.
|
|
93
|
+
|
|
94
|
+
Before you commit to it, [limits](https://tansycms.vercel.app/docs/guides/limits) lists every boundary in one place.
|
|
95
|
+
|
|
96
|
+
## Official plugins
|
|
97
|
+
|
|
98
|
+
| Package | What it adds |
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| [`@tansy/blog`](https://tansycms.vercel.app/docs/plugins/blog) | Posts, categories, tags, authors, comments and feeds |
|
|
101
|
+
| [`@tansy/shop`](https://tansycms.vercel.app/docs/plugins/shop) | Products, variants, stock, a cart, shipping zones, orders and fulfilment |
|
|
102
|
+
| [`@tansy/payments`](https://tansycms.vercel.app/docs/plugins/payments) | Subscriptions and one-time purchases through better-auth's payment plugins: Stripe, Polar, Dodo Payments, Creem and Commet |
|
|
103
|
+
| [`@tansy/subscriptions`](https://tansycms.vercel.app/docs/plugins/subscriptions) | Plans, what each one opens, and who is on which plan, in one section of the dashboard |
|
|
104
|
+
| [`@tansy/lms`](https://tansycms.vercel.app/docs/plugins/lms) | Courses, lessons, enrollments, progress, quizzes and verifiable certificates, free or paid |
|
|
105
|
+
| [`@tansy/newsletter`](https://tansycms.vercel.app/docs/plugins/newsletter) | Double opt-in subscribers, one-click unsubscribe, and campaigns sent in batches, including any post |
|
|
106
|
+
| [`@tansy/forms`](https://tansycms.vercel.app/docs/plugins/forms) | Contact and other forms built from blocks, kept as submissions, emailed, and guarded against spam |
|
|
107
|
+
| [`@tansy/ai`](https://tansycms.vercel.app/docs/plugins/ai) | An assistant on the Vercel AI SDK that creates and edits content and fills forms. OpenAI, Anthropic, Google, Mistral, xAI, Groq, DeepSeek, OpenRouter, Vercel AI Gateway, OpenCode, Command Code, or any OpenAI-compatible server |
|
|
108
|
+
| [`@tansy/analytics`](https://tansycms.vercel.app/docs/plugins/analytics) | Cookie-free page views counted by the CMS, or sent to Plausible, Umami, Google Analytics, Fathom or Matomo, with the numbers on the dashboard |
|
|
109
|
+
| [`@tansy/seo`](https://tansycms.vercel.app/docs/plugins/seo) | Search-engine fields and a sitemap built from each collection's URL pattern |
|
|
110
|
+
| [`@tansy/email`](https://tansycms.vercel.app/docs/plugins/email) | Email through Resend, Postmark, SendGrid, Mailgun, Amazon SES or Brevo instead of SMTP, with a delivery log |
|
|
111
|
+
| [`@tansy/social-sign-in`](https://tansycms.vercel.app/docs/plugins/social-sign-in) | Google, GitHub and other OAuth providers, each configured on the dashboard |
|
|
112
|
+
| [`@tansy/captcha`](https://tansycms.vercel.app/docs/plugins/captcha) | Cloudflare Turnstile, hCaptcha or reCAPTCHA on sign-in and on plugins' forms |
|
|
113
|
+
| [`@tansy/pwned-passwords`](https://tansycms.vercel.app/docs/plugins/pwned-passwords) | Refuses passwords found in known breaches, checked by hash range |
|
|
114
|
+
| [`@tansy/multi-tenant`](https://tansycms.vercel.app/docs/plugins/multi-tenant) | Many sites or customers in one instance, each with its own members, roles, domains, content, files and limits |
|
|
115
|
+
| [`@tansy/request-logs`](https://tansycms.vercel.app/docs/plugins/request-logs) | A log of every API request, on the dashboard and sent to storage, an HTTP drain or the console |
|
|
116
|
+
| [`@tansy/logs-otlp`](https://tansycms.vercel.app/docs/plugins/logs-otlp) | The audit and request logs over OpenTelemetry, to Grafana, Honeycomb, Datadog, Axiom or any collector |
|
|
117
|
+
|
|
118
|
+
Each provider is a package of its own, such as `@tansy/payments-stripe` or `@tansy/ai-anthropic`, so a site installs only the ones it uses.
|
|
119
|
+
|
|
120
|
+
## Official themes
|
|
121
|
+
|
|
122
|
+
| Package | For |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| [`@tansy/theme-blank`](https://tansycms.vercel.app/docs/guides/themes) | The smallest theme that works, made to be copied |
|
|
125
|
+
| [`@tansy/theme-blog`](https://tansycms.vercel.app/docs/guides/themes) | A blog: a menu, posts on the home page, post pages and plain pages |
|
|
126
|
+
| [`@tansy/theme-magazine`](https://tansycms.vercel.app/docs/themes/magazine) | A magazine: a hero with search, image cards and a sidebar |
|
|
127
|
+
| [`@tansy/theme-halo`](https://tansycms.vercel.app/docs/themes/halo) | A news front page whose sections editors curate |
|
|
128
|
+
| [`@tansy/theme-dispatch`](https://tansycms.vercel.app/docs/themes/dispatch) | A newsletter's site: the sign-up form up front and posts as numbered issues |
|
|
129
|
+
| [`@tansy/theme-storefront`](https://tansycms.vercel.app/docs/themes/storefront) | A shop: product cards, a product page with a size picker, and a cart |
|
|
130
|
+
| [`@tansy/theme-academy`](https://tansycms.vercel.app/docs/themes/academy) | A school's site for the LMS: the course catalogue, course pages and plans |
|
|
43
131
|
|
|
44
132
|
## Starting a new project
|
|
45
133
|
|
|
@@ -47,14 +135,10 @@ For production with Postgres, set `POSTGRES_PASSWORD` and `BETTER_AUTH_URL`, the
|
|
|
47
135
|
npm create tansy@latest
|
|
48
136
|
```
|
|
49
137
|
|
|
50
|
-
It asks what you're making, which theme, where it will run, SQLite or Postgres (or Postgres in Docker), where uploads go and which features to add, then installs, migrates and can create your admin account. Every question has a flag, and `--yes` takes the defaults: see [Start a new project](
|
|
51
|
-
|
|
52
|
-
To extend it, see the guides for [plugins](docs/guides/plugins.md), [custom fields](docs/guides/fields.md) and [themes](docs/guides/themes.md). Before you commit to it, the [limits](docs/guides/limits.md) are every boundary in one place, and [upgrading](docs/guides/upgrading.md) is what a version number promises.
|
|
138
|
+
It asks what you're making, which theme, where it will run, SQLite or Postgres (or Postgres in Docker), where uploads go and which features to add, then installs, migrates and can create your admin account. Every question has a flag, and `--yes` takes the defaults: see [Start a new project](https://tansycms.vercel.app/docs/getting-started/new-project).
|
|
53
139
|
|
|
54
140
|
## Adding it to a Next.js app
|
|
55
141
|
|
|
56
|
-
`tansy` isn't on npm yet. Build the tarballs with `npm run package`, which writes one per package in `.release/`, and install `.release/tansy-<version>.tgz` in place of the package name below.
|
|
57
|
-
|
|
58
142
|
```bash
|
|
59
143
|
npx create-next-app@latest my-site
|
|
60
144
|
cd my-site
|
|
@@ -66,8 +150,6 @@ npm run dev
|
|
|
66
150
|
|
|
67
151
|
`tansy init` never overwrites a file. Your root layout and home page move to `app/(site)/`, because the admin has its own root layout, and anything it can't change safely is printed as a step to do by hand. `npx tansy doctor` checks the result. The admin is at `/dashboard` and the API at `/api`, and your own routes, such as `/api/hello`, keep working beside them. Choose other paths with `tansy init --admin /admin --api /cms-api`.
|
|
68
152
|
|
|
69
|
-
## Building a site
|
|
70
|
-
|
|
71
153
|
`npx tansy init --site` adds a page that renders a theme, and the theme comes from `tansy.config.ts`:
|
|
72
154
|
|
|
73
155
|
```ts
|
|
@@ -76,13 +158,18 @@ import { blog } from "@tansy/theme-blog";
|
|
|
76
158
|
export default defineCms({ theme: blog({ tagline: "Field notes" }) });
|
|
77
159
|
```
|
|
78
160
|
|
|
79
|
-
|
|
161
|
+
## Quick start with Docker
|
|
162
|
+
|
|
163
|
+
No configuration is needed. Data, uploads and generated secrets live in the `/data` volume.
|
|
80
164
|
|
|
81
|
-
|
|
165
|
+
```bash
|
|
166
|
+
docker build -t tansy .
|
|
167
|
+
docker run --name tansy -p 8090:8090 -v tansy-data:/data tansy
|
|
168
|
+
```
|
|
82
169
|
|
|
83
|
-
|
|
170
|
+
The server log prints a one-time setup link. Open it to create the superadmin, then sign in at <http://localhost:8090>. If you publish a different port or a real domain, set `BETTER_AUTH_URL` to that address with `-e`.
|
|
84
171
|
|
|
85
|
-
|
|
172
|
+
For production with Postgres, set `POSTGRES_PASSWORD` and `BETTER_AUTH_URL`, then run `docker compose up -d`. The setup link is in `docker compose logs tansy`. Before going live, set up [backups](https://tansycms.vercel.app/docs/guides/backups) and copy `TANSY_BACKUP_KEY` from `/data/secrets.env` somewhere safe. Point your load balancer's health check at `/api/ready`, and see [running it](https://tansycms.vercel.app/docs/guides/operations) for what to watch.
|
|
86
173
|
|
|
87
174
|
## Running from source
|
|
88
175
|
|
|
@@ -98,22 +185,10 @@ npm run dev
|
|
|
98
185
|
On first start the server log prints a one-time setup link. Open it to create the superadmin.
|
|
99
186
|
|
|
100
187
|
`tansy init` is complete on its own: a SQLite file beside the app and uploads on local disk, like
|
|
101
|
-
Django's defaults. Before a real deployment, read [going to production](docs/guides/production
|
|
188
|
+
Django's defaults. Before a real deployment, read [going to production](https://tansycms.vercel.app/docs/guides/production) —
|
|
102
189
|
above all, choose the database before you have content, because records don't move between SQLite
|
|
103
190
|
and Postgres.
|
|
104
191
|
|
|
105
|
-
## Backups
|
|
106
|
-
|
|
107
|
-
`tansy backup` writes one encrypted archive of the database and uploads, on a schedule or by hand, to any storage adapter, and `tansy restore` puts it back. Both databases are covered, each copied by its own tools. See [docs/guides/backups.md](docs/guides/backups.md).
|
|
108
|
-
|
|
109
|
-
## Search
|
|
110
|
-
|
|
111
|
-
`/records?search=` runs in the database by default. Set `search` in `tansy.config.ts` to Meilisearch, Typesense or Algolia to use an outside engine instead, kept in step through a queue that retries until the engine has every change. See [docs/guides/search.md](docs/guides/search.md).
|
|
112
|
-
|
|
113
|
-
## Analytics
|
|
114
|
-
|
|
115
|
-
`@tansy/analytics` counts page views with no cookies and nothing personal kept, and shows them on the dashboard. Add `@tansy/analytics-plausible`, `-umami`, `-google`, `-fathom` or `-matomo` to send them to that service as well, and to see its numbers on the dashboard. See [docs/plugins/analytics.md](docs/plugins/analytics.md).
|
|
116
|
-
|
|
117
192
|
## Checks
|
|
118
193
|
|
|
119
194
|
```bash
|
|
@@ -125,19 +200,20 @@ TEST_DATABASE_URL=file:./.data/cms_test.db npm run test:package # the same
|
|
|
125
200
|
|
|
126
201
|
## Contributing
|
|
127
202
|
|
|
128
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for the repository's layout, its commands, and the three rules
|
|
129
|
-
a change has to keep: the [security model](docs/contributing/security-model.md), the
|
|
130
|
-
[dashboard design system](docs/contributing/design-system.md) and translatable text.
|
|
203
|
+
See [CONTRIBUTING.md](https://github.com/mhmdsalahsebai/tansy/blob/main/CONTRIBUTING.md) for the repository's layout, its commands, and the three rules
|
|
204
|
+
a change has to keep: the [security model](https://github.com/mhmdsalahsebai/tansy/blob/main/docs/contributing/security-model.md), the
|
|
205
|
+
[dashboard design system](https://github.com/mhmdsalahsebai/tansy/blob/main/docs/contributing/design-system.md) and translatable text.
|
|
131
206
|
|
|
132
207
|
## Releases
|
|
133
208
|
|
|
134
|
-
Every package in this repository moves on
|
|
135
|
-
|
|
136
|
-
the release workflow, which checks,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
[
|
|
209
|
+
Every package in this repository moves on its own version, so a release publishes only what changed.
|
|
210
|
+
`node scripts/set-version.mjs <package> <version>` moves one package, and pushing a
|
|
211
|
+
`<package>@<version>` tag, such as `@tansy/blog@0.1.2`, runs the release workflow, which checks,
|
|
212
|
+
builds, publishes that package to npm with provenance and opens a GitHub release from its changelog:
|
|
213
|
+
a plugin's or theme's `CHANGELOG.md` in its folder, or [CHANGELOG.md](https://github.com/mhmdsalahsebai/tansy/blob/main/CHANGELOG.md) for `tansy` and create-tansy. What a release may change before 1.0, and what it may not
|
|
214
|
+
after, is [the deprecation policy](https://github.com/mhmdsalahsebai/tansy/blob/main/docs/contributing/deprecation.md), written for users as the
|
|
215
|
+
[upgrading guide](https://tansycms.vercel.app/docs/guides/upgrading).
|
|
140
216
|
|
|
141
217
|
## Licence
|
|
142
218
|
|
|
143
|
-
MIT. See [LICENSE](LICENSE). The same licence covers every plugin and theme in this repository.
|
|
219
|
+
MIT. See [LICENSE](https://github.com/mhmdsalahsebai/tansy/blob/main/LICENSE). The same licence covers every plugin and theme in this repository.
|
package/core/auth/instance.d.ts
CHANGED
|
@@ -2402,6 +2402,7 @@ declare function createAuthInstance(s: AuthSettings, roleMap: RoleMap, extension
|
|
|
2402
2402
|
init(ctx: import("better-auth").AuthContext): {
|
|
2403
2403
|
context: {
|
|
2404
2404
|
passkeyBaseURLFromRequest: boolean;
|
|
2405
|
+
passkeyWildcardCoversRpID: boolean;
|
|
2405
2406
|
};
|
|
2406
2407
|
};
|
|
2407
2408
|
endpoints: {
|
package/core/files/service.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { type RuleLookups } from "../authz/records";
|
|
|
5
5
|
import { type CollectionWithFields } from "../content/access";
|
|
6
6
|
import { type FileText } from "./text";
|
|
7
7
|
import { type FileFocus } from "./focus";
|
|
8
|
-
export declare const THUMB_SIZES: readonly ["100x100", "300x300", "800x0"];
|
|
8
|
+
export declare const THUMB_SIZES: readonly ["100x100", "300x300", "800x0", "1600x0"];
|
|
9
9
|
export type ThumbSize = (typeof THUMB_SIZES)[number];
|
|
10
10
|
/**
|
|
11
11
|
* Files belong to the scope value they were uploaded in, such as a tenant, or to the instance
|
package/core/files/service.js
CHANGED
|
@@ -24,7 +24,7 @@ import { fileTextColumns, fileTextIn } from "./text";
|
|
|
24
24
|
import { detectType, RASTER_IMAGES, SNIFF_BYTES } from "./sniff";
|
|
25
25
|
import { clampPercent, fileFocusOf, focusCrop, focusKeyPart } from "./focus";
|
|
26
26
|
import { invalidateSiteCache } from "../site/cache";
|
|
27
|
-
export const THUMB_SIZES = ["100x100", "300x300", "800x0"];
|
|
27
|
+
export const THUMB_SIZES = ["100x100", "300x300", "800x0", "1600x0"];
|
|
28
28
|
const SIGNED_URL_SECONDS = 300;
|
|
29
29
|
/** A thumbnail from a provider is refused past this, since it is held in memory. */
|
|
30
30
|
const MAX_PROVIDER_THUMB_BYTES = 10 * 1024 * 1024;
|
|
@@ -292,7 +292,7 @@ export async function canReadFile(file, principal, canView) {
|
|
|
292
292
|
async function bytesOf(stream) {
|
|
293
293
|
return Buffer.from(await new Response(stream).arrayBuffer());
|
|
294
294
|
}
|
|
295
|
-
/** "800x0"
|
|
295
|
+
/** "800x0" and "1600x0" keep the image's shape within that many pixels wide. */
|
|
296
296
|
function thumbShape(size) {
|
|
297
297
|
const [width, height] = size.split("x").map(Number);
|
|
298
298
|
return height ? { width, height, fit: "cover" } : { width, fit: "inside" };
|
package/core/scope/data.js
CHANGED
|
@@ -23,6 +23,7 @@ import { isLocalizedCollection } from "../i18n/context";
|
|
|
23
23
|
import { localeTableName, tableName } from "../schema/names";
|
|
24
24
|
import { queueSearch, removeLocaleSearchEntry, removeSearchEntry, searchAdapter, wakeSearchQueue, writeLocaleSearchEntry, writeSearchEntry } from "../search";
|
|
25
25
|
import { invalidateSiteCache } from "../site/cache";
|
|
26
|
+
import { THUMB_SIZES } from "../files/service";
|
|
26
27
|
import { adapterNamed, uploadAdapter } from "../storage";
|
|
27
28
|
import { isScopeValue, SCOPE_COLUMN, unscoped, withScope } from "./context";
|
|
28
29
|
/**
|
|
@@ -447,7 +448,7 @@ export async function purgeScope(value) {
|
|
|
447
448
|
await prisma.storedFile.deleteMany({ where: { id: { in: ids } } });
|
|
448
449
|
for (const file of part) {
|
|
449
450
|
const adapter = adapterNamed(file.storage);
|
|
450
|
-
const keys = [file.key, ...
|
|
451
|
+
const keys = [file.key, ...THUMB_SIZES.map((size) => `thumbs/${file.key}/${size}.webp`)];
|
|
451
452
|
const results = await Promise.allSettled(keys.map((key) => adapter.delete(key)));
|
|
452
453
|
for (const result of results)
|
|
453
454
|
if (result.status === "rejected")
|
package/core/site/page.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export interface SiteReader {
|
|
|
65
65
|
accentColor?: string;
|
|
66
66
|
}>;
|
|
67
67
|
preview(token: string): Promise<PreviewedRecord | null>;
|
|
68
|
-
fileUrl(id: string, thumb?: "100x100" | "300x300" | "800x0"): string;
|
|
68
|
+
fileUrl(id: string, thumb?: "100x100" | "300x300" | "800x0" | "1600x0"): string;
|
|
69
69
|
/**
|
|
70
70
|
* The same reads as the signed-in person making this request, as a member of the site:
|
|
71
71
|
* API rules see who they are through @request.auth, and their role's permissions don't
|
package/core/theme/define.d.ts
CHANGED
|
@@ -128,7 +128,7 @@ export interface TemplateProps<Options = unknown> {
|
|
|
128
128
|
branding: SiteBranding;
|
|
129
129
|
/** True when this shows unpublished changes. */
|
|
130
130
|
preview: boolean;
|
|
131
|
-
fileUrl(id: string, thumb?: "100x100" | "300x300" | "800x0"): string;
|
|
131
|
+
fileUrl(id: string, thumb?: "100x100" | "300x300" | "800x0" | "1600x0"): string;
|
|
132
132
|
/**
|
|
133
133
|
* How a file is described, in this page's language: `alt` for an image's alternative text,
|
|
134
134
|
* with `caption` and `credit` where a theme shows them. Empty strings when the file has no
|
package/core/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** This package's version, for checking what plugins require. tests/unit/plugin-manifest.test.ts keeps it equal to package.json. */
|
|
2
|
-
export declare const TANSY_VERSION = "0.1.
|
|
2
|
+
export declare const TANSY_VERSION = "0.1.1";
|
package/core/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** This package's version, for checking what plugins require. tests/unit/plugin-manifest.test.ts keeps it equal to package.json. */
|
|
2
|
-
export const TANSY_VERSION = "0.1.
|
|
2
|
+
export const TANSY_VERSION = "0.1.1";
|
package/lib/auth-client.d.ts
CHANGED
|
@@ -1015,6 +1015,7 @@ export declare const authClient: import("better-auth/react").ReactAuthClient<{
|
|
|
1015
1015
|
init(ctx: import("better-auth").AuthContext): {
|
|
1016
1016
|
context: {
|
|
1017
1017
|
passkeyBaseURLFromRequest: boolean;
|
|
1018
|
+
passkeyWildcardCoversRpID: boolean;
|
|
1018
1019
|
};
|
|
1019
1020
|
};
|
|
1020
1021
|
endpoints: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tansy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Self-hosted, runtime-schema CMS for Next.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tansy",
|
|
@@ -115,41 +115,41 @@
|
|
|
115
115
|
"react-dom": "^19.3.0"
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@better-auth/api-key": "^1.7.
|
|
119
|
-
"@better-auth/passkey": "^1.7.
|
|
118
|
+
"@better-auth/api-key": "^1.7.25",
|
|
119
|
+
"@better-auth/passkey": "^1.7.25",
|
|
120
120
|
"@dnd-kit/core": "^6.3.1",
|
|
121
121
|
"@dnd-kit/sortable": "^10.0.0",
|
|
122
122
|
"@dnd-kit/utilities": "^3.2.2",
|
|
123
|
-
"@formatjs/icu-messageformat-parser": "~3.5.
|
|
123
|
+
"@formatjs/icu-messageformat-parser": "~3.5.23",
|
|
124
124
|
"@headlessui/react": "^2.2.10",
|
|
125
125
|
"@heroicons/react": "^2.2.0",
|
|
126
|
-
"@hookform/resolvers": "^7.0.
|
|
126
|
+
"@hookform/resolvers": "^7.0.7",
|
|
127
127
|
"@prisma/adapter-better-sqlite3": "^7.10.1",
|
|
128
128
|
"@prisma/adapter-pg": "^7.10.1",
|
|
129
129
|
"@prisma/client": "^7.10.1",
|
|
130
|
-
"@tiptap/extensions": "^3.
|
|
131
|
-
"@tiptap/pm": "^3.
|
|
132
|
-
"@tiptap/react": "^3.
|
|
133
|
-
"@tiptap/starter-kit": "^3.
|
|
130
|
+
"@tiptap/extensions": "^3.34.0",
|
|
131
|
+
"@tiptap/pm": "^3.34.0",
|
|
132
|
+
"@tiptap/react": "^3.34.0",
|
|
133
|
+
"@tiptap/starter-kit": "^3.34.0",
|
|
134
134
|
"argon2": "^0.45.2",
|
|
135
135
|
"aws4fetch": "^1.0.20",
|
|
136
|
-
"better-auth": "^1.7.
|
|
136
|
+
"better-auth": "^1.7.25",
|
|
137
137
|
"better-sqlite3": "^12.11.1",
|
|
138
138
|
"clsx": "^2.1.1",
|
|
139
|
-
"dotenv": "^18.0.
|
|
139
|
+
"dotenv": "^18.0.10",
|
|
140
140
|
"jiti": "^2.7.0",
|
|
141
|
-
"kysely": "^0.29.
|
|
142
|
-
"libpg-query": "^18.2.
|
|
143
|
-
"nodemailer": "^10.
|
|
141
|
+
"kysely": "^0.29.9",
|
|
142
|
+
"libpg-query": "^18.2.4",
|
|
143
|
+
"nodemailer": "^10.6.0",
|
|
144
144
|
"pg": "^8.23.1",
|
|
145
145
|
"prisma": "^7.10.1",
|
|
146
146
|
"qrcode.react": "^4.2.0",
|
|
147
|
-
"react-hook-form": "^7.
|
|
147
|
+
"react-hook-form": "^7.92.0",
|
|
148
148
|
"server-only": "^0.0.1",
|
|
149
149
|
"sharp": "^0.35.5",
|
|
150
150
|
"slugify": "^1.6.9",
|
|
151
151
|
"sonner": "^2.0.8",
|
|
152
|
-
"use-intl": "~4.
|
|
152
|
+
"use-intl": "~4.15.1",
|
|
153
153
|
"zod": "^4.6.7"
|
|
154
154
|
}
|
|
155
155
|
}
|
package/sdk/index.d.ts
CHANGED
|
@@ -258,7 +258,7 @@ export declare class CmsClient<C extends object = Record<string, Record<string,
|
|
|
258
258
|
body?: unknown;
|
|
259
259
|
}[]>;
|
|
260
260
|
/** The URL of a file. Add a size for a thumbnail. */
|
|
261
|
-
fileUrl(id: string, thumb?: "100x100" | "300x300" | "800x0"): string;
|
|
261
|
+
fileUrl(id: string, thumb?: "100x100" | "300x300" | "800x0" | "1600x0"): string;
|
|
262
262
|
/** Reads the stream with fetch, since the browser's EventSource can't send an API key. */
|
|
263
263
|
private subscribe;
|
|
264
264
|
}
|