alinea 2.0.0-preview.7 → 2.0.0-preview.9

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.
Files changed (301) hide show
  1. package/dist/.init/content/pages/welcome.json +1 -1
  2. package/dist/LICENSES.md +103 -103
  3. package/dist/adapter/next/cms.d.ts +18 -4
  4. package/dist/adapter/next/cms.js +141 -36
  5. package/dist/adapter/next/handler.d.ts +5 -1
  6. package/dist/adapter/next/handler.js +77 -17
  7. package/dist/adapter/next/node.d.ts +5 -0
  8. package/dist/adapter/next/node.js +16 -0
  9. package/dist/adapter/next/previews.d.ts +4 -1
  10. package/dist/adapter/next/previews.js +13 -1
  11. package/dist/adapter/next/renderStats.d.ts +45 -0
  12. package/dist/adapter/next/renderStats.js +142 -0
  13. package/dist/adapter/next/syncCheck.d.ts +8 -2
  14. package/dist/adapter/next/syncCheck.js +5 -11
  15. package/dist/adapter/next/with-alinea.js +6 -20
  16. package/dist/backend/HandleAction.d.ts +1 -1
  17. package/dist/backend/HandleAction.js +1 -1
  18. package/dist/backend/Handler.d.ts +2 -2
  19. package/dist/backend/Handler.js +45 -47
  20. package/dist/backend/api/CreateBackend.js +15 -3
  21. package/dist/backend/api/DatabaseApi.js +22 -135
  22. package/dist/backend/api/ProxyMedia.d.ts +2 -3
  23. package/dist/backend/api/ProxyMedia.js +7 -22
  24. package/dist/backend/api/database.js +15 -3
  25. package/dist/backend/resolver/ParsePreview.d.ts +2 -2
  26. package/dist/backend/router/NodeHandler.js +2 -0
  27. package/dist/backend/store/GeneratedDatabase.d.ts +8 -0
  28. package/dist/backend/store/GeneratedDatabase.js +33 -0
  29. package/dist/backend/store/GeneratedDatabaseNode.d.ts +4 -0
  30. package/dist/backend/store/GeneratedDatabaseNode.js +35 -0
  31. package/dist/backend/util/ORM.js +4 -2
  32. package/dist/bundled.d.ts +1565 -468
  33. package/dist/chunks/bun-sqlite-5SHXN3AT.js +18 -0
  34. package/dist/chunks/chunk-2BJ2IFQM.js +1085 -0
  35. package/dist/chunks/chunk-2PIFHEYR.js +364 -0
  36. package/dist/chunks/chunk-66YZ47TY.js +94 -0
  37. package/dist/chunks/chunk-76VMZTLN.js +55 -0
  38. package/dist/chunks/chunk-AIU6CMVT.js +495 -0
  39. package/dist/chunks/chunk-ASYKC6IE.js +103 -0
  40. package/dist/chunks/chunk-ATF42T2B.js +35 -0
  41. package/dist/chunks/{chunk-6P4UVRPH.js → chunk-DWR5A5KL.js} +6 -1
  42. package/dist/chunks/{chunk-NWQXN4SB.js → chunk-ETBQTP2S.js} +40 -29
  43. package/dist/chunks/chunk-ETWOY4AL.js +100 -0
  44. package/dist/chunks/chunk-K62JP6HR.js +22 -0
  45. package/dist/chunks/chunk-MOWR65LM.js +610 -0
  46. package/dist/chunks/chunk-N47Y62CI.js +396 -0
  47. package/dist/chunks/chunk-QBPYWU6C.js +24 -0
  48. package/dist/chunks/{chunk-X47OVDF3.js → chunk-QJGGYF6E.js} +356 -1000
  49. package/dist/chunks/chunk-QSN6RH6X.js +94 -0
  50. package/dist/chunks/{chunk-I4GC3E65.js → chunk-UPY2RUZF.js} +0 -1
  51. package/dist/chunks/chunk-XCZXR3C2.js +112 -0
  52. package/dist/chunks/chunk-XTWYBWP2.js +81 -0
  53. package/dist/chunks/node-sqlite-XVNTNMCY.js +18 -0
  54. package/dist/cli/Generate.js +74 -64
  55. package/dist/cli/Serve.js +1 -1
  56. package/dist/cli/bin.js +6 -1
  57. package/dist/cli/generate/CopyStaticFiles.js +17 -14
  58. package/dist/cli/generate/DevDB.d.ts +22 -5
  59. package/dist/cli/generate/DevDB.js +138 -24
  60. package/dist/cli/serve/CreateLocalServer.js +22 -4
  61. package/dist/cli/serve/DevServer.d.ts +2 -0
  62. package/dist/cli/serve/DevServer.js +7 -2
  63. package/dist/cli/serve/LiveReload.d.ts +1 -1
  64. package/dist/cli/serve/LiveReload.js +3 -0
  65. package/dist/cloud/CloudRemote.js +2 -1
  66. package/dist/components/Breadcrumbs.js +2 -2
  67. package/dist/components/Calendar.js +7 -7
  68. package/dist/components/Checkbox.js +1 -1
  69. package/dist/components/ColorSwatchPicker.js +2 -2
  70. package/dist/components/ComboBox.js +14 -14
  71. package/dist/components/DateField.js +1 -1
  72. package/dist/components/DatePicker.js +6 -6
  73. package/dist/components/DateRangePicker.js +4 -4
  74. package/dist/components/Disclosure.js +8 -8
  75. package/dist/components/Label.js +6 -6
  76. package/dist/components/List.js +33 -33
  77. package/dist/components/Menu.js +2 -2
  78. package/dist/components/Modal.js +2 -2
  79. package/dist/components/MultipleSelect.js +23 -23
  80. package/dist/components/NumberField.js +6 -6
  81. package/dist/components/ProgressCircle.js +3 -3
  82. package/dist/components/SearchField.js +8 -8
  83. package/dist/components/Select.js +8 -8
  84. package/dist/components/Surface.js +3 -3
  85. package/dist/components/Switch.js +2 -2
  86. package/dist/components/Table.js +7 -7
  87. package/dist/components/Tabs.js +2 -2
  88. package/dist/components/TagGroup.js +2 -2
  89. package/dist/components/TextField.js +2 -2
  90. package/dist/components/TimeField.js +3 -3
  91. package/dist/components/Toolbar.js +2 -2
  92. package/dist/components/Tooltip.js +4 -4
  93. package/dist/components/Tree.d.ts +2 -1
  94. package/dist/components/Tree.js +6 -6
  95. package/dist/core/Client.d.ts +1 -4
  96. package/dist/core/Client.js +5 -7
  97. package/dist/core/Connection.d.ts +4 -1
  98. package/dist/core/Connection.js +3 -1
  99. package/dist/core/Document.js +15 -3
  100. package/dist/core/Entry.d.ts +3 -0
  101. package/dist/core/Entry.js +4 -0
  102. package/dist/core/EntrySeed.d.ts +19 -0
  103. package/dist/core/EntrySeed.js +136 -0
  104. package/dist/core/Field.d.ts +7 -0
  105. package/dist/core/Field.js +4 -0
  106. package/dist/core/Filter.d.ts +40 -2
  107. package/dist/core/Filter.js +145 -0
  108. package/dist/core/Graph.d.ts +9 -0
  109. package/dist/core/ListRow.d.ts +1 -0
  110. package/dist/core/ListRow.js +1 -0
  111. package/dist/core/Reference.d.ts +1 -0
  112. package/dist/core/Root.js +1 -1
  113. package/dist/core/Scope.d.ts +2 -0
  114. package/dist/core/Scope.js +16 -1
  115. package/dist/core/Type.d.ts +2 -1
  116. package/dist/core/Type.js +13 -1
  117. package/dist/core/db/EntryAliases.js +1 -11
  118. package/dist/core/db/EntryReference.d.ts +0 -6
  119. package/dist/core/db/IndexEvent.d.ts +2 -1
  120. package/dist/core/db/IndexEvent.js +11 -3
  121. package/dist/core/db/LinkResolver.d.ts +6 -6
  122. package/dist/core/db/LinkResolver.js +0 -52
  123. package/dist/core/db/LocalStore.d.ts +27 -0
  124. package/dist/core/field/ListField.js +19 -0
  125. package/dist/core/field/RecordField.js +8 -0
  126. package/dist/core/field/RichTextField.js +42 -0
  127. package/dist/core/field/UnionField.js +8 -0
  128. package/dist/core/source/FSSource.d.ts +14 -2
  129. package/dist/core/source/FSSource.js +58 -13
  130. package/dist/core/source/GitUtils.d.ts +4 -0
  131. package/dist/core/source/GitUtils.js +9 -10
  132. package/dist/core/source/GithubSource.js +60 -21
  133. package/dist/core/source/IndexedDBSource.d.ts +2 -1
  134. package/dist/core/source/IndexedDBSource.js +67 -53
  135. package/dist/core/source/MemorySource.js +5 -3
  136. package/dist/core/source/OverlaySource.d.ts +5 -2
  137. package/dist/core/source/OverlaySource.js +31 -3
  138. package/dist/core/source/Source.d.ts +3 -0
  139. package/dist/core/source/Source.js +15 -2
  140. package/dist/core/source/Tree.d.ts +10 -7
  141. package/dist/core/source/Tree.js +118 -70
  142. package/dist/core/source/Utils.js +6 -3
  143. package/dist/core/util/Arrays.d.ts +1 -0
  144. package/dist/core/util/Arrays.js +10 -0
  145. package/dist/core/util/Async.d.ts +7 -0
  146. package/dist/core/util/Async.js +15 -0
  147. package/dist/core/util/Checks.js +1 -1
  148. package/dist/core/util/EntryFilenames.d.ts +22 -1
  149. package/dist/core/util/EntryFilenames.js +56 -2
  150. package/dist/core/util/IndexedDB.d.ts +4 -0
  151. package/dist/core/util/IndexedDB.js +20 -0
  152. package/dist/core/util/Paths.js +5 -1
  153. package/dist/dashboard/App.js +3 -3
  154. package/dist/dashboard/ViewKeys.d.ts +1 -0
  155. package/dist/dashboard/ViewKeys.js +1 -0
  156. package/dist/dashboard/app/AccessDenied.js +2 -2
  157. package/dist/dashboard/app/ActivityStatus.js +14 -14
  158. package/dist/dashboard/app/AppShell.js +2 -2
  159. package/dist/dashboard/app/AuthView.js +12 -12
  160. package/dist/dashboard/app/CompactField.js +11 -11
  161. package/dist/dashboard/app/DashboardErrorBoundary.js +6 -6
  162. package/dist/dashboard/app/DashboardLayout.js +3 -3
  163. package/dist/dashboard/app/EntryHeader.js +8 -8
  164. package/dist/dashboard/app/EntryReferences.js +8 -8
  165. package/dist/dashboard/app/EntrySidebar.js +15 -15
  166. package/dist/dashboard/app/EntrySidebarPreview.js +7 -7
  167. package/dist/dashboard/app/EntryTranslationBanner.js +5 -5
  168. package/dist/dashboard/app/Explorer.js +39 -39
  169. package/dist/dashboard/app/ExplorerCards.js +31 -31
  170. package/dist/dashboard/app/ExplorerFileCard.js +19 -19
  171. package/dist/dashboard/app/ExplorerList.js +10 -10
  172. package/dist/dashboard/app/ExplorerModal.js +5 -5
  173. package/dist/dashboard/app/ExplorerTable.js +47 -47
  174. package/dist/dashboard/app/LinkPicker.js +5 -5
  175. package/dist/dashboard/app/LocaleMenu.js +4 -4
  176. package/dist/dashboard/app/SidebarTree.js +76 -40
  177. package/dist/dashboard/app/WorkspaceMenu.js +9 -9
  178. package/dist/dashboard/app/WorkspaceRoots.js +22 -22
  179. package/dist/dashboard/app/editor/FileEditor.js +28 -28
  180. package/dist/dashboard/app/editor/FilePreview.js +6 -6
  181. package/dist/dashboard/app/modals/CreateEntry.js +3 -3
  182. package/dist/dashboard/app/pages/EntryPage.js +18 -18
  183. package/dist/dashboard/app/pages/RootPage.js +3 -3
  184. package/dist/dashboard/app/pages/SplashPage.js +45 -45
  185. package/dist/dashboard/app/pages/UsersPage.js +34 -34
  186. package/dist/dashboard/app/ui/DashboardModal.js +18 -18
  187. package/dist/dashboard/app/ui/Rail.js +5 -5
  188. package/dist/dashboard/app/ui/Sidebar.js +2 -2
  189. package/dist/dashboard/atoms/config.d.ts +4 -4
  190. package/dist/dashboard/atoms/entry.d.ts +8 -9
  191. package/dist/dashboard/atoms/entry.js +34 -4
  192. package/dist/dashboard/atoms/explorer.d.ts +2 -0
  193. package/dist/dashboard/atoms/explorer.js +7 -2
  194. package/dist/dashboard/boot/Boot.js +2 -3
  195. package/dist/dashboard/boot/DashboardWorker.d.ts +3 -3
  196. package/dist/dashboard/boot/DashboardWorker.js +82 -27
  197. package/dist/dashboard/boot/LoadWorker.js +2 -3
  198. package/dist/dashboard/boot/WorkerDB.d.ts +2 -2
  199. package/dist/dashboard/icons.d.ts +2 -0
  200. package/dist/dashboard/icons.js +40 -0
  201. package/dist/dashboard/plugins/alineaFixturePlugin.js +14 -3
  202. package/dist/database/BrowserEntryStore.d.ts +42 -0
  203. package/dist/database/BrowserEntryStore.js +182 -0
  204. package/dist/database/DatabaseSource.d.ts +13 -0
  205. package/dist/database/DatabaseSource.js +25 -0
  206. package/dist/database/DatabaseTables.d.ts +38 -0
  207. package/dist/database/DatabaseTables.js +53 -0
  208. package/dist/database/EntryDatabase.d.ts +97 -0
  209. package/dist/database/EntryDatabase.js +528 -0
  210. package/dist/database/EntryStore.d.ts +58 -0
  211. package/dist/database/EntryStore.js +230 -0
  212. package/dist/database/EntryTransaction.d.ts +33 -0
  213. package/dist/database/EntryTransaction.js +907 -0
  214. package/dist/database/EntryUrlAliases.d.ts +2 -0
  215. package/dist/database/EntryUrlAliases.js +69 -0
  216. package/dist/database/LocalDB.d.ts +39 -0
  217. package/dist/database/LocalDB.js +79 -0
  218. package/dist/database/Version.d.ts +9 -0
  219. package/dist/database/Version.js +13 -0
  220. package/dist/database/driver/DatabaseHandle.d.ts +17 -0
  221. package/dist/database/driver/DatabaseHandle.js +0 -0
  222. package/dist/database/driver/OverlayExtension.browser.d.ts +2 -0
  223. package/dist/database/driver/OverlayExtension.browser.js +9 -0
  224. package/dist/database/driver/OverlayExtension.d.ts +1 -0
  225. package/dist/database/driver/OverlayExtension.js +7 -0
  226. package/dist/database/driver/RuntimeDatabase.d.ts +13 -0
  227. package/dist/database/driver/RuntimeDatabase.js +77 -0
  228. package/dist/database/driver/WasmDatabase.d.ts +29 -0
  229. package/dist/database/driver/WasmDatabase.js +46 -0
  230. package/dist/database/entry/EntryData.d.ts +13 -0
  231. package/dist/database/entry/EntryData.js +51 -0
  232. package/dist/database/entry/EntryTable.d.ts +189 -0
  233. package/dist/database/entry/EntryTable.js +186 -0
  234. package/dist/database/query/Condition.d.ts +8 -0
  235. package/dist/database/query/Condition.js +117 -0
  236. package/dist/database/query/EntryQuery.d.ts +44 -0
  237. package/dist/database/query/EntryQuery.js +412 -0
  238. package/dist/database/query/EntryReferences.d.ts +5 -0
  239. package/dist/database/query/EntryReferences.js +70 -0
  240. package/dist/database/query/Relation.d.ts +11 -0
  241. package/dist/database/query/Relation.js +113 -0
  242. package/dist/database/query/ResolveQuery.d.ts +12 -0
  243. package/dist/database/query/ResolveQuery.js +189 -0
  244. package/dist/database/query/Search.d.ts +38 -0
  245. package/dist/database/query/Search.js +149 -0
  246. package/dist/database/sync/Derive.d.ts +8 -0
  247. package/dist/database/sync/Derive.js +270 -0
  248. package/dist/database/sync/EntryParser.d.ts +8 -0
  249. package/dist/database/sync/EntryParser.js +90 -0
  250. package/dist/database/sync/EntrySyncer.d.ts +25 -0
  251. package/dist/database/sync/EntrySyncer.js +89 -0
  252. package/dist/database/sync/Ingest.d.ts +21 -0
  253. package/dist/database/sync/Ingest.js +145 -0
  254. package/dist/database/sync/SyncQueries.d.ts +160 -0
  255. package/dist/database/sync/SyncQueries.js +216 -0
  256. package/dist/field/check/CheckField.view.js +2 -2
  257. package/dist/field/code/CodeField.view.js +10 -10
  258. package/dist/field/link/LinkField.js +23 -0
  259. package/dist/field/link/LinkField.view.js +42 -41
  260. package/dist/field/list/ListField.view.js +172 -150
  261. package/dist/field/metadata/MetadataField.d.ts +28 -3
  262. package/dist/field/metadata/MetadataField.js +44 -7
  263. package/dist/field/metadata/MetadataField.view.d.ts +5 -0
  264. package/dist/field/metadata/MetadataField.view.js +31 -16
  265. package/dist/field/richtext/RichTextDocument.js +4 -3
  266. package/dist/field/richtext/RichTextExtensions.d.ts +1 -1
  267. package/dist/field/richtext/RichTextExtensions.js +33 -29
  268. package/dist/field/richtext/RichTextField.view.js +17 -8
  269. package/dist/field/richtext/RichTextInsertMenu.js +2 -2
  270. package/dist/field/views.js +2 -0
  271. package/dist/next.cjs +6 -20
  272. package/dist/next.d.ts +4 -3
  273. package/dist/next.edge.d.ts +1 -1
  274. package/dist/next.js +1 -2
  275. package/dist/picker/entry/EntryPicker.js +2 -1
  276. package/dist/picker/url/UrlPicker.js +1 -0
  277. package/dist/preview/widget.d.ts +45 -0
  278. package/dist/preview/widget.js +96 -1
  279. package/dist/query.d.ts +28 -0
  280. package/package.json +6 -1
  281. package/dist/adapter/next/DevRemote.d.ts +0 -3
  282. package/dist/adapter/next/DevRemote.js +0 -45
  283. package/dist/backend/store/GeneratedSource.d.ts +0 -2
  284. package/dist/backend/store/GeneratedSource.js +0 -21
  285. package/dist/chunks/chunk-G6E35DMJ.js +0 -1997
  286. package/dist/core/db/EntryDB.d.ts +0 -19
  287. package/dist/core/db/EntryDB.js +0 -48
  288. package/dist/core/db/EntryIndex.d.ts +0 -143
  289. package/dist/core/db/EntryIndex.js +0 -2773
  290. package/dist/core/db/EntryReferenceIndex.d.ts +0 -21
  291. package/dist/core/db/EntryReferenceIndex.js +0 -131
  292. package/dist/core/db/EntryResolver.d.ts +0 -56
  293. package/dist/core/db/EntryResolver.js +0 -699
  294. package/dist/core/db/EntryTarget.d.ts +0 -5
  295. package/dist/core/db/EntryTransaction.d.ts +0 -31
  296. package/dist/core/db/EntryTransaction.js +0 -956
  297. package/dist/core/db/LocalDB.d.ts +0 -42
  298. package/dist/core/db/LocalDB.js +0 -127
  299. package/dist/core/db/TestDB.d.ts +0 -19
  300. package/dist/core/db/TestDB.js +0 -50
  301. /package/dist/core/db/{EntryTarget.js → LocalStore.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  {
2
- "_id": "3JgVisHzgNS5eYmsJjOMUsgVkII",
2
+ "_id": "3JxaoSVMu4j5r7ELfcth6oNPMoc",
3
3
  "_type": "Page",
4
4
  "_index": "a0",
5
5
  "_seeded": "welcome.json",
package/dist/LICENSES.md CHANGED
@@ -1,5 +1,85 @@
1
1
  This file contains the licenses of the bundled modules in this distribution.
2
2
 
3
+ ===
4
+
5
+ # rado@1.3.0-preview.11 (MIT)
6
+
7
+ MIT License
8
+
9
+ Copyright (c) 2024 Ben Merckx
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ ===
30
+
31
+ # jotai@3.0.0 (MIT)
32
+
33
+ MIT License
34
+
35
+ Copyright (c) 2020 Poimandres
36
+
37
+ Permission is hereby granted, free of charge, to any person obtaining a copy
38
+ of this software and associated documentation files (the "Software"), to deal
39
+ in the Software without restriction, including without limitation the rights
40
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
41
+ copies of the Software, and to permit persons to whom the Software is
42
+ furnished to do so, subject to the following conditions:
43
+
44
+ The above copyright notice and this permission notice shall be included in all
45
+ copies or substantial portions of the Software.
46
+
47
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
48
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
49
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
50
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
51
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
52
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
53
+ SOFTWARE.
54
+
55
+
56
+ ===
57
+
58
+ # @tiptap/core@3.30.5 (MIT)
59
+
60
+ MIT License
61
+
62
+ Copyright (c) 2025, Tiptap GmbH
63
+
64
+ Permission is hereby granted, free of charge, to any person obtaining a copy
65
+ of this software and associated documentation files (the "Software"), to deal
66
+ in the Software without restriction, including without limitation the rights
67
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
68
+ copies of the Software, and to permit persons to whom the Software is
69
+ furnished to do so, subject to the following conditions:
70
+
71
+ The above copyright notice and this permission notice shall be included in all
72
+ copies or substantial portions of the Software.
73
+
74
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
75
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
76
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
77
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
78
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
79
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
80
+ SOFTWARE.
81
+
82
+
3
83
  ===
4
84
 
5
85
  # react-aria-components@1.17.0 (Apache-2.0)
@@ -207,59 +287,6 @@ This file contains the licenses of the bundled modules in this distribution.
207
287
  limitations under the License.
208
288
 
209
289
 
210
- ===
211
-
212
- # jotai@3.0.0 (MIT)
213
-
214
- MIT License
215
-
216
- Copyright (c) 2020 Poimandres
217
-
218
- Permission is hereby granted, free of charge, to any person obtaining a copy
219
- of this software and associated documentation files (the "Software"), to deal
220
- in the Software without restriction, including without limitation the rights
221
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
222
- copies of the Software, and to permit persons to whom the Software is
223
- furnished to do so, subject to the following conditions:
224
-
225
- The above copyright notice and this permission notice shall be included in all
226
- copies or substantial portions of the Software.
227
-
228
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
229
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
230
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
231
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
232
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
233
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
234
- SOFTWARE.
235
-
236
-
237
- ===
238
-
239
- # rado@1.3.0-preview.6 (MIT)
240
-
241
- MIT License
242
-
243
- Copyright (c) 2024 Ben Merckx
244
-
245
- Permission is hereby granted, free of charge, to any person obtaining a copy
246
- of this software and associated documentation files (the "Software"), to deal
247
- in the Software without restriction, including without limitation the rights
248
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
249
- copies of the Software, and to permit persons to whom the Software is
250
- furnished to do so, subject to the following conditions:
251
-
252
- The above copyright notice and this permission notice shall be included in all
253
- copies or substantial portions of the Software.
254
-
255
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
256
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
257
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
258
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
259
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
260
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
261
- SOFTWARE.
262
-
263
290
  ===
264
291
 
265
292
  # microcbor@1.2.1 (MIT)
@@ -494,33 +521,6 @@ SOFTWARE.
494
521
  limitations under the License.
495
522
 
496
523
 
497
- ===
498
-
499
- # @tiptap/core@3.30.5 (MIT)
500
-
501
- MIT License
502
-
503
- Copyright (c) 2025, Tiptap GmbH
504
-
505
- Permission is hereby granted, free of charge, to any person obtaining a copy
506
- of this software and associated documentation files (the "Software"), to deal
507
- in the Software without restriction, including without limitation the rights
508
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
509
- copies of the Software, and to permit persons to whom the Software is
510
- furnished to do so, subject to the following conditions:
511
-
512
- The above copyright notice and this permission notice shall be included in all
513
- copies or substantial portions of the Software.
514
-
515
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
516
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
517
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
518
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
519
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
520
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
521
- SOFTWARE.
522
-
523
-
524
524
  ===
525
525
 
526
526
  # react-stately@3.46.0 (Apache-2.0)
@@ -1068,11 +1068,11 @@ IN THE SOFTWARE.
1068
1068
 
1069
1069
  ===
1070
1070
 
1071
- # use-sync-external-store@1.6.0 (MIT)
1071
+ # fp16@1.0.0 (MIT)
1072
1072
 
1073
1073
  MIT License
1074
1074
 
1075
- Copyright (c) Meta Platforms, Inc. and affiliates.
1075
+ Copyright (c) 2021 Joel Gustafson
1076
1076
 
1077
1077
  Permission is hereby granted, free of charge, to any person obtaining a copy
1078
1078
  of this software and associated documentation files (the "Software"), to deal
@@ -1095,28 +1095,11 @@ SOFTWARE.
1095
1095
 
1096
1096
  ===
1097
1097
 
1098
- # domutils@3.2.2 (BSD-2-Clause)
1099
-
1100
- Copyright (c) Felix Böhm
1101
- All rights reserved.
1102
-
1103
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1104
-
1105
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1106
-
1107
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1108
-
1109
- THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
1110
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1111
-
1112
-
1113
- ===
1114
-
1115
- # fp16@1.0.0 (MIT)
1098
+ # use-sync-external-store@1.6.0 (MIT)
1116
1099
 
1117
1100
  MIT License
1118
1101
 
1119
- Copyright (c) 2021 Joel Gustafson
1102
+ Copyright (c) Meta Platforms, Inc. and affiliates.
1120
1103
 
1121
1104
  Permission is hereby granted, free of charge, to any person obtaining a copy
1122
1105
  of this software and associated documentation files (the "Software"), to deal
@@ -1137,6 +1120,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1137
1120
  SOFTWARE.
1138
1121
 
1139
1122
 
1123
+ ===
1124
+
1125
+ # domutils@3.2.2 (BSD-2-Clause)
1126
+
1127
+ Copyright (c) Felix Böhm
1128
+ All rights reserved.
1129
+
1130
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1131
+
1132
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1133
+
1134
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1135
+
1136
+ THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
1137
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1138
+
1139
+
1140
1140
  ===
1141
1141
 
1142
1142
  # domhandler@5.0.3 (BSD-2-Clause)
@@ -1190,7 +1190,7 @@ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1190
1190
 
1191
1191
  ===
1192
1192
 
1193
- # @internationalized/string@3.2.8 (Apache-2.0)
1193
+ # @internationalized/number@3.6.6 (Apache-2.0)
1194
1194
 
1195
1195
  Apache License
1196
1196
  Version 2.0, January 2004
@@ -1397,7 +1397,7 @@ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1397
1397
 
1398
1398
  ===
1399
1399
 
1400
- # @internationalized/number@3.6.6 (Apache-2.0)
1400
+ # @internationalized/string@3.2.8 (Apache-2.0)
1401
1401
 
1402
1402
  Apache License
1403
1403
  Version 2.0, January 2004
@@ -1,27 +1,41 @@
1
1
  import { CMS } from 'alinea/core/CMS';
2
2
  import { Config } from 'alinea/core/Config';
3
3
  import type { UploadResponse } from 'alinea/core/Connection';
4
- import { LocalDB } from 'alinea/core/db/LocalDB';
4
+ import type { LocalStore } from 'alinea/core/db/LocalStore';
5
5
  import type { Mutation } from 'alinea/core/db/Mutation';
6
6
  import type { GraphQuery } from 'alinea/core/Graph';
7
7
  import type { User } from 'alinea/core/User';
8
8
  import PLazy from 'p-lazy';
9
+ import type { DatabaseOptions } from 'rado';
9
10
  export interface PreviewProps {
10
11
  widget?: boolean;
12
+ /** Show the queries and syncs of each draft render in the widget */
13
+ stats?: boolean;
11
14
  workspace?: string;
12
15
  root?: string;
13
16
  }
17
+ export type OpenBundledDatabase = (config: Config, options?: DatabaseOptions) => Promise<LocalStore>;
18
+ export interface SyncStatus {
19
+ /** Whether queries are answered from the bundled database or the handler. */
20
+ source: 'database' | 'handler';
21
+ /** The content revision the answering side is at. */
22
+ sha: string | undefined;
23
+ /** When this isolate last synced its bundled database with the handler. */
24
+ syncedAt: Date | undefined;
25
+ }
14
26
  export declare class NextCMS<Definition extends Config = Config> extends CMS<Definition> {
15
27
  #private;
16
- constructor(config: Definition);
28
+ bundledDb: PLazy<LocalStore>;
29
+ constructor(config: Definition, openBundledDatabase?: OpenBundledDatabase);
17
30
  throttle: (sync: () => Promise<unknown>, interval?: number) => Promise<void>;
18
- bundledDb: PLazy<LocalDB>;
31
+ /** Where queries are answered from and how fresh that side is. */
32
+ status(): Promise<SyncStatus>;
19
33
  resolve<Query extends GraphQuery>(query: Query): Promise<any>;
20
34
  user(): Promise<User | undefined>;
21
35
  mutate(mutations: Array<Mutation>): Promise<{
22
36
  sha: string;
23
37
  }>;
24
38
  prepareUpload(file: string): Promise<UploadResponse>;
25
- previews: ({ widget, workspace, root }: PreviewProps) => Promise<import("react").JSX.Element | null>;
39
+ previews: ({ widget, stats: showStats, workspace, root }: PreviewProps) => Promise<import("react").JSX.Element | null>;
26
40
  }
27
41
  export declare function createCMS<Definition extends Config>(config: Definition): NextCMS<Definition>;
@@ -12,42 +12,98 @@ import { createThrottledSync } from "alinea/backend/util/Syncable";
12
12
  import { Client } from "alinea/core/Client";
13
13
  import { CMS } from "alinea/core/CMS";
14
14
  import { Config } from "alinea/core/Config";
15
- import { LocalDB } from "alinea/core/db/LocalDB";
16
15
  import { outcome } from "alinea/core/Outcome";
17
16
  import { trace } from "alinea/core/Trace";
18
17
  import { getPreviewPayloadFromCookies } from "alinea/preview/PreviewCookies";
19
18
  import { Headers } from "@alinea/iso";
20
19
  import { cache } from "react";
21
20
  import { requestContext } from "./context.js";
21
+ import { RenderStats, summarizeQuery, timed } from "./renderStats.js";
22
22
  import { syncIfStale } from "./syncCheck.js";
23
23
  import { jsx } from "react/jsx-runtime";
24
+ var preValidatedRemote = { validate: false };
24
25
  var NextCMS = class extends CMS {
25
- constructor(config) {
26
+ bundledDb;
27
+ #syncedAt;
28
+ /** How the bundled database opened, once it did. */
29
+ #opened;
30
+ constructor(config, openBundledDatabase) {
26
31
  super(config);
27
- }
28
- throttle = createThrottledSync();
29
- bundledDb = PLazy.from(async () => {
30
- if (process.env.NEXT_RUNTIME === "edge")
31
- throw new Error("Local DB is not supported in Edge runtime environments.");
32
- const span = trace(this.config, "alinea.next.cms.db");
33
- return span(async () => {
34
- const { generatedSource } = await import("alinea/backend/store/GeneratedSource");
35
- const source = await generatedSource;
36
- const db = new LocalDB(this.config, source);
37
- await db.sync();
32
+ this.bundledDb = PLazy.from(async () => {
33
+ if (process.env.NEXT_RUNTIME === "edge")
34
+ throw new Error(
35
+ "Local DB is not supported in Edge runtime environments."
36
+ );
37
+ if (!openBundledDatabase)
38
+ throw new Error(
39
+ "A bundled database loader is required. Import createCMS from 'alinea/next'."
40
+ );
41
+ const span = trace(this.config, "alinea.next.cms.db");
42
+ const start = performance.now();
43
+ const db = await span(
44
+ () => openBundledDatabase(this.config, {
45
+ // Statements run in the async context of the query that caused
46
+ // them, which carries the React request of the render.
47
+ logQuery: (query, durationMs) => this.#render().stats?.statement(durationMs, query.sql)
48
+ })
49
+ );
50
+ this.#opened = {
51
+ driver: db.driver,
52
+ openMs: performance.now() - start,
53
+ readyAt: Date.now()
54
+ };
38
55
  return db;
39
56
  });
57
+ }
58
+ throttle = createThrottledSync();
59
+ /**
60
+ * Per React request; outside a request (build, route handlers) every call
61
+ * returns a fresh holder, so nothing is recorded there.
62
+ */
63
+ #render = cache(() => ({}));
64
+ #isDraft = cache(async () => {
65
+ const { draftMode } = await import("next/headers.js");
66
+ const [isDraft] = await outcome(async () => (await draftMode()).isEnabled);
67
+ return Boolean(isDraft);
40
68
  });
41
- #applyPreview = cache(async () => {
42
- const context = await requestContext(this.config);
69
+ /** Draft renders collect their queries and syncs for the preview widget. */
70
+ async #renderStats() {
71
+ if (!await this.#isDraft()) return void 0;
72
+ const render = this.#render();
73
+ return render.stats ??= new RenderStats();
74
+ }
75
+ /** The bundled database answers outside Edge, except during development. */
76
+ async #environment(context) {
43
77
  const isEdge = process.env.NEXT_RUNTIME === "edge";
44
78
  const { PHASE_PRODUCTION_BUILD } = await import("next/constants.js");
45
79
  const isBuild = process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD;
46
- const useLocalDb = !isEdge && (!context.isDev || isBuild);
47
- const { cookies, draftMode } = await import("next/headers.js");
48
- const [isDraft] = await outcome(async () => (await draftMode()).isEnabled);
80
+ return { isBuild, useLocalDb: !isEdge && (!context.isDev || isBuild) };
81
+ }
82
+ /** Renders keep serving the current content when the handler is unreachable. */
83
+ async #syncDb(db, client, stats) {
84
+ if (stats)
85
+ return stats.track(
86
+ { kind: "sync", summary: "sync" },
87
+ (row) => timed(row, () => this.#syncDb(db, client, void 0))
88
+ );
89
+ try {
90
+ const sha = await db.syncWith(client, preValidatedRemote);
91
+ this.#syncedAt = Date.now();
92
+ return sha;
93
+ } catch (error) {
94
+ console.warn(
95
+ `Alinea could not sync with the handler, serving current content: ${error instanceof Error ? error.message : String(error)}`
96
+ );
97
+ return db.sha;
98
+ }
99
+ }
100
+ #applyPreview = cache(async () => {
101
+ const context = await requestContext(this.config);
102
+ const { isBuild, useLocalDb } = await this.#environment(context);
103
+ const isDraft = await this.#isDraft();
49
104
  if (!isDraft)
50
105
  return { context, hasPreview: false, isDraft, isBuild, useLocalDb };
106
+ const { cookies } = await import("next/headers.js");
51
107
  const cookie = await cookies();
52
108
  const payload = getPreviewPayloadFromCookies(cookie.getAll());
53
109
  if (!payload)
@@ -67,37 +123,81 @@ var NextCMS = class extends CMS {
67
123
  }
68
124
  return { context, hasPreview: true, isDraft, isBuild, preview, useLocalDb };
69
125
  });
126
+ /**
127
+ * The preview cookie carries the content hash the dashboard rendered
128
+ * against, which is the freshness signal in draft mode: Next bypasses the
129
+ * `unstable_cache` that `syncIfStale` shares between renders there, so the
130
+ * cookie hash replaces the uncached lookup of the latest sha. A mismatch
131
+ * means this isolate is behind (or ahead of) the previewed content, and one
132
+ * sync brings it to the handler revision before the patch is applied.
133
+ */
70
134
  async #prepareLocalPreview(db, decoded, context) {
71
135
  if ("entry" in decoded) return decoded;
72
- if (db.sha === decoded.contentHash) return applyPreviewUpdate(db, decoded);
73
- const source = await db.source.getTree();
74
- if (source.sha === decoded.contentHash) {
75
- await db.sync();
76
- return applyPreviewUpdate(db, decoded);
77
- }
78
- const applied = await applyPreviewUpdate(db, decoded);
79
- if (applied) return applied;
80
- await db.syncWith(createClient(this.config, context));
136
+ if (await db.sha !== decoded.contentHash)
137
+ await this.#syncDb(
138
+ db,
139
+ createClient(this.config, context),
140
+ this.#render().stats
141
+ );
81
142
  return applyPreviewUpdate(db, decoded);
82
143
  }
144
+ /** Where queries are answered from and how fresh that side is. */
145
+ async status() {
146
+ const context = await requestContext(this.config);
147
+ const { useLocalDb } = await this.#environment(context);
148
+ if (useLocalDb) {
149
+ const db = await this.bundledDb;
150
+ return {
151
+ source: "database",
152
+ sha: await db.sha,
153
+ syncedAt: this.#syncedAt ? new Date(this.#syncedAt) : void 0
154
+ };
155
+ }
156
+ const client = createClient(this.config, context);
157
+ const sha = await client.getSha().catch(() => void 0);
158
+ return { source: "handler", sha, syncedAt: void 0 };
159
+ }
83
160
  async resolve(query) {
161
+ const stats = await this.#renderStats();
162
+ if (!stats) return this.#resolve(query, void 0);
163
+ return stats.track(
164
+ { kind: "query", summary: summarizeQuery(query) },
165
+ (row) => this.#resolve(query, row)
166
+ );
167
+ }
168
+ async #resolve(query, row) {
84
169
  let status = query.status;
85
170
  const { context, hasPreview, isDraft, isBuild, preview, useLocalDb } = await this.#applyPreview();
86
171
  if (isDraft && !status) status = "preferDraft";
87
172
  const request = { ...query, preview, status };
88
173
  const client = createClient(this.config, context);
174
+ if (row) row.source = useLocalDb ? "database" : "handler";
89
175
  if (!useLocalDb) {
90
176
  const span = trace(this.config, "alinea.cms.resolve.client");
91
- return span(() => client.resolve(request));
177
+ return timed(row, () => span(() => client.resolve(request)));
92
178
  }
93
179
  const db = await this.bundledDb;
180
+ const stats = this.#render().stats;
181
+ const opened = this.#opened;
182
+ if (stats && opened)
183
+ stats.database ??= {
184
+ driver: opened.driver,
185
+ openMs: opened.openMs,
186
+ cold: opened.readyAt >= stats.startedAt
187
+ };
188
+ const answer = () => stats && row ? stats.executed(row, () => db.resolve(request)) : db.resolve(request);
94
189
  const syncInterval = request.disableSync ? Number.POSITIVE_INFINITY : request.syncInterval ?? this.config.syncInterval;
95
- if (hasPreview) return db.resolve(request);
190
+ if (hasPreview) return answer();
96
191
  if (!isBuild) {
97
- const settled = await syncIfStale(db, client, syncInterval);
98
- if (!settled) await this.throttle(() => db.syncWith(client), syncInterval);
192
+ const tracked = {
193
+ sha: db.sha,
194
+ syncWith: () => this.#syncDb(db, client, stats)
195
+ };
196
+ const settled = !isDraft && await syncIfStale(tracked, client, syncInterval);
197
+ if (!settled)
198
+ await this.throttle(() => this.#syncDb(db, client, stats), syncInterval);
99
199
  }
100
- return db.resolve(request);
200
+ return answer();
101
201
  }
102
202
  async #authenticatedClient() {
103
203
  const context = await requestContext(this.config);
@@ -139,11 +239,15 @@ var NextCMS = class extends CMS {
139
239
  const client = await this.#authenticatedClient();
140
240
  return client.prepareUpload(file);
141
241
  }
142
- previews = async ({ widget, workspace, root }) => {
143
- const { draftMode } = await import("next/headers.js");
242
+ previews = async ({
243
+ widget,
244
+ stats: showStats,
245
+ workspace,
246
+ root
247
+ }) => {
248
+ const stats = await this.#renderStats();
249
+ if (!stats) return null;
144
250
  const { default: dynamic } = await import("next/dynamic.js");
145
- const [isDraft] = await outcome(async () => (await draftMode()).isEnabled);
146
- if (!isDraft) return null;
147
251
  const { isDev, handlerUrl } = await requestContext(this.config);
148
252
  let file = `${Config.adminPath(this.config)}.html`;
149
253
  if (!file.startsWith("/")) file = `/${file}`;
@@ -156,6 +260,7 @@ var NextCMS = class extends CMS {
156
260
  {
157
261
  dashboardUrl: dashboardUrl.href,
158
262
  widget,
263
+ stats: widget && showStats ? stats.settled() : void 0,
159
264
  workspace,
160
265
  root
161
266
  }
@@ -1,12 +1,16 @@
1
1
  import { type BackendFactory, type BackendOptions } from 'alinea/backend/api/CreateBackend';
2
2
  import { type HandlerHooks } from 'alinea/backend/Handler';
3
3
  import { Config } from 'alinea/core/Config';
4
+ import type { LocalStore } from 'alinea/core/db/LocalStore';
4
5
  import { NextCMS } from './cms.js';
5
6
  type Handler = (request: Request) => Promise<Response>;
6
7
  export interface NextHandlerOptions extends HandlerHooks {
7
8
  cms: NextCMS;
8
9
  backend?: BackendFactory | BackendOptions;
9
10
  }
10
- export declare function createHandler(input: NextCMS | NextHandlerOptions): Handler;
11
+ export type OpenGeneratedDatabase = (config: Config) => Promise<LocalStore>;
12
+ export declare function createHandlerWithDatabase(input: NextCMS | NextHandlerOptions, openGeneratedDatabase?: OpenGeneratedDatabase): Handler;
11
13
  export declare function handlerPathname(config: Config, requestUrl: URL): string;
14
+ /** A handler without a generated database, as used in the Edge runtime. */
15
+ export declare function createHandler(input: NextCMS | NextHandlerOptions): Handler;
12
16
  export {};