ocean-brain 0.3.3 → 0.4.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/mcp.js +151 -37
- package/package.json +5 -5
- package/scripts/postinstall-prisma.mjs +3 -2
- package/server/client/dist/assets/Calendar-CSXEuWmQ.js +25 -0
- package/server/client/dist/assets/Callout-Ap1OcxWN.js +1 -0
- package/server/client/dist/assets/Graph-C0Ax9qjI.js +1 -0
- package/server/client/dist/assets/{Image-ZxF459sC.js → Image-CSbcG-5a.js} +1 -1
- package/server/client/dist/assets/{Image.es-CFTbON7k.js → Image.es-Fbe7aDDo.js} +1 -1
- package/server/client/dist/assets/{ModalActionRow-Hg6MY61u.js → ModalActionRow-DjI5b4bl.js} +1 -1
- package/server/client/dist/assets/Note-BY6WgYLq.js +1 -0
- package/server/client/dist/assets/Note-W4f6H9K0.css +1 -0
- package/server/client/dist/assets/Reminders-vRksvSQE.js +1 -0
- package/server/client/dist/assets/Search-Cq4tuiJO.js +1 -0
- package/server/client/dist/assets/{SurfaceCard-BV6y4bCo.js → SurfaceCard-Br6TjX5W.js} +1 -1
- package/server/client/dist/assets/Tag-ARDLA-Pb.js +1 -0
- package/server/client/dist/assets/TagNotes-CDGVrCJU.js +1 -0
- package/server/client/dist/assets/{Trash.es-CPtRLE0y.js → Trash.es-BfCEiL3-.js} +1 -1
- package/server/client/dist/assets/ViewNotes-ZBOQ1adH.js +1 -0
- package/server/client/dist/assets/Views-DQHPfdwM.js +1 -0
- package/server/client/dist/assets/{image.api-Dsrx9S-G.js → image.api-DGXlQ_Ca.js} +1 -1
- package/server/client/dist/assets/index-B28TO4FC.js +1 -0
- package/server/client/dist/assets/{index-CD2bFEqK.css → index-Bm9l_L20.css} +1 -1
- package/server/client/dist/assets/index-Bsx4P7EA.js +210 -0
- package/server/client/dist/assets/manage-image-Dg297A_h.js +1 -0
- package/server/client/dist/assets/manage-image-detail-hk6jWyiB.js +1 -0
- package/server/client/dist/assets/mcp-CSjmBjFR.js +1 -0
- package/server/client/dist/assets/{note-core-BCgMq5QA.js → note-core-GgFcksAF.js} +1 -1
- package/server/client/dist/assets/{note-vendor-BofYbzmZ.js → note-vendor-5N5mRkIT.js} +3 -3
- package/server/client/dist/assets/{placeholder-MNsco0AT.js → placeholder-Bmiowo28.js} +4 -4
- package/server/client/dist/assets/trash-CM7SbVtW.js +1 -0
- package/server/client/dist/assets/{useReminderMutate-yJak8FzP.js → useReminderMutate-DsIvVpCQ.js} +2 -2
- package/server/client/dist/assets/view-dashboard-CP8nhfxQ.js +90 -0
- package/server/client/dist/index.html +4 -4
- package/server/dist/app.js +8 -84
- package/server/dist/app.js.map +1 -1
- package/server/dist/features/auth/http/api.js +43 -0
- package/server/dist/features/auth/http/api.js.map +1 -0
- package/server/dist/features/auth/http/login-page.js +28 -0
- package/server/dist/features/auth/http/login-page.js.map +1 -0
- package/server/dist/features/auth/http/pages.js +50 -0
- package/server/dist/features/auth/http/pages.js.map +1 -0
- package/server/dist/features/auth/service.js +94 -0
- package/server/dist/features/auth/service.js.map +1 -0
- package/server/dist/features/cache/graphql/cache.field.resolver.js +5 -0
- package/server/dist/features/cache/graphql/cache.field.resolver.js.map +1 -0
- package/server/dist/features/cache/graphql/cache.mutation.resolver.js +49 -0
- package/server/dist/features/cache/graphql/cache.mutation.resolver.js.map +1 -0
- package/server/dist/features/cache/graphql/cache.query.resolver.js +21 -0
- package/server/dist/features/cache/graphql/cache.query.resolver.js.map +1 -0
- package/server/dist/features/cache/graphql/cache.resolver.js +12 -0
- package/server/dist/features/cache/graphql/cache.resolver.js.map +1 -0
- package/server/dist/features/cache/graphql/cache.type-defs.js +32 -0
- package/server/dist/features/cache/graphql/cache.type-defs.js.map +1 -0
- package/server/dist/features/cache/graphql/index.js +21 -0
- package/server/dist/features/cache/graphql/index.js.map +1 -0
- package/server/dist/features/image/graphql/image.field.resolver.js +14 -0
- package/server/dist/features/image/graphql/image.field.resolver.js.map +1 -0
- package/server/dist/features/image/graphql/image.mutation.resolver.js +21 -0
- package/server/dist/features/image/graphql/image.mutation.resolver.js.map +1 -0
- package/server/dist/features/image/graphql/image.query.resolver.js +40 -0
- package/server/dist/features/image/graphql/image.query.resolver.js.map +1 -0
- package/server/dist/features/image/graphql/image.resolver.js +12 -0
- package/server/dist/features/image/graphql/image.resolver.js.map +1 -0
- package/server/dist/features/image/graphql/image.type-defs.js +31 -0
- package/server/dist/features/image/graphql/image.type-defs.js.map +1 -0
- package/server/dist/features/image/graphql/index.js +16 -0
- package/server/dist/features/image/graphql/index.js.map +1 -0
- package/server/dist/features/image/http/upload.js +48 -0
- package/server/dist/features/image/http/upload.js.map +1 -0
- package/server/dist/features/image/services/delete.js +52 -0
- package/server/dist/features/image/services/delete.js.map +1 -0
- package/server/dist/{modules/remote-image.js → features/image/services/remote-fetch.js} +1 -1
- package/server/dist/features/image/services/remote-fetch.js.map +1 -0
- package/server/dist/{modules/image-upload.js → features/image/services/upload.js} +4 -8
- package/server/dist/features/image/services/upload.js.map +1 -0
- package/server/dist/{views/mcp-admin.js → features/mcp-admin/http/handlers.js} +3 -3
- package/server/dist/features/mcp-admin/http/handlers.js.map +1 -0
- package/server/dist/{modules/mcp-admin.js → features/mcp-admin/service.js} +3 -3
- package/server/dist/features/mcp-admin/service.js.map +1 -0
- package/server/dist/features/note/graphql/index.js +8 -0
- package/server/dist/features/note/graphql/index.js.map +1 -0
- package/server/dist/features/note/graphql/note.field.resolver.js +12 -0
- package/server/dist/features/note/graphql/note.field.resolver.js.map +1 -0
- package/server/dist/features/note/graphql/note.graphql.shared.js +23 -0
- package/server/dist/features/note/graphql/note.graphql.shared.js.map +1 -0
- package/server/dist/features/note/graphql/note.mutation.resolver.js +140 -0
- package/server/dist/features/note/graphql/note.mutation.resolver.js.map +1 -0
- package/server/dist/features/note/graphql/note.query.resolver.js +382 -0
- package/server/dist/features/note/graphql/note.query.resolver.js.map +1 -0
- package/server/dist/features/note/graphql/note.resolver.js +14 -0
- package/server/dist/features/note/graphql/note.resolver.js.map +1 -0
- package/server/dist/features/note/graphql/note.type-defs.js +184 -0
- package/server/dist/features/note/graphql/note.type-defs.js.map +1 -0
- package/server/dist/{views/note.js → features/note/http/mcp.js} +27 -15
- package/server/dist/features/note/http/mcp.js.map +1 -0
- package/server/dist/{modules/note-authoring.js → features/note/services/authoring.js} +25 -7
- package/server/dist/features/note/services/authoring.js.map +1 -0
- package/server/dist/{modules/note-cleanup.js → features/note/services/cleanup.js} +14 -23
- package/server/dist/features/note/services/cleanup.js.map +1 -0
- package/server/dist/features/note/services/search-backfill.js +84 -0
- package/server/dist/features/note/services/search-backfill.js.map +1 -0
- package/server/dist/features/note/services/search.js +197 -0
- package/server/dist/features/note/services/search.js.map +1 -0
- package/server/dist/{modules/note-snapshot.js → features/note/services/snapshot.js} +51 -49
- package/server/dist/features/note/services/snapshot.js.map +1 -0
- package/server/dist/features/note/services/tag-filter.js +18 -0
- package/server/dist/features/note/services/tag-filter.js.map +1 -0
- package/server/dist/{modules/note-trash.js → features/note/services/trash.js} +28 -23
- package/server/dist/features/note/services/trash.js.map +1 -0
- package/server/dist/features/placeholder/graphql/index.js +27 -0
- package/server/dist/features/placeholder/graphql/index.js.map +1 -0
- package/server/dist/features/placeholder/graphql/placeholder.field.resolver.js +5 -0
- package/server/dist/features/placeholder/graphql/placeholder.field.resolver.js.map +1 -0
- package/server/dist/features/placeholder/graphql/placeholder.mutation.resolver.js +72 -0
- package/server/dist/features/placeholder/graphql/placeholder.mutation.resolver.js.map +1 -0
- package/server/dist/features/placeholder/graphql/placeholder.query.resolver.js +36 -0
- package/server/dist/features/placeholder/graphql/placeholder.query.resolver.js.map +1 -0
- package/server/dist/features/placeholder/graphql/placeholder.resolver.js +12 -0
- package/server/dist/features/placeholder/graphql/placeholder.resolver.js.map +1 -0
- package/server/dist/features/placeholder/graphql/placeholder.type-defs.js +50 -0
- package/server/dist/features/placeholder/graphql/placeholder.type-defs.js.map +1 -0
- package/server/dist/features/reminder/graphql/index.js +27 -0
- package/server/dist/features/reminder/graphql/index.js.map +1 -0
- package/server/dist/features/reminder/graphql/reminder.field.resolver.js +10 -0
- package/server/dist/features/reminder/graphql/reminder.field.resolver.js.map +1 -0
- package/server/dist/features/reminder/graphql/reminder.mutation.resolver.js +59 -0
- package/server/dist/features/reminder/graphql/reminder.mutation.resolver.js.map +1 -0
- package/server/dist/features/reminder/graphql/reminder.query.resolver.js +79 -0
- package/server/dist/features/reminder/graphql/reminder.query.resolver.js.map +1 -0
- package/server/dist/features/reminder/graphql/reminder.resolver.js +12 -0
- package/server/dist/features/reminder/graphql/reminder.resolver.js.map +1 -0
- package/server/dist/features/reminder/graphql/reminder.type-defs.js +51 -0
- package/server/dist/features/reminder/graphql/reminder.type-defs.js.map +1 -0
- package/server/dist/features/tag/graphql/index.js +14 -0
- package/server/dist/features/tag/graphql/index.js.map +1 -0
- package/server/dist/features/tag/graphql/tag.field.resolver.js +10 -0
- package/server/dist/features/tag/graphql/tag.field.resolver.js.map +1 -0
- package/server/dist/features/tag/graphql/tag.mutation.resolver.js +15 -0
- package/server/dist/features/tag/graphql/tag.mutation.resolver.js.map +1 -0
- package/server/dist/features/tag/graphql/tag.query.resolver.js +26 -0
- package/server/dist/features/tag/graphql/tag.query.resolver.js.map +1 -0
- package/server/dist/features/tag/graphql/tag.resolver.js +12 -0
- package/server/dist/features/tag/graphql/tag.resolver.js.map +1 -0
- package/server/dist/features/tag/graphql/tag.type-defs.js +46 -0
- package/server/dist/features/tag/graphql/tag.type-defs.js.map +1 -0
- package/server/dist/{views/tag.js → features/tag/http/mcp.js} +3 -3
- package/server/dist/features/tag/http/mcp.js.map +1 -0
- package/server/dist/{modules/tag-organization.js → features/tag/services/organization.js} +38 -8
- package/server/dist/features/tag/services/organization.js.map +1 -0
- package/server/dist/features/view/graphql/index.js +11 -0
- package/server/dist/features/view/graphql/index.js.map +1 -0
- package/server/dist/features/view/graphql/view.mutation.resolver.js +53 -0
- package/server/dist/features/view/graphql/view.mutation.resolver.js.map +1 -0
- package/server/dist/features/view/graphql/view.query.resolver.js +29 -0
- package/server/dist/features/view/graphql/view.query.resolver.js.map +1 -0
- package/server/dist/features/view/graphql/view.resolver.js +10 -0
- package/server/dist/features/view/graphql/view.resolver.js.map +1 -0
- package/server/dist/features/view/graphql/view.type-defs.js +63 -0
- package/server/dist/features/view/graphql/view.type-defs.js.map +1 -0
- package/server/dist/features/view/services/workspace.js +432 -0
- package/server/dist/features/view/services/workspace.js.map +1 -0
- package/server/dist/main.js +14 -0
- package/server/dist/main.js.map +1 -1
- package/server/dist/modules/auth-guard.js +10 -9
- package/server/dist/modules/auth-guard.js.map +1 -1
- package/server/dist/modules/auth-mode.js +1 -3
- package/server/dist/modules/auth-mode.js.map +1 -1
- package/server/dist/modules/blocknote.js +96 -33
- package/server/dist/modules/blocknote.js.map +1 -1
- package/server/dist/modules/data-maintenance.js +75 -0
- package/server/dist/modules/data-maintenance.js.map +1 -0
- package/server/dist/modules/error-handler.js.map +1 -1
- package/server/dist/modules/logger.js +5 -23
- package/server/dist/modules/logger.js.map +1 -1
- package/server/dist/modules/mcp-auth.js +4 -5
- package/server/dist/modules/mcp-auth.js.map +1 -1
- package/server/dist/modules/mcp-token.js.map +1 -1
- package/server/dist/modules/prisma-runtime.js +2 -7
- package/server/dist/modules/prisma-runtime.js.map +1 -1
- package/server/dist/modules/recovery-retention.js +1 -1
- package/server/dist/modules/recovery-retention.js.map +1 -1
- package/server/dist/modules/server-events-handler.js +34 -0
- package/server/dist/modules/server-events-handler.js.map +1 -0
- package/server/dist/modules/server-events.js +32 -0
- package/server/dist/modules/server-events.js.map +1 -0
- package/server/dist/modules/use-async.js.map +1 -1
- package/server/dist/paths.js.map +1 -1
- package/server/dist/routes/api.js +34 -0
- package/server/dist/routes/api.js.map +1 -0
- package/server/dist/routes/auth-pages.js +11 -0
- package/server/dist/routes/auth-pages.js.map +1 -0
- package/server/dist/routes/client.js +27 -0
- package/server/dist/routes/client.js.map +1 -0
- package/server/dist/routes/graphql.js +33 -0
- package/server/dist/routes/graphql.js.map +1 -0
- package/server/dist/routes/index.js +11 -0
- package/server/dist/routes/index.js.map +1 -0
- package/server/dist/routes/mcp.js +30 -0
- package/server/dist/routes/mcp.js.map +1 -0
- package/server/dist/schema/index.js +11 -8
- package/server/dist/schema/index.js.map +1 -1
- package/server/dist/types/index.js.map +1 -1
- package/server/prisma/migrations/20260413143000_0014_tag_name_unique/migration.sql +32 -0
- package/server/prisma/migrations/20260414143000_0015_note_searchable_text/migration.sql +5 -0
- package/server/prisma/migrations/20260416090000_0016_view_workspace/migration.sql +50 -0
- package/server/prisma/schema.prisma +66 -12
- package/server/client/dist/assets/Calendar-DyXzs5M3.js +0 -25
- package/server/client/dist/assets/Graph-C8K4PJOn.js +0 -1
- package/server/client/dist/assets/Note-BbgZvrC3.js +0 -1
- package/server/client/dist/assets/Note-PEevDKBh.css +0 -1
- package/server/client/dist/assets/Reminders-jFhljND4.js +0 -1
- package/server/client/dist/assets/Search-X6QIR_m2.js +0 -1
- package/server/client/dist/assets/Tag-Ba2Dw4gH.js +0 -1
- package/server/client/dist/assets/TagNotes-BRJv6sDI.js +0 -1
- package/server/client/dist/assets/index-BglnLSet.js +0 -205
- package/server/client/dist/assets/index-DpqKngJz.js +0 -1
- package/server/client/dist/assets/manage-image-C6Y_0M5H.js +0 -1
- package/server/client/dist/assets/manage-image-detail-Dv3xofpe.js +0 -1
- package/server/client/dist/assets/mcp-BijQkpfY.js +0 -1
- package/server/client/dist/assets/trash-CiFJm_PK.js +0 -1
- package/server/dist/modules/auth.js +0 -25
- package/server/dist/modules/auth.js.map +0 -1
- package/server/dist/modules/image-upload.js.map +0 -1
- package/server/dist/modules/mcp-admin.js.map +0 -1
- package/server/dist/modules/note-authoring.js.map +0 -1
- package/server/dist/modules/note-cleanup.js.map +0 -1
- package/server/dist/modules/note-snapshot.js.map +0 -1
- package/server/dist/modules/note-trash.js.map +0 -1
- package/server/dist/modules/remote-image.js.map +0 -1
- package/server/dist/modules/tag-organization.js.map +0 -1
- package/server/dist/schema/cache/index.js +0 -58
- package/server/dist/schema/cache/index.js.map +0 -1
- package/server/dist/schema/image/index.js +0 -88
- package/server/dist/schema/image/index.js.map +0 -1
- package/server/dist/schema/note/index.js +0 -551
- package/server/dist/schema/note/index.js.map +0 -1
- package/server/dist/schema/placeholder/index.js +0 -105
- package/server/dist/schema/placeholder/index.js.map +0 -1
- package/server/dist/schema/reminder/index.js +0 -161
- package/server/dist/schema/reminder/index.js.map +0 -1
- package/server/dist/schema/tag/index.js +0 -81
- package/server/dist/schema/tag/index.js.map +0 -1
- package/server/dist/urls.js +0 -9
- package/server/dist/urls.js.map +0 -1
- package/server/dist/views/auth.js +0 -305
- package/server/dist/views/auth.js.map +0 -1
- package/server/dist/views/image.js +0 -44
- package/server/dist/views/image.js.map +0 -1
- package/server/dist/views/index.js +0 -6
- package/server/dist/views/index.js.map +0 -1
- package/server/dist/views/mcp-admin.js.map +0 -1
- package/server/dist/views/note.js.map +0 -1
- package/server/dist/views/tag.js.map +0 -1
|
@@ -1,551 +0,0 @@
|
|
|
1
|
-
import models from "../../models.js";
|
|
2
|
-
import { gql } from "../../modules/graphql.js";
|
|
3
|
-
import {
|
|
4
|
-
getNoteCleanupPreview,
|
|
5
|
-
listNoteCleanupCandidates
|
|
6
|
-
} from "../../modules/note-cleanup.js";
|
|
7
|
-
import {
|
|
8
|
-
captureNoteBaseline,
|
|
9
|
-
createSnapshotMetaFromUserAgent,
|
|
10
|
-
listNoteSnapshots,
|
|
11
|
-
restoreNoteSnapshot
|
|
12
|
-
} from "../../modules/note-snapshot.js";
|
|
13
|
-
import {
|
|
14
|
-
listTrashedNotes,
|
|
15
|
-
restoreTrashedNoteById,
|
|
16
|
-
trashNoteById
|
|
17
|
-
} from "../../modules/note-trash.js";
|
|
18
|
-
const noteType = gql`
|
|
19
|
-
input PaginationInput {
|
|
20
|
-
limit: Int!
|
|
21
|
-
offset: Int!
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
input SearchFilterInput {
|
|
25
|
-
query: String!
|
|
26
|
-
sortBy: String
|
|
27
|
-
sortOrder: String
|
|
28
|
-
pinnedFirst: Boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
input DateRangeInput {
|
|
32
|
-
start: String!
|
|
33
|
-
end: String!
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
enum NoteLayout {
|
|
37
|
-
narrow
|
|
38
|
-
wide
|
|
39
|
-
full
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
input NoteInput {
|
|
43
|
-
title: String
|
|
44
|
-
content: String
|
|
45
|
-
layout: NoteLayout
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
input NoteOrderInput {
|
|
49
|
-
id: ID!
|
|
50
|
-
order: Int!
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
type Tag {
|
|
54
|
-
id: ID!
|
|
55
|
-
name: String!
|
|
56
|
-
createdAt: String!
|
|
57
|
-
updatedAt: String!
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
type Note {
|
|
61
|
-
id: ID!
|
|
62
|
-
title: String!
|
|
63
|
-
content: String!
|
|
64
|
-
contentAsMarkdown: String!
|
|
65
|
-
createdAt: String!
|
|
66
|
-
updatedAt: String!
|
|
67
|
-
pinned: Boolean!
|
|
68
|
-
order: Int!
|
|
69
|
-
layout: NoteLayout!
|
|
70
|
-
tags: [Tag!]!
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
type Notes {
|
|
74
|
-
totalCount: Int!
|
|
75
|
-
notes: [Note!]!
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
type NoteCleanupBackReference {
|
|
79
|
-
id: ID!
|
|
80
|
-
title: String!
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
type NoteCleanupCandidate {
|
|
84
|
-
id: ID!
|
|
85
|
-
title: String!
|
|
86
|
-
updatedAt: String!
|
|
87
|
-
pinned: Boolean!
|
|
88
|
-
tagNames: [String!]!
|
|
89
|
-
reminderCount: Int!
|
|
90
|
-
backReferenceCount: Int!
|
|
91
|
-
matchedTerms: [String!]!
|
|
92
|
-
reasons: [String!]!
|
|
93
|
-
requiresForce: Boolean!
|
|
94
|
-
forceReasons: [String!]!
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
type NoteCleanupPreview {
|
|
98
|
-
id: ID!
|
|
99
|
-
title: String!
|
|
100
|
-
updatedAt: String!
|
|
101
|
-
pinned: Boolean!
|
|
102
|
-
tagNames: [String!]!
|
|
103
|
-
reminderCount: Int!
|
|
104
|
-
backReferences: [NoteCleanupBackReference!]!
|
|
105
|
-
orphanedTagNames: [String!]!
|
|
106
|
-
requiresForce: Boolean!
|
|
107
|
-
forceReasons: [String!]!
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
type NoteSnapshotMeta {
|
|
111
|
-
entrypoint: String
|
|
112
|
-
label: String
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
type NoteSnapshot {
|
|
116
|
-
id: ID!
|
|
117
|
-
title: String!
|
|
118
|
-
createdAt: String!
|
|
119
|
-
meta: NoteSnapshotMeta!
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
type DeletedNote {
|
|
123
|
-
id: ID!
|
|
124
|
-
title: String!
|
|
125
|
-
createdAt: String!
|
|
126
|
-
updatedAt: String!
|
|
127
|
-
deletedAt: String!
|
|
128
|
-
pinned: Boolean!
|
|
129
|
-
order: Int!
|
|
130
|
-
layout: NoteLayout!
|
|
131
|
-
tagNames: [String!]!
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
type DeletedNotes {
|
|
135
|
-
totalCount: Int!
|
|
136
|
-
notes: [DeletedNote!]!
|
|
137
|
-
}
|
|
138
|
-
`;
|
|
139
|
-
const noteQuery = gql`
|
|
140
|
-
type GraphNode {
|
|
141
|
-
id: ID!
|
|
142
|
-
title: String!
|
|
143
|
-
connections: Int!
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
type GraphLink {
|
|
147
|
-
source: ID!
|
|
148
|
-
target: ID!
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
type NoteGraph {
|
|
152
|
-
nodes: [GraphNode!]!
|
|
153
|
-
links: [GraphLink!]!
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
type Query {
|
|
157
|
-
allNotes(searchFilter: SearchFilterInput, pagination: PaginationInput): Notes!
|
|
158
|
-
tagNotes(searchFilter: SearchFilterInput, pagination: PaginationInput): Notes!
|
|
159
|
-
notesInDateRange(dateRange: DateRangeInput): [Note!]!
|
|
160
|
-
pinnedNotes: [Note!]!
|
|
161
|
-
imageNotes(src: String!): [Note!]!
|
|
162
|
-
backReferences(id: ID!): [Note]!
|
|
163
|
-
note(id: ID!): Note!
|
|
164
|
-
noteCleanupCandidates(query: String, pagination: PaginationInput): [NoteCleanupCandidate!]!
|
|
165
|
-
noteCleanupPreview(id: ID!): NoteCleanupPreview
|
|
166
|
-
noteSnapshots(id: ID!, limit: Int): [NoteSnapshot!]!
|
|
167
|
-
trashedNotes(pagination: PaginationInput): DeletedNotes!
|
|
168
|
-
noteGraph: NoteGraph!
|
|
169
|
-
}
|
|
170
|
-
`;
|
|
171
|
-
const noteMutation = gql`
|
|
172
|
-
type Mutation {
|
|
173
|
-
createNote(note: NoteInput!): Note!
|
|
174
|
-
updateNote(id: ID!, note: NoteInput!, editSessionId: String): Note!
|
|
175
|
-
deleteNote(id: ID!): Boolean!
|
|
176
|
-
restoreNoteSnapshot(id: ID!): Note!
|
|
177
|
-
restoreTrashedNote(id: ID!): Note!
|
|
178
|
-
pinNote(id: ID!, pinned: Boolean!): Note!
|
|
179
|
-
reorderNotes(notes: [NoteOrderInput!]!): [Note!]!
|
|
180
|
-
}
|
|
181
|
-
`;
|
|
182
|
-
const noteTypeDefs = `
|
|
183
|
-
${noteType}
|
|
184
|
-
${noteQuery}
|
|
185
|
-
${noteMutation}
|
|
186
|
-
`;
|
|
187
|
-
const extractBlocksByType = (type, dataArray) => {
|
|
188
|
-
let result = [];
|
|
189
|
-
for (const data of dataArray) {
|
|
190
|
-
if (data.type === type) {
|
|
191
|
-
result.push(data);
|
|
192
|
-
}
|
|
193
|
-
if (data.children && data.children.length > 0) {
|
|
194
|
-
result = result.concat(extractBlocksByType(type, data.children));
|
|
195
|
-
}
|
|
196
|
-
if (data.content && data.content.length > 0) {
|
|
197
|
-
for (const contentItem of data.content) {
|
|
198
|
-
if (contentItem.type === type) {
|
|
199
|
-
result.push(contentItem);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return result;
|
|
205
|
-
};
|
|
206
|
-
const noteResolvers = {
|
|
207
|
-
Query: {
|
|
208
|
-
allNotes: async (_, {
|
|
209
|
-
searchFilter,
|
|
210
|
-
pagination
|
|
211
|
-
}) => {
|
|
212
|
-
const queryItems = searchFilter.query.split(" ");
|
|
213
|
-
const included = queryItems.filter((item) => !item.startsWith("-")).map((word) => `%${word}%`);
|
|
214
|
-
const excluded = queryItems.filter((item) => item.startsWith("-")).map((item) => item.slice(1)).map((word) => `%${word}%`);
|
|
215
|
-
const where = {
|
|
216
|
-
AND: [
|
|
217
|
-
...included.map((keyword) => ({
|
|
218
|
-
OR: [
|
|
219
|
-
{ title: { contains: keyword } },
|
|
220
|
-
{ content: { contains: keyword } }
|
|
221
|
-
]
|
|
222
|
-
})),
|
|
223
|
-
...excluded.map((keyword) => ({
|
|
224
|
-
NOT: {
|
|
225
|
-
OR: [
|
|
226
|
-
{ title: { contains: keyword } },
|
|
227
|
-
{ content: { contains: keyword } }
|
|
228
|
-
]
|
|
229
|
-
}
|
|
230
|
-
}))
|
|
231
|
-
]
|
|
232
|
-
};
|
|
233
|
-
const sortBy = searchFilter.sortBy || "updatedAt";
|
|
234
|
-
const sortOrder = searchFilter.sortOrder || "desc";
|
|
235
|
-
const pinnedFirst = searchFilter.pinnedFirst || false;
|
|
236
|
-
const orderBy = [];
|
|
237
|
-
if (pinnedFirst) {
|
|
238
|
-
orderBy.push({ pinned: "desc" });
|
|
239
|
-
}
|
|
240
|
-
if (sortBy === "createdAt") {
|
|
241
|
-
orderBy.push({ createdAt: sortOrder });
|
|
242
|
-
} else {
|
|
243
|
-
orderBy.push({ updatedAt: sortOrder });
|
|
244
|
-
}
|
|
245
|
-
const $notes = models.note.findMany({
|
|
246
|
-
orderBy,
|
|
247
|
-
where,
|
|
248
|
-
take: Number(pagination.limit),
|
|
249
|
-
skip: Number(pagination.offset)
|
|
250
|
-
});
|
|
251
|
-
return {
|
|
252
|
-
totalCount: models.note.count({ where }),
|
|
253
|
-
notes: $notes
|
|
254
|
-
};
|
|
255
|
-
},
|
|
256
|
-
notesInDateRange: async (_, { dateRange }) => {
|
|
257
|
-
const where = {
|
|
258
|
-
OR: [
|
|
259
|
-
{
|
|
260
|
-
updatedAt: {
|
|
261
|
-
gte: new Date(dateRange.start),
|
|
262
|
-
lte: new Date(dateRange.end)
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
createdAt: {
|
|
267
|
-
gte: new Date(dateRange.start),
|
|
268
|
-
lte: new Date(dateRange.end)
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
]
|
|
272
|
-
};
|
|
273
|
-
const $notes = await models.note.findMany({
|
|
274
|
-
orderBy: { createdAt: "asc" },
|
|
275
|
-
where
|
|
276
|
-
});
|
|
277
|
-
return $notes;
|
|
278
|
-
},
|
|
279
|
-
tagNotes: async (_, {
|
|
280
|
-
searchFilter,
|
|
281
|
-
pagination
|
|
282
|
-
}) => {
|
|
283
|
-
const where = { tags: { some: { id: Number(searchFilter.query) } } };
|
|
284
|
-
const $notes = models.note.findMany({
|
|
285
|
-
orderBy: { updatedAt: "desc" },
|
|
286
|
-
where,
|
|
287
|
-
take: Number(pagination.limit),
|
|
288
|
-
skip: Number(pagination.offset)
|
|
289
|
-
});
|
|
290
|
-
return {
|
|
291
|
-
totalCount: models.note.count({ where }),
|
|
292
|
-
notes: $notes
|
|
293
|
-
};
|
|
294
|
-
},
|
|
295
|
-
pinnedNotes: async () => models.note.findMany({
|
|
296
|
-
orderBy: [
|
|
297
|
-
{ order: "asc" },
|
|
298
|
-
{ updatedAt: "desc" }
|
|
299
|
-
],
|
|
300
|
-
where: { pinned: true }
|
|
301
|
-
}),
|
|
302
|
-
imageNotes: async (_, { src }) => models.note.findMany({
|
|
303
|
-
orderBy: { updatedAt: "desc" },
|
|
304
|
-
where: { content: { contains: src } }
|
|
305
|
-
}),
|
|
306
|
-
backReferences: async (_, { id }) => {
|
|
307
|
-
return models.note.findMany({
|
|
308
|
-
orderBy: [
|
|
309
|
-
{ pinned: "desc" },
|
|
310
|
-
{ updatedAt: "desc" }
|
|
311
|
-
],
|
|
312
|
-
where: { content: { contains: `reference","props":{"id":"${id}"` } }
|
|
313
|
-
});
|
|
314
|
-
},
|
|
315
|
-
note: async (_, { id }) => {
|
|
316
|
-
const $note = await models.note.findUnique({ where: { id: Number(id) } });
|
|
317
|
-
if (!$note) {
|
|
318
|
-
throw "NOT FOUND";
|
|
319
|
-
}
|
|
320
|
-
if ($note.content) {
|
|
321
|
-
const blocks = extractBlocksByType("reference", JSON.parse($note.content));
|
|
322
|
-
if (blocks.length > 0) {
|
|
323
|
-
const referenceIds = blocks.map((block) => Number(block.props.id));
|
|
324
|
-
const $references = await models.note.findMany({ where: { id: { in: referenceIds } } });
|
|
325
|
-
const newContent = $references.reduce((acc, $reference) => {
|
|
326
|
-
const reference = blocks.find((block) => Number(block.props.id) === $reference.id);
|
|
327
|
-
if (reference && reference.props.title !== $reference.title) {
|
|
328
|
-
return acc.replace(
|
|
329
|
-
`reference","props":{"id":"${reference.props.id}","title":"${reference.props.title}"`,
|
|
330
|
-
`reference","props":{"id":"${$reference.id}","title":"${$reference.title}"`
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
return acc;
|
|
334
|
-
}, $note.content);
|
|
335
|
-
if (newContent !== $note.content) {
|
|
336
|
-
try {
|
|
337
|
-
JSON.parse(newContent);
|
|
338
|
-
return await models.note.update({
|
|
339
|
-
where: { id: $note.id },
|
|
340
|
-
data: { content: newContent }
|
|
341
|
-
});
|
|
342
|
-
} catch {
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
return $note;
|
|
348
|
-
},
|
|
349
|
-
noteCleanupCandidates: async (_, {
|
|
350
|
-
query,
|
|
351
|
-
pagination = {
|
|
352
|
-
limit: 20,
|
|
353
|
-
offset: 0
|
|
354
|
-
}
|
|
355
|
-
}) => {
|
|
356
|
-
const result = await listNoteCleanupCandidates({
|
|
357
|
-
keywords: query ? query.split(/[,\s]+/).map((keyword) => keyword.trim()).filter(Boolean) : void 0,
|
|
358
|
-
limit: Number(pagination.limit),
|
|
359
|
-
offset: Number(pagination.offset)
|
|
360
|
-
});
|
|
361
|
-
return result.notes;
|
|
362
|
-
},
|
|
363
|
-
noteCleanupPreview: async (_, { id }) => {
|
|
364
|
-
return getNoteCleanupPreview(Number(id));
|
|
365
|
-
},
|
|
366
|
-
noteSnapshots: async (_, {
|
|
367
|
-
id,
|
|
368
|
-
limit = 5
|
|
369
|
-
}) => {
|
|
370
|
-
return listNoteSnapshots(Number(id), Number(limit));
|
|
371
|
-
},
|
|
372
|
-
trashedNotes: async (_, {
|
|
373
|
-
pagination = {
|
|
374
|
-
limit: 25,
|
|
375
|
-
offset: 0
|
|
376
|
-
}
|
|
377
|
-
}) => {
|
|
378
|
-
return listTrashedNotes({
|
|
379
|
-
limit: Number(pagination.limit),
|
|
380
|
-
offset: Number(pagination.offset)
|
|
381
|
-
});
|
|
382
|
-
},
|
|
383
|
-
noteGraph: async () => {
|
|
384
|
-
const $notes = await models.note.findMany({
|
|
385
|
-
select: {
|
|
386
|
-
id: true,
|
|
387
|
-
title: true,
|
|
388
|
-
content: true
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
const nodes = [];
|
|
392
|
-
const links = [];
|
|
393
|
-
const connectionCount = {};
|
|
394
|
-
const linkSet = /* @__PURE__ */ new Set();
|
|
395
|
-
for (const $note of $notes) {
|
|
396
|
-
if ($note.content) {
|
|
397
|
-
try {
|
|
398
|
-
const blocks = extractBlocksByType("reference", JSON.parse($note.content));
|
|
399
|
-
for (const block of blocks) {
|
|
400
|
-
const targetId = block.props.id;
|
|
401
|
-
if (targetId && String($note.id) !== targetId) {
|
|
402
|
-
const linkKey = `${$note.id}-${targetId}`;
|
|
403
|
-
const reverseLinkKey = `${targetId}-${$note.id}`;
|
|
404
|
-
if (!linkSet.has(linkKey) && !linkSet.has(reverseLinkKey)) {
|
|
405
|
-
linkSet.add(linkKey);
|
|
406
|
-
links.push({
|
|
407
|
-
source: String($note.id),
|
|
408
|
-
target: targetId
|
|
409
|
-
});
|
|
410
|
-
connectionCount[String($note.id)] = (connectionCount[String($note.id)] || 0) + 1;
|
|
411
|
-
connectionCount[targetId] = (connectionCount[targetId] || 0) + 1;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
} catch {
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
for (const $note of $notes) {
|
|
420
|
-
nodes.push({
|
|
421
|
-
id: String($note.id),
|
|
422
|
-
title: $note.title || "Untitled",
|
|
423
|
-
connections: connectionCount[String($note.id)] || 0
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
return {
|
|
427
|
-
nodes,
|
|
428
|
-
links
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
},
|
|
432
|
-
Mutation: {
|
|
433
|
-
createNote: async (_, { note }) => {
|
|
434
|
-
const PLACEHOLDER_PREFIX = "{%";
|
|
435
|
-
const PLACEHOLDER_SUFFIX = "%}";
|
|
436
|
-
const replacePlaceholder = async (content) => {
|
|
437
|
-
const placeholders = content.matchAll(new RegExp(`${PLACEHOLDER_PREFIX}([^}]+)${PLACEHOLDER_SUFFIX}`, "g"));
|
|
438
|
-
const $placeholders = await models.placeholder.findMany({
|
|
439
|
-
select: {
|
|
440
|
-
template: true,
|
|
441
|
-
replacement: true
|
|
442
|
-
},
|
|
443
|
-
where: { template: { in: Array.from(new Set(Array.from(placeholders, (p) => p[1]))) } }
|
|
444
|
-
});
|
|
445
|
-
for (const $placeholder of $placeholders) {
|
|
446
|
-
content = content.replace(new RegExp(`${PLACEHOLDER_PREFIX}${$placeholder.template}${PLACEHOLDER_SUFFIX}`, "g"), $placeholder.replacement);
|
|
447
|
-
}
|
|
448
|
-
return content;
|
|
449
|
-
};
|
|
450
|
-
const replacedTitle = await replacePlaceholder(note.title);
|
|
451
|
-
const replacedContent = await replacePlaceholder(note.content);
|
|
452
|
-
const $note = await models.note.create({
|
|
453
|
-
data: {
|
|
454
|
-
title: replacedTitle,
|
|
455
|
-
content: replacedContent,
|
|
456
|
-
...note.layout && { layout: note.layout }
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
if (note.content) {
|
|
460
|
-
const blocks = extractBlocksByType(
|
|
461
|
-
"tag",
|
|
462
|
-
JSON.parse(note.content)
|
|
463
|
-
);
|
|
464
|
-
return await models.note.update({
|
|
465
|
-
where: { id: $note.id },
|
|
466
|
-
data: { tags: { set: blocks.map((block) => ({ id: Number(block.props.id) })) } }
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
return $note;
|
|
470
|
-
},
|
|
471
|
-
updateNote: async (_, {
|
|
472
|
-
id,
|
|
473
|
-
note,
|
|
474
|
-
editSessionId
|
|
475
|
-
}, context) => {
|
|
476
|
-
const userAgentHeader = context.req?.headers["user-agent"];
|
|
477
|
-
const userAgent = Array.isArray(userAgentHeader) ? userAgentHeader[0] : userAgentHeader;
|
|
478
|
-
let blocks = [];
|
|
479
|
-
if (note.content) {
|
|
480
|
-
blocks = extractBlocksByType(
|
|
481
|
-
"tag",
|
|
482
|
-
JSON.parse(note.content)
|
|
483
|
-
);
|
|
484
|
-
}
|
|
485
|
-
await captureNoteBaseline({
|
|
486
|
-
noteId: Number(id),
|
|
487
|
-
...editSessionId ? { editSessionId } : {},
|
|
488
|
-
meta: createSnapshotMetaFromUserAgent(userAgent)
|
|
489
|
-
});
|
|
490
|
-
const $note = await models.note.update({
|
|
491
|
-
where: { id: Number(id) },
|
|
492
|
-
data: {
|
|
493
|
-
...note,
|
|
494
|
-
...note.content ? { tags: { set: blocks.map((block) => ({ id: Number(block.props.id) })) } } : {}
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
return $note;
|
|
498
|
-
},
|
|
499
|
-
deleteNote: async (_, { id }) => {
|
|
500
|
-
const trashedNote = await trashNoteById(Number(id));
|
|
501
|
-
if (!trashedNote) {
|
|
502
|
-
throw "NOT FOUND";
|
|
503
|
-
}
|
|
504
|
-
return true;
|
|
505
|
-
},
|
|
506
|
-
restoreNoteSnapshot: async (_, { id }, context) => {
|
|
507
|
-
const userAgentHeader = context.req?.headers["user-agent"];
|
|
508
|
-
const userAgent = Array.isArray(userAgentHeader) ? userAgentHeader[0] : userAgentHeader;
|
|
509
|
-
const note = await restoreNoteSnapshot(Number(id), { meta: createSnapshotMetaFromUserAgent(userAgent) });
|
|
510
|
-
if (!note) {
|
|
511
|
-
throw "NOT FOUND";
|
|
512
|
-
}
|
|
513
|
-
return note;
|
|
514
|
-
},
|
|
515
|
-
restoreTrashedNote: async (_, { id }) => {
|
|
516
|
-
const note = await restoreTrashedNoteById(Number(id));
|
|
517
|
-
if (!note) {
|
|
518
|
-
throw "NOT FOUND";
|
|
519
|
-
}
|
|
520
|
-
return note;
|
|
521
|
-
},
|
|
522
|
-
pinNote: (_, { id, pinned }) => models.note.update({
|
|
523
|
-
where: { id: Number(id) },
|
|
524
|
-
data: { pinned: Boolean(pinned) }
|
|
525
|
-
}),
|
|
526
|
-
reorderNotes: async (_, { notes }) => {
|
|
527
|
-
const updatePromises = notes.map(
|
|
528
|
-
({ id, order }) => models.note.update({
|
|
529
|
-
where: { id: Number(id) },
|
|
530
|
-
data: { order }
|
|
531
|
-
})
|
|
532
|
-
);
|
|
533
|
-
return await Promise.all(updatePromises);
|
|
534
|
-
}
|
|
535
|
-
},
|
|
536
|
-
Note: {
|
|
537
|
-
tags: async (note) => await models.tag.findMany({ where: { notes: { some: { id: note.id } } } }),
|
|
538
|
-
contentAsMarkdown: async (note) => {
|
|
539
|
-
const { blocksToMarkdown } = await import("../../modules/blocknote.js");
|
|
540
|
-
return blocksToMarkdown(note.content);
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
export {
|
|
545
|
-
noteMutation,
|
|
546
|
-
noteQuery,
|
|
547
|
-
noteResolvers,
|
|
548
|
-
noteType,
|
|
549
|
-
noteTypeDefs
|
|
550
|
-
};
|
|
551
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/schema/note/index.ts"],"sourcesContent":["import type { IResolvers } from '@graphql-tools/utils';\nimport type { Request } from 'express';\n\nimport models from '~/models.js';\nimport { gql } from '~/modules/graphql.js';\nimport {\n getNoteCleanupPreview,\n listNoteCleanupCandidates\n} from '~/modules/note-cleanup.js';\nimport {\n captureNoteBaseline,\n createSnapshotMetaFromUserAgent,\n listNoteSnapshots,\n restoreNoteSnapshot\n} from '~/modules/note-snapshot.js';\nimport {\n listTrashedNotes,\n restoreTrashedNoteById,\n trashNoteById\n} from '~/modules/note-trash.js';\n\nimport type { Note, Prisma } from '~/models.js';\nimport type { Pagination, SearchFilter, NoteInput } from '~/types/index.js';\n\nexport const noteType = gql`\n input PaginationInput {\n limit: Int!\n offset: Int!\n }\n\n input SearchFilterInput {\n query: String!\n sortBy: String\n sortOrder: String\n pinnedFirst: Boolean\n }\n\n input DateRangeInput {\n start: String!\n end: String!\n }\n\n enum NoteLayout {\n narrow\n wide\n full\n }\n\n input NoteInput {\n title: String\n content: String\n layout: NoteLayout\n }\n\n input NoteOrderInput {\n id: ID!\n order: Int!\n }\n\n type Tag {\n id: ID!\n name: String!\n createdAt: String!\n updatedAt: String!\n }\n\n type Note {\n id: ID!\n title: String!\n content: String!\n contentAsMarkdown: String!\n createdAt: String!\n updatedAt: String!\n pinned: Boolean!\n order: Int!\n layout: NoteLayout!\n tags: [Tag!]!\n }\n\n type Notes {\n totalCount: Int!\n notes: [Note!]!\n }\n\n type NoteCleanupBackReference {\n id: ID!\n title: String!\n }\n\n type NoteCleanupCandidate {\n id: ID!\n title: String!\n updatedAt: String!\n pinned: Boolean!\n tagNames: [String!]!\n reminderCount: Int!\n backReferenceCount: Int!\n matchedTerms: [String!]!\n reasons: [String!]!\n requiresForce: Boolean!\n forceReasons: [String!]!\n }\n\n type NoteCleanupPreview {\n id: ID!\n title: String!\n updatedAt: String!\n pinned: Boolean!\n tagNames: [String!]!\n reminderCount: Int!\n backReferences: [NoteCleanupBackReference!]!\n orphanedTagNames: [String!]!\n requiresForce: Boolean!\n forceReasons: [String!]!\n }\n\n type NoteSnapshotMeta {\n entrypoint: String\n label: String\n }\n\n type NoteSnapshot {\n id: ID!\n title: String!\n createdAt: String!\n meta: NoteSnapshotMeta!\n }\n\n type DeletedNote {\n id: ID!\n title: String!\n createdAt: String!\n updatedAt: String!\n deletedAt: String!\n pinned: Boolean!\n order: Int!\n layout: NoteLayout!\n tagNames: [String!]!\n }\n\n type DeletedNotes {\n totalCount: Int!\n notes: [DeletedNote!]!\n }\n`;\n\nexport const noteQuery = gql`\n type GraphNode {\n id: ID!\n title: String!\n connections: Int!\n }\n\n type GraphLink {\n source: ID!\n target: ID!\n }\n\n type NoteGraph {\n nodes: [GraphNode!]!\n links: [GraphLink!]!\n }\n\n type Query {\n allNotes(searchFilter: SearchFilterInput, pagination: PaginationInput): Notes!\n tagNotes(searchFilter: SearchFilterInput, pagination: PaginationInput): Notes!\n notesInDateRange(dateRange: DateRangeInput): [Note!]!\n pinnedNotes: [Note!]!\n imageNotes(src: String!): [Note!]!\n backReferences(id: ID!): [Note]!\n note(id: ID!): Note!\n noteCleanupCandidates(query: String, pagination: PaginationInput): [NoteCleanupCandidate!]!\n noteCleanupPreview(id: ID!): NoteCleanupPreview\n noteSnapshots(id: ID!, limit: Int): [NoteSnapshot!]!\n trashedNotes(pagination: PaginationInput): DeletedNotes!\n noteGraph: NoteGraph!\n }\n`;\n\nexport const noteMutation = gql`\n type Mutation {\n createNote(note: NoteInput!): Note!\n updateNote(id: ID!, note: NoteInput!, editSessionId: String): Note!\n deleteNote(id: ID!): Boolean!\n restoreNoteSnapshot(id: ID!): Note!\n restoreTrashedNote(id: ID!): Note!\n pinNote(id: ID!, pinned: Boolean!): Note!\n reorderNotes(notes: [NoteOrderInput!]!): [Note!]!\n }\n`;\n\nexport const noteTypeDefs = `\n ${noteType}\n ${noteQuery}\n ${noteMutation}\n`;\n\ninterface BlockNote<T = unknown> {\n id: string;\n type: string;\n props: T;\n content?: BlockNote<T>[];\n children?: BlockNote<T>[];\n}\n\nconst extractBlocksByType = <T>(type: string, dataArray: BlockNote[]): BlockNote<T>[] => {\n let result: BlockNote[] = [];\n\n for (const data of dataArray) {\n if (data.type === type) {\n result.push(data);\n }\n\n if (data.children && data.children.length > 0) {\n result = result.concat(extractBlocksByType(type, data.children));\n }\n\n if (data.content && data.content.length > 0) {\n for (const contentItem of data.content) {\n if (contentItem.type === type) {\n result.push(contentItem);\n }\n }\n }\n }\n\n return result as unknown as BlockNote<T>[];\n};\n\nexport const noteResolvers: IResolvers = {\n Query: {\n allNotes: async (_, {\n searchFilter,\n pagination\n }: {\n searchFilter: SearchFilter;\n pagination: Pagination;\n }) => {\n const queryItems = searchFilter.query.split(' ');\n const included = queryItems\n .filter((item: string) => !item.startsWith('-'))\n .map((word: string) => `%${word}%`);\n const excluded = queryItems\n .filter((item: string) => item.startsWith('-'))\n .map((item: string) => item.slice(1))\n .map((word: string) => `%${word}%`);\n\n const where: Prisma.NoteWhereInput = {\n AND: [\n ...included.map((keyword: string) => ({\n OR: [\n { title: { contains: keyword } },\n { content: { contains: keyword } }\n ]\n })),\n ...excluded.map((keyword: string) => ({\n NOT: {\n OR: [\n { title: { contains: keyword } },\n { content: { contains: keyword } }\n ]\n }\n }))\n ]\n };\n\n const sortBy = searchFilter.sortBy || 'updatedAt';\n const sortOrder = searchFilter.sortOrder || 'desc';\n const pinnedFirst = searchFilter.pinnedFirst || false;\n\n const orderBy: Prisma.NoteOrderByWithRelationInput[] = [];\n\n if (pinnedFirst) {\n orderBy.push({ pinned: 'desc' });\n }\n\n if (sortBy === 'createdAt') {\n orderBy.push({ createdAt: sortOrder as 'asc' | 'desc' });\n } else {\n orderBy.push({ updatedAt: sortOrder as 'asc' | 'desc' });\n }\n\n const $notes = models.note.findMany({\n orderBy,\n where,\n take: Number(pagination.limit),\n skip: Number(pagination.offset)\n });\n return {\n totalCount: models.note.count({ where }),\n notes: $notes\n };\n },\n notesInDateRange: async (_, { dateRange }: {\n dateRange: {\n start: string;\n end: string;\n };\n }) => {\n const where: Prisma.NoteWhereInput = {\n OR: [\n {\n updatedAt: {\n gte: new Date(dateRange.start),\n lte: new Date(dateRange.end)\n }\n },\n {\n createdAt: {\n gte: new Date(dateRange.start),\n lte: new Date(dateRange.end)\n }\n }\n ]\n };\n\n const $notes = await models.note.findMany({\n orderBy: { createdAt: 'asc' },\n where\n });\n\n return $notes;\n },\n tagNotes: async (_, {\n searchFilter,\n pagination\n }: {\n searchFilter: SearchFilter;\n pagination: Pagination;\n }) => {\n const where: Prisma.NoteWhereInput = { tags: { some: { id: Number(searchFilter.query) } } };\n\n const $notes = models.note.findMany({\n orderBy: { updatedAt: 'desc' },\n where,\n take: Number(pagination.limit),\n skip: Number(pagination.offset)\n });\n return {\n totalCount: models.note.count({ where }),\n notes: $notes\n };\n },\n pinnedNotes: async () => models.note.findMany({\n orderBy: [\n { order: 'asc' },\n { updatedAt: 'desc' }\n ],\n where: { pinned: true }\n }),\n imageNotes: async (_, { src }) => models.note.findMany({\n orderBy: { updatedAt: 'desc' },\n where: { content: { contains: src } }\n }),\n backReferences: async (_, { id }: Note) => {\n return models.note.findMany({\n orderBy: [\n { pinned: 'desc' },\n { updatedAt: 'desc' }\n ],\n where: { content: { contains: `reference\",\"props\":{\"id\":\"${id}\"` } }\n });\n },\n note: async (_, { id }: Note) => {\n const $note = await models.note.findUnique({ where: { id: Number(id) } });\n if (!$note) {\n throw 'NOT FOUND';\n }\n if ($note.content) {\n const blocks = extractBlocksByType<{\n id: string;\n title: string;\n }>('reference', JSON.parse($note.content));\n if (blocks.length > 0) {\n const referenceIds = blocks.map(block => Number(block.props.id));\n const $references = await models.note.findMany({ where: { id: { in: referenceIds } } });\n const newContent = $references.reduce<string>((acc: string, $reference: Note) => {\n const reference = blocks.find(block => Number(block.props.id) === $reference.id);\n if (reference && reference.props.title !== $reference.title) {\n return acc.replace(\n `reference\",\"props\":{\"id\":\"${reference.props.id}\",\"title\":\"${reference.props.title}\"`,\n `reference\",\"props\":{\"id\":\"${$reference.id}\",\"title\":\"${$reference.title}\"`\n );\n }\n return acc;\n }, $note.content);\n if (newContent !== $note.content) {\n try {\n JSON.parse(newContent);\n return await models.note.update({\n where: { id: $note.id },\n data: { content: newContent }\n });\n } catch {\n // Keep the stored content unchanged if the synchronized payload becomes invalid.\n }\n }\n }\n }\n return $note;\n },\n noteCleanupCandidates: async (_, {\n query,\n pagination = {\n limit: 20,\n offset: 0\n }\n }: {\n query?: string;\n pagination: Pagination;\n }) => {\n const result = await listNoteCleanupCandidates({\n keywords: query\n ? query.split(/[,\\s]+/).map((keyword) => keyword.trim()).filter(Boolean)\n : undefined,\n limit: Number(pagination.limit),\n offset: Number(pagination.offset)\n });\n\n return result.notes;\n },\n noteCleanupPreview: async (_, { id }: { id: string }) => {\n return getNoteCleanupPreview(Number(id));\n },\n noteSnapshots: async (_, {\n id,\n limit = 5\n }: {\n id: string;\n limit?: number;\n }) => {\n return listNoteSnapshots(Number(id), Number(limit));\n },\n trashedNotes: async (_, {\n pagination = {\n limit: 25,\n offset: 0\n }\n }: {\n pagination: Pagination;\n }) => {\n return listTrashedNotes({\n limit: Number(pagination.limit),\n offset: Number(pagination.offset)\n });\n },\n noteGraph: async () => {\n const $notes = await models.note.findMany({\n select: {\n id: true,\n title: true,\n content: true\n }\n });\n\n const nodes: Array<{ id: string; title: string; connections: number }> = [];\n const links: Array<{ source: string; target: string }> = [];\n const connectionCount: Record<string, number> = {};\n const linkSet = new Set<string>();\n\n // Extract all references from each note\n for (const $note of $notes) {\n if ($note.content) {\n try {\n const blocks = extractBlocksByType<{ id: string }>('reference', JSON.parse($note.content));\n for (const block of blocks) {\n const targetId = block.props.id;\n // Avoid self-references and duplicate links\n if (targetId && String($note.id) !== targetId) {\n const linkKey = `${$note.id}-${targetId}`;\n const reverseLinkKey = `${targetId}-${$note.id}`;\n if (!linkSet.has(linkKey) && !linkSet.has(reverseLinkKey)) {\n linkSet.add(linkKey);\n links.push({\n source: String($note.id),\n target: targetId\n });\n // Count connections for both nodes\n connectionCount[String($note.id)] = (connectionCount[String($note.id)] || 0) + 1;\n connectionCount[targetId] = (connectionCount[targetId] || 0) + 1;\n }\n }\n }\n } catch {\n // Skip notes with invalid JSON content\n }\n }\n }\n\n // Build nodes array with connection counts\n for (const $note of $notes) {\n nodes.push({\n id: String($note.id),\n title: $note.title || 'Untitled',\n connections: connectionCount[String($note.id)] || 0\n });\n }\n\n return {\n nodes,\n links\n };\n }\n },\n Mutation: {\n createNote: async (_, { note }: { note: NoteInput }) => {\n const PLACEHOLDER_PREFIX = '{%';\n const PLACEHOLDER_SUFFIX = '%}';\n\n const replacePlaceholder = async (content: string) => {\n const placeholders = content.matchAll(new RegExp(`${PLACEHOLDER_PREFIX}([^}]+)${PLACEHOLDER_SUFFIX}`, 'g'));\n const $placeholders = await models.placeholder.findMany({\n select: {\n template: true,\n replacement: true\n },\n where: { template: { in: Array.from(new Set(Array.from(placeholders, p => p[1]))) } }\n });\n\n for (const $placeholder of $placeholders) {\n content = content.replace(new RegExp(`${PLACEHOLDER_PREFIX}${$placeholder.template}${PLACEHOLDER_SUFFIX}`, 'g'), $placeholder.replacement);\n }\n return content;\n };\n\n const replacedTitle = await replacePlaceholder(note.title);\n const replacedContent = await replacePlaceholder(note.content);\n\n const $note = await models.note.create({\n data: {\n title: replacedTitle,\n content: replacedContent,\n ...(note.layout && { layout: note.layout })\n }\n });\n if (note.content) {\n const blocks = extractBlocksByType<{ id: string }>(\n 'tag',\n JSON.parse(note.content)\n );\n\n return await models.note.update({\n where: { id: $note.id },\n data: { tags: { set: blocks.map(block => ({ id: Number(block.props.id) })) } }\n });\n }\n\n return $note;\n },\n updateNote: async (_, {\n id,\n note,\n editSessionId\n }: {\n id: number;\n note: NoteInput;\n editSessionId?: string;\n }, context: {\n req?: Request;\n }) => {\n const userAgentHeader = context.req?.headers['user-agent'];\n const userAgent = Array.isArray(userAgentHeader) ? userAgentHeader[0] : userAgentHeader;\n let blocks: BlockNote<{ id: string }>[] = [];\n\n if (note.content) {\n blocks = extractBlocksByType<{ id: string }>(\n 'tag',\n JSON.parse(note.content)\n );\n }\n\n await captureNoteBaseline({\n noteId: Number(id),\n ...(editSessionId ? { editSessionId } : {}),\n meta: createSnapshotMetaFromUserAgent(userAgent)\n });\n\n const $note = await models.note.update({\n where: { id: Number(id) },\n data: {\n ...note,\n ...(note.content ? { tags: { set: blocks.map(block => ({ id: Number(block.props.id) })) } } : {})\n }\n });\n return $note;\n },\n deleteNote: async (_, { id }: Note) => {\n const trashedNote = await trashNoteById(Number(id));\n\n if (!trashedNote) {\n throw 'NOT FOUND';\n }\n\n return true;\n },\n restoreNoteSnapshot: async (_, { id }: { id: string }, context: {\n req?: Request;\n }) => {\n const userAgentHeader = context.req?.headers['user-agent'];\n const userAgent = Array.isArray(userAgentHeader) ? userAgentHeader[0] : userAgentHeader;\n const note = await restoreNoteSnapshot(Number(id), { meta: createSnapshotMetaFromUserAgent(userAgent) });\n\n if (!note) {\n throw 'NOT FOUND';\n }\n\n return note;\n },\n restoreTrashedNote: async (_, { id }: { id: string }) => {\n const note = await restoreTrashedNoteById(Number(id));\n\n if (!note) {\n throw 'NOT FOUND';\n }\n\n return note;\n },\n pinNote: (_, { id, pinned }: Note) => models.note.update({\n where: { id: Number(id) },\n data: { pinned: Boolean(pinned) }\n }),\n reorderNotes: async (_, { notes }: { notes: Array<{ id: string; order: number }> }) => {\n const updatePromises = notes.map(({ id, order }) =>\n models.note.update({\n where: { id: Number(id) },\n data: { order }\n })\n );\n return await Promise.all(updatePromises);\n }\n },\n Note: {\n tags: async (note: Note) => await models.tag.findMany({ where: { notes: { some: { id: note.id } } } }),\n contentAsMarkdown: async (note: Note) => {\n const { blocksToMarkdown } = await import('~/modules/blocknote.js');\n return blocksToMarkdown(note.content);\n }\n }\n};\n"],"mappings":"AAGA,OAAO,YAAY;AACnB,SAAS,WAAW;AACpB;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAKA,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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