alinea 1.5.4 → 1.6.0
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 -1
- package/dist/LICENSES.md +61 -61
- package/dist/adapter/core/cms.d.ts +1 -2
- package/dist/adapter/core/cms.js +1 -1
- package/dist/backend/Handler.js +4 -2
- package/dist/backend/api/BasicAuth.d.ts +3 -1
- package/dist/backend/api/BasicAuth.js +5 -1
- package/dist/backend/util/ExecGit.d.ts +1 -0
- package/dist/bundled.d.ts +278 -43
- package/dist/chunks/{chunk-F7QQQJ6Z.js → chunk-AAGK4MLU.js} +1 -1
- package/dist/cli/Serve.js +1 -1
- package/dist/cli/bin.js +1 -1
- package/dist/cli/static/init/cms.js +1 -1
- package/dist/cloud/CloudRemote.js +10 -9
- package/dist/config.d.ts +1 -0
- package/dist/config.js +2 -0
- package/dist/core/Config.d.ts +3 -0
- package/dist/core/Config.js +2 -0
- package/dist/core/Role.d.ts +124 -0
- package/dist/core/Role.js +246 -0
- package/dist/core/Role.test.d.ts +1 -0
- package/dist/core/Scope.d.ts +1 -0
- package/dist/core/Scope.js +3 -0
- package/dist/core/User.d.ts +2 -0
- package/dist/core/User.js +2 -1
- package/dist/core/db/EntryIndex.d.ts +99 -34
- package/dist/core/db/EntryIndex.js +488 -502
- package/dist/core/db/EntryResolver.d.ts +4 -4
- package/dist/core/db/EntryResolver.js +77 -44
- package/dist/core/db/EntryTransaction.d.ts +2 -1
- package/dist/core/db/EntryTransaction.js +71 -46
- package/dist/core/db/LinkResolver.js +2 -2
- package/dist/core/db/LocalDB.d.ts +2 -1
- package/dist/core/db/LocalDB.js +8 -2
- package/dist/core/db/WriteableGraph.d.ts +2 -0
- package/dist/core/db/WriteableGraph.js +15 -0
- package/dist/dashboard/App.js +33 -15
- package/dist/dashboard/atoms/DashboardAtoms.js +1 -1
- package/dist/dashboard/atoms/EntryAtoms.js +22 -10
- package/dist/dashboard/atoms/EntryEditorAtoms.js +6 -1
- package/dist/dashboard/atoms/NavigationAtoms.js +22 -5
- package/dist/dashboard/atoms/PolicyAtom.d.ts +6 -0
- package/dist/dashboard/atoms/PolicyAtom.js +29 -0
- package/dist/dashboard/hook/UsePolicy.d.ts +1 -0
- package/dist/dashboard/hook/UsePolicy.js +14 -0
- package/dist/dashboard/pages/ContentView.js +12 -1
- package/dist/dashboard/view/ErrorBoundary.js +2 -18
- package/dist/dashboard/view/MediaExplorer.js +4 -4
- package/dist/dashboard/view/Sidebar.js +5 -1
- package/dist/dashboard/view/entry/EntryHeader.d.ts +1 -2
- package/dist/dashboard/view/entry/EntryHeader.js +24 -14
- package/dist/dashboard/view/entry/NewEntry.js +19 -5
- package/dist/dashboard/view/sidebar/SidebarSettings.js +45 -9
- package/dist/index.css +19 -0
- package/dist/test/cms.js +1 -1
- package/dist/test/roles.test.d.ts +1 -0
- package/package.json +1 -1
package/dist/.init/src/cms.ts
CHANGED
|
@@ -33,7 +33,7 @@ export const cms = createCMS({
|
|
|
33
33
|
// Point to your local website
|
|
34
34
|
development: 'http://localhost:3000',
|
|
35
35
|
// The production URL of your website
|
|
36
|
-
production:
|
|
36
|
+
production: 'https://example.com'
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
// Enable live previews after adding <cms.previews widget /> to your layout
|
package/dist/LICENSES.md
CHANGED
|
@@ -28,11 +28,11 @@ SOFTWARE.
|
|
|
28
28
|
|
|
29
29
|
===
|
|
30
30
|
|
|
31
|
-
#
|
|
31
|
+
# lib0@0.2.88 (MIT)
|
|
32
32
|
|
|
33
|
-
MIT License
|
|
33
|
+
The MIT License (MIT)
|
|
34
34
|
|
|
35
|
-
Copyright (c) 2019
|
|
35
|
+
Copyright (c) 2019 Kevin Jahns <kevin.jahns@protonmail.com>.
|
|
36
36
|
|
|
37
37
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
38
38
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -55,11 +55,11 @@ SOFTWARE.
|
|
|
55
55
|
|
|
56
56
|
===
|
|
57
57
|
|
|
58
|
-
#
|
|
58
|
+
# react-query@3.39.3 (MIT)
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
MIT License
|
|
61
61
|
|
|
62
|
-
Copyright (c) 2019
|
|
62
|
+
Copyright (c) 2019 Tanner Linsley
|
|
63
63
|
|
|
64
64
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
65
65
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -131,19 +131,28 @@ IN THE SOFTWARE.
|
|
|
131
131
|
|
|
132
132
|
===
|
|
133
133
|
|
|
134
|
-
#
|
|
134
|
+
# @popperjs/core@2.11.8 (MIT)
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
All rights reserved.
|
|
136
|
+
The MIT License (MIT)
|
|
138
137
|
|
|
139
|
-
|
|
138
|
+
Copyright (c) 2019 Federico Zivolo
|
|
140
139
|
|
|
141
|
-
|
|
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:
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
The above copyright notice and this permission notice shall be included in all
|
|
148
|
+
copies or substantial portions of the Software.
|
|
144
149
|
|
|
145
|
-
|
|
146
|
-
|
|
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.
|
|
147
156
|
|
|
148
157
|
|
|
149
158
|
===
|
|
@@ -165,7 +174,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
165
174
|
|
|
166
175
|
===
|
|
167
176
|
|
|
168
|
-
#
|
|
177
|
+
# domhandler@5.0.3 (BSD-2-Clause)
|
|
169
178
|
|
|
170
179
|
Copyright (c) Felix Böhm
|
|
171
180
|
All rights reserved.
|
|
@@ -182,28 +191,19 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
182
191
|
|
|
183
192
|
===
|
|
184
193
|
|
|
185
|
-
# @
|
|
194
|
+
# entities@4.5.0 (BSD-2-Clause)
|
|
186
195
|
|
|
187
|
-
|
|
196
|
+
Copyright (c) Felix Böhm
|
|
197
|
+
All rights reserved.
|
|
188
198
|
|
|
189
|
-
|
|
199
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
190
200
|
|
|
191
|
-
|
|
192
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
193
|
-
the Software without restriction, including without limitation the rights to
|
|
194
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
195
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
196
|
-
subject to the following conditions:
|
|
201
|
+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
197
202
|
|
|
198
|
-
|
|
199
|
-
copies or substantial portions of the Software.
|
|
203
|
+
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.
|
|
200
204
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
204
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
205
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
206
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
205
|
+
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,
|
|
206
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
207
207
|
|
|
208
208
|
|
|
209
209
|
===
|
|
@@ -513,13 +513,13 @@ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
513
513
|
|
|
514
514
|
===
|
|
515
515
|
|
|
516
|
-
# @headless-tree/
|
|
516
|
+
# @headless-tree/core@0.0.15 (MIT)
|
|
517
517
|
|
|
518
518
|
MIT
|
|
519
519
|
|
|
520
520
|
===
|
|
521
521
|
|
|
522
|
-
# @headless-tree/
|
|
522
|
+
# @headless-tree/react@0.0.15 (MIT)
|
|
523
523
|
|
|
524
524
|
MIT
|
|
525
525
|
|
|
@@ -1612,33 +1612,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
1612
1612
|
See the License for the specific language governing permissions and
|
|
1613
1613
|
limitations under the License.
|
|
1614
1614
|
|
|
1615
|
-
===
|
|
1616
|
-
|
|
1617
|
-
# @tanstack/virtual-core@3.10.6 (MIT)
|
|
1618
|
-
|
|
1619
|
-
MIT License
|
|
1620
|
-
|
|
1621
|
-
Copyright (c) 2021-present Tanner Linsley
|
|
1622
|
-
|
|
1623
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1624
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
1625
|
-
in the Software without restriction, including without limitation the rights
|
|
1626
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1627
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
1628
|
-
furnished to do so, subject to the following conditions:
|
|
1629
|
-
|
|
1630
|
-
The above copyright notice and this permission notice shall be included in all
|
|
1631
|
-
copies or substantial portions of the Software.
|
|
1632
|
-
|
|
1633
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1634
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1635
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1636
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1637
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1638
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1639
|
-
SOFTWARE.
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
1615
|
===
|
|
1643
1616
|
|
|
1644
1617
|
# @react-stately/utils@3.10.5 (Apache-2.0)
|
|
@@ -1844,3 +1817,30 @@ SOFTWARE.
|
|
|
1844
1817
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1845
1818
|
See the License for the specific language governing permissions and
|
|
1846
1819
|
limitations under the License.
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
===
|
|
1823
|
+
|
|
1824
|
+
# @tanstack/virtual-core@3.10.6 (MIT)
|
|
1825
|
+
|
|
1826
|
+
MIT License
|
|
1827
|
+
|
|
1828
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
1829
|
+
|
|
1830
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1831
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1832
|
+
in the Software without restriction, including without limitation the rights
|
|
1833
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1834
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1835
|
+
furnished to do so, subject to the following conditions:
|
|
1836
|
+
|
|
1837
|
+
The above copyright notice and this permission notice shall be included in all
|
|
1838
|
+
copies or substantial portions of the Software.
|
|
1839
|
+
|
|
1840
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1841
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1842
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1843
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1844
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1845
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1846
|
+
SOFTWARE.
|
|
@@ -2,11 +2,10 @@ import { CMS } from 'alinea/core/CMS';
|
|
|
2
2
|
import type { Config } from 'alinea/core/Config';
|
|
3
3
|
import type { UploadResponse } from 'alinea/core/Connection';
|
|
4
4
|
import type { AnyQueryResult, GraphQuery } from 'alinea/core/Graph';
|
|
5
|
-
import type { Mutation } from 'alinea/core/db/Mutation';
|
|
6
5
|
export declare class CoreCMS<Definition extends Config = Config> extends CMS<Definition> {
|
|
7
6
|
sync(): Promise<string>;
|
|
8
7
|
resolve<Query extends GraphQuery>(query: Query): Promise<AnyQueryResult<Query>>;
|
|
9
|
-
mutate(
|
|
8
|
+
mutate(): Promise<{
|
|
10
9
|
sha: string;
|
|
11
10
|
}>;
|
|
12
11
|
prepareUpload(file: string): Promise<UploadResponse>;
|
package/dist/adapter/core/cms.js
CHANGED
package/dist/backend/Handler.js
CHANGED
|
@@ -97,6 +97,7 @@ function createHandler({
|
|
|
97
97
|
}
|
|
98
98
|
const expectUser = () => {
|
|
99
99
|
if (!userCtx) throw new Response("Unauthorized", { status: 401 });
|
|
100
|
+
return userCtx.user;
|
|
100
101
|
};
|
|
101
102
|
const body = PLazy.from(() => {
|
|
102
103
|
const isJson = request.headers.get("content-type")?.includes("application/json");
|
|
@@ -123,12 +124,13 @@ function createHandler({
|
|
|
123
124
|
return Response.json(await local.resolve(query) ?? null);
|
|
124
125
|
}
|
|
125
126
|
if (action === HandleAction.Mutate && request.method === "POST") {
|
|
126
|
-
expectUser();
|
|
127
|
+
const user = expectUser();
|
|
127
128
|
expectJson();
|
|
129
|
+
const policy = await local.createPolicy(user.roles);
|
|
128
130
|
const mutations = await body;
|
|
129
131
|
const attempt = async (retry = 0) => {
|
|
130
132
|
await local.syncWith(cnx);
|
|
131
|
-
const request2 = await local.request(mutations);
|
|
133
|
+
const request2 = await local.request(mutations, policy);
|
|
132
134
|
try {
|
|
133
135
|
let { sha } = await cnx.write(request2);
|
|
134
136
|
if (sha === request2.intoSha) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { AuthApi, AuthedContext, RequestContext } from 'alinea/core/Connection';
|
|
2
|
+
import type { User } from 'alinea/core/User';
|
|
3
|
+
export type Details = boolean | User | undefined;
|
|
2
4
|
export interface Verifier {
|
|
3
|
-
(username: string, password: string):
|
|
5
|
+
(username: string, password: string): Details | Promise<Details>;
|
|
4
6
|
}
|
|
5
7
|
export declare class BasicAuth implements AuthApi {
|
|
6
8
|
#private;
|
|
@@ -44,9 +44,13 @@ var BasicAuth = class {
|
|
|
44
44
|
const [username, password] = atob(token).split(":");
|
|
45
45
|
const authorized = await this.#verify(username, password);
|
|
46
46
|
if (!authorized) throw new InvalidCredentialsError("Invalid credentials");
|
|
47
|
+
const user = typeof authorized === "boolean" ? {
|
|
48
|
+
sub: username,
|
|
49
|
+
roles: ["admin"]
|
|
50
|
+
} : authorized;
|
|
47
51
|
return {
|
|
48
52
|
...ctx,
|
|
49
|
-
user
|
|
53
|
+
user,
|
|
50
54
|
token
|
|
51
55
|
};
|
|
52
56
|
}
|