@prmichaelsen/remember-core 0.12.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/README.md +100 -0
- package/dist/collections/composite-ids.d.ts +47 -0
- package/dist/collections/composite-ids.d.ts.map +1 -0
- package/dist/collections/composite-ids.js +97 -0
- package/dist/collections/composite-ids.js.map +1 -0
- package/dist/collections/dot-notation.d.ts +37 -0
- package/dist/collections/dot-notation.d.ts.map +1 -0
- package/dist/collections/dot-notation.js +100 -0
- package/dist/collections/dot-notation.js.map +1 -0
- package/dist/collections/index.d.ts +7 -0
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/collections/index.js +7 -0
- package/dist/collections/index.js.map +1 -0
- package/dist/collections/tracking-arrays.d.ts +28 -0
- package/dist/collections/tracking-arrays.d.ts.map +1 -0
- package/dist/collections/tracking-arrays.js +67 -0
- package/dist/collections/tracking-arrays.js.map +1 -0
- package/dist/config/debug.d.ts +36 -0
- package/dist/config/debug.d.ts.map +1 -0
- package/dist/config/debug.js +48 -0
- package/dist/config/debug.js.map +1 -0
- package/dist/config/environment.d.ts +71 -0
- package/dist/config/environment.d.ts.map +1 -0
- package/dist/config/environment.js +57 -0
- package/dist/config/environment.js.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +27 -0
- package/dist/config/index.js.map +1 -0
- package/dist/constants/content-types.d.ts +60 -0
- package/dist/constants/content-types.d.ts.map +1 -0
- package/dist/constants/content-types.js +450 -0
- package/dist/constants/content-types.js.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +3 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/database/firestore/index.d.ts +8 -0
- package/dist/database/firestore/index.d.ts.map +1 -0
- package/dist/database/firestore/index.js +10 -0
- package/dist/database/firestore/index.js.map +1 -0
- package/dist/database/firestore/init.d.ts +51 -0
- package/dist/database/firestore/init.d.ts.map +1 -0
- package/dist/database/firestore/init.js +92 -0
- package/dist/database/firestore/init.js.map +1 -0
- package/dist/database/firestore/paths.d.ts +54 -0
- package/dist/database/firestore/paths.d.ts.map +1 -0
- package/dist/database/firestore/paths.js +103 -0
- package/dist/database/firestore/paths.js.map +1 -0
- package/dist/database/weaviate/client.d.ts +68 -0
- package/dist/database/weaviate/client.d.ts.map +1 -0
- package/dist/database/weaviate/client.js +157 -0
- package/dist/database/weaviate/client.js.map +1 -0
- package/dist/database/weaviate/index.d.ts +6 -0
- package/dist/database/weaviate/index.d.ts.map +1 -0
- package/dist/database/weaviate/index.js +9 -0
- package/dist/database/weaviate/index.js.map +1 -0
- package/dist/database/weaviate/schema.d.ts +22 -0
- package/dist/database/weaviate/schema.d.ts.map +1 -0
- package/dist/database/weaviate/schema.js +50 -0
- package/dist/database/weaviate/schema.js.map +1 -0
- package/dist/database/weaviate/space-schema.d.ts +36 -0
- package/dist/database/weaviate/space-schema.d.ts.map +1 -0
- package/dist/database/weaviate/space-schema.js +65 -0
- package/dist/database/weaviate/space-schema.js.map +1 -0
- package/dist/database/weaviate/v2-collections.d.ts +160 -0
- package/dist/database/weaviate/v2-collections.d.ts.map +1 -0
- package/dist/database/weaviate/v2-collections.js +275 -0
- package/dist/database/weaviate/v2-collections.js.map +1 -0
- package/dist/errors/app-errors.d.ts +64 -0
- package/dist/errors/app-errors.d.ts.map +1 -0
- package/dist/errors/app-errors.js +90 -0
- package/dist/errors/app-errors.js.map +1 -0
- package/dist/errors/base.error.d.ts +15 -0
- package/dist/errors/base.error.d.ts.map +1 -0
- package/dist/errors/base.error.js +25 -0
- package/dist/errors/base.error.js.map +1 -0
- package/dist/errors/index.d.ts +19 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +25 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/services/confirmation-token.service.d.ts +56 -0
- package/dist/services/confirmation-token.service.d.ts.map +1 -0
- package/dist/services/confirmation-token.service.js +118 -0
- package/dist/services/confirmation-token.service.js.map +1 -0
- package/dist/services/credentials-provider.d.ts +25 -0
- package/dist/services/credentials-provider.d.ts.map +1 -0
- package/dist/services/credentials-provider.js +31 -0
- package/dist/services/credentials-provider.js.map +1 -0
- package/dist/services/index.d.ts +11 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +17 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/memory.service.d.ts +129 -0
- package/dist/services/memory.service.d.ts.map +1 -0
- package/dist/services/memory.service.js +294 -0
- package/dist/services/memory.service.js.map +1 -0
- package/dist/services/preferences.service.d.ts +27 -0
- package/dist/services/preferences.service.d.ts.map +1 -0
- package/dist/services/preferences.service.js +106 -0
- package/dist/services/preferences.service.js.map +1 -0
- package/dist/services/relationship.service.d.ts +75 -0
- package/dist/services/relationship.service.d.ts.map +1 -0
- package/dist/services/relationship.service.js +211 -0
- package/dist/services/relationship.service.js.map +1 -0
- package/dist/services/space-config.service.d.ts +22 -0
- package/dist/services/space-config.service.d.ts.map +1 -0
- package/dist/services/space-config.service.js +50 -0
- package/dist/services/space-config.service.js.map +1 -0
- package/dist/services/space.service.d.ts +160 -0
- package/dist/services/space.service.d.ts.map +1 -0
- package/dist/services/space.service.js +815 -0
- package/dist/services/space.service.js.map +1 -0
- package/dist/testing/index.d.ts +8 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +8 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/test-data-generator.d.ts +100 -0
- package/dist/testing/test-data-generator.d.ts.map +1 -0
- package/dist/testing/test-data-generator.js +194 -0
- package/dist/testing/test-data-generator.js.map +1 -0
- package/dist/testing/weaviate-mock.d.ts +317 -0
- package/dist/testing/weaviate-mock.d.ts.map +1 -0
- package/dist/testing/weaviate-mock.js +233 -0
- package/dist/testing/weaviate-mock.js.map +1 -0
- package/dist/types/auth.types.d.ts +36 -0
- package/dist/types/auth.types.d.ts.map +1 -0
- package/dist/types/auth.types.js +9 -0
- package/dist/types/auth.types.js.map +1 -0
- package/dist/types/context.types.d.ts +78 -0
- package/dist/types/context.types.d.ts.map +1 -0
- package/dist/types/context.types.js +6 -0
- package/dist/types/context.types.js.map +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/llm.types.d.ts +8 -0
- package/dist/types/llm.types.d.ts.map +1 -0
- package/dist/types/llm.types.js +8 -0
- package/dist/types/llm.types.js.map +1 -0
- package/dist/types/memory.types.d.ts +83 -0
- package/dist/types/memory.types.d.ts.map +1 -0
- package/dist/types/memory.types.js +6 -0
- package/dist/types/memory.types.js.map +1 -0
- package/dist/types/preferences.types.d.ts +285 -0
- package/dist/types/preferences.types.d.ts.map +1 -0
- package/dist/types/preferences.types.js +195 -0
- package/dist/types/preferences.types.js.map +1 -0
- package/dist/types/result.types.d.ts +60 -0
- package/dist/types/result.types.d.ts.map +1 -0
- package/dist/types/result.types.js +82 -0
- package/dist/types/result.types.js.map +1 -0
- package/dist/types/search.types.d.ts +49 -0
- package/dist/types/search.types.d.ts.map +1 -0
- package/dist/types/search.types.js +6 -0
- package/dist/types/search.types.js.map +1 -0
- package/dist/types/shared.types.d.ts +91 -0
- package/dist/types/shared.types.d.ts.map +1 -0
- package/dist/types/shared.types.js +57 -0
- package/dist/types/shared.types.js.map +1 -0
- package/dist/types/space.types.d.ts +82 -0
- package/dist/types/space.types.d.ts.map +1 -0
- package/dist/types/space.types.js +18 -0
- package/dist/types/space.types.js.map +1 -0
- package/dist/types/utils.types.d.ts +51 -0
- package/dist/types/utils.types.d.ts.map +1 -0
- package/dist/types/utils.types.js +4 -0
- package/dist/types/utils.types.js.map +1 -0
- package/dist/utils/auth-helpers.d.ts +23 -0
- package/dist/utils/auth-helpers.d.ts.map +1 -0
- package/dist/utils/auth-helpers.js +31 -0
- package/dist/utils/auth-helpers.js.map +1 -0
- package/dist/utils/debug.d.ts +45 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/dist/utils/debug.js +112 -0
- package/dist/utils/debug.js.map +1 -0
- package/dist/utils/error-handler.d.ts +46 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +63 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/filters.d.ts +42 -0
- package/dist/utils/filters.d.ts.map +1 -0
- package/dist/utils/filters.js +132 -0
- package/dist/utils/filters.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +22 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +68 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +100 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content type constants and descriptions for remember-core.
|
|
3
|
+
* Ported from remember-mcp/src/constants/content-types.ts
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* All available content types
|
|
7
|
+
*/
|
|
8
|
+
export const CONTENT_TYPES = [
|
|
9
|
+
// Core types
|
|
10
|
+
'code',
|
|
11
|
+
'note',
|
|
12
|
+
'documentation',
|
|
13
|
+
'reference',
|
|
14
|
+
// Task & Planning
|
|
15
|
+
'todo',
|
|
16
|
+
'checklist',
|
|
17
|
+
'project',
|
|
18
|
+
'goal',
|
|
19
|
+
'habit',
|
|
20
|
+
// Communication
|
|
21
|
+
'email',
|
|
22
|
+
'conversation',
|
|
23
|
+
'meeting',
|
|
24
|
+
'person',
|
|
25
|
+
// Content & Media
|
|
26
|
+
'article',
|
|
27
|
+
'webpage',
|
|
28
|
+
'social',
|
|
29
|
+
'image',
|
|
30
|
+
'video',
|
|
31
|
+
'audio',
|
|
32
|
+
'transcript',
|
|
33
|
+
'presentation',
|
|
34
|
+
'spreadsheet',
|
|
35
|
+
'pdf',
|
|
36
|
+
// Creative
|
|
37
|
+
'song',
|
|
38
|
+
'screenplay',
|
|
39
|
+
'recipe',
|
|
40
|
+
'idea',
|
|
41
|
+
'quote',
|
|
42
|
+
'poetry',
|
|
43
|
+
// Personal
|
|
44
|
+
'journal',
|
|
45
|
+
'memory',
|
|
46
|
+
'event',
|
|
47
|
+
// Organizational
|
|
48
|
+
'bookmark',
|
|
49
|
+
'form',
|
|
50
|
+
'location',
|
|
51
|
+
// Business
|
|
52
|
+
'invoice',
|
|
53
|
+
'contract',
|
|
54
|
+
// System
|
|
55
|
+
'system',
|
|
56
|
+
'action',
|
|
57
|
+
'audit',
|
|
58
|
+
'history',
|
|
59
|
+
// Cross-user & Threading
|
|
60
|
+
'ghost',
|
|
61
|
+
'comment',
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* Comprehensive content type descriptions
|
|
65
|
+
*/
|
|
66
|
+
export const CONTENT_TYPE_METADATA = {
|
|
67
|
+
// Core Types
|
|
68
|
+
code: {
|
|
69
|
+
name: 'code',
|
|
70
|
+
category: 'core',
|
|
71
|
+
description: 'Source code files and programming content',
|
|
72
|
+
examples: ['Code snippets', 'Functions', 'Scripts', 'Configuration files'],
|
|
73
|
+
common_fields: ['language', 'framework', 'purpose'],
|
|
74
|
+
},
|
|
75
|
+
note: {
|
|
76
|
+
name: 'note',
|
|
77
|
+
category: 'core',
|
|
78
|
+
description: 'Personal notes and quick documentation',
|
|
79
|
+
examples: ['Quick notes', 'Reminders', 'Observations', 'Thoughts'],
|
|
80
|
+
},
|
|
81
|
+
documentation: {
|
|
82
|
+
name: 'documentation',
|
|
83
|
+
category: 'core',
|
|
84
|
+
description: 'Technical documentation and guides',
|
|
85
|
+
examples: ['API docs', 'User guides', 'Technical specs', 'How-to guides'],
|
|
86
|
+
},
|
|
87
|
+
reference: {
|
|
88
|
+
name: 'reference',
|
|
89
|
+
category: 'core',
|
|
90
|
+
description: 'Quick reference guides and cheat sheets',
|
|
91
|
+
examples: ['Command references', 'Keyboard shortcuts', 'API references', 'Cheat sheets'],
|
|
92
|
+
},
|
|
93
|
+
// Task & Planning
|
|
94
|
+
todo: {
|
|
95
|
+
name: 'todo',
|
|
96
|
+
category: 'task',
|
|
97
|
+
description: 'Individual tasks with due dates and priorities',
|
|
98
|
+
examples: ['Task items', 'Action items', 'Assignments'],
|
|
99
|
+
common_fields: ['due_date', 'priority', 'status', 'assignee'],
|
|
100
|
+
},
|
|
101
|
+
checklist: {
|
|
102
|
+
name: 'checklist',
|
|
103
|
+
category: 'task',
|
|
104
|
+
description: 'Reusable checklists and sequential steps',
|
|
105
|
+
examples: ['Grocery lists', 'Packing lists', 'Process checklists', 'Preparation lists'],
|
|
106
|
+
common_fields: ['items', 'completion_percentage'],
|
|
107
|
+
},
|
|
108
|
+
project: {
|
|
109
|
+
name: 'project',
|
|
110
|
+
category: 'task',
|
|
111
|
+
description: 'Project plans and overviews',
|
|
112
|
+
examples: ['Project documentation', 'Project plans', 'Milestones'],
|
|
113
|
+
common_fields: ['status', 'start_date', 'end_date', 'stakeholders'],
|
|
114
|
+
},
|
|
115
|
+
goal: {
|
|
116
|
+
name: 'goal',
|
|
117
|
+
category: 'task',
|
|
118
|
+
description: 'Goals, objectives, and milestones',
|
|
119
|
+
examples: ['Personal goals', 'Professional objectives', 'KPIs'],
|
|
120
|
+
common_fields: ['target_date', 'progress', 'milestones'],
|
|
121
|
+
},
|
|
122
|
+
habit: {
|
|
123
|
+
name: 'habit',
|
|
124
|
+
category: 'task',
|
|
125
|
+
description: 'Routines and habit tracking',
|
|
126
|
+
examples: ['Daily habits', 'Routines', 'Recurring activities'],
|
|
127
|
+
common_fields: ['frequency', 'streak', 'trigger'],
|
|
128
|
+
},
|
|
129
|
+
// Communication
|
|
130
|
+
email: {
|
|
131
|
+
name: 'email',
|
|
132
|
+
category: 'communication',
|
|
133
|
+
description: 'Email messages and threads',
|
|
134
|
+
examples: ['Email messages', 'Email threads', 'Drafts'],
|
|
135
|
+
common_fields: ['from', 'to', 'subject', 'date'],
|
|
136
|
+
},
|
|
137
|
+
conversation: {
|
|
138
|
+
name: 'conversation',
|
|
139
|
+
category: 'communication',
|
|
140
|
+
description: 'Chat logs and conversations',
|
|
141
|
+
examples: ['Chat messages', 'Conversation logs', 'Discussions'],
|
|
142
|
+
common_fields: ['participants', 'platform'],
|
|
143
|
+
},
|
|
144
|
+
meeting: {
|
|
145
|
+
name: 'meeting',
|
|
146
|
+
category: 'communication',
|
|
147
|
+
description: 'Meeting notes and action items',
|
|
148
|
+
examples: ['Meeting notes', 'Standup notes', 'Conference calls'],
|
|
149
|
+
common_fields: ['attendees', 'agenda', 'decisions', 'action_items'],
|
|
150
|
+
},
|
|
151
|
+
person: {
|
|
152
|
+
name: 'person',
|
|
153
|
+
category: 'communication',
|
|
154
|
+
description: 'Track information about people - personal, professional, or both',
|
|
155
|
+
examples: ['Friends', 'Family', 'Colleagues', 'Professional contacts', 'Business partners'],
|
|
156
|
+
common_fields: ['name', 'relationship', 'company', 'job_title', 'how_we_met', 'contact_info', 'birthday', 'interests'],
|
|
157
|
+
},
|
|
158
|
+
// Content & Media
|
|
159
|
+
article: {
|
|
160
|
+
name: 'article',
|
|
161
|
+
category: 'content',
|
|
162
|
+
description: 'Articles and blog posts',
|
|
163
|
+
examples: ['Blog posts', 'News articles', 'Long-form content'],
|
|
164
|
+
common_fields: ['author', 'publication', 'url'],
|
|
165
|
+
},
|
|
166
|
+
webpage: {
|
|
167
|
+
name: 'webpage',
|
|
168
|
+
category: 'content',
|
|
169
|
+
description: 'Saved web pages and HTML content',
|
|
170
|
+
examples: ['Web pages', 'HTML documents', 'Web content'],
|
|
171
|
+
common_fields: ['url', 'domain', 'archived_at'],
|
|
172
|
+
},
|
|
173
|
+
social: {
|
|
174
|
+
name: 'social',
|
|
175
|
+
category: 'content',
|
|
176
|
+
description: 'Social media posts and updates',
|
|
177
|
+
examples: ['Tweets', 'Posts', 'Status updates'],
|
|
178
|
+
common_fields: ['platform', 'author', 'url'],
|
|
179
|
+
},
|
|
180
|
+
image: {
|
|
181
|
+
name: 'image',
|
|
182
|
+
category: 'media',
|
|
183
|
+
description: 'Image files and visual content',
|
|
184
|
+
examples: ['Photos', 'Screenshots', 'Diagrams', 'Illustrations'],
|
|
185
|
+
common_fields: ['file_path', 'dimensions', 'format'],
|
|
186
|
+
},
|
|
187
|
+
video: {
|
|
188
|
+
name: 'video',
|
|
189
|
+
category: 'media',
|
|
190
|
+
description: 'Video files and recordings',
|
|
191
|
+
examples: ['Videos', 'Recordings', 'Tutorials'],
|
|
192
|
+
common_fields: ['duration', 'format', 'url'],
|
|
193
|
+
},
|
|
194
|
+
audio: {
|
|
195
|
+
name: 'audio',
|
|
196
|
+
category: 'media',
|
|
197
|
+
description: 'Audio files and recordings',
|
|
198
|
+
examples: ['Voice notes', 'Podcasts', 'Music', 'Recordings'],
|
|
199
|
+
common_fields: ['duration', 'format'],
|
|
200
|
+
},
|
|
201
|
+
transcript: {
|
|
202
|
+
name: 'transcript',
|
|
203
|
+
category: 'media',
|
|
204
|
+
description: 'Transcriptions of audio or video',
|
|
205
|
+
examples: ['Meeting transcripts', 'Podcast transcripts', 'Video captions'],
|
|
206
|
+
common_fields: ['source_media', 'speakers'],
|
|
207
|
+
},
|
|
208
|
+
presentation: {
|
|
209
|
+
name: 'presentation',
|
|
210
|
+
category: 'content',
|
|
211
|
+
description: 'Presentation slides and decks',
|
|
212
|
+
examples: ['Slide decks', 'Pitch decks', 'Presentations'],
|
|
213
|
+
common_fields: ['slide_count', 'format'],
|
|
214
|
+
},
|
|
215
|
+
spreadsheet: {
|
|
216
|
+
name: 'spreadsheet',
|
|
217
|
+
category: 'content',
|
|
218
|
+
description: 'Data tables and spreadsheet content',
|
|
219
|
+
examples: ['Spreadsheets', 'Data tables', 'CSV content'],
|
|
220
|
+
common_fields: ['rows', 'columns', 'format'],
|
|
221
|
+
},
|
|
222
|
+
pdf: {
|
|
223
|
+
name: 'pdf',
|
|
224
|
+
category: 'content',
|
|
225
|
+
description: 'PDF documents and scanned files',
|
|
226
|
+
examples: ['PDF documents', 'Scanned documents', 'Reports'],
|
|
227
|
+
common_fields: ['pages', 'file_size'],
|
|
228
|
+
},
|
|
229
|
+
// Creative
|
|
230
|
+
song: {
|
|
231
|
+
name: 'song',
|
|
232
|
+
category: 'creative',
|
|
233
|
+
description: 'Music tracks and songs',
|
|
234
|
+
examples: ['Songs', 'Music tracks', 'Albums', 'Playlists'],
|
|
235
|
+
common_fields: ['artist', 'album', 'genre', 'duration', 'release_date', 'url'],
|
|
236
|
+
},
|
|
237
|
+
screenplay: {
|
|
238
|
+
name: 'screenplay',
|
|
239
|
+
category: 'creative',
|
|
240
|
+
description: 'Screenplay and script content',
|
|
241
|
+
examples: ['Screenplays', 'Scripts', 'Dialogue'],
|
|
242
|
+
common_fields: ['characters', 'scenes'],
|
|
243
|
+
},
|
|
244
|
+
recipe: {
|
|
245
|
+
name: 'recipe',
|
|
246
|
+
category: 'creative',
|
|
247
|
+
description: 'Cooking recipes and instructions',
|
|
248
|
+
examples: ['Recipes', 'Cooking instructions', 'Meal plans'],
|
|
249
|
+
common_fields: ['ingredients', 'instructions', 'servings', 'prep_time', 'cook_time'],
|
|
250
|
+
},
|
|
251
|
+
idea: {
|
|
252
|
+
name: 'idea',
|
|
253
|
+
category: 'creative',
|
|
254
|
+
description: 'Brainstorming and concepts',
|
|
255
|
+
examples: ['Ideas', 'Brainstorms', 'Concepts', 'Inspiration'],
|
|
256
|
+
common_fields: ['category', 'potential_impact'],
|
|
257
|
+
},
|
|
258
|
+
quote: {
|
|
259
|
+
name: 'quote',
|
|
260
|
+
category: 'creative',
|
|
261
|
+
description: 'Memorable quotes and excerpts',
|
|
262
|
+
examples: ['Quotes', 'Excerpts', 'Highlights', 'Citations'],
|
|
263
|
+
common_fields: ['author', 'source'],
|
|
264
|
+
},
|
|
265
|
+
poetry: {
|
|
266
|
+
name: 'poetry',
|
|
267
|
+
category: 'creative',
|
|
268
|
+
description: 'Poems and poetic content',
|
|
269
|
+
examples: ['Poems', 'Verses', 'Haiku', 'Sonnets', 'Free verse'],
|
|
270
|
+
common_fields: ['author', 'form', 'theme'],
|
|
271
|
+
},
|
|
272
|
+
// Personal
|
|
273
|
+
journal: {
|
|
274
|
+
name: 'journal',
|
|
275
|
+
category: 'personal',
|
|
276
|
+
description: 'Daily journal entries and reflections',
|
|
277
|
+
examples: ['Journal entries', 'Diary entries', 'Reflections'],
|
|
278
|
+
common_fields: ['date', 'mood', 'highlights'],
|
|
279
|
+
},
|
|
280
|
+
memory: {
|
|
281
|
+
name: 'memory',
|
|
282
|
+
category: 'personal',
|
|
283
|
+
description: 'Personal memories and significant moments',
|
|
284
|
+
examples: ['Life events', 'Significant moments', 'Memories'],
|
|
285
|
+
common_fields: ['date', 'people_involved', 'location'],
|
|
286
|
+
},
|
|
287
|
+
event: {
|
|
288
|
+
name: 'event',
|
|
289
|
+
category: 'personal',
|
|
290
|
+
description: 'Calendar events and activities',
|
|
291
|
+
examples: ['Events', 'Activities', 'Appointments'],
|
|
292
|
+
common_fields: ['date', 'time', 'location', 'attendees'],
|
|
293
|
+
},
|
|
294
|
+
// Organizational
|
|
295
|
+
bookmark: {
|
|
296
|
+
name: 'bookmark',
|
|
297
|
+
category: 'organizational',
|
|
298
|
+
description: 'Web bookmarks and resource collections',
|
|
299
|
+
examples: ['Bookmarks', 'Resource links', 'Reading lists'],
|
|
300
|
+
common_fields: ['url', 'domain', 'read_later'],
|
|
301
|
+
},
|
|
302
|
+
form: {
|
|
303
|
+
name: 'form',
|
|
304
|
+
category: 'organizational',
|
|
305
|
+
description: 'Forms and surveys',
|
|
306
|
+
examples: ['Questionnaires', 'Feedback forms', 'Surveys'],
|
|
307
|
+
common_fields: ['fields', 'responses'],
|
|
308
|
+
},
|
|
309
|
+
location: {
|
|
310
|
+
name: 'location',
|
|
311
|
+
category: 'organizational',
|
|
312
|
+
description: 'Place information and recommendations',
|
|
313
|
+
examples: ['Places', 'Venues', 'Destinations', 'Locations'],
|
|
314
|
+
common_fields: ['address', 'gps', 'rating'],
|
|
315
|
+
},
|
|
316
|
+
// Business
|
|
317
|
+
invoice: {
|
|
318
|
+
name: 'invoice',
|
|
319
|
+
category: 'business',
|
|
320
|
+
description: 'Invoices and receipts',
|
|
321
|
+
examples: ['Invoices', 'Receipts', 'Bills'],
|
|
322
|
+
common_fields: ['amount', 'date', 'vendor', 'items'],
|
|
323
|
+
},
|
|
324
|
+
contract: {
|
|
325
|
+
name: 'contract',
|
|
326
|
+
category: 'business',
|
|
327
|
+
description: 'Contracts and agreements',
|
|
328
|
+
examples: ['Contracts', 'Agreements', 'Terms of service'],
|
|
329
|
+
common_fields: ['parties', 'effective_date', 'terms'],
|
|
330
|
+
},
|
|
331
|
+
// System
|
|
332
|
+
system: {
|
|
333
|
+
name: 'system',
|
|
334
|
+
category: 'system',
|
|
335
|
+
description: 'Agent instructions (reserved for internal use only)',
|
|
336
|
+
examples: ['System prompts', 'Agent instructions', 'Configuration'],
|
|
337
|
+
},
|
|
338
|
+
action: {
|
|
339
|
+
name: 'action',
|
|
340
|
+
category: 'system',
|
|
341
|
+
description: 'Agent actions and operations',
|
|
342
|
+
examples: ['Actions taken', 'Operations performed', 'Commands executed'],
|
|
343
|
+
common_fields: ['action_type', 'status', 'result'],
|
|
344
|
+
},
|
|
345
|
+
audit: {
|
|
346
|
+
name: 'audit',
|
|
347
|
+
category: 'system',
|
|
348
|
+
description: 'Audit logs and compliance records',
|
|
349
|
+
examples: ['Audit logs', 'Access logs', 'Security events'],
|
|
350
|
+
common_fields: ['event_type', 'actor', 'target', 'result'],
|
|
351
|
+
},
|
|
352
|
+
history: {
|
|
353
|
+
name: 'history',
|
|
354
|
+
category: 'system',
|
|
355
|
+
description: 'Change history and version tracking',
|
|
356
|
+
examples: ['Edit history', 'Version history', 'Change logs'],
|
|
357
|
+
common_fields: ['target_id', 'change_type', 'previous_value', 'new_value'],
|
|
358
|
+
},
|
|
359
|
+
// Cross-user & Threading
|
|
360
|
+
ghost: {
|
|
361
|
+
name: 'ghost',
|
|
362
|
+
category: 'cross_user',
|
|
363
|
+
description: 'Ghost conversation memory — stores context from AI-mediated cross-user interactions',
|
|
364
|
+
examples: ['Ghost conversation context', 'Cross-user interaction history'],
|
|
365
|
+
common_fields: ['ghost_owner_id', 'conversing_user_id'],
|
|
366
|
+
},
|
|
367
|
+
comment: {
|
|
368
|
+
name: 'comment',
|
|
369
|
+
category: 'cross_user',
|
|
370
|
+
description: 'Threaded comments on shared memories in spaces and groups',
|
|
371
|
+
examples: ['Comments on shared memories', 'Discussion replies', 'Feedback'],
|
|
372
|
+
common_fields: ['parent_id', 'thread_root_id'],
|
|
373
|
+
},
|
|
374
|
+
};
|
|
375
|
+
/**
|
|
376
|
+
* Content type categories
|
|
377
|
+
*/
|
|
378
|
+
export const CONTENT_TYPE_CATEGORIES = {
|
|
379
|
+
core: ['code', 'note', 'documentation', 'reference'],
|
|
380
|
+
task: ['todo', 'checklist', 'project', 'goal', 'habit'],
|
|
381
|
+
communication: ['email', 'conversation', 'meeting', 'person'],
|
|
382
|
+
content: ['article', 'webpage', 'social', 'presentation', 'spreadsheet', 'pdf'],
|
|
383
|
+
media: ['image', 'video', 'audio', 'transcript'],
|
|
384
|
+
creative: ['song', 'screenplay', 'recipe', 'idea', 'quote', 'poetry'],
|
|
385
|
+
personal: ['journal', 'memory', 'event'],
|
|
386
|
+
organizational: ['bookmark', 'form', 'location'],
|
|
387
|
+
business: ['invoice', 'contract'],
|
|
388
|
+
system: ['system', 'action', 'audit', 'history'],
|
|
389
|
+
cross_user: ['ghost', 'comment'],
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Get content type metadata
|
|
393
|
+
*/
|
|
394
|
+
export function getContentTypeMetadata(type) {
|
|
395
|
+
return CONTENT_TYPE_METADATA[type];
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Get content types by category
|
|
399
|
+
*/
|
|
400
|
+
export function getContentTypesByCategory(category) {
|
|
401
|
+
return CONTENT_TYPE_CATEGORIES[category];
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Validate content type
|
|
405
|
+
*/
|
|
406
|
+
export function isValidContentType(type) {
|
|
407
|
+
return CONTENT_TYPES.includes(type);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Get content type description for LLM prompts
|
|
411
|
+
*/
|
|
412
|
+
export function getContentTypeDescription() {
|
|
413
|
+
const categoryNames = {
|
|
414
|
+
core: 'Core Types',
|
|
415
|
+
task: 'Task & Planning',
|
|
416
|
+
communication: 'Communication',
|
|
417
|
+
content: 'Content & Media',
|
|
418
|
+
media: 'Content & Media',
|
|
419
|
+
creative: 'Creative',
|
|
420
|
+
personal: 'Personal',
|
|
421
|
+
organizational: 'Organizational',
|
|
422
|
+
business: 'Business',
|
|
423
|
+
system: 'System (Internal Use)',
|
|
424
|
+
};
|
|
425
|
+
const lines = ['Type of content:', ''];
|
|
426
|
+
const categorized = new Map();
|
|
427
|
+
for (const type of CONTENT_TYPES) {
|
|
428
|
+
const metadata = CONTENT_TYPE_METADATA[type];
|
|
429
|
+
const categoryKey = metadata.category;
|
|
430
|
+
if (!categorized.has(categoryKey)) {
|
|
431
|
+
categorized.set(categoryKey, []);
|
|
432
|
+
}
|
|
433
|
+
categorized.get(categoryKey).push(type);
|
|
434
|
+
}
|
|
435
|
+
for (const [categoryKey, types] of categorized) {
|
|
436
|
+
const categoryName = categoryNames[categoryKey] || categoryKey;
|
|
437
|
+
lines.push(`${categoryName}:`);
|
|
438
|
+
for (const type of types) {
|
|
439
|
+
const metadata = CONTENT_TYPE_METADATA[type];
|
|
440
|
+
lines.push(` - '${type}': ${metadata.description}`);
|
|
441
|
+
}
|
|
442
|
+
lines.push('');
|
|
443
|
+
}
|
|
444
|
+
return lines.join('\n').trim();
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Default content type
|
|
448
|
+
*/
|
|
449
|
+
export const DEFAULT_CONTENT_TYPE = 'note';
|
|
450
|
+
//# sourceMappingURL=content-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-types.js","sourceRoot":"","sources":["../../src/constants/content-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAA2B;IACnD,aAAa;IACb,MAAM;IACN,MAAM;IACN,eAAe;IACf,WAAW;IACX,kBAAkB;IAClB,MAAM;IACN,WAAW;IACX,SAAS;IACT,MAAM;IACN,OAAO;IACP,gBAAgB;IAChB,OAAO;IACP,cAAc;IACd,SAAS;IACT,QAAQ;IACR,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;IACP,YAAY;IACZ,cAAc;IACd,aAAa;IACb,KAAK;IACL,WAAW;IACX,MAAM;IACN,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,OAAO;IACP,QAAQ;IACR,WAAW;IACX,SAAS;IACT,QAAQ;IACR,OAAO;IACP,iBAAiB;IACjB,UAAU;IACV,MAAM;IACN,UAAU;IACV,WAAW;IACX,SAAS;IACT,UAAU;IACV,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,SAAS;IACT,yBAAyB;IACzB,OAAO;IACP,SAAS;CACD,CAAC;AAaX;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA6C;IAC7E,aAAa;IACb,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,2CAA2C;QACxD,QAAQ,EAAE,CAAC,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,qBAAqB,CAAC;QAC1E,aAAa,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC;KACpD;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAA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AM,WAAW,GAAG,IAAI,GAAG,EAAyB,CAAC;IAErD,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,WAAW,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAEtC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YAClC,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACnC,CAAC;QACD,WAAW,CAAC,GAAG,CAAC,WAAW,CAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,WAAW,EAAE,CAAC;QAC/C,MAAM,YAAY,GAAG,aAAa,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC;QAC/D,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY,GAAG,CAAC,CAAC;QAE/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;YAC7C,KAAK,CAAC,IAAI,CAAC,QAAQ,IAAI,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QACvD,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgB,MAAM,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { CONTENT_TYPES, CONTENT_TYPE_METADATA, CONTENT_TYPE_CATEGORIES, DEFAULT_CONTENT_TYPE, getContentTypeMetadata, getContentTypesByCategory, isValidContentType, getContentTypeDescription, } from './content-types.js';
|
|
2
|
+
export type { ContentTypeMetadata } from './content-types.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// src/constants/index.ts
|
|
2
|
+
export { CONTENT_TYPES, CONTENT_TYPE_METADATA, CONTENT_TYPE_CATEGORIES, DEFAULT_CONTENT_TYPE, getContentTypeMetadata, getContentTypesByCategory, isValidContentType, getContentTypeDescription, } from './content-types.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,yBAAyB;AAEzB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firestore module barrel exports.
|
|
3
|
+
*
|
|
4
|
+
* Provides Firebase Admin SDK initialization and Firestore document path utilities.
|
|
5
|
+
*/
|
|
6
|
+
export { initFirestore, isFirestoreInitialized, testFirestoreConnection, _resetFirestoreState, type FirestoreConfig, type FirestoreLogger, getDocument, setDocument, addDocument, updateDocument, deleteDocument, queryDocuments, batchWrite, FieldValue, verifyIdToken, type QueryOptions, } from './init.js';
|
|
7
|
+
export { BASE, getUserPreferencesPath, getUserTemplatesPath, getUserAccessLogsPath, getUserTrustRelationshipsPath, getUserPermissionsPath, getUserPermissionPath, getDefaultTemplatesPath, getDefaultTemplatePath, } from './paths.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/database/firestore/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,eAAe,EAEpB,WAAW,EACX,WAAW,EACX,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,aAAa,EACb,KAAK,YAAY,GAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,IAAI,EACJ,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firestore module barrel exports.
|
|
3
|
+
*
|
|
4
|
+
* Provides Firebase Admin SDK initialization and Firestore document path utilities.
|
|
5
|
+
*/
|
|
6
|
+
export { initFirestore, isFirestoreInitialized, testFirestoreConnection, _resetFirestoreState,
|
|
7
|
+
// Re-exported from @prmichaelsen/firebase-admin-sdk-v8
|
|
8
|
+
getDocument, setDocument, addDocument, updateDocument, deleteDocument, queryDocuments, batchWrite, FieldValue, verifyIdToken, } from './init.js';
|
|
9
|
+
export { BASE, getUserPreferencesPath, getUserTemplatesPath, getUserAccessLogsPath, getUserTrustRelationshipsPath, getUserPermissionsPath, getUserPermissionPath, getDefaultTemplatesPath, getDefaultTemplatePath, } from './paths.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/database/firestore/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB;AAGpB,uDAAuD;AACvD,WAAW,EACX,WAAW,EACX,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,aAAa,GAEd,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,IAAI,EACJ,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Admin SDK initialization for remember-core.
|
|
3
|
+
*
|
|
4
|
+
* Ported from remember-mcp/src/firestore/init.ts
|
|
5
|
+
* Design: accepts FirestoreConfig parameter instead of importing from a config module,
|
|
6
|
+
* keeping the core SDK transport-agnostic. Consumers provide their own config.
|
|
7
|
+
*/
|
|
8
|
+
export { getDocument, setDocument, addDocument, updateDocument, deleteDocument, queryDocuments, batchWrite, FieldValue, verifyIdToken, type QueryOptions, } from '@prmichaelsen/firebase-admin-sdk-v8';
|
|
9
|
+
/**
|
|
10
|
+
* Configuration required to initialize Firebase Admin SDK.
|
|
11
|
+
*/
|
|
12
|
+
export interface FirestoreConfig {
|
|
13
|
+
/** JSON string containing the Firebase service account credentials */
|
|
14
|
+
serviceAccount: string;
|
|
15
|
+
/** Firebase project ID */
|
|
16
|
+
projectId: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Optional logger interface for Firestore initialization.
|
|
20
|
+
* Consumers can provide their own logger; falls back to console.
|
|
21
|
+
*/
|
|
22
|
+
export interface FirestoreLogger {
|
|
23
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
24
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Initialize Firebase Admin SDK.
|
|
28
|
+
*
|
|
29
|
+
* FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY should be a JSON string containing the service account.
|
|
30
|
+
* Make sure it's properly escaped in your .env file.
|
|
31
|
+
*
|
|
32
|
+
* @param config - Firebase configuration with serviceAccount JSON and projectId
|
|
33
|
+
* @param logger - Optional logger; defaults to console
|
|
34
|
+
*/
|
|
35
|
+
export declare function initFirestore(config: FirestoreConfig, logger?: FirestoreLogger): void;
|
|
36
|
+
/**
|
|
37
|
+
* Check if Firestore is initialized.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isFirestoreInitialized(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Test Firestore connection by attempting a simple read.
|
|
42
|
+
*
|
|
43
|
+
* @param logger - Optional logger; defaults to console
|
|
44
|
+
*/
|
|
45
|
+
export declare function testFirestoreConnection(logger?: FirestoreLogger): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Reset initialization state. Useful for testing.
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export declare function _resetFirestoreState(): void;
|
|
51
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/database/firestore/init.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EACL,WAAW,EACX,WAAW,EACX,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,aAAa,EACb,KAAK,YAAY,GAClB,MAAM,qCAAqC,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,cAAc,EAAE,MAAM,CAAC;IACvB,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC9D;AASD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,eAAe,EACvB,MAAM,GAAE,eAA+B,GACtC,IAAI,CA8BN;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,GAAE,eAA+B,GACtC,OAAO,CAAC,OAAO,CAAC,CAoBlB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Admin SDK initialization for remember-core.
|
|
3
|
+
*
|
|
4
|
+
* Ported from remember-mcp/src/firestore/init.ts
|
|
5
|
+
* Design: accepts FirestoreConfig parameter instead of importing from a config module,
|
|
6
|
+
* keeping the core SDK transport-agnostic. Consumers provide their own config.
|
|
7
|
+
*/
|
|
8
|
+
import { initializeApp } from '@prmichaelsen/firebase-admin-sdk-v8';
|
|
9
|
+
// Re-export firebase-admin-sdk-v8 functions for convenience
|
|
10
|
+
export { getDocument, setDocument, addDocument, updateDocument, deleteDocument, queryDocuments, batchWrite, FieldValue, verifyIdToken, } from '@prmichaelsen/firebase-admin-sdk-v8';
|
|
11
|
+
const defaultLogger = {
|
|
12
|
+
info: (message, meta) => console.log(message, meta),
|
|
13
|
+
error: (message, meta) => console.error(message, meta),
|
|
14
|
+
};
|
|
15
|
+
let initialized = false;
|
|
16
|
+
/**
|
|
17
|
+
* Initialize Firebase Admin SDK.
|
|
18
|
+
*
|
|
19
|
+
* FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY should be a JSON string containing the service account.
|
|
20
|
+
* Make sure it's properly escaped in your .env file.
|
|
21
|
+
*
|
|
22
|
+
* @param config - Firebase configuration with serviceAccount JSON and projectId
|
|
23
|
+
* @param logger - Optional logger; defaults to console
|
|
24
|
+
*/
|
|
25
|
+
export function initFirestore(config, logger = defaultLogger) {
|
|
26
|
+
if (initialized) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const serviceAccount = JSON.parse(config.serviceAccount);
|
|
31
|
+
initializeApp({
|
|
32
|
+
serviceAccount,
|
|
33
|
+
projectId: config.projectId,
|
|
34
|
+
});
|
|
35
|
+
initialized = true;
|
|
36
|
+
logger.info('Firestore initialized successfully', {
|
|
37
|
+
module: 'firestore-init',
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
logger.error('Firestore initialization failed', {
|
|
42
|
+
module: 'firestore-init',
|
|
43
|
+
error: error instanceof Error ? error.message : String(error),
|
|
44
|
+
});
|
|
45
|
+
logger.error('Make sure FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY is valid JSON', {
|
|
46
|
+
module: 'firestore-init',
|
|
47
|
+
});
|
|
48
|
+
logger.error('Check for proper escaping in .env file', {
|
|
49
|
+
module: 'firestore-init',
|
|
50
|
+
});
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Check if Firestore is initialized.
|
|
56
|
+
*/
|
|
57
|
+
export function isFirestoreInitialized() {
|
|
58
|
+
return initialized;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Test Firestore connection by attempting a simple read.
|
|
62
|
+
*
|
|
63
|
+
* @param logger - Optional logger; defaults to console
|
|
64
|
+
*/
|
|
65
|
+
export async function testFirestoreConnection(logger = defaultLogger) {
|
|
66
|
+
try {
|
|
67
|
+
if (!initialized) {
|
|
68
|
+
throw new Error('Firestore not initialized');
|
|
69
|
+
}
|
|
70
|
+
const { getDocument } = await import('@prmichaelsen/firebase-admin-sdk-v8');
|
|
71
|
+
await getDocument('_health_check', 'test');
|
|
72
|
+
logger.info('Firestore connection test successful', {
|
|
73
|
+
module: 'firestore-init',
|
|
74
|
+
});
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
logger.error('Firestore connection test failed', {
|
|
79
|
+
module: 'firestore-init',
|
|
80
|
+
error: error instanceof Error ? error.message : String(error),
|
|
81
|
+
});
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Reset initialization state. Useful for testing.
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
export function _resetFirestoreState() {
|
|
90
|
+
initialized = false;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=init.js.map
|