alinea 1.7.0-preview.1 → 1.7.0-preview.10
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/LICENSES.md +75 -75
- package/dist/adapter/next/cms.js +7 -10
- package/dist/adapter/next/handler.js +1 -1
- package/dist/adapter/next/with-alinea.js +5 -10
- package/dist/backend/Handler.js +3 -2
- package/dist/backend/api/OAuth2.d.ts +6 -0
- package/dist/backend/api/OAuth2.js +35 -13
- package/dist/backend/resolver/ParsePreview.d.ts +1 -1
- package/dist/backend/resolver/ParsePreview.js +10 -2
- package/dist/backend/router/Router.d.ts +15 -0
- package/dist/backend/router/Router.js +3 -0
- package/dist/backend/util/ExecGit.d.ts +2 -2
- package/dist/bundled.d.ts +307 -240
- package/dist/chunks/{chunk-XUSXCKEG.js → chunk-WKC37UOZ.js} +13 -9
- package/dist/chunks/{chunk-DVF6JRD6.js → chunk-XQOSC7K3.js} +10 -7
- package/dist/cli/Serve.js +4 -4
- package/dist/cli/bin.js +6 -4
- package/dist/cli/serve/CreateLocalServer.js +34 -4
- package/dist/cli/util/ForwardCommand.d.ts +1 -1
- package/dist/cli/util/ForwardCommand.js +17 -19
- package/dist/cloud/CloudRemote.d.ts +2 -2
- package/dist/cloud/CloudRemote.js +8 -2
- package/dist/core/Graph.d.ts +1 -1
- package/dist/core/Type.d.ts +2 -0
- package/dist/core/db/EntryIndex.d.ts +3 -1
- package/dist/core/db/EntryIndex.js +15 -3
- package/dist/core/db/LocalDB.d.ts +1 -1
- package/dist/core/db/Operation.js +3 -1
- package/dist/core/db/WriteableGraph.d.ts +1 -1
- package/dist/core/field/RichTextField.d.ts +1 -1
- package/dist/core/field/RichTextField.js +70 -7
- package/dist/core/media/IsImage.d.ts +1 -1
- package/dist/core/media/MediaTypes.d.ts +1 -1
- package/dist/core/media/Summary.d.ts +2 -2
- package/dist/core/shape/ListShape.d.ts +1 -1
- package/dist/core/shape/RichTextShape.js +1 -0
- package/dist/core/source/FSSource.d.ts +2 -2
- package/dist/core/source/Source.d.ts +2 -2
- package/dist/core/source/Tree.d.ts +3 -3
- package/dist/core/source/Utils.js +4 -1
- package/dist/core/util/ArrayBuffers.d.ts +1 -1
- package/dist/core/util/BufferToBase64.d.ts +2 -2
- package/dist/core/util/EntryFilenames.d.ts +1 -2
- package/dist/core/util/EntryFilenames.js +11 -6
- package/dist/core/util/EntryFilenames.test.d.ts +1 -0
- package/dist/core/util/JWT.d.ts +11 -2
- package/dist/core/util/JWT.js +16 -12
- package/dist/dashboard/DashboardNav.d.ts +8 -8
- package/dist/dashboard/Routes.d.ts +25 -25
- package/dist/dashboard/atoms/DbAtoms.d.ts +1 -1
- package/dist/dashboard/atoms/Edits.d.ts +3 -3
- package/dist/dashboard/atoms/EntryEditorAtoms.d.ts +27 -27
- package/dist/dashboard/atoms/EntryEditorAtoms.js +3 -1
- package/dist/dashboard/atoms/EntrySummaryAtoms.d.ts +1 -1
- package/dist/dashboard/atoms/NavigationAtoms.d.ts +9 -9
- package/dist/dashboard/atoms/PreferencesAtoms.d.ts +1 -1
- package/dist/dashboard/atoms/RouterAtoms.d.ts +1 -1
- package/dist/dashboard/boot/LoadWorker.js +3 -2
- package/dist/dashboard/editor/DefaultViews.d.ts +1 -1
- package/dist/dashboard/editor/UseField.js +8 -1
- package/dist/dashboard/hook/UseNav.d.ts +4 -4
- package/dist/dashboard/hook/UseRoot.d.ts +2 -2
- package/dist/dashboard/hook/UseWorkspace.d.ts +3 -3
- package/dist/dashboard/util/Loader.d.ts +1 -1
- package/dist/dashboard/view/InputLabel.d.ts +1 -1
- package/dist/dashboard/view/explorer/ExplorerRow.d.ts +1 -1
- package/dist/field/link/EntryLink.d.ts +1 -1
- package/dist/field/link/FileLink.d.ts +2 -2
- package/dist/field/link/LinkField.view.js +18 -0
- package/dist/field/link/UrlLink.d.ts +1 -1
- package/dist/field/richtext/Extensions.d.ts +1 -0
- package/dist/field/richtext/Extensions.js +118 -9
- package/dist/field/richtext/Toolbar.d.ts +6 -0
- package/dist/field/richtext/Toolbar.js +7 -0
- package/dist/index.css +4 -0
- package/dist/next.cjs +4 -11
- package/dist/picker/url/UrlPicker.js +1 -1
- package/dist/query.d.ts +85 -85
- package/dist/test/example.d.ts +58 -58
- package/dist/test/schema/DemoHome.d.ts +17 -17
- package/dist/test/schema/DemoRecipe.d.ts +10 -10
- package/dist/test/schema/DemoRecipes.d.ts +2 -2
- package/dist/ui/Button.stories.d.ts +1 -1
- package/dist/ui/Ellipsis.d.ts +1 -1
- package/dist/ui/Stack.d.ts +4 -4
- package/dist/ui/Typo.d.ts +2 -2
- package/dist/ui/icons/IcRoundAttachFile.d.ts +2 -0
- package/dist/ui/icons/IcRoundAttachFile.js +10 -0
- package/dist/ui/icons/IcRoundFormatPaint.d.ts +2 -0
- package/dist/ui/icons/IcRoundFormatPaint.js +10 -0
- package/dist/ui/icons/IcRoundPanorama.d.ts +2 -0
- package/dist/ui/icons/IcRoundPanorama.js +10 -0
- package/dist/ui/util/CreateTypo.d.ts +2 -2
- package/llms-full.txt +4278 -0
- package/package.json +10 -5
- package/readme.md +4 -0
package/dist/LICENSES.md
CHANGED
|
@@ -28,34 +28,11 @@ SOFTWARE.
|
|
|
28
28
|
|
|
29
29
|
===
|
|
30
30
|
|
|
31
|
-
#
|
|
32
|
-
|
|
33
|
-
Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
|
|
34
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
35
|
-
of this software and associated documentation files (the "Software"), to
|
|
36
|
-
deal in the Software without restriction, including without limitation the
|
|
37
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
38
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
|
39
|
-
furnished to do so, subject to the following conditions:
|
|
40
|
-
|
|
41
|
-
The above copyright notice and this permission notice shall be included in
|
|
42
|
-
all copies or substantial portions of the Software.
|
|
43
|
-
|
|
44
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
45
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
46
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
47
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
48
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
49
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
50
|
-
IN THE SOFTWARE.
|
|
51
|
-
|
|
52
|
-
===
|
|
53
|
-
|
|
54
|
-
# @headlessui/react@2.2.0 (MIT)
|
|
31
|
+
# lib0@0.2.88 (MIT)
|
|
55
32
|
|
|
56
|
-
MIT License
|
|
33
|
+
The MIT License (MIT)
|
|
57
34
|
|
|
58
|
-
Copyright (c)
|
|
35
|
+
Copyright (c) 2019 Kevin Jahns <kevin.jahns@protonmail.com>.
|
|
59
36
|
|
|
60
37
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
61
38
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -75,6 +52,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
75
52
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
76
53
|
SOFTWARE.
|
|
77
54
|
|
|
55
|
+
|
|
78
56
|
===
|
|
79
57
|
|
|
80
58
|
# react-query@3.39.3 (MIT)
|
|
@@ -104,11 +82,11 @@ SOFTWARE.
|
|
|
104
82
|
|
|
105
83
|
===
|
|
106
84
|
|
|
107
|
-
#
|
|
85
|
+
# @headlessui/react@2.2.0 (MIT)
|
|
108
86
|
|
|
109
|
-
|
|
87
|
+
MIT License
|
|
110
88
|
|
|
111
|
-
Copyright (c)
|
|
89
|
+
Copyright (c) 2020 Tailwind Labs
|
|
112
90
|
|
|
113
91
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
114
92
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -128,10 +106,58 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
128
106
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
129
107
|
SOFTWARE.
|
|
130
108
|
|
|
109
|
+
===
|
|
110
|
+
|
|
111
|
+
# htmlparser2@9.1.0 (MIT)
|
|
112
|
+
|
|
113
|
+
Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
|
|
114
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
115
|
+
of this software and associated documentation files (the "Software"), to
|
|
116
|
+
deal in the Software without restriction, including without limitation the
|
|
117
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
118
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
119
|
+
furnished to do so, subject to the following conditions:
|
|
120
|
+
|
|
121
|
+
The above copyright notice and this permission notice shall be included in
|
|
122
|
+
all copies or substantial portions of the Software.
|
|
123
|
+
|
|
124
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
125
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
126
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
127
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
128
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
129
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
130
|
+
IN THE SOFTWARE.
|
|
131
131
|
|
|
132
132
|
===
|
|
133
133
|
|
|
134
|
-
#
|
|
134
|
+
# @popperjs/core@2.11.8 (MIT)
|
|
135
|
+
|
|
136
|
+
The MIT License (MIT)
|
|
137
|
+
|
|
138
|
+
Copyright (c) 2019 Federico Zivolo
|
|
139
|
+
|
|
140
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
141
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
142
|
+
the Software without restriction, including without limitation the rights to
|
|
143
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
144
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
145
|
+
subject to the following conditions:
|
|
146
|
+
|
|
147
|
+
The above copyright notice and this permission notice shall be included in all
|
|
148
|
+
copies or substantial portions of the Software.
|
|
149
|
+
|
|
150
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
151
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
152
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
153
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
154
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
155
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
===
|
|
159
|
+
|
|
160
|
+
# domhandler@5.0.3 (BSD-2-Clause)
|
|
135
161
|
|
|
136
162
|
Copyright (c) Felix Böhm
|
|
137
163
|
All rights reserved.
|
|
@@ -148,7 +174,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
148
174
|
|
|
149
175
|
===
|
|
150
176
|
|
|
151
|
-
#
|
|
177
|
+
# domutils@3.1.0 (BSD-2-Clause)
|
|
152
178
|
|
|
153
179
|
Copyright (c) Felix Böhm
|
|
154
180
|
All rights reserved.
|
|
@@ -182,11 +208,11 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
182
208
|
|
|
183
209
|
===
|
|
184
210
|
|
|
185
|
-
#
|
|
211
|
+
# @badgateway/oauth2-client@3.2.0 (MIT)
|
|
186
212
|
|
|
187
213
|
MIT License
|
|
188
214
|
|
|
189
|
-
Copyright (c)
|
|
215
|
+
Copyright (c) 2019-2023 Evert Pot
|
|
190
216
|
|
|
191
217
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
192
218
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -209,37 +235,11 @@ SOFTWARE.
|
|
|
209
235
|
|
|
210
236
|
===
|
|
211
237
|
|
|
212
|
-
# @
|
|
213
|
-
|
|
214
|
-
The MIT License (MIT)
|
|
215
|
-
|
|
216
|
-
Copyright (c) 2019 Federico Zivolo
|
|
217
|
-
|
|
218
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
219
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
220
|
-
the Software without restriction, including without limitation the rights to
|
|
221
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
222
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
223
|
-
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, FITNESS
|
|
230
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
231
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
232
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
233
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
===
|
|
237
|
-
|
|
238
|
-
# @badgateway/oauth2-client@3.2.0 (MIT)
|
|
238
|
+
# prop-types@15.8.1 (MIT)
|
|
239
239
|
|
|
240
240
|
MIT License
|
|
241
241
|
|
|
242
|
-
Copyright (c)
|
|
242
|
+
Copyright (c) 2013-present, Facebook, Inc.
|
|
243
243
|
|
|
244
244
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
245
245
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -511,18 +511,6 @@ The above copyright notice and this permission notice shall be included in all c
|
|
|
511
511
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
512
512
|
|
|
513
513
|
|
|
514
|
-
===
|
|
515
|
-
|
|
516
|
-
# @headless-tree/core@0.0.15 (MIT)
|
|
517
|
-
|
|
518
|
-
MIT
|
|
519
|
-
|
|
520
|
-
===
|
|
521
|
-
|
|
522
|
-
# @headless-tree/react@0.0.15 (MIT)
|
|
523
|
-
|
|
524
|
-
MIT
|
|
525
|
-
|
|
526
514
|
===
|
|
527
515
|
|
|
528
516
|
# @babel/runtime@7.25.4 (MIT)
|
|
@@ -551,6 +539,18 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
551
539
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
552
540
|
|
|
553
541
|
|
|
542
|
+
===
|
|
543
|
+
|
|
544
|
+
# @headless-tree/core@0.0.15 (MIT)
|
|
545
|
+
|
|
546
|
+
MIT
|
|
547
|
+
|
|
548
|
+
===
|
|
549
|
+
|
|
550
|
+
# @headless-tree/react@0.0.15 (MIT)
|
|
551
|
+
|
|
552
|
+
MIT
|
|
553
|
+
|
|
554
554
|
===
|
|
555
555
|
|
|
556
556
|
# y-prosemirror@1.2.15 (MIT)
|
|
@@ -580,7 +580,7 @@ SOFTWARE.
|
|
|
580
580
|
|
|
581
581
|
===
|
|
582
582
|
|
|
583
|
-
# @react-aria/
|
|
583
|
+
# @react-aria/focus@3.19.1 (Apache-2.0)
|
|
584
584
|
|
|
585
585
|
Apache License
|
|
586
586
|
Version 2.0, January 2004
|
|
@@ -787,7 +787,7 @@ SOFTWARE.
|
|
|
787
787
|
|
|
788
788
|
===
|
|
789
789
|
|
|
790
|
-
# @react-aria/
|
|
790
|
+
# @react-aria/interactions@3.23.0 (Apache-2.0)
|
|
791
791
|
|
|
792
792
|
Apache License
|
|
793
793
|
Version 2.0, January 2004
|
package/dist/adapter/next/cms.js
CHANGED
|
@@ -49,19 +49,16 @@ var NextCMS = class extends CMS {
|
|
|
49
49
|
const payload = getPreviewPayloadFromCookies(cookie.getAll());
|
|
50
50
|
if (payload) preview = { payload };
|
|
51
51
|
}
|
|
52
|
-
const { PHASE_PRODUCTION_BUILD } = await import("next/constants");
|
|
52
|
+
const { PHASE_PRODUCTION_SERVER, PHASE_PRODUCTION_BUILD } = await import("next/constants");
|
|
53
53
|
const isEdge = process.env.NEXT_RUNTIME === "edge";
|
|
54
|
+
const isServer = process.env.NEXT_PHASE === PHASE_PRODUCTION_SERVER;
|
|
54
55
|
const isBuild = process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD;
|
|
55
|
-
const isDev = process.env.NODE_ENV === "development";
|
|
56
56
|
const request = { preview, ...query, status };
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return db.resolve(request);
|
|
63
|
-
}
|
|
64
|
-
return client.resolve(request);
|
|
57
|
+
const useLocalDb = !isEdge && (isServer || isBuild);
|
|
58
|
+
if (!useLocalDb) return client.resolve(request);
|
|
59
|
+
const db = await this.bundledDb;
|
|
60
|
+
await this.throttle(() => db.syncWith(client), request.syncInterval);
|
|
61
|
+
return db.resolve(request);
|
|
65
62
|
}
|
|
66
63
|
async #authenticatedClient() {
|
|
67
64
|
const { handlerUrl, apiKey } = await requestContext(this.config);
|
|
@@ -19,7 +19,7 @@ import { requestContext } from "./context.js";
|
|
|
19
19
|
var handlers = /* @__PURE__ */ new WeakMap();
|
|
20
20
|
function createHandler(input) {
|
|
21
21
|
const options = input instanceof NextCMS ? { cms: input } : input;
|
|
22
|
-
const remote = options.remote ?? (options.backend ? createBackend(options.cms.config, options.backend) : (context) => new CloudRemote(context, options.cms));
|
|
22
|
+
const remote = options.remote ?? (options.backend ? createBackend(options.cms.config, options.backend) : (context) => new CloudRemote(context, options.cms.config));
|
|
23
23
|
if (handlers.has(options.cms)) return handlers.get(options.cms);
|
|
24
24
|
const config = options.cms.config;
|
|
25
25
|
const db = PLazy.from(async () => {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
version
|
|
3
|
-
} from "../../chunks/chunk-DVF6JRD6.js";
|
|
4
1
|
import "../../chunks/chunk-NZLE2WMY.js";
|
|
5
2
|
|
|
6
3
|
// src/adapter/next/with-alinea.ts
|
|
7
4
|
import { readFileSync } from "node:fs";
|
|
8
5
|
import { createRequire } from "node:module";
|
|
9
6
|
import { resolve } from "node:path";
|
|
10
|
-
import { bold, cyan
|
|
7
|
+
import { bold, cyan } from "alinea/cli/util/Report";
|
|
11
8
|
function createCMS() {
|
|
12
9
|
throw new Error(
|
|
13
10
|
'Alinea was loaded in a CJS environment. Please ensure your project is marked as "type": "module" in package.json.'
|
|
@@ -98,12 +95,10 @@ function createRewrites(config, adminPath) {
|
|
|
98
95
|
const nextHost = process.env.__NEXT_PRIVATE_HOST;
|
|
99
96
|
const origin = nextOrigin ?? (nextHost ? `http://${nextHost}` : null);
|
|
100
97
|
const location = origin ? new URL(adminPath, origin).href : adminPath;
|
|
101
|
-
if (isDev) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
`;
|
|
106
|
-
console.log(`${header} - Local CMS: ${location}
|
|
98
|
+
if (isDev && !process.env.__NEXT_PRIVATE_ALINEA_REPORTED) {
|
|
99
|
+
process.env.__NEXT_PRIVATE_ALINEA_REPORTED = "true";
|
|
100
|
+
console.log(`
|
|
101
|
+
${cyan(bold("\u0251 Alinea CMS"))}: ${location}
|
|
107
102
|
`);
|
|
108
103
|
}
|
|
109
104
|
const existing = config.rewrites ? await config.rewrites() : [];
|
package/dist/backend/Handler.js
CHANGED
|
@@ -215,13 +215,14 @@ function createHandler({
|
|
|
215
215
|
return new Response("Bad Request", { status: 400 });
|
|
216
216
|
} catch (error) {
|
|
217
217
|
if (error instanceof Response) return error;
|
|
218
|
-
|
|
218
|
+
const status = error instanceof HttpError ? error.code : 500;
|
|
219
|
+
if (!(error instanceof HttpError)) console.error(error);
|
|
219
220
|
return Response.json(
|
|
220
221
|
{
|
|
221
222
|
success: false,
|
|
222
223
|
error: error instanceof Error ? error.message : String(error)
|
|
223
224
|
},
|
|
224
|
-
{ status
|
|
225
|
+
{ status }
|
|
225
226
|
);
|
|
226
227
|
}
|
|
227
228
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Request, Response } from '@alinea/iso';
|
|
2
2
|
import { Config } from 'alinea/core/Config';
|
|
3
3
|
import type { AuthApi, AuthedContext, RequestContext } from 'alinea/core/Connection';
|
|
4
|
+
import { JWTPayload } from 'alinea/core/util/JWT';
|
|
4
5
|
export interface OAuth2Options {
|
|
5
6
|
/**
|
|
6
7
|
* OAuth2 clientId
|
|
@@ -36,6 +37,11 @@ export interface OAuth2Options {
|
|
|
36
37
|
* Required for revoking tokens. Not supported by all servers.
|
|
37
38
|
*/
|
|
38
39
|
revocationEndpoint?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Extra claims to validate, such as `iss` or `aud`,
|
|
42
|
+
* If the claims are invalid, an error should be thrown.
|
|
43
|
+
*/
|
|
44
|
+
validateClaims?(claims: JWTPayload): void;
|
|
39
45
|
}
|
|
40
46
|
export declare class OAuth2 implements AuthApi {
|
|
41
47
|
#private;
|
|
@@ -457,13 +457,15 @@ var OAuth2 = class {
|
|
|
457
457
|
#config;
|
|
458
458
|
#client;
|
|
459
459
|
#jwks;
|
|
460
|
+
#validateClaims;
|
|
460
461
|
constructor(context, config, options) {
|
|
461
462
|
this.#context = context;
|
|
462
463
|
this.#config = config;
|
|
464
|
+
this.#validateClaims = options.validateClaims;
|
|
463
465
|
this.#client = new OAuth2Client({
|
|
464
466
|
...options,
|
|
465
467
|
authenticationMethod: "client_secret_basic_interop",
|
|
466
|
-
async
|
|
468
|
+
fetch: async (input, init) => {
|
|
467
469
|
const request = new Request2(input, init);
|
|
468
470
|
const response = await fetch(request);
|
|
469
471
|
if (!response.ok) {
|
|
@@ -526,7 +528,8 @@ var OAuth2 = class {
|
|
|
526
528
|
value: codeVerifier,
|
|
527
529
|
path: redirectUri.pathname,
|
|
528
530
|
secure: redirectUri.protocol === "https:",
|
|
529
|
-
httpOnly: true
|
|
531
|
+
httpOnly: true,
|
|
532
|
+
sameSite: "lax"
|
|
530
533
|
})
|
|
531
534
|
}
|
|
532
535
|
}
|
|
@@ -601,31 +604,29 @@ var OAuth2 = class {
|
|
|
601
604
|
throw new MissingCredentialsError("Missing access token cookie");
|
|
602
605
|
const key = selectKey(jwks, accessToken);
|
|
603
606
|
const user = await verify(accessToken, key);
|
|
607
|
+
this.#validateClaims?.(user);
|
|
608
|
+
assert(user.exp, "Missing exp claim in access token");
|
|
604
609
|
const expiresSoon = user.exp - Math.floor(Date.now() / 1e3) < 30;
|
|
605
610
|
if (expiresSoon && refreshToken)
|
|
606
611
|
throw new InvalidCredentialsError("Access token will expire soon");
|
|
607
612
|
return { ...ctx, user, token: accessToken };
|
|
608
613
|
} catch (error) {
|
|
609
614
|
if (!refreshToken) throw error;
|
|
610
|
-
const key = selectKey(jwks, refreshToken);
|
|
611
|
-
const [, failed] = await outcome(verify(refreshToken, key));
|
|
612
|
-
if (failed)
|
|
613
|
-
throw new InvalidCredentialsError("Invalid refresh token", {
|
|
614
|
-
cause: [failed, error]
|
|
615
|
-
});
|
|
616
615
|
const token = { accessToken, refreshToken, expiresAt: null };
|
|
617
616
|
const newToken = await this.#client.refreshToken(token).catch((cause) => {
|
|
618
617
|
throw new InvalidCredentialsError("Failed to refresh token", {
|
|
619
618
|
cause: [cause, error]
|
|
620
619
|
});
|
|
621
620
|
});
|
|
622
|
-
|
|
621
|
+
const key = selectKey(jwks, newToken.accessToken);
|
|
622
|
+
const user = await verify(newToken.accessToken, key, {
|
|
623
623
|
clockTolerance: 30
|
|
624
624
|
}).catch((cause) => {
|
|
625
625
|
throw new InvalidCredentialsError("Failed to verify user", {
|
|
626
626
|
cause: [cause, error]
|
|
627
627
|
});
|
|
628
628
|
});
|
|
629
|
+
this.#validateClaims?.(user);
|
|
629
630
|
throw Response.json(
|
|
630
631
|
{ type: AuthResultType.NeedsRefresh },
|
|
631
632
|
{
|
|
@@ -639,10 +640,29 @@ var OAuth2 = class {
|
|
|
639
640
|
}
|
|
640
641
|
};
|
|
641
642
|
function selectKey(jwks, token) {
|
|
642
|
-
const
|
|
643
|
-
|
|
643
|
+
const { header } = decode(token);
|
|
644
|
+
const kid = header.kid;
|
|
645
|
+
const alg = header.alg;
|
|
646
|
+
if (!kid) {
|
|
647
|
+
if (jwks.length === 1) {
|
|
648
|
+
const key2 = jwks[0];
|
|
649
|
+
if (key2.alg && alg && key2.alg !== alg) {
|
|
650
|
+
throw new Error(
|
|
651
|
+
`Algorithm mismatch: token uses ${alg}, but key specifies ${key2.alg}`
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
return key2;
|
|
655
|
+
}
|
|
656
|
+
throw new Error(
|
|
657
|
+
'Token is missing "kid" header, and JWKS contains multiple keys'
|
|
658
|
+
);
|
|
659
|
+
}
|
|
644
660
|
const key = jwks.find((k) => k.kid === kid);
|
|
645
661
|
if (!key) throw new Error(`No key found for kid: ${kid}`);
|
|
662
|
+
if (key.alg && alg && key.alg !== alg)
|
|
663
|
+
throw new Error(
|
|
664
|
+
`Algorithm mismatch: token uses ${alg}, but key specifies ${key.alg}`
|
|
665
|
+
);
|
|
646
666
|
return key;
|
|
647
667
|
}
|
|
648
668
|
function clearCookies(redirectUri) {
|
|
@@ -653,7 +673,8 @@ function clearCookies(redirectUri) {
|
|
|
653
673
|
expires: /* @__PURE__ */ new Date(0),
|
|
654
674
|
path: "/",
|
|
655
675
|
secure: redirectUri.protocol === "https:",
|
|
656
|
-
httpOnly: true
|
|
676
|
+
httpOnly: true,
|
|
677
|
+
sameSite: "lax"
|
|
657
678
|
},
|
|
658
679
|
{
|
|
659
680
|
name: COOKIE_REFRESH_TOKEN,
|
|
@@ -675,7 +696,8 @@ function tokenToCookie(token, redirectUri) {
|
|
|
675
696
|
expires: token.expiresAt ? new Date(token.expiresAt) : void 0,
|
|
676
697
|
path: "/",
|
|
677
698
|
secure: redirectUri.protocol === "https:",
|
|
678
|
-
httpOnly: true
|
|
699
|
+
httpOnly: true,
|
|
700
|
+
sameSite: "lax"
|
|
679
701
|
},
|
|
680
702
|
{
|
|
681
703
|
name: COOKIE_REFRESH_TOKEN,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PreviewRequest } from 'alinea/core/Preview';
|
|
2
1
|
import type { LocalDB } from 'alinea/core/db/LocalDB';
|
|
2
|
+
import type { PreviewRequest } from 'alinea/core/Preview';
|
|
3
3
|
export declare function createPreviewParser(local: LocalDB): {
|
|
4
4
|
parse(preview: PreviewRequest, sync: () => Promise<unknown>): Promise<PreviewRequest | undefined>;
|
|
5
5
|
};
|
|
@@ -25,9 +25,17 @@ function createPreviewParser(local) {
|
|
|
25
25
|
});
|
|
26
26
|
if (!entry) return;
|
|
27
27
|
const baseText = decoder.decode(
|
|
28
|
-
JsonLoader.format(
|
|
28
|
+
JsonLoader.format(
|
|
29
|
+
local.config.schema,
|
|
30
|
+
createRecord(entry, entry.status)
|
|
31
|
+
)
|
|
29
32
|
);
|
|
30
|
-
|
|
33
|
+
let updatedText;
|
|
34
|
+
try {
|
|
35
|
+
updatedText = await applyFilePatch(baseText, payload.patch);
|
|
36
|
+
} catch {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
31
39
|
const { data } = parseRecord(JSON.parse(updatedText));
|
|
32
40
|
const { rowHash: _rowHash, fileHash: _fileHash, ...withoutHashes } = entry;
|
|
33
41
|
const patched = await createEntryRow(
|
|
@@ -38,6 +38,11 @@ export declare namespace router {
|
|
|
38
38
|
url: URL;
|
|
39
39
|
params: Record<string, unknown>;
|
|
40
40
|
}>;
|
|
41
|
+
options(path: string): Route<globalThis.Request, {
|
|
42
|
+
request: globalThis.Request;
|
|
43
|
+
url: URL;
|
|
44
|
+
params: Record<string, unknown>;
|
|
45
|
+
}>;
|
|
41
46
|
all(path: string): Route<globalThis.Request, {
|
|
42
47
|
request: globalThis.Request;
|
|
43
48
|
url: URL;
|
|
@@ -65,6 +70,11 @@ export declare namespace router {
|
|
|
65
70
|
url: URL;
|
|
66
71
|
params: Record<string, unknown>;
|
|
67
72
|
}>;
|
|
73
|
+
options(path: string): Route<globalThis.Request, {
|
|
74
|
+
request: globalThis.Request;
|
|
75
|
+
url: URL;
|
|
76
|
+
params: Record<string, unknown>;
|
|
77
|
+
}>;
|
|
68
78
|
all(path: string): Route<globalThis.Request, {
|
|
69
79
|
request: globalThis.Request;
|
|
70
80
|
url: URL;
|
|
@@ -92,6 +102,11 @@ export declare namespace router {
|
|
|
92
102
|
url: URL;
|
|
93
103
|
params: Record<string, unknown>;
|
|
94
104
|
}>;
|
|
105
|
+
options(path: string): Route<globalThis.Request, {
|
|
106
|
+
request: globalThis.Request;
|
|
107
|
+
url: URL;
|
|
108
|
+
params: Record<string, unknown>;
|
|
109
|
+
}>;
|
|
95
110
|
all(path: string): Route<globalThis.Request, {
|
|
96
111
|
request: globalThis.Request;
|
|
97
112
|
url: URL;
|
|
@@ -91,6 +91,9 @@ function callHandler(handler, input) {
|
|
|
91
91
|
delete(path) {
|
|
92
92
|
return withMethod("DELETE").map(withPath(path, getPathname));
|
|
93
93
|
},
|
|
94
|
+
options(path) {
|
|
95
|
+
return withMethod("OPTIONS").map(withPath(path, getPathname));
|
|
96
|
+
},
|
|
94
97
|
all(path) {
|
|
95
98
|
return withPath(path, getPathname);
|
|
96
99
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import PLazy from 'p-lazy';
|
|
2
2
|
export declare function execGit(cwd: string, args: string[]): Promise<string>;
|
|
3
3
|
export declare function gitUser(cwd: string): PLazy<{
|
|
4
|
-
name: string;
|
|
5
|
-
email: string;
|
|
6
4
|
sub: string;
|
|
7
5
|
roles: string[];
|
|
6
|
+
name: string;
|
|
7
|
+
email: string;
|
|
8
8
|
}>;
|