foldkit-cms-drizzle 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 +23 -7
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -6,12 +6,9 @@ unpublished work in three tables beside your own, and it is where the **audience
|
|
|
6
6
|
boundary** is enforced: who is not an author is refused entries, drafts and
|
|
7
7
|
revisions outright, and sees of your content only what is published.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
> is left of [the design](../../docs/design/cms-DESIGN.md#13-build-order).
|
|
13
|
-
> Not on npm. SQLite and Postgres; MySQL has no `returning`, which the conflict
|
|
14
|
-
> rule needs.
|
|
9
|
+
Supports SQLite and Postgres. The conflict check requires `returning`, so this
|
|
10
|
+
adapter does not support MySQL. The [CMS example](../../examples/cms/README.md)
|
|
11
|
+
includes the server, in-app preview, and a browser mode over an in-memory database.
|
|
15
12
|
|
|
16
13
|
## What it owns
|
|
17
14
|
|
|
@@ -47,7 +44,13 @@ pnpm add effect drizzle-orm foldkit-cms foldkit-cms-drizzle foldkit-remote-drizz
|
|
|
47
44
|
|
|
48
45
|
## Example
|
|
49
46
|
|
|
50
|
-
|
|
47
|
+
The following is **wiring pseudocode**: `Blog`, `Posts`, `posts`, `isAuthor`,
|
|
48
|
+
and the insert/update handlers belong to your application. Use
|
|
49
|
+
[the runnable server](../../examples/cms/src/server.ts) for complete handlers,
|
|
50
|
+
a database layer, and transaction setup. `sqliteTables()` describes tables;
|
|
51
|
+
include them in your migrations before running the server.
|
|
52
|
+
|
|
53
|
+
```text
|
|
51
54
|
import { CmsServer, Transaction, published, sqliteTables } from 'foldkit-cms-drizzle'
|
|
52
55
|
|
|
53
56
|
const cmsTables = sqliteTables() // or pgTables(); add them to your schema and migrations
|
|
@@ -88,6 +91,19 @@ RemoteServer.make({
|
|
|
88
91
|
- **`create` and `update` go to the CMS, not to `RemoteServer.make`.** Registered
|
|
89
92
|
there too, they are a way to publish with no draft, no revision and no `allow`.
|
|
90
93
|
|
|
94
|
+
## Verify the audience boundary
|
|
95
|
+
|
|
96
|
+
Before connecting the editor, exercise the same content read as an author and
|
|
97
|
+
as a visitor. An author may see working content; a visitor must see only rows
|
|
98
|
+
allowed by the binding's `visible` rule. Repeat through a relation and a query,
|
|
99
|
+
not just a direct id read. CMS state and allowed actions are separate from the
|
|
100
|
+
identity established by your HTTP or RPC authentication.
|
|
101
|
+
|
|
102
|
+
For the first write, save a draft and read the public row again: it must be
|
|
103
|
+
unchanged. Publishing should then update the row, append a revision, and remove
|
|
104
|
+
the draft within the supplied transaction. A scheduled time alone executes
|
|
105
|
+
nothing; your host must call `cms.due` as described below.
|
|
106
|
+
|
|
91
107
|
## Saving a draft
|
|
92
108
|
|
|
93
109
|
`CmsSaveDraft` writes the working copy, valid or not. The client names something
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-cms-drizzle",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "The server half of foldkit-cms over Drizzle: the entries, drafts and revisions tables, the draft operations with their conflict rule, the worklist query, and the audience boundary between a visitor and an author.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"drizzle-orm": "1.0.0-rc.4",
|
|
42
|
-
"foldkit-cms": "0.1.
|
|
43
|
-
"foldkit-
|
|
44
|
-
"foldkit-remote
|
|
45
|
-
"foldkit-remote-drizzle": "0.
|
|
46
|
-
"foldkit-
|
|
42
|
+
"foldkit-cms": "0.1.1",
|
|
43
|
+
"foldkit-entity": "0.3.0",
|
|
44
|
+
"foldkit-remote": "0.6.0",
|
|
45
|
+
"foldkit-remote-drizzle": "0.6.0",
|
|
46
|
+
"foldkit-remote-server": "0.6.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"effect": "^4.0.0-rc.112"
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"tsdown": "^0.23.0",
|
|
55
55
|
"typescript": "5.9.3",
|
|
56
56
|
"foldkit-bundle": "0.2.0",
|
|
57
|
-
"foldkit-
|
|
58
|
-
"foldkit-
|
|
57
|
+
"foldkit-surface": "0.4.0",
|
|
58
|
+
"foldkit-form": "0.1.2"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsdown",
|