From fff77fbd8e424c6a5031a7a0c5938de9e11415f6 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Sun, 1 Feb 2026 23:33:35 +0000 Subject: [PATCH] feat(tsmdb): implement TsmDB Mongo-wire-compatible server, add storage/engine modules and reorganize exports --- changelog.md | 9 ++ ts/00_commitinfo_data.ts | 2 +- ts/index.ts | 78 ++-------- ts/ts_local/classes.localtsmdb.ts | 138 ++++++++++++++++++ ts/ts_local/index.ts | 2 + ts/ts_local/plugins.ts | 4 + ts/ts_mongotools/classes.smartmongo.ts | 71 +++++++++ ts/ts_mongotools/index.ts | 2 + .../plugins.ts} | 0 .../engine/AggregationEngine.ts | 2 +- ts/{tsmdb => ts_tsmdb}/engine/IndexEngine.ts | 2 +- ts/{tsmdb => ts_tsmdb}/engine/QueryEngine.ts | 2 +- ts/{tsmdb => ts_tsmdb}/engine/QueryPlanner.ts | 2 +- .../engine/SessionEngine.ts | 2 +- .../engine/TransactionEngine.ts | 2 +- ts/{tsmdb => ts_tsmdb}/engine/UpdateEngine.ts | 2 +- ts/{tsmdb => ts_tsmdb}/errors/TsmdbErrors.ts | 0 ts/{tsmdb => ts_tsmdb}/index.ts | 2 +- .../tsmdb.plugins.ts => ts_tsmdb/plugins.ts} | 0 .../server/CommandRouter.ts | 2 +- ts/{tsmdb => ts_tsmdb}/server/TsmdbServer.ts | 2 +- ts/{tsmdb => ts_tsmdb}/server/WireProtocol.ts | 2 +- .../server/handlers/AdminHandler.ts | 2 +- .../server/handlers/AggregateHandler.ts | 2 +- .../server/handlers/DeleteHandler.ts | 2 +- .../server/handlers/FindHandler.ts | 2 +- .../server/handlers/HelloHandler.ts | 2 +- .../server/handlers/IndexHandler.ts | 2 +- .../server/handlers/InsertHandler.ts | 2 +- .../server/handlers/UpdateHandler.ts | 2 +- .../server/handlers/index.ts | 0 ts/{tsmdb => ts_tsmdb}/server/index.ts | 0 .../storage/FileStorageAdapter.ts | 2 +- .../storage/IStorageAdapter.ts | 2 +- .../storage/MemoryStorageAdapter.ts | 2 +- ts/{tsmdb => ts_tsmdb}/storage/OpLog.ts | 2 +- ts/{tsmdb => ts_tsmdb}/storage/WAL.ts | 2 +- ts/{tsmdb => ts_tsmdb}/types/interfaces.ts | 2 +- ts/{tsmdb => ts_tsmdb}/utils/checksum.ts | 0 ts/{tsmdb => ts_tsmdb}/utils/index.ts | 0 40 files changed, 261 insertions(+), 95 deletions(-) create mode 100644 ts/ts_local/classes.localtsmdb.ts create mode 100644 ts/ts_local/index.ts create mode 100644 ts/ts_local/plugins.ts create mode 100644 ts/ts_mongotools/classes.smartmongo.ts create mode 100644 ts/ts_mongotools/index.ts rename ts/{smartmongo.plugins.ts => ts_mongotools/plugins.ts} (100%) rename ts/{tsmdb => ts_tsmdb}/engine/AggregationEngine.ts (99%) rename ts/{tsmdb => ts_tsmdb}/engine/IndexEngine.ts (99%) rename ts/{tsmdb => ts_tsmdb}/engine/QueryEngine.ts (99%) rename ts/{tsmdb => ts_tsmdb}/engine/QueryPlanner.ts (99%) rename ts/{tsmdb => ts_tsmdb}/engine/SessionEngine.ts (99%) rename ts/{tsmdb => ts_tsmdb}/engine/TransactionEngine.ts (99%) rename ts/{tsmdb => ts_tsmdb}/engine/UpdateEngine.ts (99%) rename ts/{tsmdb => ts_tsmdb}/errors/TsmdbErrors.ts (100%) rename ts/{tsmdb => ts_tsmdb}/index.ts (97%) rename ts/{tsmdb/tsmdb.plugins.ts => ts_tsmdb/plugins.ts} (100%) rename ts/{tsmdb => ts_tsmdb}/server/CommandRouter.ts (99%) rename ts/{tsmdb => ts_tsmdb}/server/TsmdbServer.ts (99%) rename ts/{tsmdb => ts_tsmdb}/server/WireProtocol.ts (99%) rename ts/{tsmdb => ts_tsmdb}/server/handlers/AdminHandler.ts (99%) rename ts/{tsmdb => ts_tsmdb}/server/handlers/AggregateHandler.ts (99%) rename ts/{tsmdb => ts_tsmdb}/server/handlers/DeleteHandler.ts (98%) rename ts/{tsmdb => ts_tsmdb}/server/handlers/FindHandler.ts (99%) rename ts/{tsmdb => ts_tsmdb}/server/handlers/HelloHandler.ts (97%) rename ts/{tsmdb => ts_tsmdb}/server/handlers/IndexHandler.ts (99%) rename ts/{tsmdb => ts_tsmdb}/server/handlers/InsertHandler.ts (98%) rename ts/{tsmdb => ts_tsmdb}/server/handlers/UpdateHandler.ts (99%) rename ts/{tsmdb => ts_tsmdb}/server/handlers/index.ts (100%) rename ts/{tsmdb => ts_tsmdb}/server/index.ts (100%) rename ts/{tsmdb => ts_tsmdb}/storage/FileStorageAdapter.ts (99%) rename ts/{tsmdb => ts_tsmdb}/storage/IStorageAdapter.ts (99%) rename ts/{tsmdb => ts_tsmdb}/storage/MemoryStorageAdapter.ts (99%) rename ts/{tsmdb => ts_tsmdb}/storage/OpLog.ts (99%) rename ts/{tsmdb => ts_tsmdb}/storage/WAL.ts (99%) rename ts/{tsmdb => ts_tsmdb}/types/interfaces.ts (99%) rename ts/{tsmdb => ts_tsmdb}/utils/checksum.ts (100%) rename ts/{tsmdb => ts_tsmdb}/utils/index.ts (100%) diff --git a/changelog.md b/changelog.md index 5f3ec36..92a2f26 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,14 @@ # Changelog +## 2026-02-01 - 4.2.0 - feat(tsmdb) +implement TsmDB Mongo-wire-compatible server, add storage/engine modules and reorganize exports + +- Add full TsmDB implementation under ts/ts_tsmdb: wire protocol, server, command router, handlers, engines (Query, Update, Aggregation, Index, Transaction, Session), storage adapters (Memory, File), OpLog, WAL, utils and types. +- Remove legacy ts/tsmdb implementation and replace with new ts_tsmdb module exports. +- Introduce ts/ts_mongotools module and move SmartMongo class there; update top-level exports in ts/index.ts to export SmartMongo, tsmdb (from ts_tsmdb) and LocalTsmDb. +- Add LocalTsmDb convenience class (ts/ts_local) to start a file-backed TsmDB and return a connected MongoClient. +- Refactor plugin imports into per-module plugins files and add utilities (checksum, persistence, query planner, index engine). + ## 2026-02-01 - 4.1.1 - fix(tsmdb) add comprehensive unit tests for tsmdb components: checksum, query planner, index engine, session, and WAL diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 6c26a42..dffb97b 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartmongo', - version: '4.1.1', + version: '4.2.0', description: 'A module for creating and managing a local MongoDB instance for testing purposes.' } diff --git a/ts/index.ts b/ts/index.ts index fb57f62..d2d20d1 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,74 +1,14 @@ import { commitinfo } from './00_commitinfo_data.js'; -import * as plugins from './smartmongo.plugins.js'; + +// Export SmartMongo from ts_mongotools +export { SmartMongo } from './ts_mongotools/index.js'; // Export TsmDB module -export * as tsmdb from './tsmdb/index.js'; +export * as tsmdb from './ts_tsmdb/index.js'; -export class SmartMongo { - // STATIC - public static async createAndStart(replCountArg: number = 1) { - const smartMongoInstance = new SmartMongo(); - await smartMongoInstance.start(replCountArg); - return smartMongoInstance; - } +// Export LocalTsmDb from ts_local +export { LocalTsmDb } from './ts_local/index.js'; +export type { ILocalTsmDbOptions } from './ts_local/index.js'; - // INSTANCE - private _readyDeferred = plugins.smartpromise.defer(); - public readyPromise = this._readyDeferred.promise; - public mongoReplicaSet: plugins.mongoPlugin.MongoMemoryReplSet; - - constructor() {} - - public async start(countArg: number = 1) { - this.mongoReplicaSet = await plugins.mongoPlugin.MongoMemoryReplSet.create({ - replSet: { count: countArg }, - instanceOpts: [ - { - storageEngine: 'wiredTiger', - }, - ], - }); - this._readyDeferred.resolve(); - console.log(`mongoReplicaSet with ${countArg} replicas started.`); - console.log(`@pushrocks/smartmongo version ${commitinfo.version}`); - } - - /** - * returns a mongo descriptor for modules like - * @pushrocks/smartfile. - */ - public async getMongoDescriptor(): Promise { - await this.readyPromise; - return { - mongoDbName: `smartmongo_testdatabase`, - mongoDbUrl: this.mongoReplicaSet.getUri(), - }; - } - - /** - * stops the smartmongo instance - * and cleans up after itself - */ - public async stop() { - await this.mongoReplicaSet.stop(); - await this.mongoReplicaSet.cleanup(); - } - - /** - * like stop() but allows you to actually store - * the database on disk - */ - public async stopAndDumpToDir( - dirArg: string, - nameFunctionArg?: (doc: any) => string, - emptyDirArg = true, - ) { - const mongodumpInstance = new plugins.mongodump.MongoDump(); - const mongodumpTarget = await mongodumpInstance.addMongoTargetByMongoDescriptor( - await this.getMongoDescriptor(), - ); - await mongodumpTarget.dumpAllCollectionsToDir(dirArg, nameFunctionArg, emptyDirArg); - await mongodumpInstance.stop(); - await this.stop(); - } -} +// Export commitinfo +export { commitinfo }; diff --git a/ts/ts_local/classes.localtsmdb.ts b/ts/ts_local/classes.localtsmdb.ts new file mode 100644 index 0000000..5b4ad26 --- /dev/null +++ b/ts/ts_local/classes.localtsmdb.ts @@ -0,0 +1,138 @@ +import * as plugins from './plugins.js'; +import { TsmdbServer } from '../ts_tsmdb/index.js'; +import type { MongoClient } from 'mongodb'; + +export interface ILocalTsmDbOptions { + folderPath: string; + port?: number; + host?: string; +} + +/** + * LocalTsmDb - Convenience class for local MongoDB-compatible database + * + * This class wraps TsmdbServer and provides a simple interface for + * starting a local file-based MongoDB-compatible server and connecting to it. + * + * @example + * ```typescript + * import { LocalTsmDb } from '@push.rocks/smartmongo'; + * + * const db = new LocalTsmDb({ folderPath: './data' }); + * const client = await db.start(); + * + * // Use the MongoDB client + * const collection = client.db('mydb').collection('users'); + * await collection.insertOne({ name: 'Alice' }); + * + * // When done + * await db.stop(); + * ``` + */ +export class LocalTsmDb { + private options: ILocalTsmDbOptions; + private server: TsmdbServer | null = null; + private client: MongoClient | null = null; + + constructor(options: ILocalTsmDbOptions) { + this.options = options; + } + + /** + * Find an available port starting from the given port + */ + private async findAvailablePort(startPort = 27017): Promise { + return new Promise((resolve, reject) => { + const server = plugins.net.createServer(); + server.listen(startPort, '127.0.0.1', () => { + const addr = server.address(); + const port = typeof addr === 'object' && addr ? addr.port : startPort; + server.close(() => resolve(port)); + }); + server.on('error', () => { + this.findAvailablePort(startPort + 1).then(resolve).catch(reject); + }); + }); + } + + /** + * Start the local TsmDB server and return a connected MongoDB client + */ + async start(): Promise { + if (this.server && this.client) { + throw new Error('LocalTsmDb is already running'); + } + + const port = this.options.port ?? await this.findAvailablePort(); + const host = this.options.host ?? '127.0.0.1'; + + this.server = new TsmdbServer({ + port, + host, + storage: 'file', + storagePath: this.options.folderPath, + }); + await this.server.start(); + + // Dynamically import mongodb to avoid requiring it as a hard dependency + const mongodb = await import('mongodb'); + this.client = new mongodb.MongoClient(this.server.getConnectionUri(), { + directConnection: true, + serverSelectionTimeoutMS: 5000, + }); + await this.client.connect(); + + return this.client; + } + + /** + * Get the MongoDB client (throws if not started) + */ + getClient(): MongoClient { + if (!this.client) { + throw new Error('LocalTsmDb is not running. Call start() first.'); + } + return this.client; + } + + /** + * Get the underlying TsmdbServer instance (throws if not started) + */ + getServer(): TsmdbServer { + if (!this.server) { + throw new Error('LocalTsmDb is not running. Call start() first.'); + } + return this.server; + } + + /** + * Get the connection URI + */ + getConnectionUri(): string { + if (!this.server) { + throw new Error('LocalTsmDb is not running. Call start() first.'); + } + return this.server.getConnectionUri(); + } + + /** + * Check if the server is running + */ + get running(): boolean { + return this.server !== null && this.server.running; + } + + /** + * Stop the local TsmDB server and close the client connection + */ + async stop(): Promise { + if (this.client) { + await this.client.close(); + this.client = null; + } + if (this.server) { + await this.server.stop(); + this.server = null; + } + } +} diff --git a/ts/ts_local/index.ts b/ts/ts_local/index.ts new file mode 100644 index 0000000..838eef8 --- /dev/null +++ b/ts/ts_local/index.ts @@ -0,0 +1,2 @@ +export { LocalTsmDb } from './classes.localtsmdb.js'; +export type { ILocalTsmDbOptions } from './classes.localtsmdb.js'; diff --git a/ts/ts_local/plugins.ts b/ts/ts_local/plugins.ts new file mode 100644 index 0000000..aed316b --- /dev/null +++ b/ts/ts_local/plugins.ts @@ -0,0 +1,4 @@ +import * as smartpromise from '@push.rocks/smartpromise'; +import * as net from 'net'; + +export { smartpromise, net }; diff --git a/ts/ts_mongotools/classes.smartmongo.ts b/ts/ts_mongotools/classes.smartmongo.ts new file mode 100644 index 0000000..f3e6fe3 --- /dev/null +++ b/ts/ts_mongotools/classes.smartmongo.ts @@ -0,0 +1,71 @@ +import { commitinfo } from '../00_commitinfo_data.js'; +import * as plugins from './plugins.js'; + +export class SmartMongo { + // STATIC + public static async createAndStart(replCountArg: number = 1) { + const smartMongoInstance = new SmartMongo(); + await smartMongoInstance.start(replCountArg); + return smartMongoInstance; + } + + // INSTANCE + private _readyDeferred = plugins.smartpromise.defer(); + public readyPromise = this._readyDeferred.promise; + public mongoReplicaSet: plugins.mongoPlugin.MongoMemoryReplSet; + + constructor() {} + + public async start(countArg: number = 1) { + this.mongoReplicaSet = await plugins.mongoPlugin.MongoMemoryReplSet.create({ + replSet: { count: countArg }, + instanceOpts: [ + { + storageEngine: 'wiredTiger', + }, + ], + }); + this._readyDeferred.resolve(); + console.log(`mongoReplicaSet with ${countArg} replicas started.`); + console.log(`@pushrocks/smartmongo version ${commitinfo.version}`); + } + + /** + * returns a mongo descriptor for modules like + * @pushrocks/smartfile. + */ + public async getMongoDescriptor(): Promise { + await this.readyPromise; + return { + mongoDbName: `smartmongo_testdatabase`, + mongoDbUrl: this.mongoReplicaSet.getUri(), + }; + } + + /** + * stops the smartmongo instance + * and cleans up after itself + */ + public async stop() { + await this.mongoReplicaSet.stop(); + await this.mongoReplicaSet.cleanup(); + } + + /** + * like stop() but allows you to actually store + * the database on disk + */ + public async stopAndDumpToDir( + dirArg: string, + nameFunctionArg?: (doc: any) => string, + emptyDirArg = true, + ) { + const mongodumpInstance = new plugins.mongodump.MongoDump(); + const mongodumpTarget = await mongodumpInstance.addMongoTargetByMongoDescriptor( + await this.getMongoDescriptor(), + ); + await mongodumpTarget.dumpAllCollectionsToDir(dirArg, nameFunctionArg, emptyDirArg); + await mongodumpInstance.stop(); + await this.stop(); + } +} diff --git a/ts/ts_mongotools/index.ts b/ts/ts_mongotools/index.ts new file mode 100644 index 0000000..60bf744 --- /dev/null +++ b/ts/ts_mongotools/index.ts @@ -0,0 +1,2 @@ +export * from './plugins.js'; +export { SmartMongo } from './classes.smartmongo.js'; diff --git a/ts/smartmongo.plugins.ts b/ts/ts_mongotools/plugins.ts similarity index 100% rename from ts/smartmongo.plugins.ts rename to ts/ts_mongotools/plugins.ts diff --git a/ts/tsmdb/engine/AggregationEngine.ts b/ts/ts_tsmdb/engine/AggregationEngine.ts similarity index 99% rename from ts/tsmdb/engine/AggregationEngine.ts rename to ts/ts_tsmdb/engine/AggregationEngine.ts index ec5f663..f119162 100644 --- a/ts/tsmdb/engine/AggregationEngine.ts +++ b/ts/ts_tsmdb/engine/AggregationEngine.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { Document, IStoredDocument, IAggregateOptions } from '../types/interfaces.js'; // Import mingo Aggregator diff --git a/ts/tsmdb/engine/IndexEngine.ts b/ts/ts_tsmdb/engine/IndexEngine.ts similarity index 99% rename from ts/tsmdb/engine/IndexEngine.ts rename to ts/ts_tsmdb/engine/IndexEngine.ts index 5003b68..491dfb3 100644 --- a/ts/tsmdb/engine/IndexEngine.ts +++ b/ts/ts_tsmdb/engine/IndexEngine.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { IStorageAdapter } from '../storage/IStorageAdapter.js'; // Simple B-Tree implementation for range queries diff --git a/ts/tsmdb/engine/QueryEngine.ts b/ts/ts_tsmdb/engine/QueryEngine.ts similarity index 99% rename from ts/tsmdb/engine/QueryEngine.ts rename to ts/ts_tsmdb/engine/QueryEngine.ts index d290876..7919d26 100644 --- a/ts/tsmdb/engine/QueryEngine.ts +++ b/ts/ts_tsmdb/engine/QueryEngine.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { Document, IStoredDocument, ISortSpecification, ISortDirection } from '../types/interfaces.js'; // Import mingo Query class diff --git a/ts/tsmdb/engine/QueryPlanner.ts b/ts/ts_tsmdb/engine/QueryPlanner.ts similarity index 99% rename from ts/tsmdb/engine/QueryPlanner.ts rename to ts/ts_tsmdb/engine/QueryPlanner.ts index 300cfbd..3ee817e 100644 --- a/ts/tsmdb/engine/QueryPlanner.ts +++ b/ts/ts_tsmdb/engine/QueryPlanner.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { Document, IStoredDocument } from '../types/interfaces.js'; import { IndexEngine } from './IndexEngine.js'; diff --git a/ts/tsmdb/engine/SessionEngine.ts b/ts/ts_tsmdb/engine/SessionEngine.ts similarity index 99% rename from ts/tsmdb/engine/SessionEngine.ts rename to ts/ts_tsmdb/engine/SessionEngine.ts index 3216561..90e794d 100644 --- a/ts/tsmdb/engine/SessionEngine.ts +++ b/ts/ts_tsmdb/engine/SessionEngine.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { TransactionEngine } from './TransactionEngine.js'; /** diff --git a/ts/tsmdb/engine/TransactionEngine.ts b/ts/ts_tsmdb/engine/TransactionEngine.ts similarity index 99% rename from ts/tsmdb/engine/TransactionEngine.ts rename to ts/ts_tsmdb/engine/TransactionEngine.ts index c3f19f2..05e1d01 100644 --- a/ts/tsmdb/engine/TransactionEngine.ts +++ b/ts/ts_tsmdb/engine/TransactionEngine.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { IStorageAdapter } from '../storage/IStorageAdapter.js'; import type { Document, IStoredDocument, ITransactionOptions } from '../types/interfaces.js'; import { TsmdbTransactionError, TsmdbWriteConflictError } from '../errors/TsmdbErrors.js'; diff --git a/ts/tsmdb/engine/UpdateEngine.ts b/ts/ts_tsmdb/engine/UpdateEngine.ts similarity index 99% rename from ts/tsmdb/engine/UpdateEngine.ts rename to ts/ts_tsmdb/engine/UpdateEngine.ts index aef6699..dfe1670 100644 --- a/ts/tsmdb/engine/UpdateEngine.ts +++ b/ts/ts_tsmdb/engine/UpdateEngine.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { Document, IStoredDocument } from '../types/interfaces.js'; import { QueryEngine } from './QueryEngine.js'; diff --git a/ts/tsmdb/errors/TsmdbErrors.ts b/ts/ts_tsmdb/errors/TsmdbErrors.ts similarity index 100% rename from ts/tsmdb/errors/TsmdbErrors.ts rename to ts/ts_tsmdb/errors/TsmdbErrors.ts diff --git a/ts/tsmdb/index.ts b/ts/ts_tsmdb/index.ts similarity index 97% rename from ts/tsmdb/index.ts rename to ts/ts_tsmdb/index.ts index 4b37944..01adf9c 100644 --- a/ts/tsmdb/index.ts +++ b/ts/ts_tsmdb/index.ts @@ -2,7 +2,7 @@ // Use the official MongoDB driver to connect to TsmdbServer // Re-export plugins for external use -import * as plugins from './tsmdb.plugins.js'; +import * as plugins from './plugins.js'; export { plugins }; // Export BSON types for convenience diff --git a/ts/tsmdb/tsmdb.plugins.ts b/ts/ts_tsmdb/plugins.ts similarity index 100% rename from ts/tsmdb/tsmdb.plugins.ts rename to ts/ts_tsmdb/plugins.ts diff --git a/ts/tsmdb/server/CommandRouter.ts b/ts/ts_tsmdb/server/CommandRouter.ts similarity index 99% rename from ts/tsmdb/server/CommandRouter.ts rename to ts/ts_tsmdb/server/CommandRouter.ts index 852386c..4d6da57 100644 --- a/ts/tsmdb/server/CommandRouter.ts +++ b/ts/ts_tsmdb/server/CommandRouter.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { IStorageAdapter } from '../storage/IStorageAdapter.js'; import type { IParsedCommand } from './WireProtocol.js'; import type { TsmdbServer } from './TsmdbServer.js'; diff --git a/ts/tsmdb/server/TsmdbServer.ts b/ts/ts_tsmdb/server/TsmdbServer.ts similarity index 99% rename from ts/tsmdb/server/TsmdbServer.ts rename to ts/ts_tsmdb/server/TsmdbServer.ts index d1ca9e0..0c352c3 100644 --- a/ts/tsmdb/server/TsmdbServer.ts +++ b/ts/ts_tsmdb/server/TsmdbServer.ts @@ -1,5 +1,5 @@ import * as net from 'net'; -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import { WireProtocol, OP_QUERY } from './WireProtocol.js'; import { CommandRouter } from './CommandRouter.js'; import { MemoryStorageAdapter } from '../storage/MemoryStorageAdapter.js'; diff --git a/ts/tsmdb/server/WireProtocol.ts b/ts/ts_tsmdb/server/WireProtocol.ts similarity index 99% rename from ts/tsmdb/server/WireProtocol.ts rename to ts/ts_tsmdb/server/WireProtocol.ts index 3162038..f0e236b 100644 --- a/ts/tsmdb/server/WireProtocol.ts +++ b/ts/ts_tsmdb/server/WireProtocol.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; /** * MongoDB Wire Protocol Implementation diff --git a/ts/tsmdb/server/handlers/AdminHandler.ts b/ts/ts_tsmdb/server/handlers/AdminHandler.ts similarity index 99% rename from ts/tsmdb/server/handlers/AdminHandler.ts rename to ts/ts_tsmdb/server/handlers/AdminHandler.ts index 629ce6f..848ebb7 100644 --- a/ts/tsmdb/server/handlers/AdminHandler.ts +++ b/ts/ts_tsmdb/server/handlers/AdminHandler.ts @@ -1,4 +1,4 @@ -import * as plugins from '../../tsmdb.plugins.js'; +import * as plugins from '../../plugins.js'; import type { ICommandHandler, IHandlerContext } from '../CommandRouter.js'; import { SessionEngine } from '../../engine/SessionEngine.js'; diff --git a/ts/tsmdb/server/handlers/AggregateHandler.ts b/ts/ts_tsmdb/server/handlers/AggregateHandler.ts similarity index 99% rename from ts/tsmdb/server/handlers/AggregateHandler.ts rename to ts/ts_tsmdb/server/handlers/AggregateHandler.ts index 9f93f6c..2988102 100644 --- a/ts/tsmdb/server/handlers/AggregateHandler.ts +++ b/ts/ts_tsmdb/server/handlers/AggregateHandler.ts @@ -1,4 +1,4 @@ -import * as plugins from '../../tsmdb.plugins.js'; +import * as plugins from '../../plugins.js'; import type { ICommandHandler, IHandlerContext, ICursorState } from '../CommandRouter.js'; import { AggregationEngine } from '../../engine/AggregationEngine.js'; diff --git a/ts/tsmdb/server/handlers/DeleteHandler.ts b/ts/ts_tsmdb/server/handlers/DeleteHandler.ts similarity index 98% rename from ts/tsmdb/server/handlers/DeleteHandler.ts rename to ts/ts_tsmdb/server/handlers/DeleteHandler.ts index f2a7f86..d2f4533 100644 --- a/ts/tsmdb/server/handlers/DeleteHandler.ts +++ b/ts/ts_tsmdb/server/handlers/DeleteHandler.ts @@ -1,4 +1,4 @@ -import * as plugins from '../../tsmdb.plugins.js'; +import * as plugins from '../../plugins.js'; import type { ICommandHandler, IHandlerContext } from '../CommandRouter.js'; import type { IStoredDocument } from '../../types/interfaces.js'; import { QueryEngine } from '../../engine/QueryEngine.js'; diff --git a/ts/tsmdb/server/handlers/FindHandler.ts b/ts/ts_tsmdb/server/handlers/FindHandler.ts similarity index 99% rename from ts/tsmdb/server/handlers/FindHandler.ts rename to ts/ts_tsmdb/server/handlers/FindHandler.ts index 6a3404f..c8d6e60 100644 --- a/ts/tsmdb/server/handlers/FindHandler.ts +++ b/ts/ts_tsmdb/server/handlers/FindHandler.ts @@ -1,4 +1,4 @@ -import * as plugins from '../../tsmdb.plugins.js'; +import * as plugins from '../../plugins.js'; import type { ICommandHandler, IHandlerContext, ICursorState } from '../CommandRouter.js'; import type { IStoredDocument } from '../../types/interfaces.js'; import { QueryEngine } from '../../engine/QueryEngine.js'; diff --git a/ts/tsmdb/server/handlers/HelloHandler.ts b/ts/ts_tsmdb/server/handlers/HelloHandler.ts similarity index 97% rename from ts/tsmdb/server/handlers/HelloHandler.ts rename to ts/ts_tsmdb/server/handlers/HelloHandler.ts index 77ac972..6cb3665 100644 --- a/ts/tsmdb/server/handlers/HelloHandler.ts +++ b/ts/ts_tsmdb/server/handlers/HelloHandler.ts @@ -1,4 +1,4 @@ -import * as plugins from '../../tsmdb.plugins.js'; +import * as plugins from '../../plugins.js'; import type { ICommandHandler, IHandlerContext } from '../CommandRouter.js'; /** diff --git a/ts/tsmdb/server/handlers/IndexHandler.ts b/ts/ts_tsmdb/server/handlers/IndexHandler.ts similarity index 99% rename from ts/tsmdb/server/handlers/IndexHandler.ts rename to ts/ts_tsmdb/server/handlers/IndexHandler.ts index d69d748..a2b0974 100644 --- a/ts/tsmdb/server/handlers/IndexHandler.ts +++ b/ts/ts_tsmdb/server/handlers/IndexHandler.ts @@ -1,4 +1,4 @@ -import * as plugins from '../../tsmdb.plugins.js'; +import * as plugins from '../../plugins.js'; import type { ICommandHandler, IHandlerContext } from '../CommandRouter.js'; import { IndexEngine } from '../../engine/IndexEngine.js'; diff --git a/ts/tsmdb/server/handlers/InsertHandler.ts b/ts/ts_tsmdb/server/handlers/InsertHandler.ts similarity index 98% rename from ts/tsmdb/server/handlers/InsertHandler.ts rename to ts/ts_tsmdb/server/handlers/InsertHandler.ts index b736439..8aa1974 100644 --- a/ts/tsmdb/server/handlers/InsertHandler.ts +++ b/ts/ts_tsmdb/server/handlers/InsertHandler.ts @@ -1,4 +1,4 @@ -import * as plugins from '../../tsmdb.plugins.js'; +import * as plugins from '../../plugins.js'; import type { ICommandHandler, IHandlerContext } from '../CommandRouter.js'; import type { IStoredDocument } from '../../types/interfaces.js'; diff --git a/ts/tsmdb/server/handlers/UpdateHandler.ts b/ts/ts_tsmdb/server/handlers/UpdateHandler.ts similarity index 99% rename from ts/tsmdb/server/handlers/UpdateHandler.ts rename to ts/ts_tsmdb/server/handlers/UpdateHandler.ts index 4771157..bbc8f09 100644 --- a/ts/tsmdb/server/handlers/UpdateHandler.ts +++ b/ts/ts_tsmdb/server/handlers/UpdateHandler.ts @@ -1,4 +1,4 @@ -import * as plugins from '../../tsmdb.plugins.js'; +import * as plugins from '../../plugins.js'; import type { ICommandHandler, IHandlerContext } from '../CommandRouter.js'; import type { IStoredDocument } from '../../types/interfaces.js'; import { QueryEngine } from '../../engine/QueryEngine.js'; diff --git a/ts/tsmdb/server/handlers/index.ts b/ts/ts_tsmdb/server/handlers/index.ts similarity index 100% rename from ts/tsmdb/server/handlers/index.ts rename to ts/ts_tsmdb/server/handlers/index.ts diff --git a/ts/tsmdb/server/index.ts b/ts/ts_tsmdb/server/index.ts similarity index 100% rename from ts/tsmdb/server/index.ts rename to ts/ts_tsmdb/server/index.ts diff --git a/ts/tsmdb/storage/FileStorageAdapter.ts b/ts/ts_tsmdb/storage/FileStorageAdapter.ts similarity index 99% rename from ts/tsmdb/storage/FileStorageAdapter.ts rename to ts/ts_tsmdb/storage/FileStorageAdapter.ts index bc94d64..a49c0f4 100644 --- a/ts/tsmdb/storage/FileStorageAdapter.ts +++ b/ts/ts_tsmdb/storage/FileStorageAdapter.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { IStorageAdapter } from './IStorageAdapter.js'; import type { IStoredDocument, IOpLogEntry, Document } from '../types/interfaces.js'; import { calculateDocumentChecksum, verifyChecksum } from '../utils/checksum.js'; diff --git a/ts/tsmdb/storage/IStorageAdapter.ts b/ts/ts_tsmdb/storage/IStorageAdapter.ts similarity index 99% rename from ts/tsmdb/storage/IStorageAdapter.ts rename to ts/ts_tsmdb/storage/IStorageAdapter.ts index 71ada24..29064b8 100644 --- a/ts/tsmdb/storage/IStorageAdapter.ts +++ b/ts/ts_tsmdb/storage/IStorageAdapter.ts @@ -1,4 +1,4 @@ -import type * as plugins from '../tsmdb.plugins.js'; +import type * as plugins from '../plugins.js'; import type { IStoredDocument, IOpLogEntry, Document } from '../types/interfaces.js'; /** diff --git a/ts/tsmdb/storage/MemoryStorageAdapter.ts b/ts/ts_tsmdb/storage/MemoryStorageAdapter.ts similarity index 99% rename from ts/tsmdb/storage/MemoryStorageAdapter.ts rename to ts/ts_tsmdb/storage/MemoryStorageAdapter.ts index 9199940..82582fc 100644 --- a/ts/tsmdb/storage/MemoryStorageAdapter.ts +++ b/ts/ts_tsmdb/storage/MemoryStorageAdapter.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { IStorageAdapter } from './IStorageAdapter.js'; import type { IStoredDocument, IOpLogEntry, Document } from '../types/interfaces.js'; diff --git a/ts/tsmdb/storage/OpLog.ts b/ts/ts_tsmdb/storage/OpLog.ts similarity index 99% rename from ts/tsmdb/storage/OpLog.ts rename to ts/ts_tsmdb/storage/OpLog.ts index cbabeee..f560531 100644 --- a/ts/tsmdb/storage/OpLog.ts +++ b/ts/ts_tsmdb/storage/OpLog.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { IStorageAdapter } from './IStorageAdapter.js'; import type { IOpLogEntry, Document, IResumeToken, ChangeStreamOperationType } from '../types/interfaces.js'; diff --git a/ts/tsmdb/storage/WAL.ts b/ts/ts_tsmdb/storage/WAL.ts similarity index 99% rename from ts/tsmdb/storage/WAL.ts rename to ts/ts_tsmdb/storage/WAL.ts index 36f0542..6b01023 100644 --- a/ts/tsmdb/storage/WAL.ts +++ b/ts/ts_tsmdb/storage/WAL.ts @@ -1,4 +1,4 @@ -import * as plugins from '../tsmdb.plugins.js'; +import * as plugins from '../plugins.js'; import type { Document, IStoredDocument } from '../types/interfaces.js'; /** diff --git a/ts/tsmdb/types/interfaces.ts b/ts/ts_tsmdb/types/interfaces.ts similarity index 99% rename from ts/tsmdb/types/interfaces.ts rename to ts/ts_tsmdb/types/interfaces.ts index 7ae2b5b..a0908bf 100644 --- a/ts/tsmdb/types/interfaces.ts +++ b/ts/ts_tsmdb/types/interfaces.ts @@ -1,4 +1,4 @@ -import type * as plugins from '../tsmdb.plugins.js'; +import type * as plugins from '../plugins.js'; // ============================================================================ // Document Types diff --git a/ts/tsmdb/utils/checksum.ts b/ts/ts_tsmdb/utils/checksum.ts similarity index 100% rename from ts/tsmdb/utils/checksum.ts rename to ts/ts_tsmdb/utils/checksum.ts diff --git a/ts/tsmdb/utils/index.ts b/ts/ts_tsmdb/utils/index.ts similarity index 100% rename from ts/tsmdb/utils/index.ts rename to ts/ts_tsmdb/utils/index.ts