alinea 2.0.0-preview.4 → 2.0.0-preview.6
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/.init/content/pages/welcome.json +1 -1
- package/dist/.init/src/cms.ts +1 -4
- package/dist/LICENSES.md +137 -137
- package/dist/adapter/next/cms.js +5 -1
- package/dist/adapter/next/handler.js +35 -6
- package/dist/adapter/next/previews.js +7 -1
- package/dist/adapter/next/syncCheck.d.ts +12 -0
- package/dist/adapter/next/syncCheck.js +59 -0
- package/dist/adapter/next/with-alinea.d.ts +0 -8
- package/dist/adapter/next/with-alinea.js +43 -19
- package/dist/adapter/vite/plugin.js +9 -4
- package/dist/backend/Handler.js +106 -0
- package/dist/backend/api/GithubApi.js +16 -7
- package/dist/backend/api/ProxyMedia.d.ts +3 -0
- package/dist/backend/api/ProxyMedia.js +39 -0
- package/dist/backend/api/S3Uploads.d.ts +1 -1
- package/dist/backend/router/Router.js +2 -0
- package/dist/backend/util/Syncable.js +1 -1
- package/dist/bundled.d.ts +166 -73
- package/dist/chunks/{chunk-XMOVGDFI.js → chunk-7IOKMUKO.js} +1 -1
- package/dist/chunks/{chunk-O7XWTMCB.js → chunk-D6RGFNUW.js} +73 -72
- package/dist/chunks/{chunk-VXZM6V4P.js → chunk-OFEKTDRF.js} +41 -41
- package/dist/cli/Generate.js +3 -4
- package/dist/cli/Serve.js +3 -2
- package/dist/cli/bin.js +1 -1
- package/dist/cli/generate/FillCache.d.ts +1 -1
- package/dist/cli/generate/FillCache.js +20 -9
- package/dist/cli/generate/GenerateDashboard.js +1 -0
- package/dist/cli/serve/CreateLocalServer.d.ts +1 -1
- package/dist/cli/serve/CreateLocalServer.js +42 -34
- package/dist/cli/serve/DevServer.js +1 -0
- package/dist/cli/static/init/cms.js +1 -4
- package/dist/cli/util/ContentType.d.ts +1 -0
- package/dist/cli/util/ContentType.js +36 -0
- package/dist/cli/util/Emitter.js +1 -1
- package/dist/cloud/CloudHandshake.d.ts +6 -0
- package/dist/cloud/CloudHandshake.js +67 -10
- package/dist/cloud/CloudRemote.js +24 -11
- package/dist/components/Breadcrumbs.js +7 -7
- package/dist/components/Button.js +5 -5
- package/dist/components/Calendar.js +7 -7
- package/dist/components/Checkbox.js +8 -8
- package/dist/components/CheckboxGroup.js +5 -5
- package/dist/components/ColorSwatch.js +5 -5
- package/dist/components/ColorSwatchPicker.js +7 -7
- package/dist/components/ComboBox.js +14 -14
- package/dist/components/DateField.js +8 -8
- package/dist/components/DatePicker.js +10 -10
- package/dist/components/DateRangePicker.js +11 -11
- package/dist/components/Dialog.js +5 -5
- package/dist/components/Disclosure.js +11 -11
- package/dist/components/DropZone.js +5 -5
- package/dist/components/Label.js +9 -9
- package/dist/components/Link.js +5 -5
- package/dist/components/List.d.ts +1 -1
- package/dist/components/List.js +37 -36
- package/dist/components/Menu.js +9 -9
- package/dist/components/Modal.js +8 -8
- package/dist/components/MultipleSelect.js +33 -33
- package/dist/components/NumberField.js +11 -11
- package/dist/components/Popover.js +5 -5
- package/dist/components/ProgressCircle.js +8 -8
- package/dist/components/RadioGroup.js +7 -7
- package/dist/components/SearchField.js +10 -10
- package/dist/components/Select.js +12 -12
- package/dist/components/Surface.js +3 -3
- package/dist/components/Switch.js +7 -7
- package/dist/components/Table.js +11 -11
- package/dist/components/Tabs.js +9 -9
- package/dist/components/TagGroup.js +7 -7
- package/dist/components/TextField.js +10 -10
- package/dist/components/TimeField.js +5 -5
- package/dist/components/Toggle.js +5 -5
- package/dist/components/Toolbar.js +6 -6
- package/dist/components/Tooltip.js +8 -8
- package/dist/components/Tree.js +13 -13
- package/dist/core/Config.d.ts +10 -3
- package/dist/core/Config.js +16 -1
- package/dist/core/Graph.d.ts +2 -2
- package/dist/core/Role.js +16 -14
- package/dist/core/TextDoc.d.ts +2 -0
- package/dist/core/TextDoc.js +1 -0
- package/dist/core/Workspace.d.ts +6 -5
- package/dist/core/db/EntryIndex.d.ts +3 -0
- package/dist/core/db/EntryIndex.js +55 -0
- package/dist/core/db/EntryTransaction.js +34 -32
- package/dist/core/db/EntryUrlConflictError.js +1 -1
- package/dist/core/db/LinkResolver.d.ts +8 -2
- package/dist/core/db/LinkResolver.js +27 -5
- package/dist/core/field/RichTextField.js +16 -10
- package/dist/core/media/MediaLocation.d.ts +9 -15
- package/dist/core/media/MediaLocation.js +29 -19
- package/dist/core/media/MediaTypes.js +1 -2
- package/dist/dashboard/App.js +4 -4
- package/dist/dashboard/app/ActivityStatus.js +31 -37
- package/dist/dashboard/app/AppShell.js +2 -2
- package/dist/dashboard/app/AuthView.js +12 -12
- package/dist/dashboard/app/Badge.js +2 -2
- package/dist/dashboard/app/CompactField.js +9 -9
- package/dist/dashboard/app/DashboardErrorBoundary.js +6 -6
- package/dist/dashboard/app/EntryFields.d.ts +3 -1
- package/dist/dashboard/app/EntryFields.js +11 -8
- package/dist/dashboard/app/EntryHeader.js +116 -84
- package/dist/dashboard/app/EntryHeaderActions.d.ts +21 -4
- package/dist/dashboard/app/EntryHeaderActions.js +48 -27
- package/dist/dashboard/app/EntryReferences.js +6 -6
- package/dist/dashboard/app/EntrySidebar.js +15 -15
- package/dist/dashboard/app/EntrySidebarPreview.js +4 -4
- package/dist/dashboard/app/EntryTranslationBanner.d.ts +3 -1
- package/dist/dashboard/app/EntryTranslationBanner.js +23 -20
- package/dist/dashboard/app/Explorer.d.ts +4 -2
- package/dist/dashboard/app/Explorer.js +53 -49
- package/dist/dashboard/app/ExplorerCards.js +31 -31
- package/dist/dashboard/app/ExplorerFileCard.js +16 -16
- package/dist/dashboard/app/ExplorerList.js +14 -15
- package/dist/dashboard/app/ExplorerModal.js +4 -4
- package/dist/dashboard/app/ExplorerTable.js +54 -54
- package/dist/dashboard/app/LinkPicker.js +5 -5
- package/dist/dashboard/app/LocaleMenu.d.ts +7 -0
- package/dist/dashboard/app/LocaleMenu.js +34 -18
- package/dist/dashboard/app/ReadOnlyBadge.d.ts +4 -0
- package/dist/dashboard/app/ReadOnlyBadge.js +33 -0
- package/dist/dashboard/app/SidebarTree.d.ts +3 -6
- package/dist/dashboard/app/SidebarTree.js +62 -57
- package/dist/dashboard/app/WorkspaceMenu.js +16 -16
- package/dist/dashboard/app/WorkspaceRoots.js +21 -21
- package/dist/dashboard/app/editor/FileEditor.d.ts +2 -3
- package/dist/dashboard/app/editor/FileEditor.js +24 -27
- package/dist/dashboard/app/editor/FilePreview.js +4 -4
- package/dist/dashboard/app/modals/CreateEntry.js +5 -5
- package/dist/dashboard/app/pages/EntryPage.js +72 -29
- package/dist/dashboard/app/pages/RootPage.js +3 -3
- package/dist/dashboard/app/pages/SplashPage.js +45 -45
- package/dist/dashboard/app/pages/UsersPage.js +36 -36
- package/dist/dashboard/app/ui/DashboardModal.js +21 -21
- package/dist/dashboard/app/ui/Rail.js +5 -5
- package/dist/dashboard/app/ui/Sidebar.js +2 -2
- package/dist/dashboard/atoms/activity.d.ts +0 -2
- package/dist/dashboard/atoms/activity.js +4 -10
- package/dist/dashboard/atoms/editor.d.ts +2 -1
- package/dist/dashboard/atoms/editor.js +4 -2
- package/dist/dashboard/atoms/entry.d.ts +2 -0
- package/dist/dashboard/atoms/entry.js +32 -14
- package/dist/dashboard/atoms/explorer.d.ts +4 -3
- package/dist/dashboard/atoms/explorer.js +61 -22
- package/dist/dashboard/atoms/link.d.ts +1 -1
- package/dist/dashboard/atoms/link.js +39 -55
- package/dist/dashboard/atoms/root.d.ts +7 -2
- package/dist/dashboard/atoms/root.js +51 -16
- package/dist/dashboard/atoms/upload.d.ts +1 -0
- package/dist/dashboard/atoms/upload.js +2 -1
- package/dist/dashboard/boot/ActivityEvent.d.ts +1 -1
- package/dist/dashboard/boot/DashboardWorker.js +2 -28
- package/dist/dashboard/fixture/cms.js +1 -4
- package/dist/dashboard/hook/UseSaveShortcut.d.ts +1 -0
- package/dist/dashboard/hook/UseSaveShortcut.js +24 -0
- package/dist/dashboard/hooks.d.ts +1 -1
- package/dist/dashboard/hooks.js +12 -3
- package/dist/field/check/CheckField.view.js +2 -2
- package/dist/field/code/CodeField.view.js +11 -11
- package/dist/field/date/DateField.view.js +5 -5
- package/dist/field/link/ImageLink.js +1 -3
- package/dist/field/link/LinkField.view.js +88 -62
- package/dist/field/list/ListField.view.js +25 -25
- package/dist/field/metadata/MetadataField.d.ts +3 -3
- package/dist/field/metadata/MetadataField.view.js +27 -20
- package/dist/field/object/ObjectField.view.js +11 -4
- package/dist/field/richtext/PickTextLink.js +5 -2
- package/dist/field/richtext/ReferenceLink.d.ts +2 -0
- package/dist/field/richtext/ReferenceLink.js +5 -0
- package/dist/field/richtext/RichTextBlock.js +2 -2
- package/dist/field/richtext/RichTextExtensions.js +24 -24
- package/dist/field/richtext/RichTextField.view.js +2 -2
- package/dist/field/richtext/RichTextInsertMenu.js +3 -3
- package/dist/field/richtext/extensions/Link.d.ts +1 -0
- package/dist/field/richtext/extensions/Link.js +1 -0
- package/dist/field/select/SelectField.view.js +1 -1
- package/dist/field/time/TimeField.d.ts +0 -2
- package/dist/field/time/TimeField.view.js +1 -1
- package/dist/index.css +44 -38
- package/dist/next.cjs +96 -19
- package/dist/picker/entry/EntryPicker.js +10 -12
- package/dist/picker/entry/EntryReference.d.ts +2 -0
- package/dist/picker/entry/EntryReference.js +1 -0
- package/dist/types.d.ts +0 -1
- package/package.json +1 -1
- package/dist/chunks/{chunk-6V4TAD2N.js → chunk-DNJX6CRV.js} +4 -4
package/dist/.init/src/cms.ts
CHANGED
|
@@ -17,7 +17,6 @@ export const cms = createCMS({
|
|
|
17
17
|
main: Config.workspace('Example', {
|
|
18
18
|
source: 'content',
|
|
19
19
|
mediaDir: 'public/media',
|
|
20
|
-
mediaUrl: '/media',
|
|
21
20
|
roots: {
|
|
22
21
|
pages: Config.root('Example site', {
|
|
23
22
|
contains: ['Page']
|
|
@@ -39,7 +38,5 @@ export const cms = createCMS({
|
|
|
39
38
|
|
|
40
39
|
// The handler route URL
|
|
41
40
|
handlerUrl: '/api/cms',
|
|
42
|
-
|
|
43
|
-
// The admin dashboard will be bundled in this static file
|
|
44
|
-
dashboardFile: 'admin.html'
|
|
41
|
+
adminPath: '/admin'
|
|
45
42
|
})
|
package/dist/LICENSES.md
CHANGED
|
@@ -2,32 +2,6 @@ This file contains the licenses of the bundled modules in this distribution.
|
|
|
2
2
|
|
|
3
3
|
===
|
|
4
4
|
|
|
5
|
-
# rado@1.3.0-preview.6 (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
5
|
# jotai@3.0.0 (MIT)
|
|
32
6
|
|
|
33
7
|
MIT License
|
|
@@ -55,7 +29,7 @@ SOFTWARE.
|
|
|
55
29
|
|
|
56
30
|
===
|
|
57
31
|
|
|
58
|
-
# @
|
|
32
|
+
# react-aria-components@1.17.0 (Apache-2.0)
|
|
59
33
|
|
|
60
34
|
Apache License
|
|
61
35
|
Version 2.0, January 2004
|
|
@@ -262,11 +236,37 @@ SOFTWARE.
|
|
|
262
236
|
|
|
263
237
|
===
|
|
264
238
|
|
|
265
|
-
#
|
|
239
|
+
# rado@1.3.0-preview.6 (MIT)
|
|
266
240
|
|
|
267
241
|
MIT License
|
|
268
242
|
|
|
269
|
-
Copyright (c)
|
|
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
|
+
===
|
|
264
|
+
|
|
265
|
+
# microcbor@1.2.1 (MIT)
|
|
266
|
+
|
|
267
|
+
MIT License
|
|
268
|
+
|
|
269
|
+
Copyright (c) 2021 Joel Gustafson
|
|
270
270
|
|
|
271
271
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
272
272
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -289,7 +289,7 @@ SOFTWARE.
|
|
|
289
289
|
|
|
290
290
|
===
|
|
291
291
|
|
|
292
|
-
#
|
|
292
|
+
# @internationalized/date@3.12.1 (Apache-2.0)
|
|
293
293
|
|
|
294
294
|
Apache License
|
|
295
295
|
Version 2.0, January 2004
|
|
@@ -494,33 +494,6 @@ SOFTWARE.
|
|
|
494
494
|
limitations under the License.
|
|
495
495
|
|
|
496
496
|
|
|
497
|
-
===
|
|
498
|
-
|
|
499
|
-
# microcbor@1.2.1 (MIT)
|
|
500
|
-
|
|
501
|
-
MIT License
|
|
502
|
-
|
|
503
|
-
Copyright (c) 2021 Joel Gustafson
|
|
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
497
|
===
|
|
525
498
|
|
|
526
499
|
# @tiptap/core@3.30.5 (MIT)
|
|
@@ -550,7 +523,7 @@ SOFTWARE.
|
|
|
550
523
|
|
|
551
524
|
===
|
|
552
525
|
|
|
553
|
-
# react-
|
|
526
|
+
# react-stately@3.46.0 (Apache-2.0)
|
|
554
527
|
|
|
555
528
|
Apache License
|
|
556
529
|
Version 2.0, January 2004
|
|
@@ -755,6 +728,33 @@ SOFTWARE.
|
|
|
755
728
|
limitations under the License.
|
|
756
729
|
|
|
757
730
|
|
|
731
|
+
===
|
|
732
|
+
|
|
733
|
+
# jotai-family@1.1.0 (MIT)
|
|
734
|
+
|
|
735
|
+
MIT License
|
|
736
|
+
|
|
737
|
+
Copyright (c) 2025 Poimandres
|
|
738
|
+
|
|
739
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
740
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
741
|
+
in the Software without restriction, including without limitation the rights
|
|
742
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
743
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
744
|
+
furnished to do so, subject to the following conditions:
|
|
745
|
+
|
|
746
|
+
The above copyright notice and this permission notice shall be included in all
|
|
747
|
+
copies or substantial portions of the Software.
|
|
748
|
+
|
|
749
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
750
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
751
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
752
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
753
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
754
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
755
|
+
SOFTWARE.
|
|
756
|
+
|
|
757
|
+
|
|
758
758
|
===
|
|
759
759
|
|
|
760
760
|
# jotai-location@0.6.2 (MIT)
|
|
@@ -989,29 +989,6 @@ THE SOFTWARE.
|
|
|
989
989
|
limitations under the License.
|
|
990
990
|
|
|
991
991
|
|
|
992
|
-
===
|
|
993
|
-
|
|
994
|
-
# htmlparser2@9.1.0 (MIT)
|
|
995
|
-
|
|
996
|
-
Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
|
|
997
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
998
|
-
of this software and associated documentation files (the "Software"), to
|
|
999
|
-
deal in the Software without restriction, including without limitation the
|
|
1000
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
1001
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
|
1002
|
-
furnished to do so, subject to the following conditions:
|
|
1003
|
-
|
|
1004
|
-
The above copyright notice and this permission notice shall be included in
|
|
1005
|
-
all copies or substantial portions of the Software.
|
|
1006
|
-
|
|
1007
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1008
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1009
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1010
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1011
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
1012
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
1013
|
-
IN THE SOFTWARE.
|
|
1014
|
-
|
|
1015
992
|
===
|
|
1016
993
|
|
|
1017
994
|
# @badgateway/oauth2-client@3.3.1 (MIT)
|
|
@@ -1041,54 +1018,53 @@ SOFTWARE.
|
|
|
1041
1018
|
|
|
1042
1019
|
===
|
|
1043
1020
|
|
|
1044
|
-
#
|
|
1045
|
-
|
|
1046
|
-
Copyright (c) Felix Böhm
|
|
1047
|
-
All rights reserved.
|
|
1048
|
-
|
|
1049
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
1050
|
-
|
|
1051
|
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
1052
|
-
|
|
1053
|
-
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.
|
|
1054
|
-
|
|
1055
|
-
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,
|
|
1056
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
===
|
|
1060
|
-
|
|
1061
|
-
# domhandler@5.0.3 (BSD-2-Clause)
|
|
1021
|
+
# use-sync-external-store@1.6.0 (MIT)
|
|
1062
1022
|
|
|
1063
|
-
|
|
1064
|
-
All rights reserved.
|
|
1023
|
+
MIT License
|
|
1065
1024
|
|
|
1066
|
-
|
|
1025
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1067
1026
|
|
|
1068
|
-
|
|
1027
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1028
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1029
|
+
in the Software without restriction, including without limitation the rights
|
|
1030
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1031
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1032
|
+
furnished to do so, subject to the following conditions:
|
|
1069
1033
|
|
|
1070
|
-
|
|
1034
|
+
The above copyright notice and this permission notice shall be included in all
|
|
1035
|
+
copies or substantial portions of the Software.
|
|
1071
1036
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1037
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1038
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1039
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1040
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1041
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1042
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1043
|
+
SOFTWARE.
|
|
1074
1044
|
|
|
1075
1045
|
|
|
1076
1046
|
===
|
|
1077
1047
|
|
|
1078
|
-
#
|
|
1079
|
-
|
|
1080
|
-
Copyright (c) Felix Böhm
|
|
1081
|
-
All rights reserved.
|
|
1082
|
-
|
|
1083
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
1084
|
-
|
|
1085
|
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
1086
|
-
|
|
1087
|
-
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.
|
|
1088
|
-
|
|
1089
|
-
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,
|
|
1090
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1048
|
+
# htmlparser2@9.1.0 (MIT)
|
|
1091
1049
|
|
|
1050
|
+
Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
|
|
1051
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1052
|
+
of this software and associated documentation files (the "Software"), to
|
|
1053
|
+
deal in the Software without restriction, including without limitation the
|
|
1054
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
1055
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
1056
|
+
furnished to do so, subject to the following conditions:
|
|
1057
|
+
|
|
1058
|
+
The above copyright notice and this permission notice shall be included in
|
|
1059
|
+
all copies or substantial portions of the Software.
|
|
1060
|
+
|
|
1061
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1062
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1063
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1064
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1065
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
1066
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
1067
|
+
IN THE SOFTWARE.
|
|
1092
1068
|
|
|
1093
1069
|
===
|
|
1094
1070
|
|
|
@@ -1146,29 +1122,53 @@ SOFTWARE.
|
|
|
1146
1122
|
|
|
1147
1123
|
===
|
|
1148
1124
|
|
|
1149
|
-
#
|
|
1125
|
+
# domutils@3.2.2 (BSD-2-Clause)
|
|
1150
1126
|
|
|
1151
|
-
|
|
1127
|
+
Copyright (c) Felix Böhm
|
|
1128
|
+
All rights reserved.
|
|
1152
1129
|
|
|
1153
|
-
|
|
1130
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
1154
1131
|
|
|
1155
|
-
|
|
1156
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
1157
|
-
in the Software without restriction, including without limitation the rights
|
|
1158
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1159
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
1160
|
-
furnished to do so, subject to the following conditions:
|
|
1132
|
+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
1161
1133
|
|
|
1162
|
-
|
|
1163
|
-
copies or substantial portions of the Software.
|
|
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.
|
|
1164
1135
|
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
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
|
+
===
|
|
1141
|
+
|
|
1142
|
+
# domhandler@5.0.3 (BSD-2-Clause)
|
|
1143
|
+
|
|
1144
|
+
Copyright (c) Felix Böhm
|
|
1145
|
+
All rights reserved.
|
|
1146
|
+
|
|
1147
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
1148
|
+
|
|
1149
|
+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
1150
|
+
|
|
1151
|
+
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.
|
|
1152
|
+
|
|
1153
|
+
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,
|
|
1154
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
===
|
|
1158
|
+
|
|
1159
|
+
# entities@4.5.0 (BSD-2-Clause)
|
|
1160
|
+
|
|
1161
|
+
Copyright (c) Felix Böhm
|
|
1162
|
+
All rights reserved.
|
|
1163
|
+
|
|
1164
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
1165
|
+
|
|
1166
|
+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
1167
|
+
|
|
1168
|
+
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.
|
|
1169
|
+
|
|
1170
|
+
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,
|
|
1171
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1172
1172
|
|
|
1173
1173
|
|
|
1174
1174
|
===
|
package/dist/adapter/next/cms.js
CHANGED
|
@@ -19,6 +19,7 @@ import { getPreviewPayloadFromCookies } from "alinea/preview/PreviewCookies";
|
|
|
19
19
|
import { Headers } from "@alinea/iso";
|
|
20
20
|
import { cache } from "react";
|
|
21
21
|
import { requestContext } from "./context.js";
|
|
22
|
+
import { syncIfStale } from "./syncCheck.js";
|
|
22
23
|
import { jsx } from "react/jsx-runtime";
|
|
23
24
|
var NextCMS = class extends CMS {
|
|
24
25
|
constructor(config) {
|
|
@@ -92,7 +93,10 @@ var NextCMS = class extends CMS {
|
|
|
92
93
|
const db = await this.bundledDb;
|
|
93
94
|
const syncInterval = request.disableSync ? Number.POSITIVE_INFINITY : request.syncInterval ?? this.config.syncInterval;
|
|
94
95
|
if (hasPreview) return db.resolve(request);
|
|
95
|
-
if (!isBuild)
|
|
96
|
+
if (!isBuild) {
|
|
97
|
+
const settled = await syncIfStale(db, client, syncInterval);
|
|
98
|
+
if (!settled) await this.throttle(() => db.syncWith(client), syncInterval);
|
|
99
|
+
}
|
|
96
100
|
return db.resolve(request);
|
|
97
101
|
}
|
|
98
102
|
async #authenticatedClient() {
|
|
@@ -19,6 +19,7 @@ import { trace } from "alinea/core/Trace";
|
|
|
19
19
|
import { NextCMS } from "./cms.js";
|
|
20
20
|
import { requestContext } from "./context.js";
|
|
21
21
|
import { createDevRemote } from "./DevRemote.js";
|
|
22
|
+
import { revalidateContentSha } from "./syncCheck.js";
|
|
22
23
|
function createHandler(input) {
|
|
23
24
|
const options = input instanceof NextCMS ? { cms: input } : input;
|
|
24
25
|
const config = options.cms.config;
|
|
@@ -36,18 +37,34 @@ function createHandler(input) {
|
|
|
36
37
|
const handleBackend = createCoreHandler({
|
|
37
38
|
...options,
|
|
38
39
|
remote,
|
|
39
|
-
db
|
|
40
|
+
db,
|
|
41
|
+
// Revalidate the shared content sha before the user-provided hook so
|
|
42
|
+
// page revalidation triggered there already sees the fresh sha when
|
|
43
|
+
// RSC renders resolve. Invalidation never throws (failures are
|
|
44
|
+
// swallowed inside revalidateContentSha).
|
|
45
|
+
afterCommit: async (context) => {
|
|
46
|
+
await revalidateContentSha();
|
|
47
|
+
await options.afterCommit?.(context);
|
|
48
|
+
}
|
|
40
49
|
});
|
|
41
50
|
const handle = async (request) => {
|
|
42
51
|
const url = new URL(request.url);
|
|
43
|
-
const { searchParams } = url;
|
|
44
52
|
const context = await requestContext(config, request);
|
|
45
53
|
const handlerPath = handlerPathname(config, url);
|
|
46
|
-
|
|
47
|
-
return new Response(`Expected handler to be served on ${handlerPath}`, {
|
|
48
|
-
status: 400
|
|
49
|
-
});
|
|
54
|
+
const rewrittenFile = rewrittenFilePath(config, request);
|
|
50
55
|
try {
|
|
56
|
+
if (rewrittenFile !== void 0) {
|
|
57
|
+
const backendUrl = new URL(url);
|
|
58
|
+
backendUrl.pathname = handlerPath;
|
|
59
|
+
backendUrl.searchParams.set("file", rewrittenFile);
|
|
60
|
+
backendUrl.searchParams.set("delivery", "proxy");
|
|
61
|
+
return await handleBackend(new Request(backendUrl, request), context);
|
|
62
|
+
}
|
|
63
|
+
if (url.pathname !== handlerPath)
|
|
64
|
+
return new Response(`Expected handler to be served on ${handlerPath}`, {
|
|
65
|
+
status: 400
|
|
66
|
+
});
|
|
67
|
+
const { searchParams } = url;
|
|
51
68
|
const previews = new JWTPreviews(context.apiKey);
|
|
52
69
|
const previewToken = searchParams.get("preview");
|
|
53
70
|
if (previewToken) {
|
|
@@ -79,6 +96,18 @@ function createHandler(input) {
|
|
|
79
96
|
function handlerPathname(config, requestUrl) {
|
|
80
97
|
return new URL(Config.handlerUrl(config), requestUrl).pathname;
|
|
81
98
|
}
|
|
99
|
+
function rewrittenFilePath(config, request) {
|
|
100
|
+
if (request.method !== "GET" && request.method !== "HEAD") return;
|
|
101
|
+
const url = new URL(request.url);
|
|
102
|
+
const fileRoot = new URL(Config.filePathname(config, ""), url).pathname;
|
|
103
|
+
const prefix = `${fileRoot}/`;
|
|
104
|
+
if (!url.pathname.startsWith(prefix)) return;
|
|
105
|
+
try {
|
|
106
|
+
return decodeURIComponent(url.pathname.slice(prefix.length));
|
|
107
|
+
} catch {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
82
111
|
export {
|
|
83
112
|
createHandler,
|
|
84
113
|
handlerPathname
|
|
@@ -19,12 +19,18 @@ function NextPreviews({
|
|
|
19
19
|
const [previewDisabled, setPreviewDisabled] = useState(false);
|
|
20
20
|
const pathname = usePathname();
|
|
21
21
|
const adminUrl = new URL(dashboardUrl, location.origin);
|
|
22
|
+
const host = window.parent !== window ? window.parent : window.opener;
|
|
23
|
+
let hostOrigin = adminUrl.origin;
|
|
24
|
+
try {
|
|
25
|
+
if (host?.location.origin === location.origin) hostOrigin = location.origin;
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
22
28
|
const entryParams = new URLSearchParams({ url: pathname });
|
|
23
29
|
if (workspace) entryParams.set("workspace", workspace);
|
|
24
30
|
if (root) entryParams.set("root", root);
|
|
25
31
|
const editUrl = new URL(`#/edit?${entryParams}`, adminUrl);
|
|
26
32
|
const { isPreviewing } = usePreview({
|
|
27
|
-
hostOrigin
|
|
33
|
+
hostOrigin,
|
|
28
34
|
async preview(update) {
|
|
29
35
|
if (!update) return;
|
|
30
36
|
const success = await setPreviewCookies(update.payload);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Client } from 'alinea/core/Client';
|
|
2
|
+
import type { LocalDB } from 'alinea/core/db/LocalDB';
|
|
3
|
+
export declare const CONTENT_SHA_TAG = "alinea-content-sha";
|
|
4
|
+
export declare function revalidateContentSha(): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Sync the isolate-local db only when it is behind the shared content sha.
|
|
7
|
+
* Returns true when the freshness question is settled here (synced, forced,
|
|
8
|
+
* or explicitly disabled) and the caller can skip its throttled sync.
|
|
9
|
+
* Returns false when the sha could not be determined, so the caller falls
|
|
10
|
+
* back to its existing throttle behavior.
|
|
11
|
+
*/
|
|
12
|
+
export declare function syncIfStale(db: LocalDB, client: Client, syncInterval?: number): Promise<boolean>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import "../../chunks/chunk-CQ52GEHY.js";
|
|
2
|
+
|
|
3
|
+
// src/adapter/next/syncCheck.ts
|
|
4
|
+
import { ReadonlyTree } from "alinea/core/source/Tree";
|
|
5
|
+
var CONTENT_SHA_TAG = "alinea-content-sha";
|
|
6
|
+
var SHA_REVALIDATE_SECONDS = 60;
|
|
7
|
+
var SENTINEL_SHA = ReadonlyTree.EMPTY.sha;
|
|
8
|
+
var inflight;
|
|
9
|
+
function latestSha(client) {
|
|
10
|
+
if (inflight) return inflight;
|
|
11
|
+
inflight = loadLatestSha(client).finally(() => {
|
|
12
|
+
inflight = void 0;
|
|
13
|
+
});
|
|
14
|
+
return inflight;
|
|
15
|
+
}
|
|
16
|
+
async function loadLatestSha(client) {
|
|
17
|
+
try {
|
|
18
|
+
const { unstable_cache } = await import("next/cache.js");
|
|
19
|
+
const getSha = unstable_cache(
|
|
20
|
+
async () => {
|
|
21
|
+
const tree = await client.getTreeIfDifferent(SENTINEL_SHA);
|
|
22
|
+
return tree?.sha;
|
|
23
|
+
},
|
|
24
|
+
["alinea-content-sha"],
|
|
25
|
+
{ revalidate: SHA_REVALIDATE_SECONDS, tags: [CONTENT_SHA_TAG] }
|
|
26
|
+
);
|
|
27
|
+
return await getSha();
|
|
28
|
+
} catch {
|
|
29
|
+
try {
|
|
30
|
+
const tree = await client.getTreeIfDifferent(SENTINEL_SHA);
|
|
31
|
+
return tree?.sha;
|
|
32
|
+
} catch {
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function revalidateContentSha() {
|
|
38
|
+
try {
|
|
39
|
+
const { revalidateTag } = await import("next/cache.js");
|
|
40
|
+
revalidateTag(CONTENT_SHA_TAG, { expire: 0 });
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function syncIfStale(db, client, syncInterval) {
|
|
45
|
+
if (syncInterval === Number.POSITIVE_INFINITY) return true;
|
|
46
|
+
if (syncInterval === 0) {
|
|
47
|
+
await db.syncWith(client);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
const expected = await latestSha(client);
|
|
51
|
+
if (!expected) return false;
|
|
52
|
+
if (expected !== db.sha) await db.syncWith(client);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
CONTENT_SHA_TAG,
|
|
57
|
+
revalidateContentSha,
|
|
58
|
+
syncIfStale
|
|
59
|
+
};
|
|
@@ -1,11 +1,3 @@
|
|
|
1
1
|
import type { NextConfig } from 'next/dist/types.js';
|
|
2
|
-
export interface WithAlineaOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Base path where the dashboard is mounted.
|
|
5
|
-
*
|
|
6
|
-
* @default '/admin'
|
|
7
|
-
*/
|
|
8
|
-
adminPath?: string;
|
|
9
|
-
}
|
|
10
2
|
export declare function createCMS(): void;
|
|
11
3
|
export declare function withAlinea(config?: NextConfig): NextConfig;
|