@joystick.js/db-canary 0.0.0-canary.2209
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/.build/getFilesToBuild.js +26 -0
- package/.build/getPlatformSafeFilePath.js +6 -0
- package/.build/getPlatformSafePath.js +6 -0
- package/.build/index.js +88 -0
- package/.build/isWindows.js +3 -0
- package/API_KEY +1 -0
- package/README.md +1821 -0
- package/data/data.mdb +0 -0
- package/data/lock.mdb +0 -0
- package/dist/client/database.js +1 -0
- package/dist/client/index.js +1 -0
- package/dist/server/cluster/index.js +1 -0
- package/dist/server/cluster/master.js +20 -0
- package/dist/server/cluster/worker.js +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/lib/api_key_manager.js +9 -0
- package/dist/server/lib/auth_manager.js +1 -0
- package/dist/server/lib/auto_index_manager.js +1 -0
- package/dist/server/lib/backup_manager.js +1 -0
- package/dist/server/lib/connection_manager.js +1 -0
- package/dist/server/lib/disk_utils.js +2 -0
- package/dist/server/lib/http_server.js +405 -0
- package/dist/server/lib/index_manager.js +1 -0
- package/dist/server/lib/load_settings.js +1 -0
- package/dist/server/lib/logger.js +1 -0
- package/dist/server/lib/op_types.js +1 -0
- package/dist/server/lib/operation_dispatcher.js +1 -0
- package/dist/server/lib/operations/admin.js +1 -0
- package/dist/server/lib/operations/bulk_write.js +1 -0
- package/dist/server/lib/operations/create_index.js +1 -0
- package/dist/server/lib/operations/delete_one.js +1 -0
- package/dist/server/lib/operations/drop_index.js +1 -0
- package/dist/server/lib/operations/find.js +1 -0
- package/dist/server/lib/operations/find_one.js +1 -0
- package/dist/server/lib/operations/get_indexes.js +1 -0
- package/dist/server/lib/operations/insert_one.js +1 -0
- package/dist/server/lib/operations/update_one.js +1 -0
- package/dist/server/lib/performance_monitor.js +1 -0
- package/dist/server/lib/query_engine.js +1 -0
- package/dist/server/lib/recovery_manager.js +1 -0
- package/dist/server/lib/replication_manager.js +1 -0
- package/dist/server/lib/safe_json_parse.js +1 -0
- package/dist/server/lib/send_response.js +1 -0
- package/dist/server/lib/tcp_protocol.js +1 -0
- package/dist/server/lib/write_forwarder.js +1 -0
- package/dist/server/lib/write_queue.js +1 -0
- package/increment_version.js +3 -0
- package/logs/.013e15b54597d05db4b4b53ecc37b10c92a72927-audit.json +20 -0
- package/logs/.02de550a67ea0f5961faa2dfd458a4d06f59ebd1-audit.json +20 -0
- package/logs/.03494ba24eb3c72214b4068a77d54b8993bee651-audit.json +20 -0
- package/logs/.06309ec60b339be1259a7993dd09c732f8907fbc-audit.json +20 -0
- package/logs/.0663a04dcfa17285661e5e1b8cfa51f41523b210-audit.json +20 -0
- package/logs/.0f06e6c4c9b824622729e13927587479e5060391-audit.json +20 -0
- package/logs/.16ccf58682ecb22b3e3ec63f0da1b7fe9be56528-audit.json +20 -0
- package/logs/.1fa1a5d02f496474b1ab473524c65c984146a9ad-audit.json +20 -0
- package/logs/.2223c0ae3bea6f0d62c62b1d319cc8634856abb7-audit.json +20 -0
- package/logs/.23dc79ffda3e083665e6f5993f59397adcbf4a46-audit.json +20 -0
- package/logs/.28104f49b03906b189eefd1cd462cb46c3c0af22-audit.json +20 -0
- package/logs/.29cdbf13808abe6a0ce70ee2f2efdd680ce3fd8e-audit.json +20 -0
- package/logs/.2a9889afd071f77f41f5170d08703a0afca866b7-audit.json +20 -0
- package/logs/.2acec3d1940a2bbed487528b703ee5948959a599-audit.json +20 -0
- package/logs/.2fb60ff326338c02bfedbcd0e936444e4a216750-audit.json +20 -0
- package/logs/.318fc7a19530d76a345f030f7cad00dda15300e7-audit.json +20 -0
- package/logs/.3cf27043e19085f908cedc7701e6d013463208ee-audit.json +25 -0
- package/logs/.3d90d785415817fc443402843b7c95f8371adc9b-audit.json +20 -0
- package/logs/.4074bca620375f72966fc52dfd439577727671e5-audit.json +20 -0
- package/logs/.40eecf018417ea80a70ea8ec7a3cc9406bc6334b-audit.json +20 -0
- package/logs/.50e974f1ef7c365fca6a1251b2e2c2252914cb5e-audit.json +20 -0
- package/logs/.52cb7d9e4223cf26ba36006ac26b949a97c7923c-audit.json +20 -0
- package/logs/.54befcdb84c15aad980705a31bcc9f555c3577ab-audit.json +20 -0
- package/logs/.57dfb70e22eddb84db2e3c0ceeefac5c0b9baffa-audit.json +20 -0
- package/logs/.5f0b24705a1eaad4eca4968f2d86f91b3f9be683-audit.json +20 -0
- package/logs/.61ba98fdda7db58576b382fee07904e5db1169d6-audit.json +20 -0
- package/logs/.6235017727ef6b199d569a99d6aa8c8e80a1b475-audit.json +20 -0
- package/logs/.63db16193699219489d218a1ddea5dde3750cae4-audit.json +20 -0
- package/logs/.64fb67dfe14149c9eef728d79bf30a54da809c60-audit.json +20 -0
- package/logs/.669137453368987c1f311b5345342527afb54e50-audit.json +20 -0
- package/logs/.7a71f8c89ea28ae266d356aeff6306e876a30fbb-audit.json +20 -0
- package/logs/.7afbaa90fe9dc3a7d682676f9bb79f9a1b1fd9a6-audit.json +20 -0
- package/logs/.7ca29e322cd05327035de850099e7610864f2347-audit.json +20 -0
- package/logs/.83335ab3347e449dae03455a110aaf7f120d4802-audit.json +20 -0
- package/logs/.8c2487b5fd445d2c8e5c483c80b9fa99bbf1ca58-audit.json +20 -0
- package/logs/.8c8b9dc386922c9f3b4c13251af7052aac1d24c0-audit.json +20 -0
- package/logs/.8d6155d94640c4863301ae0fee5e4e7372a21446-audit.json +20 -0
- package/logs/.944a3119a243deea7c8270d5d9e582bb1d0eaa10-audit.json +20 -0
- package/logs/.9816a845c30fb2909f3b26a23eeb3538ebcad5db-audit.json +20 -0
- package/logs/.9dc08784e38b865488177c26d4af5934555e0323-audit.json +20 -0
- package/logs/.9dd27d2e0e454ac0a37600206d1cac5493b0d7ee-audit.json +20 -0
- package/logs/.a3d486feeac7654c59b547de96600e8849a06d4f-audit.json +20 -0
- package/logs/.a5b811f4def22250f86cc18870d7c4573625df22-audit.json +20 -0
- package/logs/.a61648eb5f830e0b6f508ac35e4f8f629d2ad4c7-audit.json +20 -0
- package/logs/.a89016d507045771b4b5a65656944a9c0f1e528b-audit.json +20 -0
- package/logs/.a99bee160a1c590be959af46bacc02724803f691-audit.json +20 -0
- package/logs/.ada7906d6243fd7da802f03d86c4ae5dd9df6236-audit.json +20 -0
- package/logs/.b518339ee942143b6af983af167f5bbb6983b4de-audit.json +20 -0
- package/logs/.b51b124b166d53c9519017856ea610d61d65fabe-audit.json +20 -0
- package/logs/.b7a6aee19f58e55633d5e4a3709041c47dfff975-audit.json +20 -0
- package/logs/.bd7a8a6ba9c55d557a4867ab53f02e3ec2e1553d-audit.json +20 -0
- package/logs/.c1435dafe453b169d6392b25065f3cf4ab6fbb21-audit.json +20 -0
- package/logs/.c17e1ce043109f77dc2f0e2aa290a9d1ed842c03-audit.json +20 -0
- package/logs/.ca62637ce9540e5a38a2fbedb2115febb6ad308a-audit.json +15 -0
- package/logs/.ccee67b9c176967f8977071409a41f5cb5cd6ad4-audit.json +20 -0
- package/logs/.db24043417ea79a6f14cd947476399e53930b48d-audit.json +20 -0
- package/logs/.e0f12acccb57829f5f33712bb2e2607ecd808147-audit.json +20 -0
- package/logs/.e9b6cc33d0bbd2e644c4e2bf44d177f850016557-audit.json +20 -0
- package/logs/.f15291d434808e3bdca7963ccd2e73893be027e6-audit.json +20 -0
- package/logs/.f4bdf9e21ef84f8a3fae3ffb32bbc39275991351-audit.json +15 -0
- package/logs/.fbac3aefac1e81b4230df5aa50667cb90d51024f-audit.json +20 -0
- package/logs/.fcfd495c0a9169db243f4a4f21878ee02b76413c-audit.json +20 -0
- package/logs/admin-2025-09-12.log +580 -0
- package/logs/admin-2025-09-15.log +283 -0
- package/logs/admin-error-2025-09-12.log +22 -0
- package/logs/admin-error-2025-09-15.log +10 -0
- package/logs/api_key_manager-2025-09-12.log +658 -0
- package/logs/api_key_manager-2025-09-15.log +295 -0
- package/logs/api_key_manager-error-2025-09-12.log +0 -0
- package/logs/api_key_manager-error-2025-09-15.log +0 -0
- package/logs/auth_manager-2025-09-12.log +4432 -0
- package/logs/auth_manager-2025-09-15.log +2000 -0
- package/logs/auth_manager-error-2025-09-12.log +11 -0
- package/logs/auth_manager-error-2025-09-15.log +5 -0
- package/logs/auto_index_manager-2025-09-12.log +84 -0
- package/logs/auto_index_manager-2025-09-15.log +45 -0
- package/logs/auto_index_manager-error-2025-09-12.log +6 -0
- package/logs/auto_index_manager-error-2025-09-15.log +0 -0
- package/logs/backup_manager-2025-09-12.log +198 -0
- package/logs/backup_manager-2025-09-15.log +90 -0
- package/logs/backup_manager-error-2025-09-12.log +198 -0
- package/logs/backup_manager-error-2025-09-15.log +90 -0
- package/logs/bulk_write-2025-09-12.log +66 -0
- package/logs/bulk_write-2025-09-15.log +38 -0
- package/logs/bulk_write-error-2025-09-12.log +0 -0
- package/logs/bulk_write-error-2025-09-15.log +0 -0
- package/logs/connection_manager-2025-09-12.log +2412 -0
- package/logs/connection_manager-2025-09-15.log +1132 -0
- package/logs/connection_manager-error-2025-09-12.log +0 -0
- package/logs/connection_manager-error-2025-09-15.log +0 -0
- package/logs/create_index-2025-09-12.log +302 -0
- package/logs/create_index-2025-09-15.log +158 -0
- package/logs/create_index-error-2025-09-12.log +30 -0
- package/logs/create_index-error-2025-09-15.log +13 -0
- package/logs/delete_one-2025-09-12.log +73 -0
- package/logs/delete_one-2025-09-15.log +43 -0
- package/logs/delete_one-error-2025-09-12.log +0 -0
- package/logs/delete_one-error-2025-09-15.log +0 -0
- package/logs/disk_utils-2025-09-12.log +4954 -0
- package/logs/disk_utils-2025-09-15.log +2446 -0
- package/logs/disk_utils-error-2025-09-12.log +0 -0
- package/logs/disk_utils-error-2025-09-15.log +0 -0
- package/logs/drop_index-2025-09-12.log +41 -0
- package/logs/drop_index-2025-09-15.log +23 -0
- package/logs/drop_index-error-2025-09-12.log +11 -0
- package/logs/drop_index-error-2025-09-15.log +5 -0
- package/logs/find-2025-09-12.log +1050 -0
- package/logs/find-2025-09-15.log +592 -0
- package/logs/find-error-2025-09-12.log +1 -0
- package/logs/find-error-2025-09-15.log +0 -0
- package/logs/find_one-2025-09-12.log +425 -0
- package/logs/find_one-2025-09-15.log +264 -0
- package/logs/find_one-error-2025-09-12.log +5 -0
- package/logs/find_one-error-2025-09-15.log +0 -0
- package/logs/get_indexes-2025-09-12.log +84 -0
- package/logs/get_indexes-2025-09-15.log +56 -0
- package/logs/get_indexes-error-2025-09-12.log +6 -0
- package/logs/get_indexes-error-2025-09-15.log +0 -0
- package/logs/http_server-2025-09-12.log +2772 -0
- package/logs/http_server-2025-09-15.log +1276 -0
- package/logs/http_server-error-2025-09-12.log +212 -0
- package/logs/http_server-error-2025-09-15.log +44 -0
- package/logs/index_manager-2025-09-12.log +5031 -0
- package/logs/index_manager-2025-09-15.log +2909 -0
- package/logs/index_manager-error-2025-09-12.log +80 -0
- package/logs/index_manager-error-2025-09-15.log +38 -0
- package/logs/insert_one-2025-09-12.log +2181 -0
- package/logs/insert_one-2025-09-15.log +1293 -0
- package/logs/insert_one-error-2025-09-12.log +0 -0
- package/logs/insert_one-error-2025-09-15.log +0 -0
- package/logs/master-2025-09-12.log +1882 -0
- package/logs/master-2025-09-15.log +910 -0
- package/logs/master-error-2025-09-12.log +80 -0
- package/logs/master-error-2025-09-15.log +0 -0
- package/logs/operation_dispatcher-2025-09-12.log +751 -0
- package/logs/operation_dispatcher-2025-09-15.log +359 -0
- package/logs/operation_dispatcher-error-2025-09-12.log +33 -0
- package/logs/operation_dispatcher-error-2025-09-15.log +11 -0
- package/logs/performance_monitor-2025-09-12.log +14889 -0
- package/logs/performance_monitor-2025-09-15.log +6803 -0
- package/logs/performance_monitor-error-2025-09-12.log +0 -0
- package/logs/performance_monitor-error-2025-09-15.log +0 -0
- package/logs/query_engine-2025-09-12.log +5310 -0
- package/logs/query_engine-2025-09-15.log +2639 -0
- package/logs/query_engine-error-2025-09-12.log +0 -0
- package/logs/query_engine-error-2025-09-15.log +0 -0
- package/logs/recovery_manager-2025-09-12.log +462 -0
- package/logs/recovery_manager-2025-09-15.log +210 -0
- package/logs/recovery_manager-error-2025-09-12.log +22 -0
- package/logs/recovery_manager-error-2025-09-15.log +10 -0
- package/logs/replication-2025-09-12.log +1923 -0
- package/logs/replication-2025-09-15.log +917 -0
- package/logs/replication-error-2025-09-12.log +33 -0
- package/logs/replication-error-2025-09-15.log +15 -0
- package/logs/server-2025-09-12.log +2601 -0
- package/logs/server-2025-09-15.log +1191 -0
- package/logs/server-error-2025-09-12.log +0 -0
- package/logs/server-error-2025-09-15.log +0 -0
- package/logs/tcp_protocol-2025-09-12.log +22 -0
- package/logs/tcp_protocol-2025-09-15.log +10 -0
- package/logs/tcp_protocol-error-2025-09-12.log +22 -0
- package/logs/tcp_protocol-error-2025-09-15.log +10 -0
- package/logs/test-2025-09-12.log +0 -0
- package/logs/test-2025-09-15.log +0 -0
- package/logs/test-error-2025-09-12.log +0 -0
- package/logs/test-error-2025-09-15.log +0 -0
- package/logs/update_one-2025-09-12.log +173 -0
- package/logs/update_one-2025-09-15.log +118 -0
- package/logs/update_one-error-2025-09-12.log +0 -0
- package/logs/update_one-error-2025-09-15.log +0 -0
- package/logs/worker-2025-09-12.log +1457 -0
- package/logs/worker-2025-09-15.log +695 -0
- package/logs/worker-error-2025-09-12.log +0 -0
- package/logs/worker-error-2025-09-15.log +0 -0
- package/logs/write_forwarder-2025-09-12.log +1956 -0
- package/logs/write_forwarder-2025-09-15.log +932 -0
- package/logs/write_forwarder-error-2025-09-12.log +66 -0
- package/logs/write_forwarder-error-2025-09-15.log +30 -0
- package/logs/write_queue-2025-09-12.log +612 -0
- package/logs/write_queue-2025-09-15.log +301 -0
- package/logs/write_queue-error-2025-09-12.log +184 -0
- package/logs/write_queue-error-2025-09-15.log +83 -0
- package/package.json +48 -0
- package/prompts/01-core-infrastructure.md +56 -0
- package/prompts/02-secondary-indexing.md +65 -0
- package/prompts/03-write-serialization.md +63 -0
- package/prompts/04-enhanced-authentication.md +75 -0
- package/prompts/05-comprehensive-admin-operations.md +75 -0
- package/prompts/06-backup-and-restore-system.md +106 -0
- package/prompts/07-production-safety-features.md +107 -0
- package/prompts/08-tcp-client-library.md +121 -0
- package/prompts/09-api-method-chaining.md +134 -0
- package/prompts/10-automatic-index-creation.md +223 -0
- package/prompts/11-operation-naming-consistency.md +268 -0
- package/prompts/12-tcp-replication-system.md +333 -0
- package/prompts/13-master-read-write-operations.md +57 -0
- package/prompts/14-index-upsert-operations.md +68 -0
- package/prompts/15-client-api-return-types.md +81 -0
- package/prompts/16-server-setup-ui.md +97 -0
- package/prompts/17-emergency-password-change.md +108 -0
- package/prompts/18-joystick-framework-integration.md +116 -0
- package/prompts/19-api-key-authentication-system.md +137 -0
- package/prompts/20-configurable-server-port.md +105 -0
- package/prompts/21-multi-database-support.md +161 -0
- package/prompts/FULL_TEXT_SEARCH.md +293 -0
- package/prompts/PROMPTS.md +158 -0
- package/prompts/README.md +221 -0
- package/prompts/TYPESCRIPT_GENERATION.md +179 -0
- package/src/client/database.js +166 -0
- package/src/client/index.js +752 -0
- package/src/server/cluster/index.js +53 -0
- package/src/server/cluster/master.js +774 -0
- package/src/server/cluster/worker.js +537 -0
- package/src/server/index.js +540 -0
- package/src/server/lib/api_key_manager.js +473 -0
- package/src/server/lib/auth_manager.js +375 -0
- package/src/server/lib/auto_index_manager.js +681 -0
- package/src/server/lib/backup_manager.js +650 -0
- package/src/server/lib/connection_manager.js +218 -0
- package/src/server/lib/disk_utils.js +118 -0
- package/src/server/lib/http_server.js +1165 -0
- package/src/server/lib/index_manager.js +756 -0
- package/src/server/lib/load_settings.js +143 -0
- package/src/server/lib/logger.js +135 -0
- package/src/server/lib/op_types.js +29 -0
- package/src/server/lib/operation_dispatcher.js +268 -0
- package/src/server/lib/operations/admin.js +808 -0
- package/src/server/lib/operations/bulk_write.js +367 -0
- package/src/server/lib/operations/create_index.js +68 -0
- package/src/server/lib/operations/delete_one.js +114 -0
- package/src/server/lib/operations/drop_index.js +58 -0
- package/src/server/lib/operations/find.js +340 -0
- package/src/server/lib/operations/find_one.js +319 -0
- package/src/server/lib/operations/get_indexes.js +52 -0
- package/src/server/lib/operations/insert_one.js +113 -0
- package/src/server/lib/operations/update_one.js +225 -0
- package/src/server/lib/performance_monitor.js +313 -0
- package/src/server/lib/query_engine.js +243 -0
- package/src/server/lib/recovery_manager.js +388 -0
- package/src/server/lib/replication_manager.js +727 -0
- package/src/server/lib/safe_json_parse.js +21 -0
- package/src/server/lib/send_response.js +47 -0
- package/src/server/lib/tcp_protocol.js +130 -0
- package/src/server/lib/write_forwarder.js +636 -0
- package/src/server/lib/write_queue.js +335 -0
- package/test_data/data.mdb +0 -0
- package/test_data/lock.mdb +0 -0
- package/tests/client/index.test.js +1232 -0
- package/tests/server/cluster/cluster.test.js +248 -0
- package/tests/server/cluster/master_read_write_operations.test.js +577 -0
- package/tests/server/index.test.js +651 -0
- package/tests/server/integration/authentication_integration.test.js +294 -0
- package/tests/server/integration/auto_indexing_integration.test.js +268 -0
- package/tests/server/integration/backup_integration.test.js +513 -0
- package/tests/server/integration/indexing_integration.test.js +126 -0
- package/tests/server/integration/production_safety_integration.test.js +358 -0
- package/tests/server/integration/replication_integration.test.js +227 -0
- package/tests/server/integration/write_serialization_integration.test.js +246 -0
- package/tests/server/lib/api_key_manager.test.js +516 -0
- package/tests/server/lib/auth_manager.test.js +317 -0
- package/tests/server/lib/auto_index_manager.test.js +275 -0
- package/tests/server/lib/backup_manager.test.js +238 -0
- package/tests/server/lib/connection_manager.test.js +221 -0
- package/tests/server/lib/disk_utils.test.js +63 -0
- package/tests/server/lib/http_server.test.js +389 -0
- package/tests/server/lib/index_manager.test.js +301 -0
- package/tests/server/lib/load_settings.test.js +107 -0
- package/tests/server/lib/load_settings_port_config.test.js +243 -0
- package/tests/server/lib/logger.test.js +282 -0
- package/tests/server/lib/operations/admin.test.js +638 -0
- package/tests/server/lib/operations/bulk_write.test.js +128 -0
- package/tests/server/lib/operations/create_index.test.js +138 -0
- package/tests/server/lib/operations/delete_one.test.js +52 -0
- package/tests/server/lib/operations/drop_index.test.js +72 -0
- package/tests/server/lib/operations/find.test.js +93 -0
- package/tests/server/lib/operations/find_one.test.js +91 -0
- package/tests/server/lib/operations/get_indexes.test.js +87 -0
- package/tests/server/lib/operations/insert_one.test.js +42 -0
- package/tests/server/lib/operations/update_one.test.js +89 -0
- package/tests/server/lib/performance_monitor.test.js +185 -0
- package/tests/server/lib/query_engine.test.js +46 -0
- package/tests/server/lib/recovery_manager.test.js +414 -0
- package/tests/server/lib/replication_manager.test.js +202 -0
- package/tests/server/lib/safe_json_parse.test.js +45 -0
- package/tests/server/lib/send_response.test.js +155 -0
- package/tests/server/lib/tcp_protocol.test.js +169 -0
- package/tests/server/lib/write_forwarder.test.js +258 -0
- package/tests/server/lib/write_queue.test.js +255 -0
- package/tsconfig.json +30 -0
- package/types/client/index.d.ts +447 -0
- package/types/server/cluster/index.d.ts +28 -0
- package/types/server/cluster/master.d.ts +115 -0
- package/types/server/cluster/worker.d.ts +1 -0
- package/types/server/lib/auth_manager.d.ts +13 -0
- package/types/server/lib/backup_manager.d.ts +43 -0
- package/types/server/lib/connection_manager.d.ts +15 -0
- package/types/server/lib/disk_utils.d.ts +3 -0
- package/types/server/lib/index_manager.d.ts +24 -0
- package/types/server/lib/load_settings.d.ts +4 -0
- package/types/server/lib/logger.d.ts +44 -0
- package/types/server/lib/op_types.d.ts +6 -0
- package/types/server/lib/performance_monitor.d.ts +68 -0
- package/types/server/lib/query_engine.d.ts +10 -0
- package/types/server/lib/safe_json_parse.d.ts +7 -0
- package/types/server/lib/send_response.d.ts +3 -0
- package/types/server/lib/tcp_protocol.d.ts +12 -0
- package/types/server/lib/write_queue.d.ts +2 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# Full Text Search Implementation Prompt
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Implement full text search capabilities for the JoystickDB LMDB-based database server. This feature should provide fast, scalable text search across document fields while maintaining the existing clustered architecture and performance characteristics.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
### Core Functionality
|
|
10
|
+
- Support full text search across specified document fields
|
|
11
|
+
- Implement inverted index strategy for optimal search performance
|
|
12
|
+
- Provide boolean query operators (AND, OR, NOT)
|
|
13
|
+
- Support phrase matching with quotes
|
|
14
|
+
- Include fuzzy matching capabilities for typos/variations
|
|
15
|
+
- Case-insensitive search by default with case-sensitive option
|
|
16
|
+
|
|
17
|
+
### Text Processing
|
|
18
|
+
- Tokenization: Split text into searchable terms
|
|
19
|
+
- Normalization: Convert to lowercase, handle Unicode
|
|
20
|
+
- Stop word filtering: Remove common words (the, and, or, etc.)
|
|
21
|
+
- Stemming: Reduce words to root forms (running → run)
|
|
22
|
+
- Support for multiple languages (start with English)
|
|
23
|
+
|
|
24
|
+
### Index Management
|
|
25
|
+
- Automatic index creation for designated searchable fields
|
|
26
|
+
- Atomic index updates during document modifications
|
|
27
|
+
- Index rebuilding capabilities for schema changes
|
|
28
|
+
- Configurable index settings per field
|
|
29
|
+
|
|
30
|
+
### Query Interface
|
|
31
|
+
- Add new operation type: `text_search`
|
|
32
|
+
- Query syntax: `{ "query": "search terms", "fields": ["title", "content"], "options": {...} }`
|
|
33
|
+
- Support for field-specific searches: `title:"exact phrase" content:keyword`
|
|
34
|
+
- Result ranking based on relevance scores
|
|
35
|
+
- Pagination support for large result sets
|
|
36
|
+
|
|
37
|
+
## Technical Implementation
|
|
38
|
+
|
|
39
|
+
### LMDB Storage Strategy
|
|
40
|
+
```
|
|
41
|
+
Document Storage:
|
|
42
|
+
- Key: `doc:{collection}:{id}`
|
|
43
|
+
- Value: Original document data
|
|
44
|
+
|
|
45
|
+
Inverted Index Storage:
|
|
46
|
+
- Key: `idx:{collection}:{field}:{term}`
|
|
47
|
+
- Value: Array of document IDs with positions
|
|
48
|
+
|
|
49
|
+
Term Frequency Storage:
|
|
50
|
+
- Key: `tf:{collection}:{field}:{doc_id}`
|
|
51
|
+
- Value: Term frequency map for relevance scoring
|
|
52
|
+
|
|
53
|
+
Metadata Storage:
|
|
54
|
+
- Key: `meta:{collection}:search_config`
|
|
55
|
+
- Value: Search configuration and field mappings
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Architecture Integration
|
|
59
|
+
|
|
60
|
+
#### Master Process Responsibilities
|
|
61
|
+
- Handle index updates during write operations
|
|
62
|
+
- Coordinate index rebuilding across workers
|
|
63
|
+
- Manage search configuration changes
|
|
64
|
+
- Ensure index consistency during bulk operations
|
|
65
|
+
|
|
66
|
+
#### Worker Process Responsibilities
|
|
67
|
+
- Execute search queries against local LMDB instances
|
|
68
|
+
- Perform text processing and tokenization
|
|
69
|
+
- Calculate relevance scores
|
|
70
|
+
- Handle search result pagination
|
|
71
|
+
|
|
72
|
+
### New Operation Types
|
|
73
|
+
Add to `op_types.js`:
|
|
74
|
+
```javascript
|
|
75
|
+
"text_search",
|
|
76
|
+
"create_text_index",
|
|
77
|
+
"drop_text_index",
|
|
78
|
+
"rebuild_text_index"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Search Query Structure
|
|
82
|
+
```javascript
|
|
83
|
+
{
|
|
84
|
+
"op": "text_search",
|
|
85
|
+
"data": {
|
|
86
|
+
"collection": "documents",
|
|
87
|
+
"query": "machine learning algorithms",
|
|
88
|
+
"fields": ["title", "content", "tags"],
|
|
89
|
+
"options": {
|
|
90
|
+
"fuzzy": true,
|
|
91
|
+
"case_sensitive": false,
|
|
92
|
+
"max_results": 50,
|
|
93
|
+
"offset": 0,
|
|
94
|
+
"highlight": true,
|
|
95
|
+
"min_score": 0.1
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Response Format
|
|
102
|
+
```javascript
|
|
103
|
+
{
|
|
104
|
+
"success": true,
|
|
105
|
+
"data": {
|
|
106
|
+
"results": [
|
|
107
|
+
{
|
|
108
|
+
"document": { /* original document */ },
|
|
109
|
+
"score": 0.85,
|
|
110
|
+
"highlights": {
|
|
111
|
+
"title": ["<mark>machine learning</mark> basics"],
|
|
112
|
+
"content": ["advanced <mark>algorithms</mark> for..."]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"total_count": 127,
|
|
117
|
+
"search_time_ms": 23,
|
|
118
|
+
"query_info": {
|
|
119
|
+
"parsed_terms": ["machine", "learning", "algorithms"],
|
|
120
|
+
"fields_searched": ["title", "content", "tags"]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Implementation Steps
|
|
127
|
+
|
|
128
|
+
### Phase 1: Core Infrastructure
|
|
129
|
+
1. Create text processing utilities (tokenization, normalization, stemming)
|
|
130
|
+
2. Implement inverted index data structures
|
|
131
|
+
3. Add LMDB storage patterns for search indexes
|
|
132
|
+
4. Create search configuration management
|
|
133
|
+
|
|
134
|
+
### Phase 2: Basic Search
|
|
135
|
+
1. Implement simple keyword search
|
|
136
|
+
2. Add boolean operators (AND, OR, NOT)
|
|
137
|
+
3. Create relevance scoring algorithm
|
|
138
|
+
4. Add result ranking and pagination
|
|
139
|
+
|
|
140
|
+
### Phase 3: Advanced Features
|
|
141
|
+
1. Implement phrase matching
|
|
142
|
+
2. Add fuzzy search capabilities
|
|
143
|
+
3. Create result highlighting
|
|
144
|
+
4. Add field-specific search syntax
|
|
145
|
+
|
|
146
|
+
### Phase 4: Integration
|
|
147
|
+
1. Integrate with existing cluster architecture
|
|
148
|
+
2. Add search operations to worker/master communication
|
|
149
|
+
3. Implement atomic index updates
|
|
150
|
+
4. Add search-specific error handling
|
|
151
|
+
|
|
152
|
+
### Phase 5: Optimization
|
|
153
|
+
1. Performance tuning for large datasets
|
|
154
|
+
2. Memory usage optimization
|
|
155
|
+
3. Index compression techniques
|
|
156
|
+
4. Query optimization strategies
|
|
157
|
+
|
|
158
|
+
## File Structure
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
src/server/search/
|
|
162
|
+
├── index.js # Main search module exports
|
|
163
|
+
├── text_processor.js # Tokenization, stemming, normalization
|
|
164
|
+
├── inverted_index.js # Index creation and management
|
|
165
|
+
├── query_parser.js # Parse search query syntax
|
|
166
|
+
├── relevance_scorer.js # Calculate document relevance scores
|
|
167
|
+
├── search_executor.js # Execute search queries
|
|
168
|
+
├── index_manager.js # Manage index lifecycle
|
|
169
|
+
└── search_config.js # Search configuration utilities
|
|
170
|
+
|
|
171
|
+
src/server/lib/
|
|
172
|
+
├── search_operations.js # Search-specific database operations
|
|
173
|
+
└── search_utils.js # Shared search utilities
|
|
174
|
+
|
|
175
|
+
test/server/search/
|
|
176
|
+
├── text_processor.test.js
|
|
177
|
+
├── inverted_index.test.js
|
|
178
|
+
├── query_parser.test.js
|
|
179
|
+
├── relevance_scorer.test.js
|
|
180
|
+
└── search_integration.test.js
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Configuration Options
|
|
184
|
+
|
|
185
|
+
### Database Settings
|
|
186
|
+
```javascript
|
|
187
|
+
{
|
|
188
|
+
"search": {
|
|
189
|
+
"default_language": "en",
|
|
190
|
+
"stop_words_enabled": true,
|
|
191
|
+
"stemming_enabled": true,
|
|
192
|
+
"fuzzy_threshold": 0.8,
|
|
193
|
+
"max_index_memory_mb": 512,
|
|
194
|
+
"index_update_batch_size": 1000,
|
|
195
|
+
"search_timeout_ms": 5000
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Field-Level Configuration
|
|
201
|
+
```javascript
|
|
202
|
+
{
|
|
203
|
+
"collections": {
|
|
204
|
+
"documents": {
|
|
205
|
+
"search_fields": {
|
|
206
|
+
"title": {
|
|
207
|
+
"weight": 2.0,
|
|
208
|
+
"stemming": true,
|
|
209
|
+
"fuzzy": true
|
|
210
|
+
},
|
|
211
|
+
"content": {
|
|
212
|
+
"weight": 1.0,
|
|
213
|
+
"stemming": true,
|
|
214
|
+
"fuzzy": false
|
|
215
|
+
},
|
|
216
|
+
"tags": {
|
|
217
|
+
"weight": 1.5,
|
|
218
|
+
"stemming": false,
|
|
219
|
+
"fuzzy": true
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Performance Considerations
|
|
228
|
+
|
|
229
|
+
### Memory Management
|
|
230
|
+
- Use LMDB's memory-mapped files for large indexes
|
|
231
|
+
- Implement index compression for frequently accessed terms
|
|
232
|
+
- Cache frequently used search results
|
|
233
|
+
- Limit concurrent search operations per worker
|
|
234
|
+
|
|
235
|
+
### Scalability
|
|
236
|
+
- Distribute index updates across multiple workers
|
|
237
|
+
- Implement index sharding for very large collections
|
|
238
|
+
- Use background processes for index maintenance
|
|
239
|
+
- Monitor index size and performance metrics
|
|
240
|
+
|
|
241
|
+
### Query Optimization
|
|
242
|
+
- Implement query plan optimization
|
|
243
|
+
- Use term frequency for query reordering
|
|
244
|
+
- Cache parsed queries for repeated searches
|
|
245
|
+
- Implement search result caching
|
|
246
|
+
|
|
247
|
+
## Testing Strategy
|
|
248
|
+
|
|
249
|
+
### Unit Tests
|
|
250
|
+
- Text processing functions
|
|
251
|
+
- Index creation and updates
|
|
252
|
+
- Query parsing logic
|
|
253
|
+
- Relevance scoring algorithms
|
|
254
|
+
|
|
255
|
+
### Integration Tests
|
|
256
|
+
- End-to-end search operations
|
|
257
|
+
- Index consistency during concurrent writes
|
|
258
|
+
- Search performance under load
|
|
259
|
+
- Error handling and recovery
|
|
260
|
+
|
|
261
|
+
### Performance Tests
|
|
262
|
+
- Search latency benchmarks
|
|
263
|
+
- Index update performance
|
|
264
|
+
- Memory usage patterns
|
|
265
|
+
- Concurrent search handling
|
|
266
|
+
|
|
267
|
+
## Success Criteria
|
|
268
|
+
|
|
269
|
+
1. **Functionality**: All search operations work correctly with accurate results
|
|
270
|
+
2. **Performance**: Search queries complete within 100ms for typical datasets
|
|
271
|
+
3. **Scalability**: System handles 1000+ concurrent searches without degradation
|
|
272
|
+
4. **Reliability**: Index consistency maintained during all write operations
|
|
273
|
+
5. **Usability**: Intuitive query syntax with comprehensive error messages
|
|
274
|
+
|
|
275
|
+
## Dependencies
|
|
276
|
+
|
|
277
|
+
### New Package Dependencies
|
|
278
|
+
```javascript
|
|
279
|
+
{
|
|
280
|
+
"natural": "^6.0.0", // Text processing and stemming
|
|
281
|
+
"stopword": "^2.0.0", // Stop word removal
|
|
282
|
+
"fuse.js": "^7.0.0" // Fuzzy search capabilities
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Development Dependencies
|
|
287
|
+
```javascript
|
|
288
|
+
{
|
|
289
|
+
"benchmark": "^2.1.4" // Performance testing
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
This implementation will provide a robust, scalable full text search solution that integrates seamlessly with the existing JoystickDB architecture while maintaining high performance and reliability.
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Prompt 1: Build JoystickDB TCP Server (Production-Grade, Secure, Reliable)
|
|
2
|
+
|
|
3
|
+
You are building a Node.js app that acts as the **JoystickDB TCP server**.
|
|
4
|
+
|
|
5
|
+
Requirements:
|
|
6
|
+
- Use ESM syntax (`import`).
|
|
7
|
+
- Follow coding conventions: snake_case for variables/functions/keys, arrow functions preferred.
|
|
8
|
+
- Install dependencies: `lmdb`, `msgpack-lite`, `bcrypt`, `@aws-sdk/client-s3`, `crypto`, plus standard Node libs.
|
|
9
|
+
- The server should:
|
|
10
|
+
|
|
11
|
+
### Core
|
|
12
|
+
1. **Auto-calculate map_size at bootstrap**:
|
|
13
|
+
- Detect total disk size (e.g. via `df -k .`).
|
|
14
|
+
- Set `map_size = disk_size * 0.8`.
|
|
15
|
+
- Example: 3 TB disk → map_size = ~2.4 TB.
|
|
16
|
+
- This ensures JoystickDB never consumes 100% of disk, leaving margin for OS, swap, logs, and backups.
|
|
17
|
+
- Map_size must be **grown automatically** if data approaches 80% of current map_size (double it, capped at 80% of total disk).
|
|
18
|
+
2. Open an LMDB environment at `./data` with that map_size.
|
|
19
|
+
3. Start a TCP server on port `6000` (Node `net` module).
|
|
20
|
+
4. Each message = 4-byte length prefix + MessagePack payload.
|
|
21
|
+
5. Decode MessagePack payload into JSON-like object:
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"op": "auth" | "find_one" | "find" | "insert_one" | "update_one" | "delete_one" | "bulk_write" | "admin" | "ping",
|
|
25
|
+
"collection": "string",
|
|
26
|
+
"filter": { ... },
|
|
27
|
+
"update": { ... },
|
|
28
|
+
"options": { ... },
|
|
29
|
+
"operations": [ ... ],
|
|
30
|
+
"admin_action": "stats" | "list_collections" | "create_index" | "drop_index" | "get_indexes" | "list_documents" | "get_document" | "query_documents" | "insert_document" | "update_document" | "delete_document" | "backup_now" | "restore_backup" | "list_backups",
|
|
31
|
+
"password": "string"
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Query Language
|
|
36
|
+
6. Implement a **MongoDB-style query language** (1:1 with MongoDB except no aggregation pipeline).
|
|
37
|
+
7. **Secondary indexing**:
|
|
38
|
+
- Maintain sub-databases for indexed fields.
|
|
39
|
+
- Keys: `index:<collection>:<field>:<value> → [document_ids...]`.
|
|
40
|
+
- Update indexes on insert/update.
|
|
41
|
+
- Use indexes for queries when filters match indexed fields.
|
|
42
|
+
|
|
43
|
+
### Writes
|
|
44
|
+
8. **Bulk writes**:
|
|
45
|
+
- Accept array of insert/update/delete ops.
|
|
46
|
+
- Run in a single LMDB write transaction (atomic).
|
|
47
|
+
- Roll back entire batch if any fail.
|
|
48
|
+
9. **Write serialization**:
|
|
49
|
+
- Only one LMDB write transaction at a time.
|
|
50
|
+
- Queue concurrent writes.
|
|
51
|
+
|
|
52
|
+
### Authentication
|
|
53
|
+
10. **Auth flow**:
|
|
54
|
+
- Bootstrap: provision 32-char password via SSH.
|
|
55
|
+
- Store `bcrypt.hash(password)` in `./auth.json`.
|
|
56
|
+
- First op must be `{ op: "auth", password: "..." }`.
|
|
57
|
+
- Rate-limit failures (5/min per IP).
|
|
58
|
+
|
|
59
|
+
### Admin Operations
|
|
60
|
+
11. **Admin actions**:
|
|
61
|
+
- Metadata: `stats`, `list_collections`, `create_index`, `drop_index`, `get_indexes`.
|
|
62
|
+
- Data: `list_documents`, `get_document`, `query_documents`, `insert_document`, `update_document`, `delete_document`.
|
|
63
|
+
- Backups: `backup_now`, `list_backups`, `restore_backup`.
|
|
64
|
+
|
|
65
|
+
### Backups & Restore
|
|
66
|
+
12. **Automatic backups**:
|
|
67
|
+
- If S3 configured in `settings.json`, run `backup_now` hourly.
|
|
68
|
+
- Store compressed sparse backup (`tar --sparse`) in `./backups` and S3.
|
|
69
|
+
- Retention: keep 24 hourly + 30 daily, rotate older.
|
|
70
|
+
- Backup includes SHA256 checksum file.
|
|
71
|
+
13. **restore_from one-shot**:
|
|
72
|
+
- If `settings.json` has `"restore_from": "<backup_file>"`:
|
|
73
|
+
- Download from S3 (or local).
|
|
74
|
+
- Verify SHA256 checksum.
|
|
75
|
+
- Replace `./data/data.mdb`.
|
|
76
|
+
- If restore fails: log + boot fresh LMDB.
|
|
77
|
+
- If restore succeeds: rewrite `settings.json` without `restore_from`.
|
|
78
|
+
|
|
79
|
+
### Safety
|
|
80
|
+
14. **Health**:
|
|
81
|
+
- `ping` always returns `{ ok: 1 }`.
|
|
82
|
+
- `stats` includes: memory, disk, ops/sec, doc count, map_size usage %.
|
|
83
|
+
15. **Timeouts**:
|
|
84
|
+
- Max 5s per request.
|
|
85
|
+
16. **Connections**:
|
|
86
|
+
- Max ~1000 connections.
|
|
87
|
+
- Drop idle after 10m.
|
|
88
|
+
17. **Logging**:
|
|
89
|
+
- Structured logs: `{ ts, client_id, op, collection, duration_ms, status }`.
|
|
90
|
+
18. **Protocol versioning**:
|
|
91
|
+
- After auth: `{ ok: 1, version: "1.0.0" }`.
|
|
92
|
+
- API never changes; future changes must remain backward-compatible.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
# Prompt 2: Build JoystickDB TCP Client
|
|
97
|
+
|
|
98
|
+
- ESM + snake_case.
|
|
99
|
+
- Install `msgpack-lite`.
|
|
100
|
+
- Export `create_client({ host, port, password })`.
|
|
101
|
+
- On connect: send `{ op: "auth", password: "..." }`.
|
|
102
|
+
- Methods:
|
|
103
|
+
- CRUD: `insert_one`, `find_one`, `find`, `update_one`, `delete_one`.
|
|
104
|
+
- Bulk: `bulk_write`.
|
|
105
|
+
- Admin Metadata: `get_stats`, `list_collections`, `create_index`, `drop_index`, `get_indexes`.
|
|
106
|
+
- Admin Data: `list_documents`, `get_document`, `query_documents`, `insert_document`, `update_document`, `delete_document`.
|
|
107
|
+
- Backups: `backup_now`, `list_backups`, `restore_backup`.
|
|
108
|
+
- Health: `ping`.
|
|
109
|
+
- Per-request timeout: 5s.
|
|
110
|
+
- Auto reconnect + queueing.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
# Prompt 3: NGINX TLS Termination
|
|
115
|
+
|
|
116
|
+
```nginx
|
|
117
|
+
stream {
|
|
118
|
+
upstream joystickdb_backend {
|
|
119
|
+
server 127.0.0.1:6000;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
server {
|
|
123
|
+
listen 443 ssl;
|
|
124
|
+
proxy_pass joystickdb_backend;
|
|
125
|
+
|
|
126
|
+
ssl_certificate /etc/letsencrypt/live/db.cheatcode.co/fullchain.pem;
|
|
127
|
+
ssl_certificate_key /etc/letsencrypt/live/db.cheatcode.co/privkey.pem;
|
|
128
|
+
|
|
129
|
+
ssl_protocols TLSv1.3;
|
|
130
|
+
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
131
|
+
ssl_prefer_server_ciphers on;
|
|
132
|
+
ssl_session_cache shared:SSL:10m;
|
|
133
|
+
ssl_session_timeout 10m;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
# Prompt 4: settings.json Schema
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"s3": {
|
|
145
|
+
"bucket": "joystickdb-backups",
|
|
146
|
+
"region": "us-east-1",
|
|
147
|
+
"access_key": "AKIA...",
|
|
148
|
+
"secret_key": "abcd...",
|
|
149
|
+
"endpoint": "https://s3.amazonaws.com"
|
|
150
|
+
},
|
|
151
|
+
"backup_schedule": "hourly",
|
|
152
|
+
"restore_from": "joystickdb-backup-2025-08-28T12:00:00.mdb"
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
- `s3`: optional.
|
|
157
|
+
- `backup_schedule`: default hourly if omitted.
|
|
158
|
+
- `restore_from`: one-shot restore, auto-cleared after success.
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# JoystickDB Implementation Tasks
|
|
2
|
+
|
|
3
|
+
This directory contains detailed prompts for implementing the complete production-grade JoystickDB TCP server. Each task builds upon the previous ones and should be completed in order.
|
|
4
|
+
|
|
5
|
+
## Current Status
|
|
6
|
+
✅ **COMPLETED**: Basic query engine with CRUD operations, authentication, and admin/reload operations (119 tests passing)
|
|
7
|
+
✅ **COMPLETED**: Task 1 - Core Infrastructure Upgrades (153 tests passing)
|
|
8
|
+
✅ **COMPLETED**: Task 2 - Secondary Indexing System (196 tests passing)
|
|
9
|
+
✅ **COMPLETED**: Task 3 - Write Serialization and Queuing (214 tests passing)
|
|
10
|
+
✅ **COMPLETED**: Task 4 - Enhanced Authentication System (251 tests passing)
|
|
11
|
+
✅ **COMPLETED**: Task 5 - Comprehensive Admin Operations (266 tests passing)
|
|
12
|
+
✅ **COMPLETED**: Task 6 - Backup and Restore System (296 tests passing)
|
|
13
|
+
✅ **COMPLETED**: Task 7 - Production Safety Features (316 tests passing)
|
|
14
|
+
✅ **COMPLETED**: Task 8 - TCP Client Library (All original tasks complete)
|
|
15
|
+
|
|
16
|
+
## Next Phase: API and Infrastructure Enhancements
|
|
17
|
+
✅ **COMPLETED**: Task 9 - API Method Chaining Enhancement (347 tests passing)
|
|
18
|
+
✅ **COMPLETED**: Task 10 - Automatic Index Creation (381 tests passing)
|
|
19
|
+
✅ **COMPLETED**: Task 11 - Operation Naming Consistency (383 tests passing)
|
|
20
|
+
✅ **COMPLETED**: Task 12 - TCP Replication System (423 tests passing)
|
|
21
|
+
|
|
22
|
+
## Phase 3: Core Improvements and User Experience
|
|
23
|
+
✅ **COMPLETED**: Task 13 - Master Node Read and Write Operations (420 tests passing)
|
|
24
|
+
✅ **COMPLETED**: Task 14 - Index Upsert Operations (428 tests passing)
|
|
25
|
+
✅ **COMPLETED**: Task 15 - Client API Return Types Enhancement (428 tests passing)
|
|
26
|
+
✅ **COMPLETED**: Task 16 - Server Setup UI (451 tests passing - Test Suite Stabilized)
|
|
27
|
+
✅ **COMPLETED**: Task 17 - Emergency Password Change System (474 tests passing)
|
|
28
|
+
|
|
29
|
+
## All Core Tasks Complete
|
|
30
|
+
🎉 **ALL TASKS COMPLETED**: JoystickDB production-grade implementation is complete with comprehensive emergency password recovery system.
|
|
31
|
+
|
|
32
|
+
## Task Overview
|
|
33
|
+
|
|
34
|
+
### 1. Core Infrastructure Upgrades
|
|
35
|
+
**File**: `01-core-infrastructure.md`
|
|
36
|
+
**Priority**: High
|
|
37
|
+
**Dependencies**: None
|
|
38
|
+
**Description**: Implement auto-calculating LMDB map_size, proper TCP protocol with length prefixing, connection limits, timeouts, and enhanced logging.
|
|
39
|
+
|
|
40
|
+
### 2. Secondary Indexing System
|
|
41
|
+
**File**: `02-secondary-indexing.md`
|
|
42
|
+
**Priority**: High
|
|
43
|
+
**Dependencies**: Task 1
|
|
44
|
+
**Description**: Build comprehensive indexing system for query optimization with index management operations and automatic index maintenance.
|
|
45
|
+
|
|
46
|
+
### 3. Write Serialization and Queuing
|
|
47
|
+
**File**: `03-write-serialization.md`
|
|
48
|
+
**Priority**: High
|
|
49
|
+
**Dependencies**: Task 1
|
|
50
|
+
**Description**: Implement write queue system to ensure only one LMDB write transaction at a time with proper concurrent read support.
|
|
51
|
+
|
|
52
|
+
### 4. Enhanced Authentication System
|
|
53
|
+
**File**: `04-enhanced-authentication.md`
|
|
54
|
+
**Priority**: Medium
|
|
55
|
+
**Dependencies**: Task 1
|
|
56
|
+
**Description**: Add setup command for password generation, rate limiting, protocol versioning, and secure authentication.json file management.
|
|
57
|
+
|
|
58
|
+
### 5. Comprehensive Admin Operations
|
|
59
|
+
**File**: `05-comprehensive-admin-operations.md`
|
|
60
|
+
**Priority**: Medium
|
|
61
|
+
**Dependencies**: Tasks 1, 2
|
|
62
|
+
**Description**: Expand admin operations with metadata management, data operations, and system monitoring capabilities.
|
|
63
|
+
|
|
64
|
+
### 6. Backup and Restore System
|
|
65
|
+
**File**: `06-backup-and-restore-system.md`
|
|
66
|
+
**Priority**: Medium
|
|
67
|
+
**Dependencies**: Tasks 1, 5
|
|
68
|
+
**Description**: Implement S3-integrated backup system with automatic scheduling, retention management, and one-shot restore capabilities.
|
|
69
|
+
|
|
70
|
+
### 7. Production Safety Features
|
|
71
|
+
**File**: `07-production-safety-features.md`
|
|
72
|
+
**Priority**: High
|
|
73
|
+
**Dependencies**: Tasks 1, 3
|
|
74
|
+
**Description**: Add comprehensive health monitoring, request timeouts, connection management, and enhanced structured logging.
|
|
75
|
+
|
|
76
|
+
### 8. TCP Client Library
|
|
77
|
+
**File**: `08-tcp-client-library.md`
|
|
78
|
+
**Priority**: Medium
|
|
79
|
+
**Dependencies**: Tasks 1, 4, 5
|
|
80
|
+
**Description**: Create Node.js client library with auto-reconnection, full operation support, and comprehensive error handling.
|
|
81
|
+
|
|
82
|
+
### 9. API Method Chaining Enhancement
|
|
83
|
+
**File**: `09-api-method-chaining.md`
|
|
84
|
+
**Priority**: High
|
|
85
|
+
**Dependencies**: Task 8
|
|
86
|
+
**Description**: Update the client API to chain methods off of `collection()` instead of passing collection names as the first argument, providing a more intuitive and fluent API interface.
|
|
87
|
+
|
|
88
|
+
### 10. Automatic Index Creation
|
|
89
|
+
**File**: `10-automatic-index-creation.md`
|
|
90
|
+
**Priority**: Medium
|
|
91
|
+
**Dependencies**: Task 2
|
|
92
|
+
**Description**: Implement automatic index creation based on query patterns to optimize database performance without requiring manual index management.
|
|
93
|
+
|
|
94
|
+
### 11. Operation Naming Consistency
|
|
95
|
+
**File**: `11-operation-naming-consistency.md`
|
|
96
|
+
**Priority**: Medium
|
|
97
|
+
**Dependencies**: Task 9
|
|
98
|
+
**Description**: Standardize the operation object structure to use snake_case naming consistently across the entire codebase and API.
|
|
99
|
+
|
|
100
|
+
### 12. TCP Replication System
|
|
101
|
+
**File**: `12-tcp-replication-system.md`
|
|
102
|
+
**Priority**: High
|
|
103
|
+
**Dependencies**: Tasks 1, 8
|
|
104
|
+
**Description**: Implement TCP-based replication to read-only secondary nodes with write forwarding, providing high availability and read scaling capabilities.
|
|
105
|
+
|
|
106
|
+
### 13. Master Node Read and Write Operations
|
|
107
|
+
**File**: `13-master-read-write-operations.md`
|
|
108
|
+
**Priority**: Medium
|
|
109
|
+
**Dependencies**: Task 12
|
|
110
|
+
**Description**: Ensure that master nodes in the cluster can handle both read and write operations, not just writes, improving load distribution and eliminating artificial restrictions.
|
|
111
|
+
|
|
112
|
+
### 14. Index Upsert Operations
|
|
113
|
+
**File**: `14-index-upsert-operations.md`
|
|
114
|
+
**Priority**: Medium
|
|
115
|
+
**Dependencies**: Task 2
|
|
116
|
+
**Description**: Implement index upsert functionality where indexes are created if they don't exist or updated if they do exist, providing seamless "create or update" operations for index management.
|
|
117
|
+
|
|
118
|
+
### 15. Client API Return Types Enhancement
|
|
119
|
+
**File**: `15-client-api-return-types.md`
|
|
120
|
+
**Priority**: High
|
|
121
|
+
**Dependencies**: Task 9
|
|
122
|
+
**Description**: Update the client API so that `find()` returns an array of matching documents and `find_one()` returns a single document (or null), providing more intuitive return types for developers.
|
|
123
|
+
|
|
124
|
+
### 16. Server Setup UI
|
|
125
|
+
**File**: `16-server-setup-ui.md`
|
|
126
|
+
**Priority**: Medium
|
|
127
|
+
**Dependencies**: Task 4
|
|
128
|
+
**Description**: Implement a minimalist web UI hosted by the server that provides a secure setup interface using randomly generated tokens, eliminating the need to connect a separate client for initial setup.
|
|
129
|
+
|
|
130
|
+
### 17. Emergency Password Change System
|
|
131
|
+
**File**: `17-emergency-password-change.md`
|
|
132
|
+
**Priority**: High
|
|
133
|
+
**Dependencies**: Tasks 4, 16
|
|
134
|
+
**Description**: Implement a secure emergency password change system using CLI-generated recovery tokens, allowing administrators to quickly change passwords in case of security breaches with minimal downtime.
|
|
135
|
+
|
|
136
|
+
## Implementation Guidelines
|
|
137
|
+
|
|
138
|
+
### Code Standards
|
|
139
|
+
- Use ESM syntax (`import`/`export`)
|
|
140
|
+
- Follow snake_case for variables, functions, and keys
|
|
141
|
+
- Prefer arrow functions
|
|
142
|
+
- Two-space indentation
|
|
143
|
+
- Minimal comments (only when necessary for clarity)
|
|
144
|
+
|
|
145
|
+
### Testing Requirements
|
|
146
|
+
- All existing tests must continue to pass (currently 119 tests)
|
|
147
|
+
- Add comprehensive test suites for each new feature
|
|
148
|
+
- Use AVA test runner with `--serial` flag
|
|
149
|
+
- Include both unit and integration tests
|
|
150
|
+
|
|
151
|
+
### Dependencies
|
|
152
|
+
- Keep existing: `lmdb`, `msgpackr`, `bcrypt`
|
|
153
|
+
- Add as needed: `@aws-sdk/client-s3`, `crypto`
|
|
154
|
+
- Maintain compatibility with existing codebase
|
|
155
|
+
|
|
156
|
+
## Getting Started
|
|
157
|
+
|
|
158
|
+
1. Choose a task based on priority and dependencies
|
|
159
|
+
2. Read the detailed prompt in the corresponding `.md` file
|
|
160
|
+
3. Create a new branch for the task (see Git Workflow below)
|
|
161
|
+
4. Implement the features following the specifications
|
|
162
|
+
5. Ensure all existing tests continue to pass
|
|
163
|
+
6. Add comprehensive tests for new functionality
|
|
164
|
+
7. Debug and fix any failing tests (no shortcuts or hacks allowed)
|
|
165
|
+
8. Merge branch to main only when all tests pass
|
|
166
|
+
9. Move to the next task
|
|
167
|
+
|
|
168
|
+
## Git Workflow
|
|
169
|
+
|
|
170
|
+
Each task must be implemented in a separate branch to maintain code quality and enable proper review:
|
|
171
|
+
|
|
172
|
+
### Branch Management
|
|
173
|
+
- **Branch Naming**: Use format `task-N-description` (e.g., `task-1-core-infrastructure`)
|
|
174
|
+
- **Create Branch**: `git checkout -b task-N-description` from main
|
|
175
|
+
- **Work Isolation**: All development for a task happens in its dedicated branch
|
|
176
|
+
- **No Partial Merges**: Only merge when task is 100% complete with all tests passing
|
|
177
|
+
|
|
178
|
+
### Development Process
|
|
179
|
+
1. **Start Task**: Create new branch from main
|
|
180
|
+
2. **Implement Features**: Follow task specifications exactly
|
|
181
|
+
3. **Write Tests**: Comprehensive test coverage for all new functionality
|
|
182
|
+
4. **Debug Thoroughly**: Fix all failing tests without shortcuts or hacks
|
|
183
|
+
5. **Verify Quality**: Run full test suite (`npm test`) - all 119+ tests must pass
|
|
184
|
+
6. **Merge to Main**: Only when everything works perfectly
|
|
185
|
+
|
|
186
|
+
### Quality Gates
|
|
187
|
+
- ✅ All existing tests continue to pass (119 baseline tests)
|
|
188
|
+
- ✅ New comprehensive tests for implemented features
|
|
189
|
+
- ✅ No failing tests (debug and fix, don't skip or hack)
|
|
190
|
+
- ✅ Code follows established patterns and standards
|
|
191
|
+
- ✅ No temporary workarounds or incomplete implementations
|
|
192
|
+
|
|
193
|
+
### Merge Requirements
|
|
194
|
+
```bash
|
|
195
|
+
# Before merging, verify:
|
|
196
|
+
npm test # All tests pass
|
|
197
|
+
git status # Clean working directory
|
|
198
|
+
git checkout main # Switch to main
|
|
199
|
+
git merge task-N-description # Merge completed task
|
|
200
|
+
git branch -d task-N-description # Clean up branch
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Cline Chat Management
|
|
204
|
+
|
|
205
|
+
This project is being developed using Cline, an AI coding assistant. To manage context window limits:
|
|
206
|
+
|
|
207
|
+
- **Context Threshold**: When context usage exceeds 50K tokens during development
|
|
208
|
+
- **Task Completion Rule**: Always complete the current task before starting a new chat
|
|
209
|
+
- **New Chat Process**: Once a task is complete and context > 50K tokens:
|
|
210
|
+
1. Update this README.md with task completion status
|
|
211
|
+
2. Generate a detailed prompt for the next task
|
|
212
|
+
3. Use Cline's "new task" feature to start fresh with the next task prompt
|
|
213
|
+
4. Include full context about completed work and current project state
|
|
214
|
+
|
|
215
|
+
## Notes
|
|
216
|
+
|
|
217
|
+
- Tasks 1, 3, and 7 are critical for production readiness
|
|
218
|
+
- Task 2 (indexing) significantly improves query performance
|
|
219
|
+
- Tasks 4, 5, 6, and 8 add important functionality but are less critical
|
|
220
|
+
- Each task is designed to be completed independently while building on previous work
|
|
221
|
+
- Context management ensures efficient development without losing important project context
|