@axium/notes 0.3.2 → 0.3.4
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/server.d.ts +2 -12
- package/dist/server.js +4 -4
- package/lib/Note.svelte +5 -0
- package/package.json +4 -3
- package/routes/+layout.ts +0 -1
package/dist/server.d.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type schema from '../db.json';
|
|
2
2
|
declare module '@axium/server/database' {
|
|
3
|
-
interface Schema {
|
|
4
|
-
notes: {
|
|
5
|
-
id: GeneratedAlways<string>;
|
|
6
|
-
userId: string;
|
|
7
|
-
created: GeneratedAlways<Date>;
|
|
8
|
-
modified: Generated<Date>;
|
|
9
|
-
title: string;
|
|
10
|
-
content: string | null;
|
|
11
|
-
labels: Generated<string[]>;
|
|
12
|
-
};
|
|
13
|
-
'acl.notes': DBAccessControl & DBBool<'read' | 'edit' | 'manage'>;
|
|
3
|
+
interface Schema extends FromSchemaFile<typeof schema> {
|
|
14
4
|
}
|
|
15
5
|
}
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { authRequestForItem, checkAuthForUser } from '@axium/server/auth';
|
|
2
2
|
import { database } from '@axium/server/database';
|
|
3
3
|
import { parseBody, withError } from '@axium/server/requests';
|
|
4
4
|
import { addRoute } from '@axium/server/routes';
|
|
@@ -31,12 +31,12 @@ addRoute({
|
|
|
31
31
|
path: '/api/notes/:id',
|
|
32
32
|
params: { id: z.uuid() },
|
|
33
33
|
async GET(request, { id }) {
|
|
34
|
-
const { item } = await
|
|
34
|
+
const { item } = await authRequestForItem(request, 'notes', id, { read: true });
|
|
35
35
|
return item;
|
|
36
36
|
},
|
|
37
37
|
async PATCH(request, { id }) {
|
|
38
38
|
const init = await parseBody(request, NoteInit);
|
|
39
|
-
await
|
|
39
|
+
await authRequestForItem(request, 'notes', id, { edit: true });
|
|
40
40
|
return await database
|
|
41
41
|
.updateTable('notes')
|
|
42
42
|
.set(init)
|
|
@@ -47,7 +47,7 @@ addRoute({
|
|
|
47
47
|
.catch(withError('Could not update note'));
|
|
48
48
|
},
|
|
49
49
|
async DELETE(request, { id }) {
|
|
50
|
-
await
|
|
50
|
+
await authRequestForItem(request, 'notes', id, { manage: true });
|
|
51
51
|
return await database
|
|
52
52
|
.deleteFrom('notes')
|
|
53
53
|
.where('id', '=', id)
|
package/lib/Note.svelte
CHANGED
|
@@ -71,6 +71,10 @@
|
|
|
71
71
|
onchange={e => {
|
|
72
72
|
note.content = e.currentTarget.value;
|
|
73
73
|
fetchAPI('PATCH', 'notes/:id', note, note.id);
|
|
74
|
+
}}
|
|
75
|
+
onkeyup={e => {
|
|
76
|
+
if (!navigator.userAgent.includes('Firefox')) return;
|
|
77
|
+
e.currentTarget.rows = Math.min(e.currentTarget.value.split('\n').length, 40);
|
|
74
78
|
}}>{note.content}</textarea
|
|
75
79
|
>
|
|
76
80
|
</div>
|
|
@@ -97,6 +101,7 @@
|
|
|
97
101
|
resize: none;
|
|
98
102
|
field-sizing: content;
|
|
99
103
|
height: max-content;
|
|
104
|
+
overflow-y: scroll;
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
107
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/notes",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"description": "Notes for Axium",
|
|
6
6
|
"funding": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@axium/client": ">=0.13.0",
|
|
39
39
|
"@axium/core": ">=0.19.0",
|
|
40
|
-
"@axium/server": ">=0.
|
|
40
|
+
"@axium/server": ">=0.35.0",
|
|
41
41
|
"@sveltejs/kit": "^2.27.3",
|
|
42
42
|
"utilium": "^2.4.0"
|
|
43
43
|
},
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"server": {
|
|
49
49
|
"routes": "routes",
|
|
50
50
|
"hooks": "./dist/hooks.js",
|
|
51
|
-
"db": "./db.json"
|
|
51
|
+
"db": "./db.json",
|
|
52
|
+
"web_client_hooks": "./dist/common.js"
|
|
52
53
|
},
|
|
53
54
|
"apps": [
|
|
54
55
|
{
|
package/routes/+layout.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@axium/notes/common';
|