@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.
Files changed (198) hide show
  1. package/README.md +100 -0
  2. package/dist/collections/composite-ids.d.ts +47 -0
  3. package/dist/collections/composite-ids.d.ts.map +1 -0
  4. package/dist/collections/composite-ids.js +97 -0
  5. package/dist/collections/composite-ids.js.map +1 -0
  6. package/dist/collections/dot-notation.d.ts +37 -0
  7. package/dist/collections/dot-notation.d.ts.map +1 -0
  8. package/dist/collections/dot-notation.js +100 -0
  9. package/dist/collections/dot-notation.js.map +1 -0
  10. package/dist/collections/index.d.ts +7 -0
  11. package/dist/collections/index.d.ts.map +1 -0
  12. package/dist/collections/index.js +7 -0
  13. package/dist/collections/index.js.map +1 -0
  14. package/dist/collections/tracking-arrays.d.ts +28 -0
  15. package/dist/collections/tracking-arrays.d.ts.map +1 -0
  16. package/dist/collections/tracking-arrays.js +67 -0
  17. package/dist/collections/tracking-arrays.js.map +1 -0
  18. package/dist/config/debug.d.ts +36 -0
  19. package/dist/config/debug.d.ts.map +1 -0
  20. package/dist/config/debug.js +48 -0
  21. package/dist/config/debug.js.map +1 -0
  22. package/dist/config/environment.d.ts +71 -0
  23. package/dist/config/environment.d.ts.map +1 -0
  24. package/dist/config/environment.js +57 -0
  25. package/dist/config/environment.js.map +1 -0
  26. package/dist/config/index.d.ts +9 -0
  27. package/dist/config/index.d.ts.map +1 -0
  28. package/dist/config/index.js +27 -0
  29. package/dist/config/index.js.map +1 -0
  30. package/dist/constants/content-types.d.ts +60 -0
  31. package/dist/constants/content-types.d.ts.map +1 -0
  32. package/dist/constants/content-types.js +450 -0
  33. package/dist/constants/content-types.js.map +1 -0
  34. package/dist/constants/index.d.ts +3 -0
  35. package/dist/constants/index.d.ts.map +1 -0
  36. package/dist/constants/index.js +3 -0
  37. package/dist/constants/index.js.map +1 -0
  38. package/dist/database/firestore/index.d.ts +8 -0
  39. package/dist/database/firestore/index.d.ts.map +1 -0
  40. package/dist/database/firestore/index.js +10 -0
  41. package/dist/database/firestore/index.js.map +1 -0
  42. package/dist/database/firestore/init.d.ts +51 -0
  43. package/dist/database/firestore/init.d.ts.map +1 -0
  44. package/dist/database/firestore/init.js +92 -0
  45. package/dist/database/firestore/init.js.map +1 -0
  46. package/dist/database/firestore/paths.d.ts +54 -0
  47. package/dist/database/firestore/paths.d.ts.map +1 -0
  48. package/dist/database/firestore/paths.js +103 -0
  49. package/dist/database/firestore/paths.js.map +1 -0
  50. package/dist/database/weaviate/client.d.ts +68 -0
  51. package/dist/database/weaviate/client.d.ts.map +1 -0
  52. package/dist/database/weaviate/client.js +157 -0
  53. package/dist/database/weaviate/client.js.map +1 -0
  54. package/dist/database/weaviate/index.d.ts +6 -0
  55. package/dist/database/weaviate/index.d.ts.map +1 -0
  56. package/dist/database/weaviate/index.js +9 -0
  57. package/dist/database/weaviate/index.js.map +1 -0
  58. package/dist/database/weaviate/schema.d.ts +22 -0
  59. package/dist/database/weaviate/schema.d.ts.map +1 -0
  60. package/dist/database/weaviate/schema.js +50 -0
  61. package/dist/database/weaviate/schema.js.map +1 -0
  62. package/dist/database/weaviate/space-schema.d.ts +36 -0
  63. package/dist/database/weaviate/space-schema.d.ts.map +1 -0
  64. package/dist/database/weaviate/space-schema.js +65 -0
  65. package/dist/database/weaviate/space-schema.js.map +1 -0
  66. package/dist/database/weaviate/v2-collections.d.ts +160 -0
  67. package/dist/database/weaviate/v2-collections.d.ts.map +1 -0
  68. package/dist/database/weaviate/v2-collections.js +275 -0
  69. package/dist/database/weaviate/v2-collections.js.map +1 -0
  70. package/dist/errors/app-errors.d.ts +64 -0
  71. package/dist/errors/app-errors.d.ts.map +1 -0
  72. package/dist/errors/app-errors.js +90 -0
  73. package/dist/errors/app-errors.js.map +1 -0
  74. package/dist/errors/base.error.d.ts +15 -0
  75. package/dist/errors/base.error.d.ts.map +1 -0
  76. package/dist/errors/base.error.js +25 -0
  77. package/dist/errors/base.error.js.map +1 -0
  78. package/dist/errors/index.d.ts +19 -0
  79. package/dist/errors/index.d.ts.map +1 -0
  80. package/dist/errors/index.js +25 -0
  81. package/dist/errors/index.js.map +1 -0
  82. package/dist/index.d.ts +8 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/index.js +9 -0
  85. package/dist/index.js.map +1 -0
  86. package/dist/services/confirmation-token.service.d.ts +56 -0
  87. package/dist/services/confirmation-token.service.d.ts.map +1 -0
  88. package/dist/services/confirmation-token.service.js +118 -0
  89. package/dist/services/confirmation-token.service.js.map +1 -0
  90. package/dist/services/credentials-provider.d.ts +25 -0
  91. package/dist/services/credentials-provider.d.ts.map +1 -0
  92. package/dist/services/credentials-provider.js +31 -0
  93. package/dist/services/credentials-provider.js.map +1 -0
  94. package/dist/services/index.d.ts +11 -0
  95. package/dist/services/index.d.ts.map +1 -0
  96. package/dist/services/index.js +17 -0
  97. package/dist/services/index.js.map +1 -0
  98. package/dist/services/memory.service.d.ts +129 -0
  99. package/dist/services/memory.service.d.ts.map +1 -0
  100. package/dist/services/memory.service.js +294 -0
  101. package/dist/services/memory.service.js.map +1 -0
  102. package/dist/services/preferences.service.d.ts +27 -0
  103. package/dist/services/preferences.service.d.ts.map +1 -0
  104. package/dist/services/preferences.service.js +106 -0
  105. package/dist/services/preferences.service.js.map +1 -0
  106. package/dist/services/relationship.service.d.ts +75 -0
  107. package/dist/services/relationship.service.d.ts.map +1 -0
  108. package/dist/services/relationship.service.js +211 -0
  109. package/dist/services/relationship.service.js.map +1 -0
  110. package/dist/services/space-config.service.d.ts +22 -0
  111. package/dist/services/space-config.service.d.ts.map +1 -0
  112. package/dist/services/space-config.service.js +50 -0
  113. package/dist/services/space-config.service.js.map +1 -0
  114. package/dist/services/space.service.d.ts +160 -0
  115. package/dist/services/space.service.d.ts.map +1 -0
  116. package/dist/services/space.service.js +815 -0
  117. package/dist/services/space.service.js.map +1 -0
  118. package/dist/testing/index.d.ts +8 -0
  119. package/dist/testing/index.d.ts.map +1 -0
  120. package/dist/testing/index.js +8 -0
  121. package/dist/testing/index.js.map +1 -0
  122. package/dist/testing/test-data-generator.d.ts +100 -0
  123. package/dist/testing/test-data-generator.d.ts.map +1 -0
  124. package/dist/testing/test-data-generator.js +194 -0
  125. package/dist/testing/test-data-generator.js.map +1 -0
  126. package/dist/testing/weaviate-mock.d.ts +317 -0
  127. package/dist/testing/weaviate-mock.d.ts.map +1 -0
  128. package/dist/testing/weaviate-mock.js +233 -0
  129. package/dist/testing/weaviate-mock.js.map +1 -0
  130. package/dist/types/auth.types.d.ts +36 -0
  131. package/dist/types/auth.types.d.ts.map +1 -0
  132. package/dist/types/auth.types.js +9 -0
  133. package/dist/types/auth.types.js.map +1 -0
  134. package/dist/types/context.types.d.ts +78 -0
  135. package/dist/types/context.types.d.ts.map +1 -0
  136. package/dist/types/context.types.js +6 -0
  137. package/dist/types/context.types.js.map +1 -0
  138. package/dist/types/index.d.ts +14 -0
  139. package/dist/types/index.d.ts.map +1 -0
  140. package/dist/types/index.js +6 -0
  141. package/dist/types/index.js.map +1 -0
  142. package/dist/types/llm.types.d.ts +8 -0
  143. package/dist/types/llm.types.d.ts.map +1 -0
  144. package/dist/types/llm.types.js +8 -0
  145. package/dist/types/llm.types.js.map +1 -0
  146. package/dist/types/memory.types.d.ts +83 -0
  147. package/dist/types/memory.types.d.ts.map +1 -0
  148. package/dist/types/memory.types.js +6 -0
  149. package/dist/types/memory.types.js.map +1 -0
  150. package/dist/types/preferences.types.d.ts +285 -0
  151. package/dist/types/preferences.types.d.ts.map +1 -0
  152. package/dist/types/preferences.types.js +195 -0
  153. package/dist/types/preferences.types.js.map +1 -0
  154. package/dist/types/result.types.d.ts +60 -0
  155. package/dist/types/result.types.d.ts.map +1 -0
  156. package/dist/types/result.types.js +82 -0
  157. package/dist/types/result.types.js.map +1 -0
  158. package/dist/types/search.types.d.ts +49 -0
  159. package/dist/types/search.types.d.ts.map +1 -0
  160. package/dist/types/search.types.js +6 -0
  161. package/dist/types/search.types.js.map +1 -0
  162. package/dist/types/shared.types.d.ts +91 -0
  163. package/dist/types/shared.types.d.ts.map +1 -0
  164. package/dist/types/shared.types.js +57 -0
  165. package/dist/types/shared.types.js.map +1 -0
  166. package/dist/types/space.types.d.ts +82 -0
  167. package/dist/types/space.types.d.ts.map +1 -0
  168. package/dist/types/space.types.js +18 -0
  169. package/dist/types/space.types.js.map +1 -0
  170. package/dist/types/utils.types.d.ts +51 -0
  171. package/dist/types/utils.types.d.ts.map +1 -0
  172. package/dist/types/utils.types.js +4 -0
  173. package/dist/types/utils.types.js.map +1 -0
  174. package/dist/utils/auth-helpers.d.ts +23 -0
  175. package/dist/utils/auth-helpers.d.ts.map +1 -0
  176. package/dist/utils/auth-helpers.js +31 -0
  177. package/dist/utils/auth-helpers.js.map +1 -0
  178. package/dist/utils/debug.d.ts +45 -0
  179. package/dist/utils/debug.d.ts.map +1 -0
  180. package/dist/utils/debug.js +112 -0
  181. package/dist/utils/debug.js.map +1 -0
  182. package/dist/utils/error-handler.d.ts +46 -0
  183. package/dist/utils/error-handler.d.ts.map +1 -0
  184. package/dist/utils/error-handler.js +63 -0
  185. package/dist/utils/error-handler.js.map +1 -0
  186. package/dist/utils/filters.d.ts +42 -0
  187. package/dist/utils/filters.d.ts.map +1 -0
  188. package/dist/utils/filters.js +132 -0
  189. package/dist/utils/filters.js.map +1 -0
  190. package/dist/utils/index.d.ts +9 -0
  191. package/dist/utils/index.d.ts.map +1 -0
  192. package/dist/utils/index.js +9 -0
  193. package/dist/utils/index.js.map +1 -0
  194. package/dist/utils/logger.d.ts +22 -0
  195. package/dist/utils/logger.d.ts.map +1 -0
  196. package/dist/utils/logger.js +68 -0
  197. package/dist/utils/logger.js.map +1 -0
  198. package/package.json +100 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/database/firestore/init.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,C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AK,CAAC,wCAAwC,EAAE;YACrD,MAAM,EAAE,gBAAgB;SACzB,CAAC,CAAC;QACH,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,SAA0B,aAAa;IAEvC,IAAI,CAAC;QACH,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QAED,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,qCAAqC,CAAC,CAAC;QAC5E,MAAM,WAAW,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QAE3C,MAAM,CAAC,IAAI,CAAC,sCAAsC,EAAE;YAClD,MAAM,EAAE,gBAAgB;SACzB,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,kCAAkC,EAAE;YAC/C,MAAM,EAAE,gBAAgB;YACxB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,WAAW,GAAG,KAAK,CAAC;AACtB,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Firestore collection path helpers.
3
+ *
4
+ * Ported from remember-mcp/src/firestore/paths.ts
5
+ *
6
+ * Following the environment-based prefix + users subcollection pattern:
7
+ * - Environment prefix: e0.remember-mcp (dev), remember-mcp (prod)
8
+ * - User-scoped data: {BASE}.users/{user_id}/*
9
+ * - Shared data: {BASE}.templates/default, {BASE}.user-permissions
10
+ */
11
+ export declare const BASE: string;
12
+ /**
13
+ * Get path to user preferences document.
14
+ * Pattern: {BASE}.users/{user_id}/preferences
15
+ */
16
+ export declare function getUserPreferencesPath(userId: string): string;
17
+ /**
18
+ * Get path to user's templates collection.
19
+ * Pattern: {BASE}.users/{user_id}/templates
20
+ */
21
+ export declare function getUserTemplatesPath(userId: string): string;
22
+ /**
23
+ * Get path to user's access logs collection.
24
+ * Pattern: {BASE}.users/{user_id}/access-logs
25
+ */
26
+ export declare function getUserAccessLogsPath(userId: string): string;
27
+ /**
28
+ * Get path to user's trust relationships collection.
29
+ * Pattern: {BASE}.users/{user_id}/trust-relationships
30
+ */
31
+ export declare function getUserTrustRelationshipsPath(userId: string): string;
32
+ /**
33
+ * Get path to user's allowed accessors collection (permissions).
34
+ * Pattern: {BASE}.user-permissions/{owner_user_id}/allowed-accessors
35
+ *
36
+ * Note: Outside users/ because it involves two users (owner + accessor)
37
+ */
38
+ export declare function getUserPermissionsPath(ownerUserId: string): string;
39
+ /**
40
+ * Get path to specific permission document.
41
+ * Pattern: {BASE}.user-permissions/{owner_user_id}/allowed-accessors/{accessor_user_id}
42
+ */
43
+ export declare function getUserPermissionPath(ownerUserId: string, accessorUserId: string): string;
44
+ /**
45
+ * Get path to default templates collection.
46
+ * Pattern: {BASE}.templates/default
47
+ */
48
+ export declare function getDefaultTemplatesPath(): string;
49
+ /**
50
+ * Get path to specific default template.
51
+ * Pattern: {BASE}.templates/default/{template_id}
52
+ */
53
+ export declare function getDefaultTemplatePath(templateId: string): string;
54
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/database/firestore/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA+BH,eAAO,MAAM,IAAI,QAAkB,CAAC;AAMpC;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAMD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAElE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAEzF;AAMD;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEjE"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Firestore collection path helpers.
3
+ *
4
+ * Ported from remember-mcp/src/firestore/paths.ts
5
+ *
6
+ * Following the environment-based prefix + users subcollection pattern:
7
+ * - Environment prefix: e0.remember-mcp (dev), remember-mcp (prod)
8
+ * - User-scoped data: {BASE}.users/{user_id}/*
9
+ * - Shared data: {BASE}.templates/default, {BASE}.user-permissions
10
+ */
11
+ const APP_NAME = 'remember-mcp';
12
+ /**
13
+ * Get the database collection prefix based on environment.
14
+ *
15
+ * - Development: Uses ENVIRONMENT env var or DB_PREFIX, defaults to 'e0.remember-mcp'
16
+ * - Production: Uses base 'remember-mcp'
17
+ *
18
+ * This allows developers to use their own database entries as a sandbox per dev or branch.
19
+ */
20
+ function getBasePrefix() {
21
+ const environment = process.env.ENVIRONMENT;
22
+ if (environment && environment !== 'production' && environment !== 'prod') {
23
+ return `${environment}.${APP_NAME}`;
24
+ }
25
+ const isDevelopment = process.env.NODE_ENV === 'development';
26
+ if (isDevelopment) {
27
+ const customPrefix = process.env.DB_PREFIX;
28
+ if (customPrefix) {
29
+ return customPrefix;
30
+ }
31
+ return `e0.${APP_NAME}`;
32
+ }
33
+ return APP_NAME;
34
+ }
35
+ export const BASE = getBasePrefix();
36
+ // ============================================================================
37
+ // USER-SCOPED COLLECTIONS (under users/{user_id}/)
38
+ // ============================================================================
39
+ /**
40
+ * Get path to user preferences document.
41
+ * Pattern: {BASE}.users/{user_id}/preferences
42
+ */
43
+ export function getUserPreferencesPath(userId) {
44
+ return `${BASE}.users/${userId}/preferences`;
45
+ }
46
+ /**
47
+ * Get path to user's templates collection.
48
+ * Pattern: {BASE}.users/{user_id}/templates
49
+ */
50
+ export function getUserTemplatesPath(userId) {
51
+ return `${BASE}.users/${userId}/templates`;
52
+ }
53
+ /**
54
+ * Get path to user's access logs collection.
55
+ * Pattern: {BASE}.users/{user_id}/access-logs
56
+ */
57
+ export function getUserAccessLogsPath(userId) {
58
+ return `${BASE}.users/${userId}/access-logs`;
59
+ }
60
+ /**
61
+ * Get path to user's trust relationships collection.
62
+ * Pattern: {BASE}.users/{user_id}/trust-relationships
63
+ */
64
+ export function getUserTrustRelationshipsPath(userId) {
65
+ return `${BASE}.users/${userId}/trust-relationships`;
66
+ }
67
+ // ============================================================================
68
+ // CROSS-USER COLLECTIONS (outside users/)
69
+ // ============================================================================
70
+ /**
71
+ * Get path to user's allowed accessors collection (permissions).
72
+ * Pattern: {BASE}.user-permissions/{owner_user_id}/allowed-accessors
73
+ *
74
+ * Note: Outside users/ because it involves two users (owner + accessor)
75
+ */
76
+ export function getUserPermissionsPath(ownerUserId) {
77
+ return `${BASE}.user-permissions/${ownerUserId}/allowed-accessors`;
78
+ }
79
+ /**
80
+ * Get path to specific permission document.
81
+ * Pattern: {BASE}.user-permissions/{owner_user_id}/allowed-accessors/{accessor_user_id}
82
+ */
83
+ export function getUserPermissionPath(ownerUserId, accessorUserId) {
84
+ return `${BASE}.user-permissions/${ownerUserId}/allowed-accessors/${accessorUserId}`;
85
+ }
86
+ // ============================================================================
87
+ // SHARED/GLOBAL COLLECTIONS
88
+ // ============================================================================
89
+ /**
90
+ * Get path to default templates collection.
91
+ * Pattern: {BASE}.templates/default
92
+ */
93
+ export function getDefaultTemplatesPath() {
94
+ return `${BASE}.templates/default`;
95
+ }
96
+ /**
97
+ * Get path to specific default template.
98
+ * Pattern: {BASE}.templates/default/{template_id}
99
+ */
100
+ export function getDefaultTemplatePath(templateId) {
101
+ return `${BASE}.templates/default/${templateId}`;
102
+ }
103
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/database/firestore/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,QAAQ,GAAG,cAAc,CAAC;AAEhC;;;;;;;GAOG;AACH,SAAS,aAAa;IACpB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IAC5C,IAAI,WAAW,IAAI,WAAW,KAAK,YAAY,IAAI,WAAW,KAAK,MAAM,EAAE,CAAC;QAC1E,OAAO,GAAG,WAAW,IAAI,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;IAE7D,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;QAC3C,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,YAAY,CAAC;QACtB,CAAC;QACD,OAAO,MAAM,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;AAEpC,+EAA+E;AAC/E,mDAAmD;AACnD,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACnD,OAAO,GAAG,IAAI,UAAU,MAAM,cAAc,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,OAAO,GAAG,IAAI,UAAU,MAAM,YAAY,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,OAAO,GAAG,IAAI,UAAU,MAAM,cAAc,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAAC,MAAc;IAC1D,OAAO,GAAG,IAAI,UAAU,MAAM,sBAAsB,CAAC;AACvD,CAAC;AAED,+EAA+E;AAC/E,0CAA0C;AAC1C,+EAA+E;AAE/E;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,WAAmB;IACxD,OAAO,GAAG,IAAI,qBAAqB,WAAW,oBAAoB,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,WAAmB,EAAE,cAAsB;IAC/E,OAAO,GAAG,IAAI,qBAAqB,WAAW,sBAAsB,cAAc,EAAE,CAAC;AACvF,CAAC;AAED,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,GAAG,IAAI,oBAAoB,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAkB;IACvD,OAAO,GAAG,IAAI,sBAAsB,UAAU,EAAE,CAAC;AACnD,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Weaviate client initialization and connection management.
3
+ * Ported from remember-mcp/src/weaviate/client.ts
4
+ *
5
+ * Note: This module depends on config (Task 6) and logger/debug (Task 7).
6
+ * Import paths reference where those modules will be after porting.
7
+ */
8
+ import { WeaviateClient } from 'weaviate-client';
9
+ /**
10
+ * Weaviate connection configuration
11
+ */
12
+ export interface WeaviateConfig {
13
+ url: string;
14
+ apiKey?: string;
15
+ openaiApiKey?: string;
16
+ }
17
+ /**
18
+ * Initialize Weaviate client.
19
+ *
20
+ * Connection strategy:
21
+ * - If URL contains localhost/127.0.0.1 → use local connection
22
+ * - Otherwise → use cloud connection (remote/self-hosted)
23
+ */
24
+ export declare function initWeaviateClient(config: WeaviateConfig): Promise<WeaviateClient>;
25
+ /**
26
+ * Get Weaviate client instance
27
+ */
28
+ export declare function getWeaviateClient(): WeaviateClient;
29
+ /**
30
+ * Test Weaviate connection
31
+ */
32
+ export declare function testWeaviateConnection(): Promise<boolean>;
33
+ /**
34
+ * Get collection name for user's memories (v2 format)
35
+ */
36
+ export declare function getMemoryCollectionName(userId: string): string;
37
+ /**
38
+ * Get collection name for user's templates
39
+ */
40
+ export declare function getTemplateCollectionName(userId: string): string;
41
+ /**
42
+ * Get collection name for user's audit logs
43
+ */
44
+ export declare function getAuditCollectionName(userId: string): string;
45
+ /**
46
+ * Sanitize user_id for collection name.
47
+ * @deprecated v2 uses literal userId — no sanitization needed. Kept for migration only.
48
+ */
49
+ export declare function sanitizeUserId(userId: string): string;
50
+ /**
51
+ * List of all memory properties to fetch.
52
+ * Includes both v2 canonical names and v1 compat names.
53
+ */
54
+ export declare const ALL_MEMORY_PROPERTIES: readonly ["user_id", "doc_type", "content", "content_type", "title", "summary", "type", "weight", "base_weight", "trust_score", "trust", "confidence", "computed_weight", "location_name", "location_lat", "location_lon", "location_gps_lat", "location_gps_lng", "location_address", "location_city", "location_country", "location_source", "locale_language", "locale_timezone", "context_conversation_id", "context_summary", "context_timestamp", "context_app", "context_url", "relationship_ids", "related_memory_ids", "relationships", "memory_ids", "relationship_type", "observation", "strength", "access_count", "last_accessed_at", "tags", "references", "created_at", "updated_at", "version", "template_id", "space_ids", "group_ids", "parent_id", "thread_root_id", "moderation_flags", "spaces", "space_id", "author_id", "ghost_id", "attribution", "published_at", "discovery_count", "space_memory_id", "original_memory_id", "revised_at", "revision_count", "revision_history", "deleted_at", "deleted_by", "deletion_reason"];
55
+ /**
56
+ * Fetch a memory object by ID with all properties.
57
+ * Falls back to unspecified fetch if full property query fails.
58
+ */
59
+ export declare function fetchMemoryWithAllProperties(collection: any, memoryId: string): Promise<any>;
60
+ /**
61
+ * Check if collection exists
62
+ */
63
+ export declare function collectionExists(collectionName: string): Promise<boolean>;
64
+ /**
65
+ * Close Weaviate client connection
66
+ */
67
+ export declare function closeWeaviateClient(): Promise<void>;
68
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/database/weaviate/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAI3D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAqCxF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAKlD;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC,CAO/D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMrD;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,0/BAiBxB,CAAC;AAEX;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,UAAU,EAAE,GAAG,EACf,QAAQ,EAAE,MAAM,gBAUjB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO/E;AAED;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAIzD"}
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Weaviate client initialization and connection management.
3
+ * Ported from remember-mcp/src/weaviate/client.ts
4
+ *
5
+ * Note: This module depends on config (Task 6) and logger/debug (Task 7).
6
+ * Import paths reference where those modules will be after porting.
7
+ */
8
+ import weaviate from 'weaviate-client';
9
+ let client = null;
10
+ /**
11
+ * Initialize Weaviate client.
12
+ *
13
+ * Connection strategy:
14
+ * - If URL contains localhost/127.0.0.1 → use local connection
15
+ * - Otherwise → use cloud connection (remote/self-hosted)
16
+ */
17
+ export async function initWeaviateClient(config) {
18
+ if (client) {
19
+ return client;
20
+ }
21
+ const isLocal = config.url.includes('localhost') || config.url.includes('127.0.0.1');
22
+ if (!isLocal) {
23
+ client = await weaviate.connectToWeaviateCloud(config.url, {
24
+ authCredentials: config.apiKey
25
+ ? new weaviate.ApiKey(config.apiKey)
26
+ : undefined,
27
+ headers: config.openaiApiKey
28
+ ? { 'X-OpenAI-Api-Key': config.openaiApiKey }
29
+ : undefined,
30
+ });
31
+ }
32
+ else {
33
+ const localConfig = {
34
+ host: config.url.replace(/^https?:\/\//, '').split(':')[0],
35
+ port: config.url.includes(':')
36
+ ? parseInt(config.url.split(':').pop() || '8080')
37
+ : 8080,
38
+ scheme: config.url.startsWith('https') ? 'https' : 'http',
39
+ };
40
+ if (config.apiKey) {
41
+ localConfig.authClientSecret = new weaviate.ApiKey(config.apiKey);
42
+ }
43
+ if (config.openaiApiKey) {
44
+ localConfig.headers = { 'X-OpenAI-Api-Key': config.openaiApiKey };
45
+ }
46
+ client = await weaviate.connectToLocal(localConfig);
47
+ }
48
+ return client;
49
+ }
50
+ /**
51
+ * Get Weaviate client instance
52
+ */
53
+ export function getWeaviateClient() {
54
+ if (!client) {
55
+ throw new Error('Weaviate client not initialized. Call initWeaviateClient() first.');
56
+ }
57
+ return client;
58
+ }
59
+ /**
60
+ * Test Weaviate connection
61
+ */
62
+ export async function testWeaviateConnection() {
63
+ try {
64
+ const weaviateClient = getWeaviateClient();
65
+ return await weaviateClient.isReady();
66
+ }
67
+ catch {
68
+ return false;
69
+ }
70
+ }
71
+ /**
72
+ * Get collection name for user's memories (v2 format)
73
+ */
74
+ export function getMemoryCollectionName(userId) {
75
+ return `Memory_users_${userId}`;
76
+ }
77
+ /**
78
+ * Get collection name for user's templates
79
+ */
80
+ export function getTemplateCollectionName(userId) {
81
+ return `Template_${sanitizeUserId(userId)}`;
82
+ }
83
+ /**
84
+ * Get collection name for user's audit logs
85
+ */
86
+ export function getAuditCollectionName(userId) {
87
+ return `Audit_${sanitizeUserId(userId)}`;
88
+ }
89
+ /**
90
+ * Sanitize user_id for collection name.
91
+ * @deprecated v2 uses literal userId — no sanitization needed. Kept for migration only.
92
+ */
93
+ export function sanitizeUserId(userId) {
94
+ let sanitized = userId.replace(/[^a-zA-Z0-9]/g, '_');
95
+ if (/^[0-9]/.test(sanitized)) {
96
+ sanitized = '_' + sanitized;
97
+ }
98
+ return sanitized.charAt(0).toUpperCase() + sanitized.slice(1);
99
+ }
100
+ /**
101
+ * List of all memory properties to fetch.
102
+ * Includes both v2 canonical names and v1 compat names.
103
+ */
104
+ export const ALL_MEMORY_PROPERTIES = [
105
+ 'user_id', 'doc_type',
106
+ 'content', 'content_type', 'title', 'summary', 'type',
107
+ 'weight', 'base_weight', 'trust_score', 'trust', 'confidence', 'computed_weight',
108
+ 'location_name', 'location_lat', 'location_lon',
109
+ 'location_gps_lat', 'location_gps_lng', 'location_address', 'location_city', 'location_country', 'location_source',
110
+ 'locale_language', 'locale_timezone',
111
+ 'context_conversation_id', 'context_summary', 'context_timestamp', 'context_app', 'context_url',
112
+ 'relationship_ids', 'related_memory_ids', 'relationships', 'memory_ids',
113
+ 'relationship_type', 'observation', 'strength',
114
+ 'access_count', 'last_accessed_at',
115
+ 'tags', 'references', 'created_at', 'updated_at', 'version', 'template_id',
116
+ 'space_ids', 'group_ids',
117
+ 'parent_id', 'thread_root_id', 'moderation_flags',
118
+ 'spaces', 'space_id', 'author_id', 'ghost_id', 'attribution', 'published_at', 'discovery_count',
119
+ 'space_memory_id', 'original_memory_id', 'revised_at', 'revision_count', 'revision_history',
120
+ 'deleted_at', 'deleted_by', 'deletion_reason',
121
+ ];
122
+ /**
123
+ * Fetch a memory object by ID with all properties.
124
+ * Falls back to unspecified fetch if full property query fails.
125
+ */
126
+ export async function fetchMemoryWithAllProperties(collection, memoryId) {
127
+ try {
128
+ return await collection.query.fetchObjectById(memoryId, {
129
+ returnProperties: ALL_MEMORY_PROPERTIES,
130
+ });
131
+ }
132
+ catch {
133
+ // Fallback: fetch without specifying properties
134
+ return await collection.query.fetchObjectById(memoryId);
135
+ }
136
+ }
137
+ /**
138
+ * Check if collection exists
139
+ */
140
+ export async function collectionExists(collectionName) {
141
+ try {
142
+ const weaviateClient = getWeaviateClient();
143
+ return await weaviateClient.collections.exists(collectionName);
144
+ }
145
+ catch {
146
+ return false;
147
+ }
148
+ }
149
+ /**
150
+ * Close Weaviate client connection
151
+ */
152
+ export async function closeWeaviateClient() {
153
+ if (client) {
154
+ client = null;
155
+ }
156
+ }
157
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/database/weaviate/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,QAA4B,MAAM,iBAAiB,CAAC;AAE3D,IAAI,MAAM,GAA0B,IAAI,CAAC;AAWzC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAsB;IAC7D,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ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MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,cAAsB;IAC3D,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;QAC3C,OAAO,MAAM,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type { WeaviateConfig } from './client.js';
2
+ export { initWeaviateClient, getWeaviateClient, testWeaviateConnection, getMemoryCollectionName, getTemplateCollectionName, getAuditCollectionName, sanitizeUserId, ALL_MEMORY_PROPERTIES, fetchMemoryWithAllProperties, collectionExists, closeWeaviateClient, } from './client.js';
3
+ export { createMemoryCollection, ensureMemoryCollection, getMemoryCollection, deleteMemoryCollection, } from './schema.js';
4
+ export { PUBLIC_COLLECTION_NAME, getSpaceCollectionName, sanitizeSpaceId, getSpaceDisplayName, isValidSpaceId, ensurePublicCollection, ensureSpaceCollection, } from './space-schema.js';
5
+ export { createUserCollectionSchema, createSpaceCollectionSchema, createGroupCollectionSchema, ensureUserCollection, ensureSpacesCollection, ensureGroupCollection, getUserCollectionProperties, getPublishedCollectionProperties, validateV2CollectionName, getCollectionType, extractIdFromCollectionName, } from './v2-collections.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/database/weaviate/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,4BAA4B,EAC5B,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,gCAAgC,EAChC,wBAAwB,EACxB,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,9 @@
1
+ // src/database/weaviate/index.ts
2
+ export { initWeaviateClient, getWeaviateClient, testWeaviateConnection, getMemoryCollectionName, getTemplateCollectionName, getAuditCollectionName, sanitizeUserId, ALL_MEMORY_PROPERTIES, fetchMemoryWithAllProperties, collectionExists, closeWeaviateClient, } from './client.js';
3
+ // Schema management
4
+ export { createMemoryCollection, ensureMemoryCollection, getMemoryCollection, deleteMemoryCollection, } from './schema.js';
5
+ // Space schema
6
+ export { PUBLIC_COLLECTION_NAME, getSpaceCollectionName, sanitizeSpaceId, getSpaceDisplayName, isValidSpaceId, ensurePublicCollection, ensureSpaceCollection, } from './space-schema.js';
7
+ // V2 collection definitions
8
+ export { createUserCollectionSchema, createSpaceCollectionSchema, createGroupCollectionSchema, ensureUserCollection, ensureSpacesCollection, ensureGroupCollection, getUserCollectionProperties, getPublishedCollectionProperties, validateV2CollectionName, getCollectionType, extractIdFromCollectionName, } from './v2-collections.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/database/weaviate/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AAIjC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,4BAA4B,EAC5B,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,oBAAoB;AACpB,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAErB,eAAe;AACf,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,4BAA4B;AAC5B,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,gCAAgC,EAChC,wBAAwB,EACxB,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Weaviate schema management for user memory collections.
3
+ * Ported from remember-mcp/src/weaviate/schema.ts
4
+ */
5
+ /**
6
+ * Create Memory collection schema for a user.
7
+ * Stores BOTH memories AND relationships using doc_type discriminator.
8
+ */
9
+ export declare function createMemoryCollection(userId: string): Promise<void>;
10
+ /**
11
+ * Ensure Memory collection exists for user (lazy creation)
12
+ */
13
+ export declare function ensureMemoryCollection(userId: string): Promise<void>;
14
+ /**
15
+ * Get Memory collection for user
16
+ */
17
+ export declare function getMemoryCollection(userId: string): import("weaviate-client").Collection<undefined, string, undefined>;
18
+ /**
19
+ * Delete Memory collection for user (use with caution!)
20
+ */
21
+ export declare function deleteMemoryCollection(userId: string): Promise<void>;
22
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/database/weaviate/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAS1E;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ1E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,sEAIjD;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ1E"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Weaviate schema management for user memory collections.
3
+ * Ported from remember-mcp/src/weaviate/schema.ts
4
+ */
5
+ import { getWeaviateClient } from './client.js';
6
+ import { createUserCollectionSchema } from './v2-collections.js';
7
+ /**
8
+ * Create Memory collection schema for a user.
9
+ * Stores BOTH memories AND relationships using doc_type discriminator.
10
+ */
11
+ export async function createMemoryCollection(userId) {
12
+ const client = getWeaviateClient();
13
+ const collectionName = `Memory_users_${userId}`;
14
+ const exists = await client.collections.exists(collectionName);
15
+ if (exists)
16
+ return;
17
+ const schema = createUserCollectionSchema(userId);
18
+ await client.collections.create(schema);
19
+ }
20
+ /**
21
+ * Ensure Memory collection exists for user (lazy creation)
22
+ */
23
+ export async function ensureMemoryCollection(userId) {
24
+ const client = getWeaviateClient();
25
+ const collectionName = `Memory_users_${userId}`;
26
+ const exists = await client.collections.exists(collectionName);
27
+ if (!exists) {
28
+ await createMemoryCollection(userId);
29
+ }
30
+ }
31
+ /**
32
+ * Get Memory collection for user
33
+ */
34
+ export function getMemoryCollection(userId) {
35
+ const client = getWeaviateClient();
36
+ const collectionName = `Memory_users_${userId}`;
37
+ return client.collections.get(collectionName);
38
+ }
39
+ /**
40
+ * Delete Memory collection for user (use with caution!)
41
+ */
42
+ export async function deleteMemoryCollection(userId) {
43
+ const client = getWeaviateClient();
44
+ const collectionName = `Memory_users_${userId}`;
45
+ const exists = await client.collections.exists(collectionName);
46
+ if (exists) {
47
+ await client.collections.delete(collectionName);
48
+ }
49
+ }
50
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/database/weaviate/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,MAAc;IACzD,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,gBAAgB,MAAM,EAAE,CAAC;IAEhD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC/D,IAAI,MAAM;QAAE,OAAO;IAEnB,MAAM,MAAM,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,MAAc;IACzD,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,gBAAgB,MAAM,EAAE,CAAC;IAEhD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC/D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,gBAAgB,MAAM,EAAE,CAAC;IAChD,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,MAAc;IACzD,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,gBAAgB,MAAM,EAAE,CAAC;IAEhD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC/D,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Weaviate space collection schema and utilities.
3
+ * Ported from remember-mcp/src/weaviate/space-schema.ts
4
+ */
5
+ import type { WeaviateClient, Collection } from 'weaviate-client';
6
+ /**
7
+ * Unified public collection name for all public spaces (v2)
8
+ */
9
+ export declare const PUBLIC_COLLECTION_NAME = "Memory_spaces_public";
10
+ /**
11
+ * Get collection name for a space.
12
+ * @deprecated Use PUBLIC_COLLECTION_NAME instead.
13
+ */
14
+ export declare function getSpaceCollectionName(spaceId: string): string;
15
+ /**
16
+ * Sanitize display name to space ID (snake_case).
17
+ */
18
+ export declare function sanitizeSpaceId(displayName: string): string;
19
+ /**
20
+ * Get display name for a space ID.
21
+ */
22
+ export declare function getSpaceDisplayName(spaceId: string): string;
23
+ /**
24
+ * Validate space ID.
25
+ */
26
+ export declare function isValidSpaceId(spaceId: string): boolean;
27
+ /**
28
+ * Ensure the unified public collection exists, creating it if needed.
29
+ */
30
+ export declare function ensurePublicCollection(client: WeaviateClient): Promise<Collection<any>>;
31
+ /**
32
+ * Ensure a space collection exists, creating it if needed.
33
+ * @deprecated Use ensurePublicCollection() instead.
34
+ */
35
+ export declare function ensureSpaceCollection(client: WeaviateClient, spaceId: string): Promise<Collection<any>>;
36
+ //# sourceMappingURL=space-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space-schema.d.ts","sourceRoot":"","sources":["../../../src/database/weaviate/space-schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlE;;GAEG;AACH,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAU1B;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAe1B"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Weaviate space collection schema and utilities.
3
+ * Ported from remember-mcp/src/weaviate/space-schema.ts
4
+ */
5
+ import { SUPPORTED_SPACES, SPACE_DISPLAY_NAMES } from '../../types/space.types.js';
6
+ import { createSpaceCollectionSchema } from './v2-collections.js';
7
+ /**
8
+ * Unified public collection name for all public spaces (v2)
9
+ */
10
+ export const PUBLIC_COLLECTION_NAME = 'Memory_spaces_public';
11
+ /**
12
+ * Get collection name for a space.
13
+ * @deprecated Use PUBLIC_COLLECTION_NAME instead.
14
+ */
15
+ export function getSpaceCollectionName(spaceId) {
16
+ return `Memory_${spaceId}`;
17
+ }
18
+ /**
19
+ * Sanitize display name to space ID (snake_case).
20
+ */
21
+ export function sanitizeSpaceId(displayName) {
22
+ return displayName.toLowerCase().replace(/\s+/g, '_');
23
+ }
24
+ /**
25
+ * Get display name for a space ID.
26
+ */
27
+ export function getSpaceDisplayName(spaceId) {
28
+ return SPACE_DISPLAY_NAMES[spaceId] || spaceId;
29
+ }
30
+ /**
31
+ * Validate space ID.
32
+ */
33
+ export function isValidSpaceId(spaceId) {
34
+ return SUPPORTED_SPACES.includes(spaceId);
35
+ }
36
+ /**
37
+ * Ensure the unified public collection exists, creating it if needed.
38
+ */
39
+ export async function ensurePublicCollection(client) {
40
+ const collectionName = PUBLIC_COLLECTION_NAME;
41
+ const exists = await client.collections.exists(collectionName);
42
+ if (!exists) {
43
+ const schema = createSpaceCollectionSchema();
44
+ await client.collections.create(schema);
45
+ }
46
+ return client.collections.get(collectionName);
47
+ }
48
+ /**
49
+ * Ensure a space collection exists, creating it if needed.
50
+ * @deprecated Use ensurePublicCollection() instead.
51
+ */
52
+ export async function ensureSpaceCollection(client, spaceId) {
53
+ if (!isValidSpaceId(spaceId)) {
54
+ throw new Error(`Invalid space ID: ${spaceId}. Supported spaces: ${SUPPORTED_SPACES.join(', ')}`);
55
+ }
56
+ const collectionName = getSpaceCollectionName(spaceId);
57
+ const exists = await client.collections.exists(collectionName);
58
+ if (!exists) {
59
+ // Create inline for legacy per-space collections
60
+ const schema = createSpaceCollectionSchema();
61
+ await client.collections.create({ ...schema, name: collectionName });
62
+ }
63
+ return client.collections.get(collectionName);
64
+ }
65
+ //# sourceMappingURL=space-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space-schema.js","sourceRoot":"","sources":["../../../src/database/weaviate/space-schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAgB,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAElE;;GAE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