foldkit-cms-drizzle 0.1.0 → 0.1.2

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 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
- > **Status: every operation.** Saving and discarding a draft, publishing and
10
- > unpublishing, scheduling, archiving, restoring a revision, the worklist, an
11
- > entry's derived state, and the boundary. In-app preview and an example are what
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
- ```ts
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/dist/index.d.mts CHANGED
@@ -1173,8 +1173,8 @@ export declare const CmsServer: {
1173
1173
  }>>;
1174
1174
  }>;
1175
1175
  } & {
1176
- readonly draft: Schema.NullOr<Schema.Codec<import("foldkit-remote").EntityRef<"CmsDraft", Schema.Struct.Fields>, string, never, never>>;
1177
- readonly revisions: Schema.$Array<Schema.Codec<import("foldkit-remote").EntityRef<"CmsRevision", Schema.Struct.Fields>, string, never, never>>;
1176
+ readonly draft: Schema.NullOr<Schema.Codec<import("foldkit-remote").EntityRef<"CmsDraft", Schema.Struct.Fields>, `CmsDraft:${string}`, never, never>>;
1177
+ readonly revisions: Schema.$Array<Schema.Codec<import("foldkit-remote").EntityRef<"CmsRevision", Schema.Struct.Fields>, `CmsRevision:${string}`, never, never>>;
1178
1178
  }, Record<"draft" | "revisions", import("foldkit-remote-drizzle").RelationBinding>>;
1179
1179
  readonly Draft: import("foldkit-remote-drizzle").EntityBinding<"CmsDraft", import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
1180
1180
  name: "cms_drafts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldkit-cms-drizzle",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
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.0",
43
- "foldkit-remote": "0.5.0",
44
- "foldkit-remote-server": "0.5.0",
45
- "foldkit-remote-drizzle": "0.5.0",
46
- "foldkit-entity": "0.2.0"
42
+ "foldkit-entity": "0.3.0",
43
+ "foldkit-remote-drizzle": "0.7.0",
44
+ "foldkit-remote": "0.7.0",
45
+ "foldkit-cms": "0.1.2",
46
+ "foldkit-remote-server": "0.7.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-form": "0.1.1",
58
- "foldkit-surface": "0.3.0"
57
+ "foldkit-form": "0.1.2",
58
+ "foldkit-surface": "0.4.1"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "tsdown",