mongo.do 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.d.ts +1 -15
- package/dist/cli/index.js +4083 -196
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +2740 -20
- package/dist/index.js +9375 -27
- package/dist/index.js.map +1 -1
- package/dist/worker-entrypoint-BEW23Gmp.d.ts +1331 -0
- package/dist/worker.d.ts +6 -5
- package/dist/worker.js +5477 -18
- package/dist/worker.js.map +1 -1
- package/package.json +3 -2
- package/dist/agentfs/adapters/anthropic.d.ts +0 -176
- package/dist/agentfs/adapters/anthropic.d.ts.map +0 -1
- package/dist/agentfs/adapters/anthropic.js +0 -629
- package/dist/agentfs/adapters/anthropic.js.map +0 -1
- package/dist/agentfs/adapters/index.d.ts +0 -21
- package/dist/agentfs/adapters/index.d.ts.map +0 -1
- package/dist/agentfs/adapters/index.js +0 -23
- package/dist/agentfs/adapters/index.js.map +0 -1
- package/dist/agentfs/adapters/vercel.d.ts +0 -260
- package/dist/agentfs/adapters/vercel.d.ts.map +0 -1
- package/dist/agentfs/adapters/vercel.js +0 -288
- package/dist/agentfs/adapters/vercel.js.map +0 -1
- package/dist/agentfs/glob.d.ts +0 -116
- package/dist/agentfs/glob.d.ts.map +0 -1
- package/dist/agentfs/glob.js +0 -270
- package/dist/agentfs/glob.js.map +0 -1
- package/dist/agentfs/grep.d.ts +0 -83
- package/dist/agentfs/grep.d.ts.map +0 -1
- package/dist/agentfs/grep.js +0 -193
- package/dist/agentfs/grep.js.map +0 -1
- package/dist/agentfs/index.d.ts +0 -22
- package/dist/agentfs/index.d.ts.map +0 -1
- package/dist/agentfs/index.js +0 -18
- package/dist/agentfs/index.js.map +0 -1
- package/dist/agentfs/kv-store.d.ts +0 -128
- package/dist/agentfs/kv-store.d.ts.map +0 -1
- package/dist/agentfs/kv-store.js +0 -227
- package/dist/agentfs/kv-store.js.map +0 -1
- package/dist/agentfs/mondo-agent.d.ts +0 -255
- package/dist/agentfs/mondo-agent.d.ts.map +0 -1
- package/dist/agentfs/mondo-agent.js +0 -879
- package/dist/agentfs/mondo-agent.js.map +0 -1
- package/dist/agentfs/toolcalls.d.ts +0 -130
- package/dist/agentfs/toolcalls.d.ts.map +0 -1
- package/dist/agentfs/toolcalls.js +0 -178
- package/dist/agentfs/toolcalls.js.map +0 -1
- package/dist/agentfs/types.d.ts +0 -171
- package/dist/agentfs/types.d.ts.map +0 -1
- package/dist/agentfs/types.js +0 -7
- package/dist/agentfs/types.js.map +0 -1
- package/dist/agentfs/vfs.d.ts +0 -249
- package/dist/agentfs/vfs.d.ts.map +0 -1
- package/dist/agentfs/vfs.js +0 -469
- package/dist/agentfs/vfs.js.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/mcp.d.ts +0 -119
- package/dist/cli/mcp.d.ts.map +0 -1
- package/dist/cli/mcp.js +0 -418
- package/dist/cli/mcp.js.map +0 -1
- package/dist/cli/server.d.ts +0 -179
- package/dist/cli/server.d.ts.map +0 -1
- package/dist/cli/server.js +0 -441
- package/dist/cli/server.js.map +0 -1
- package/dist/client/Collection.d.ts +0 -199
- package/dist/client/Collection.d.ts.map +0 -1
- package/dist/client/Collection.js +0 -256
- package/dist/client/Collection.js.map +0 -1
- package/dist/client/Database.d.ts +0 -68
- package/dist/client/Database.d.ts.map +0 -1
- package/dist/client/Database.js +0 -105
- package/dist/client/Database.js.map +0 -1
- package/dist/client/MongoClient.d.ts +0 -165
- package/dist/client/MongoClient.d.ts.map +0 -1
- package/dist/client/MongoClient.js +0 -307
- package/dist/client/MongoClient.js.map +0 -1
- package/dist/client/aggregation-cursor.d.ts +0 -210
- package/dist/client/aggregation-cursor.d.ts.map +0 -1
- package/dist/client/aggregation-cursor.js +0 -509
- package/dist/client/aggregation-cursor.js.map +0 -1
- package/dist/client/bulk-write.d.ts +0 -216
- package/dist/client/bulk-write.d.ts.map +0 -1
- package/dist/client/bulk-write.js +0 -63
- package/dist/client/bulk-write.js.map +0 -1
- package/dist/client/change-stream.d.ts +0 -245
- package/dist/client/change-stream.d.ts.map +0 -1
- package/dist/client/change-stream.js +0 -429
- package/dist/client/change-stream.js.map +0 -1
- package/dist/client/cursor.d.ts +0 -85
- package/dist/client/cursor.d.ts.map +0 -1
- package/dist/client/cursor.js +0 -156
- package/dist/client/cursor.js.map +0 -1
- package/dist/client/http-cursor.d.ts +0 -233
- package/dist/client/http-cursor.d.ts.map +0 -1
- package/dist/client/http-cursor.js +0 -496
- package/dist/client/http-cursor.js.map +0 -1
- package/dist/client/index.d.ts +0 -18
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -24
- package/dist/client/index.js.map +0 -1
- package/dist/client/mongo-client.d.ts +0 -60
- package/dist/client/mongo-client.d.ts.map +0 -1
- package/dist/client/mongo-client.js +0 -190
- package/dist/client/mongo-client.js.map +0 -1
- package/dist/client/mongo-collection.d.ts +0 -359
- package/dist/client/mongo-collection.d.ts.map +0 -1
- package/dist/client/mongo-collection.js +0 -1641
- package/dist/client/mongo-collection.js.map +0 -1
- package/dist/client/mongo-cursor.d.ts +0 -257
- package/dist/client/mongo-cursor.d.ts.map +0 -1
- package/dist/client/mongo-cursor.js +0 -621
- package/dist/client/mongo-cursor.js.map +0 -1
- package/dist/client/mongo-database.d.ts +0 -88
- package/dist/client/mongo-database.d.ts.map +0 -1
- package/dist/client/mongo-database.js +0 -139
- package/dist/client/mongo-database.js.map +0 -1
- package/dist/client/session.d.ts +0 -210
- package/dist/client/session.d.ts.map +0 -1
- package/dist/client/session.js +0 -326
- package/dist/client/session.js.map +0 -1
- package/dist/durable-object/index-manager.d.ts +0 -173
- package/dist/durable-object/index-manager.d.ts.map +0 -1
- package/dist/durable-object/index-manager.js +0 -764
- package/dist/durable-object/index-manager.js.map +0 -1
- package/dist/durable-object/index.d.ts +0 -12
- package/dist/durable-object/index.d.ts.map +0 -1
- package/dist/durable-object/index.js +0 -8
- package/dist/durable-object/index.js.map +0 -1
- package/dist/durable-object/mcp-handler.d.ts +0 -52
- package/dist/durable-object/mcp-handler.d.ts.map +0 -1
- package/dist/durable-object/mcp-handler.js +0 -186
- package/dist/durable-object/mcp-handler.js.map +0 -1
- package/dist/durable-object/migrations.d.ts +0 -40
- package/dist/durable-object/migrations.d.ts.map +0 -1
- package/dist/durable-object/migrations.js +0 -121
- package/dist/durable-object/migrations.js.map +0 -1
- package/dist/durable-object/mondo-database.d.ts +0 -148
- package/dist/durable-object/mondo-database.d.ts.map +0 -1
- package/dist/durable-object/mondo-database.js +0 -621
- package/dist/durable-object/mondo-database.js.map +0 -1
- package/dist/durable-object/schema.d.ts +0 -192
- package/dist/durable-object/schema.d.ts.map +0 -1
- package/dist/durable-object/schema.js +0 -186
- package/dist/durable-object/schema.js.map +0 -1
- package/dist/embedding/document-serializer.d.ts +0 -118
- package/dist/embedding/document-serializer.d.ts.map +0 -1
- package/dist/embedding/document-serializer.js +0 -339
- package/dist/embedding/document-serializer.js.map +0 -1
- package/dist/embedding/embedding-manager.d.ts +0 -136
- package/dist/embedding/embedding-manager.d.ts.map +0 -1
- package/dist/embedding/embedding-manager.js +0 -176
- package/dist/embedding/embedding-manager.js.map +0 -1
- package/dist/embedding/index.d.ts +0 -9
- package/dist/embedding/index.d.ts.map +0 -1
- package/dist/embedding/index.js +0 -9
- package/dist/embedding/index.js.map +0 -1
- package/dist/executor/aggregation-executor.d.ts +0 -93
- package/dist/executor/aggregation-executor.d.ts.map +0 -1
- package/dist/executor/aggregation-executor.js +0 -275
- package/dist/executor/aggregation-executor.js.map +0 -1
- package/dist/executor/function-executor.d.ts +0 -39
- package/dist/executor/function-executor.d.ts.map +0 -1
- package/dist/executor/function-executor.js +0 -168
- package/dist/executor/function-executor.js.map +0 -1
- package/dist/executor/index.d.ts +0 -4
- package/dist/executor/index.d.ts.map +0 -1
- package/dist/executor/index.js +0 -4
- package/dist/executor/index.js.map +0 -1
- package/dist/executor/vector-search-executor.d.ts +0 -71
- package/dist/executor/vector-search-executor.d.ts.map +0 -1
- package/dist/executor/vector-search-executor.js +0 -113
- package/dist/executor/vector-search-executor.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/mcp/adapters/anthropic-adapter.d.ts +0 -256
- package/dist/mcp/adapters/anthropic-adapter.d.ts.map +0 -1
- package/dist/mcp/adapters/anthropic-adapter.js +0 -409
- package/dist/mcp/adapters/anthropic-adapter.js.map +0 -1
- package/dist/mcp/adapters/base-adapter.d.ts +0 -164
- package/dist/mcp/adapters/base-adapter.d.ts.map +0 -1
- package/dist/mcp/adapters/base-adapter.js +0 -277
- package/dist/mcp/adapters/base-adapter.js.map +0 -1
- package/dist/mcp/adapters/errors.d.ts +0 -173
- package/dist/mcp/adapters/errors.d.ts.map +0 -1
- package/dist/mcp/adapters/errors.js +0 -305
- package/dist/mcp/adapters/errors.js.map +0 -1
- package/dist/mcp/adapters/index.d.ts +0 -65
- package/dist/mcp/adapters/index.d.ts.map +0 -1
- package/dist/mcp/adapters/index.js +0 -92
- package/dist/mcp/adapters/index.js.map +0 -1
- package/dist/mcp/adapters/streaming.d.ts +0 -200
- package/dist/mcp/adapters/streaming.d.ts.map +0 -1
- package/dist/mcp/adapters/streaming.js +0 -381
- package/dist/mcp/adapters/streaming.js.map +0 -1
- package/dist/mcp/adapters/vercel-adapter.d.ts +0 -321
- package/dist/mcp/adapters/vercel-adapter.d.ts.map +0 -1
- package/dist/mcp/adapters/vercel-adapter.js +0 -487
- package/dist/mcp/adapters/vercel-adapter.js.map +0 -1
- package/dist/mcp/agent.d.ts +0 -192
- package/dist/mcp/agent.d.ts.map +0 -1
- package/dist/mcp/agent.js +0 -338
- package/dist/mcp/agent.js.map +0 -1
- package/dist/mcp/cli.d.ts +0 -71
- package/dist/mcp/cli.d.ts.map +0 -1
- package/dist/mcp/cli.js +0 -218
- package/dist/mcp/cli.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -15
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -20
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/sandbox/database-proxy.d.ts +0 -118
- package/dist/mcp/sandbox/database-proxy.d.ts.map +0 -1
- package/dist/mcp/sandbox/database-proxy.js +0 -154
- package/dist/mcp/sandbox/database-proxy.js.map +0 -1
- package/dist/mcp/sandbox/index.d.ts +0 -8
- package/dist/mcp/sandbox/index.d.ts.map +0 -1
- package/dist/mcp/sandbox/index.js +0 -7
- package/dist/mcp/sandbox/index.js.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts +0 -72
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.js +0 -379
- package/dist/mcp/sandbox/miniflare-evaluator.js.map +0 -1
- package/dist/mcp/sandbox/template.d.ts +0 -48
- package/dist/mcp/sandbox/template.d.ts.map +0 -1
- package/dist/mcp/sandbox/template.js +0 -147
- package/dist/mcp/sandbox/template.js.map +0 -1
- package/dist/mcp/sandbox/worker-evaluator.d.ts +0 -160
- package/dist/mcp/sandbox/worker-evaluator.d.ts.map +0 -1
- package/dist/mcp/sandbox/worker-evaluator.js +0 -217
- package/dist/mcp/sandbox/worker-evaluator.js.map +0 -1
- package/dist/mcp/server.d.ts +0 -75
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/server.js +0 -278
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/tool-call-auditor.d.ts +0 -188
- package/dist/mcp/tool-call-auditor.d.ts.map +0 -1
- package/dist/mcp/tool-call-auditor.js +0 -198
- package/dist/mcp/tool-call-auditor.js.map +0 -1
- package/dist/mcp/tools/do.d.ts +0 -51
- package/dist/mcp/tools/do.d.ts.map +0 -1
- package/dist/mcp/tools/do.js +0 -113
- package/dist/mcp/tools/do.js.map +0 -1
- package/dist/mcp/tools/fetch.d.ts +0 -43
- package/dist/mcp/tools/fetch.d.ts.map +0 -1
- package/dist/mcp/tools/fetch.js +0 -127
- package/dist/mcp/tools/fetch.js.map +0 -1
- package/dist/mcp/tools/index.d.ts +0 -9
- package/dist/mcp/tools/index.d.ts.map +0 -1
- package/dist/mcp/tools/index.js +0 -9
- package/dist/mcp/tools/index.js.map +0 -1
- package/dist/mcp/tools/search.d.ts +0 -60
- package/dist/mcp/tools/search.d.ts.map +0 -1
- package/dist/mcp/tools/search.js +0 -278
- package/dist/mcp/tools/search.js.map +0 -1
- package/dist/mcp/transport/http.d.ts +0 -144
- package/dist/mcp/transport/http.d.ts.map +0 -1
- package/dist/mcp/transport/http.js +0 -545
- package/dist/mcp/transport/http.js.map +0 -1
- package/dist/mcp/transport/index.d.ts +0 -10
- package/dist/mcp/transport/index.d.ts.map +0 -1
- package/dist/mcp/transport/index.js +0 -12
- package/dist/mcp/transport/index.js.map +0 -1
- package/dist/mcp/transport/stdio.d.ts +0 -132
- package/dist/mcp/transport/stdio.d.ts.map +0 -1
- package/dist/mcp/transport/stdio.js +0 -466
- package/dist/mcp/transport/stdio.js.map +0 -1
- package/dist/mcp/types.d.ts +0 -476
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/mcp/types.js +0 -178
- package/dist/mcp/types.js.map +0 -1
- package/dist/olap/cdc/cdc-buffer.d.ts +0 -92
- package/dist/olap/cdc/cdc-buffer.d.ts.map +0 -1
- package/dist/olap/cdc/cdc-buffer.js +0 -146
- package/dist/olap/cdc/cdc-buffer.js.map +0 -1
- package/dist/olap/cdc/cdc-emitter.d.ts +0 -118
- package/dist/olap/cdc/cdc-emitter.d.ts.map +0 -1
- package/dist/olap/cdc/cdc-emitter.js +0 -217
- package/dist/olap/cdc/cdc-emitter.js.map +0 -1
- package/dist/olap/cdc/cdc-schema.d.ts +0 -119
- package/dist/olap/cdc/cdc-schema.d.ts.map +0 -1
- package/dist/olap/cdc/cdc-schema.js +0 -253
- package/dist/olap/cdc/cdc-schema.js.map +0 -1
- package/dist/olap/cdc/index.d.ts +0 -10
- package/dist/olap/cdc/index.d.ts.map +0 -1
- package/dist/olap/cdc/index.js +0 -10
- package/dist/olap/cdc/index.js.map +0 -1
- package/dist/olap/clickhouse/iceberg.d.ts +0 -164
- package/dist/olap/clickhouse/iceberg.d.ts.map +0 -1
- package/dist/olap/clickhouse/iceberg.js +0 -138
- package/dist/olap/clickhouse/iceberg.js.map +0 -1
- package/dist/olap/clickhouse/index.d.ts +0 -14
- package/dist/olap/clickhouse/index.d.ts.map +0 -1
- package/dist/olap/clickhouse/index.js +0 -14
- package/dist/olap/clickhouse/index.js.map +0 -1
- package/dist/olap/clickhouse/mapper.d.ts +0 -170
- package/dist/olap/clickhouse/mapper.d.ts.map +0 -1
- package/dist/olap/clickhouse/mapper.js +0 -654
- package/dist/olap/clickhouse/mapper.js.map +0 -1
- package/dist/olap/clickhouse/olap-backend.d.ts +0 -181
- package/dist/olap/clickhouse/olap-backend.d.ts.map +0 -1
- package/dist/olap/clickhouse/olap-backend.js +0 -1083
- package/dist/olap/clickhouse/olap-backend.js.map +0 -1
- package/dist/olap/clickhouse/query-executor.d.ts +0 -163
- package/dist/olap/clickhouse/query-executor.d.ts.map +0 -1
- package/dist/olap/clickhouse/query-executor.js +0 -560
- package/dist/olap/clickhouse/query-executor.js.map +0 -1
- package/dist/olap/clickhouse/query.d.ts +0 -134
- package/dist/olap/clickhouse/query.d.ts.map +0 -1
- package/dist/olap/clickhouse/query.js +0 -512
- package/dist/olap/clickhouse/query.js.map +0 -1
- package/dist/olap/stage/index.d.ts +0 -6
- package/dist/olap/stage/index.d.ts.map +0 -1
- package/dist/olap/stage/index.js +0 -6
- package/dist/olap/stage/index.js.map +0 -1
- package/dist/olap/stage/parser.d.ts +0 -68
- package/dist/olap/stage/parser.d.ts.map +0 -1
- package/dist/olap/stage/parser.js +0 -293
- package/dist/olap/stage/parser.js.map +0 -1
- package/dist/olap/stage/router.d.ts +0 -94
- package/dist/olap/stage/router.d.ts.map +0 -1
- package/dist/olap/stage/router.js +0 -390
- package/dist/olap/stage/router.js.map +0 -1
- package/dist/rpc/endpoint.d.ts +0 -52
- package/dist/rpc/endpoint.d.ts.map +0 -1
- package/dist/rpc/endpoint.js +0 -734
- package/dist/rpc/endpoint.js.map +0 -1
- package/dist/rpc/index.d.ts +0 -34
- package/dist/rpc/index.d.ts.map +0 -1
- package/dist/rpc/index.js +0 -45
- package/dist/rpc/index.js.map +0 -1
- package/dist/rpc/rpc-client.d.ts +0 -275
- package/dist/rpc/rpc-client.d.ts.map +0 -1
- package/dist/rpc/rpc-client.js +0 -735
- package/dist/rpc/rpc-client.js.map +0 -1
- package/dist/rpc/rpc-target.d.ts +0 -220
- package/dist/rpc/rpc-target.d.ts.map +0 -1
- package/dist/rpc/rpc-target.js +0 -500
- package/dist/rpc/rpc-target.js.map +0 -1
- package/dist/rpc/worker-entrypoint.d.ts +0 -159
- package/dist/rpc/worker-entrypoint.d.ts.map +0 -1
- package/dist/rpc/worker-entrypoint.js +0 -212
- package/dist/rpc/worker-entrypoint.js.map +0 -1
- package/dist/server.d.ts +0 -18
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -129
- package/dist/server.js.map +0 -1
- package/dist/studio/components/browser/CollectionItem.d.ts +0 -26
- package/dist/studio/components/browser/CollectionItem.d.ts.map +0 -1
- package/dist/studio/components/browser/CollectionItem.js +0 -143
- package/dist/studio/components/browser/CollectionItem.js.map +0 -1
- package/dist/studio/components/browser/CollectionTree.d.ts +0 -45
- package/dist/studio/components/browser/CollectionTree.d.ts.map +0 -1
- package/dist/studio/components/browser/CollectionTree.js +0 -207
- package/dist/studio/components/browser/CollectionTree.js.map +0 -1
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.d.ts +0 -51
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.d.ts.map +0 -1
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.js +0 -185
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.js.map +0 -1
- package/dist/studio/components/browser/DatabaseBrowser.d.ts +0 -46
- package/dist/studio/components/browser/DatabaseBrowser.d.ts.map +0 -1
- package/dist/studio/components/browser/DatabaseBrowser.js +0 -304
- package/dist/studio/components/browser/DatabaseBrowser.js.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionItem.test.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/CollectionItem.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionItem.test.js +0 -169
- package/dist/studio/components/browser/__tests__/CollectionItem.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionTree.test.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/CollectionTree.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionTree.test.js +0 -203
- package/dist/studio/components/browser/__tests__/CollectionTree.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.d.ts +0 -8
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.js +0 -522
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.js +0 -518
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/setup.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/setup.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/setup.js +0 -22
- package/dist/studio/components/browser/__tests__/setup.js.map +0 -1
- package/dist/studio/components/browser/index.d.ts +0 -15
- package/dist/studio/components/browser/index.d.ts.map +0 -1
- package/dist/studio/components/browser/index.js +0 -10
- package/dist/studio/components/browser/index.js.map +0 -1
- package/dist/studio/components/browser/types.d.ts +0 -33
- package/dist/studio/components/browser/types.d.ts.map +0 -1
- package/dist/studio/components/browser/types.js +0 -5
- package/dist/studio/components/browser/types.js.map +0 -1
- package/dist/studio/components/connection/ConnectionForm.d.ts +0 -59
- package/dist/studio/components/connection/ConnectionForm.d.ts.map +0 -1
- package/dist/studio/components/connection/ConnectionForm.js +0 -274
- package/dist/studio/components/connection/ConnectionForm.js.map +0 -1
- package/dist/studio/components/connection/ConnectionList.d.ts +0 -59
- package/dist/studio/components/connection/ConnectionList.d.ts.map +0 -1
- package/dist/studio/components/connection/ConnectionList.js +0 -286
- package/dist/studio/components/connection/ConnectionList.js.map +0 -1
- package/dist/studio/components/connection/ConnectionPanel.d.ts +0 -132
- package/dist/studio/components/connection/ConnectionPanel.d.ts.map +0 -1
- package/dist/studio/components/connection/ConnectionPanel.js +0 -293
- package/dist/studio/components/connection/ConnectionPanel.js.map +0 -1
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.d.ts +0 -8
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.d.ts.map +0 -1
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.js +0 -632
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.js.map +0 -1
- package/dist/studio/components/connection/__tests__/setup.d.ts +0 -5
- package/dist/studio/components/connection/__tests__/setup.d.ts.map +0 -1
- package/dist/studio/components/connection/__tests__/setup.js +0 -11
- package/dist/studio/components/connection/__tests__/setup.js.map +0 -1
- package/dist/studio/components/connection/index.d.ts +0 -10
- package/dist/studio/components/connection/index.d.ts.map +0 -1
- package/dist/studio/components/connection/index.js +0 -7
- package/dist/studio/components/connection/index.js.map +0 -1
- package/dist/studio/components/crud/DeleteDocumentDialog.d.ts +0 -91
- package/dist/studio/components/crud/DeleteDocumentDialog.d.ts.map +0 -1
- package/dist/studio/components/crud/DeleteDocumentDialog.js +0 -273
- package/dist/studio/components/crud/DeleteDocumentDialog.js.map +0 -1
- package/dist/studio/components/crud/DocumentEditor.d.ts +0 -32
- package/dist/studio/components/crud/DocumentEditor.d.ts.map +0 -1
- package/dist/studio/components/crud/DocumentEditor.js +0 -546
- package/dist/studio/components/crud/DocumentEditor.js.map +0 -1
- package/dist/studio/components/crud/InsertDocumentDialog.d.ts +0 -78
- package/dist/studio/components/crud/InsertDocumentDialog.d.ts.map +0 -1
- package/dist/studio/components/crud/InsertDocumentDialog.js +0 -323
- package/dist/studio/components/crud/InsertDocumentDialog.js.map +0 -1
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.d.ts +0 -5
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.js +0 -298
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.js.map +0 -1
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.d.ts +0 -8
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.js +0 -368
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.js.map +0 -1
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.d.ts +0 -2
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.js +0 -352
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.js.map +0 -1
- package/dist/studio/components/crud/__tests__/setup.d.ts +0 -5
- package/dist/studio/components/crud/__tests__/setup.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/setup.js +0 -22
- package/dist/studio/components/crud/__tests__/setup.js.map +0 -1
- package/dist/studio/components/crud/index.d.ts +0 -12
- package/dist/studio/components/crud/index.d.ts.map +0 -1
- package/dist/studio/components/crud/index.js +0 -11
- package/dist/studio/components/crud/index.js.map +0 -1
- package/dist/studio/hooks/useConnection.d.ts +0 -127
- package/dist/studio/hooks/useConnection.d.ts.map +0 -1
- package/dist/studio/hooks/useConnection.js +0 -414
- package/dist/studio/hooks/useConnection.js.map +0 -1
- package/dist/studio/hooks/useDatabaseBrowser.d.ts +0 -107
- package/dist/studio/hooks/useDatabaseBrowser.d.ts.map +0 -1
- package/dist/studio/hooks/useDatabaseBrowser.js +0 -294
- package/dist/studio/hooks/useDatabaseBrowser.js.map +0 -1
- package/dist/studio/index.d.ts +0 -16
- package/dist/studio/index.d.ts.map +0 -1
- package/dist/studio/index.js +0 -14
- package/dist/studio/index.js.map +0 -1
- package/dist/studio/types/connection.d.ts +0 -266
- package/dist/studio/types/connection.d.ts.map +0 -1
- package/dist/studio/types/connection.js +0 -159
- package/dist/studio/types/connection.js.map +0 -1
- package/dist/studio/vitest.config.d.ts +0 -3
- package/dist/studio/vitest.config.d.ts.map +0 -1
- package/dist/studio/vitest.config.js +0 -33
- package/dist/studio/vitest.config.js.map +0 -1
- package/dist/translator/aggregation-translator.d.ts +0 -51
- package/dist/translator/aggregation-translator.d.ts.map +0 -1
- package/dist/translator/aggregation-translator.js +0 -324
- package/dist/translator/aggregation-translator.js.map +0 -1
- package/dist/translator/dialect.d.ts +0 -131
- package/dist/translator/dialect.d.ts.map +0 -1
- package/dist/translator/dialect.js +0 -276
- package/dist/translator/dialect.js.map +0 -1
- package/dist/translator/geo-translator.d.ts +0 -91
- package/dist/translator/geo-translator.d.ts.map +0 -1
- package/dist/translator/geo-translator.js +0 -587
- package/dist/translator/geo-translator.js.map +0 -1
- package/dist/translator/hybrid-translator.d.ts +0 -70
- package/dist/translator/hybrid-translator.d.ts.map +0 -1
- package/dist/translator/hybrid-translator.js +0 -193
- package/dist/translator/hybrid-translator.js.map +0 -1
- package/dist/translator/index.d.ts +0 -13
- package/dist/translator/index.d.ts.map +0 -1
- package/dist/translator/index.js +0 -11
- package/dist/translator/index.js.map +0 -1
- package/dist/translator/query-translator.d.ts +0 -211
- package/dist/translator/query-translator.d.ts.map +0 -1
- package/dist/translator/query-translator.js +0 -1276
- package/dist/translator/query-translator.js.map +0 -1
- package/dist/translator/search-highlight.d.ts +0 -83
- package/dist/translator/search-highlight.d.ts.map +0 -1
- package/dist/translator/search-highlight.js +0 -83
- package/dist/translator/search-highlight.js.map +0 -1
- package/dist/translator/search-translator.d.ts +0 -155
- package/dist/translator/search-translator.d.ts.map +0 -1
- package/dist/translator/search-translator.js +0 -241
- package/dist/translator/search-translator.js.map +0 -1
- package/dist/translator/stages/add-fields-stage.d.ts +0 -7
- package/dist/translator/stages/add-fields-stage.d.ts.map +0 -1
- package/dist/translator/stages/add-fields-stage.js +0 -72
- package/dist/translator/stages/add-fields-stage.js.map +0 -1
- package/dist/translator/stages/bucket-stage.d.ts +0 -7
- package/dist/translator/stages/bucket-stage.d.ts.map +0 -1
- package/dist/translator/stages/bucket-stage.js +0 -87
- package/dist/translator/stages/bucket-stage.js.map +0 -1
- package/dist/translator/stages/count-stage.d.ts +0 -7
- package/dist/translator/stages/count-stage.d.ts.map +0 -1
- package/dist/translator/stages/count-stage.js +0 -12
- package/dist/translator/stages/count-stage.js.map +0 -1
- package/dist/translator/stages/expression-translator.d.ts +0 -68
- package/dist/translator/stages/expression-translator.d.ts.map +0 -1
- package/dist/translator/stages/expression-translator.js +0 -467
- package/dist/translator/stages/expression-translator.js.map +0 -1
- package/dist/translator/stages/facet-stage.d.ts +0 -13
- package/dist/translator/stages/facet-stage.d.ts.map +0 -1
- package/dist/translator/stages/facet-stage.js +0 -26
- package/dist/translator/stages/facet-stage.js.map +0 -1
- package/dist/translator/stages/fusion-stages.d.ts +0 -118
- package/dist/translator/stages/fusion-stages.d.ts.map +0 -1
- package/dist/translator/stages/fusion-stages.js +0 -201
- package/dist/translator/stages/fusion-stages.js.map +0 -1
- package/dist/translator/stages/group-stage.d.ts +0 -8
- package/dist/translator/stages/group-stage.d.ts.map +0 -1
- package/dist/translator/stages/group-stage.js +0 -123
- package/dist/translator/stages/group-stage.js.map +0 -1
- package/dist/translator/stages/index.d.ts +0 -24
- package/dist/translator/stages/index.d.ts.map +0 -1
- package/dist/translator/stages/index.js +0 -24
- package/dist/translator/stages/index.js.map +0 -1
- package/dist/translator/stages/join-optimizer.d.ts +0 -37
- package/dist/translator/stages/join-optimizer.d.ts.map +0 -1
- package/dist/translator/stages/join-optimizer.js +0 -93
- package/dist/translator/stages/join-optimizer.js.map +0 -1
- package/dist/translator/stages/limit-stage.d.ts +0 -7
- package/dist/translator/stages/limit-stage.d.ts.map +0 -1
- package/dist/translator/stages/limit-stage.js +0 -11
- package/dist/translator/stages/limit-stage.js.map +0 -1
- package/dist/translator/stages/lookup-stage.d.ts +0 -7
- package/dist/translator/stages/lookup-stage.d.ts.map +0 -1
- package/dist/translator/stages/lookup-stage.js +0 -73
- package/dist/translator/stages/lookup-stage.js.map +0 -1
- package/dist/translator/stages/match-stage.d.ts +0 -7
- package/dist/translator/stages/match-stage.d.ts.map +0 -1
- package/dist/translator/stages/match-stage.js +0 -14
- package/dist/translator/stages/match-stage.js.map +0 -1
- package/dist/translator/stages/optimizer.d.ts +0 -15
- package/dist/translator/stages/optimizer.d.ts.map +0 -1
- package/dist/translator/stages/optimizer.js +0 -249
- package/dist/translator/stages/optimizer.js.map +0 -1
- package/dist/translator/stages/parallel-facet.d.ts +0 -47
- package/dist/translator/stages/parallel-facet.d.ts.map +0 -1
- package/dist/translator/stages/parallel-facet.js +0 -57
- package/dist/translator/stages/parallel-facet.js.map +0 -1
- package/dist/translator/stages/project-stage.d.ts +0 -8
- package/dist/translator/stages/project-stage.d.ts.map +0 -1
- package/dist/translator/stages/project-stage.js +0 -145
- package/dist/translator/stages/project-stage.js.map +0 -1
- package/dist/translator/stages/search-stage.d.ts +0 -60
- package/dist/translator/stages/search-stage.d.ts.map +0 -1
- package/dist/translator/stages/search-stage.js +0 -89
- package/dist/translator/stages/search-stage.js.map +0 -1
- package/dist/translator/stages/skip-stage.d.ts +0 -7
- package/dist/translator/stages/skip-stage.d.ts.map +0 -1
- package/dist/translator/stages/skip-stage.js +0 -11
- package/dist/translator/stages/skip-stage.js.map +0 -1
- package/dist/translator/stages/sort-stage.d.ts +0 -7
- package/dist/translator/stages/sort-stage.d.ts.map +0 -1
- package/dist/translator/stages/sort-stage.js +0 -21
- package/dist/translator/stages/sort-stage.js.map +0 -1
- package/dist/translator/stages/types.d.ts +0 -136
- package/dist/translator/stages/types.d.ts.map +0 -1
- package/dist/translator/stages/types.js +0 -5
- package/dist/translator/stages/types.js.map +0 -1
- package/dist/translator/stages/unwind-stage.d.ts +0 -7
- package/dist/translator/stages/unwind-stage.d.ts.map +0 -1
- package/dist/translator/stages/unwind-stage.js +0 -61
- package/dist/translator/stages/unwind-stage.js.map +0 -1
- package/dist/translator/stages/vector-search-stage.d.ts +0 -53
- package/dist/translator/stages/vector-search-stage.d.ts.map +0 -1
- package/dist/translator/stages/vector-search-stage.js +0 -62
- package/dist/translator/stages/vector-search-stage.js.map +0 -1
- package/dist/translator/update-translator.d.ts +0 -148
- package/dist/translator/update-translator.d.ts.map +0 -1
- package/dist/translator/update-translator.js +0 -819
- package/dist/translator/update-translator.js.map +0 -1
- package/dist/translator/vector-translator.d.ts +0 -89
- package/dist/translator/vector-translator.d.ts.map +0 -1
- package/dist/translator/vector-translator.js +0 -106
- package/dist/translator/vector-translator.js.map +0 -1
- package/dist/types/env.d.ts +0 -31
- package/dist/types/env.d.ts.map +0 -1
- package/dist/types/env.js +0 -5
- package/dist/types/env.js.map +0 -1
- package/dist/types/function.d.ts +0 -65
- package/dist/types/function.d.ts.map +0 -1
- package/dist/types/function.js +0 -5
- package/dist/types/function.js.map +0 -1
- package/dist/types/index.d.ts +0 -137
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -13
- package/dist/types/index.js.map +0 -1
- package/dist/types/mongodb.d.ts +0 -258
- package/dist/types/mongodb.d.ts.map +0 -1
- package/dist/types/mongodb.js +0 -5
- package/dist/types/mongodb.js.map +0 -1
- package/dist/types/objectid.d.ts +0 -130
- package/dist/types/objectid.d.ts.map +0 -1
- package/dist/types/objectid.js +0 -314
- package/dist/types/objectid.js.map +0 -1
- package/dist/types/rpc.d.ts +0 -313
- package/dist/types/rpc.d.ts.map +0 -1
- package/dist/types/rpc.js +0 -136
- package/dist/types/rpc.js.map +0 -1
- package/dist/types/vectorize.d.ts +0 -136
- package/dist/types/vectorize.d.ts.map +0 -1
- package/dist/types/vectorize.js +0 -8
- package/dist/types/vectorize.js.map +0 -1
- package/dist/utils/sql-safety.d.ts +0 -64
- package/dist/utils/sql-safety.d.ts.map +0 -1
- package/dist/utils/sql-safety.js +0 -112
- package/dist/utils/sql-safety.js.map +0 -1
- package/dist/validation/document-validator.d.ts +0 -195
- package/dist/validation/document-validator.d.ts.map +0 -1
- package/dist/validation/document-validator.js +0 -529
- package/dist/validation/document-validator.js.map +0 -1
- package/dist/vectorize/document-serializer.d.ts +0 -119
- package/dist/vectorize/document-serializer.d.ts.map +0 -1
- package/dist/vectorize/document-serializer.js +0 -320
- package/dist/vectorize/document-serializer.js.map +0 -1
- package/dist/wire/auth/index.d.ts +0 -5
- package/dist/wire/auth/index.d.ts.map +0 -1
- package/dist/wire/auth/index.js +0 -5
- package/dist/wire/auth/index.js.map +0 -1
- package/dist/wire/auth/scram.d.ts +0 -160
- package/dist/wire/auth/scram.d.ts.map +0 -1
- package/dist/wire/auth/scram.js +0 -425
- package/dist/wire/auth/scram.js.map +0 -1
- package/dist/wire/backend/interface.d.ts +0 -168
- package/dist/wire/backend/interface.d.ts.map +0 -1
- package/dist/wire/backend/interface.js +0 -10
- package/dist/wire/backend/interface.js.map +0 -1
- package/dist/wire/backend/local-sqlite.d.ts +0 -89
- package/dist/wire/backend/local-sqlite.d.ts.map +0 -1
- package/dist/wire/backend/local-sqlite.js +0 -1002
- package/dist/wire/backend/local-sqlite.js.map +0 -1
- package/dist/wire/backend/query-router.d.ts +0 -197
- package/dist/wire/backend/query-router.d.ts.map +0 -1
- package/dist/wire/backend/query-router.js +0 -590
- package/dist/wire/backend/query-router.js.map +0 -1
- package/dist/wire/backend/validation.d.ts +0 -26
- package/dist/wire/backend/validation.d.ts.map +0 -1
- package/dist/wire/backend/validation.js +0 -79
- package/dist/wire/backend/validation.js.map +0 -1
- package/dist/wire/backend/workers-proxy.d.ts +0 -95
- package/dist/wire/backend/workers-proxy.d.ts.map +0 -1
- package/dist/wire/backend/workers-proxy.js +0 -429
- package/dist/wire/backend/workers-proxy.js.map +0 -1
- package/dist/wire/commands/admin.d.ts +0 -49
- package/dist/wire/commands/admin.d.ts.map +0 -1
- package/dist/wire/commands/admin.js +0 -272
- package/dist/wire/commands/admin.js.map +0 -1
- package/dist/wire/commands/aggregate.d.ts +0 -15
- package/dist/wire/commands/aggregate.d.ts.map +0 -1
- package/dist/wire/commands/aggregate.js +0 -98
- package/dist/wire/commands/aggregate.js.map +0 -1
- package/dist/wire/commands/auth.d.ts +0 -58
- package/dist/wire/commands/auth.d.ts.map +0 -1
- package/dist/wire/commands/auth.js +0 -158
- package/dist/wire/commands/auth.js.map +0 -1
- package/dist/wire/commands/crud.d.ts +0 -49
- package/dist/wire/commands/crud.d.ts.map +0 -1
- package/dist/wire/commands/crud.js +0 -336
- package/dist/wire/commands/crud.js.map +0 -1
- package/dist/wire/commands/hello.d.ts +0 -35
- package/dist/wire/commands/hello.d.ts.map +0 -1
- package/dist/wire/commands/hello.js +0 -204
- package/dist/wire/commands/hello.js.map +0 -1
- package/dist/wire/commands/index.d.ts +0 -24
- package/dist/wire/commands/index.d.ts.map +0 -1
- package/dist/wire/commands/index.js +0 -145
- package/dist/wire/commands/index.js.map +0 -1
- package/dist/wire/commands/router.d.ts +0 -46
- package/dist/wire/commands/router.d.ts.map +0 -1
- package/dist/wire/commands/router.js +0 -151
- package/dist/wire/commands/router.js.map +0 -1
- package/dist/wire/commands/types.d.ts +0 -51
- package/dist/wire/commands/types.d.ts.map +0 -1
- package/dist/wire/commands/types.js +0 -15
- package/dist/wire/commands/types.js.map +0 -1
- package/dist/wire/index.d.ts +0 -15
- package/dist/wire/index.d.ts.map +0 -1
- package/dist/wire/index.js +0 -19
- package/dist/wire/index.js.map +0 -1
- package/dist/wire/message.d.ts +0 -49
- package/dist/wire/message.d.ts.map +0 -1
- package/dist/wire/message.js +0 -299
- package/dist/wire/message.js.map +0 -1
- package/dist/wire/server.d.ts +0 -145
- package/dist/wire/server.d.ts.map +0 -1
- package/dist/wire/server.js +0 -284
- package/dist/wire/server.js.map +0 -1
- package/dist/wire/types.d.ts +0 -140
- package/dist/wire/types.d.ts.map +0 -1
- package/dist/wire/types.js +0 -64
- package/dist/wire/types.js.map +0 -1
- package/dist/worker.d.ts.map +0 -1
|
@@ -0,0 +1,1331 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectId - MongoDB-compatible 12-byte unique identifier
|
|
3
|
+
*
|
|
4
|
+
* Structure (12 bytes = 24 hex characters):
|
|
5
|
+
* - 4 bytes: Unix timestamp (seconds since epoch)
|
|
6
|
+
* - 5 bytes: Random value (generated once per process)
|
|
7
|
+
* - 3 bytes: Incrementing counter (initialized to random value)
|
|
8
|
+
*
|
|
9
|
+
* Compatible with MongoDB BSON ObjectId specification.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Type guard for ObjectId-like values
|
|
13
|
+
*/
|
|
14
|
+
type ObjectIdLike = ObjectId | string | Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Input types accepted by ObjectId constructor
|
|
17
|
+
*/
|
|
18
|
+
type ObjectIdInput = ObjectIdLike | null | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* ObjectId class - MongoDB-compatible unique identifier
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Generate new ObjectId
|
|
25
|
+
* const id = new ObjectId()
|
|
26
|
+
*
|
|
27
|
+
* // Create from hex string
|
|
28
|
+
* const id2 = ObjectId.createFromHexString('507f1f77bcf86cd799439011')
|
|
29
|
+
*
|
|
30
|
+
* // Get timestamp
|
|
31
|
+
* const timestamp = id.getTimestamp()
|
|
32
|
+
*
|
|
33
|
+
* // Compare ObjectIds
|
|
34
|
+
* id.equals(id2) // false
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare class ObjectId {
|
|
38
|
+
/** BSON type identifier for serialization compatibility */
|
|
39
|
+
readonly _bsontype: "ObjectId";
|
|
40
|
+
/** The raw 12-byte buffer containing the ObjectId data */
|
|
41
|
+
readonly id: Uint8Array;
|
|
42
|
+
/** Cached hex string representation (computed lazily) */
|
|
43
|
+
private _hexString;
|
|
44
|
+
/**
|
|
45
|
+
* Create a new ObjectId
|
|
46
|
+
*
|
|
47
|
+
* @param input - Optional: hex string, Uint8Array, or another ObjectId.
|
|
48
|
+
* If omitted, generates a new unique ObjectId.
|
|
49
|
+
* @throws {TypeError} If input is invalid
|
|
50
|
+
*/
|
|
51
|
+
constructor(input?: ObjectIdInput);
|
|
52
|
+
/**
|
|
53
|
+
* Generate a new 12-byte ObjectId buffer
|
|
54
|
+
* Structure: 4-byte timestamp | 5-byte random | 3-byte counter
|
|
55
|
+
*/
|
|
56
|
+
private generate;
|
|
57
|
+
/**
|
|
58
|
+
* Get the timestamp component of this ObjectId as a Date
|
|
59
|
+
*
|
|
60
|
+
* @returns Date object representing when this ObjectId was generated
|
|
61
|
+
*/
|
|
62
|
+
getTimestamp(): Date;
|
|
63
|
+
/**
|
|
64
|
+
* Get the generation time as Unix timestamp (seconds)
|
|
65
|
+
*/
|
|
66
|
+
getGenerationTime(): number;
|
|
67
|
+
/**
|
|
68
|
+
* Return the ObjectId as a 24-character lowercase hex string
|
|
69
|
+
*/
|
|
70
|
+
toHexString(): string;
|
|
71
|
+
/**
|
|
72
|
+
* String representation of the ObjectId (same as toHexString)
|
|
73
|
+
*/
|
|
74
|
+
toString(): string;
|
|
75
|
+
/**
|
|
76
|
+
* JSON serialization - returns hex string
|
|
77
|
+
* This allows ObjectIds to serialize naturally in JSON.stringify()
|
|
78
|
+
*/
|
|
79
|
+
toJSON(): string;
|
|
80
|
+
/**
|
|
81
|
+
* Compare this ObjectId to another value for equality
|
|
82
|
+
*
|
|
83
|
+
* @param other - ObjectId, hex string, or null/undefined to compare
|
|
84
|
+
* @returns true if the ObjectIds are equal, false otherwise
|
|
85
|
+
*/
|
|
86
|
+
equals(other: ObjectId | string | null | undefined): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Primitive value conversion (returns hex string)
|
|
89
|
+
*/
|
|
90
|
+
valueOf(): string;
|
|
91
|
+
/**
|
|
92
|
+
* Symbol.toStringTag for better debugging output
|
|
93
|
+
*/
|
|
94
|
+
get [Symbol.toStringTag](): string;
|
|
95
|
+
/**
|
|
96
|
+
* Create an ObjectId from a 24-character hex string
|
|
97
|
+
*
|
|
98
|
+
* @param hexString - 24-character hex string
|
|
99
|
+
* @returns New ObjectId instance
|
|
100
|
+
* @throws {TypeError} If hexString is invalid
|
|
101
|
+
*/
|
|
102
|
+
static createFromHexString(hexString: string): ObjectId;
|
|
103
|
+
/**
|
|
104
|
+
* Create an ObjectId with a specific timestamp
|
|
105
|
+
* Useful for range queries on _id fields
|
|
106
|
+
*
|
|
107
|
+
* @param time - Unix timestamp in seconds
|
|
108
|
+
* @returns New ObjectId with the given timestamp and zeroed remaining bytes
|
|
109
|
+
*/
|
|
110
|
+
static createFromTime(time: number): ObjectId;
|
|
111
|
+
/**
|
|
112
|
+
* Generate a new ObjectId (factory method, equivalent to new ObjectId())
|
|
113
|
+
*
|
|
114
|
+
* @returns New unique ObjectId instance
|
|
115
|
+
*/
|
|
116
|
+
static generate(): ObjectId;
|
|
117
|
+
/**
|
|
118
|
+
* Check if a value is a valid ObjectId or ObjectId hex string
|
|
119
|
+
*
|
|
120
|
+
* @param value - Value to check
|
|
121
|
+
* @returns true if valid ObjectId or 24-char hex string
|
|
122
|
+
*/
|
|
123
|
+
static isValid(value: unknown): value is ObjectId | string;
|
|
124
|
+
/**
|
|
125
|
+
* Check if a string is a valid 24-character hex string
|
|
126
|
+
*/
|
|
127
|
+
private static isValidHex;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Consolidated RPC Types
|
|
132
|
+
*
|
|
133
|
+
* This module contains all shared RPC-related type definitions used across:
|
|
134
|
+
* - src/rpc/rpc-target.ts
|
|
135
|
+
* - src/rpc/rpc-client.ts
|
|
136
|
+
* - src/rpc/endpoint.ts
|
|
137
|
+
* - src/rpc/index.ts
|
|
138
|
+
* - src/wire/backend/workers-proxy.ts
|
|
139
|
+
*/
|
|
140
|
+
/**
|
|
141
|
+
* Durable Object namespace interface
|
|
142
|
+
*/
|
|
143
|
+
interface DurableObjectNamespace {
|
|
144
|
+
idFromName(name: string): DurableObjectId;
|
|
145
|
+
get(id: DurableObjectId): DurableObjectStub;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Durable Object ID interface
|
|
149
|
+
*/
|
|
150
|
+
interface DurableObjectId {
|
|
151
|
+
toString(): string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Durable Object stub interface
|
|
155
|
+
*/
|
|
156
|
+
interface DurableObjectStub {
|
|
157
|
+
fetch(request: Request | string, init?: RequestInit): Promise<Response>;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Base Mondo environment bindings interface
|
|
161
|
+
*/
|
|
162
|
+
interface MondoEnv {
|
|
163
|
+
MONDO_DATABASE: DurableObjectNamespace;
|
|
164
|
+
/** Optional Worker Loader for $function support (closed beta) */
|
|
165
|
+
LOADER?: WorkerLoader;
|
|
166
|
+
/** Optional auth token for RPC endpoint */
|
|
167
|
+
MONDO_AUTH_TOKEN?: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Worker Loader interface for dynamic worker creation
|
|
171
|
+
* (Closed beta feature for $function operator support)
|
|
172
|
+
*/
|
|
173
|
+
interface WorkerLoader {
|
|
174
|
+
get(id: string, getCode: () => Promise<WorkerCode>): WorkerStub;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Worker code specification for dynamic workers
|
|
178
|
+
*/
|
|
179
|
+
interface WorkerCode {
|
|
180
|
+
compatibilityDate: string;
|
|
181
|
+
compatibilityFlags?: string[];
|
|
182
|
+
mainModule: string;
|
|
183
|
+
modules: Record<string, string | {
|
|
184
|
+
js: string;
|
|
185
|
+
} | {
|
|
186
|
+
text: string;
|
|
187
|
+
}>;
|
|
188
|
+
globalOutbound?: null;
|
|
189
|
+
env?: Record<string, unknown>;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Worker stub interface for dynamic workers
|
|
193
|
+
*/
|
|
194
|
+
interface WorkerStub {
|
|
195
|
+
fetch?(request: Request): Promise<Response>;
|
|
196
|
+
getEntrypoint?(name?: string): WorkerEntrypoint$1;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Worker entrypoint interface
|
|
200
|
+
*/
|
|
201
|
+
interface WorkerEntrypoint$1 {
|
|
202
|
+
fetch(request: Request): Promise<Response>;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* RPC request structure for Workers RPC (capnweb-style)
|
|
206
|
+
* Used by rpc-target.ts and rpc-client.ts
|
|
207
|
+
*/
|
|
208
|
+
interface RpcRequest {
|
|
209
|
+
id?: string;
|
|
210
|
+
method: string;
|
|
211
|
+
params: unknown[];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* RPC response structure for Workers RPC
|
|
215
|
+
*/
|
|
216
|
+
interface RpcResponse {
|
|
217
|
+
id?: string;
|
|
218
|
+
result?: unknown;
|
|
219
|
+
error?: string;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Batch response structure
|
|
223
|
+
*/
|
|
224
|
+
interface BatchResponse {
|
|
225
|
+
results: RpcResponse[];
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* RPC request structure for HTTP endpoint
|
|
229
|
+
* Used by endpoint.ts and workers-proxy.ts
|
|
230
|
+
*/
|
|
231
|
+
interface HttpRpcRequest {
|
|
232
|
+
method: string;
|
|
233
|
+
db?: string;
|
|
234
|
+
collection?: string;
|
|
235
|
+
filter?: Record<string, unknown>;
|
|
236
|
+
update?: Record<string, unknown>;
|
|
237
|
+
document?: Record<string, unknown>;
|
|
238
|
+
documents?: Record<string, unknown>[];
|
|
239
|
+
pipeline?: Record<string, unknown>[];
|
|
240
|
+
options?: Record<string, unknown>;
|
|
241
|
+
field?: string;
|
|
242
|
+
query?: Record<string, unknown>;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* HTTP RPC success response
|
|
246
|
+
*/
|
|
247
|
+
interface HttpRpcSuccessResponse {
|
|
248
|
+
ok: 1;
|
|
249
|
+
result: unknown;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* HTTP RPC error response
|
|
253
|
+
*/
|
|
254
|
+
interface HttpRpcErrorResponse {
|
|
255
|
+
ok: 0;
|
|
256
|
+
error: string;
|
|
257
|
+
code: number;
|
|
258
|
+
codeName?: string;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* HTTP RPC response (union type)
|
|
262
|
+
*/
|
|
263
|
+
type HttpRpcResponse = HttpRpcSuccessResponse | HttpRpcErrorResponse;
|
|
264
|
+
/**
|
|
265
|
+
* RPC message types for internal operations
|
|
266
|
+
*/
|
|
267
|
+
declare enum MessageType {
|
|
268
|
+
INSERT_ONE = "insertOne",
|
|
269
|
+
INSERT_MANY = "insertMany",
|
|
270
|
+
FIND_ONE = "findOne",
|
|
271
|
+
FIND = "find",
|
|
272
|
+
UPDATE_ONE = "updateOne",
|
|
273
|
+
UPDATE_MANY = "updateMany",
|
|
274
|
+
DELETE_ONE = "deleteOne",
|
|
275
|
+
DELETE_MANY = "deleteMany",
|
|
276
|
+
AGGREGATE = "aggregate",
|
|
277
|
+
COUNT = "count",
|
|
278
|
+
DISTINCT = "distinct",
|
|
279
|
+
CREATE_INDEX = "createIndex",
|
|
280
|
+
DROP_INDEX = "dropIndex",
|
|
281
|
+
LIST_INDEXES = "listIndexes",
|
|
282
|
+
CREATE_COLLECTION = "createCollection",
|
|
283
|
+
DROP_COLLECTION = "dropCollection",
|
|
284
|
+
LIST_COLLECTIONS = "listCollections",
|
|
285
|
+
STATS = "stats",
|
|
286
|
+
HEALTH = "health"
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Legacy RPC request interface (message-based)
|
|
290
|
+
*/
|
|
291
|
+
interface LegacyRpcRequest {
|
|
292
|
+
type: MessageType;
|
|
293
|
+
collection?: string;
|
|
294
|
+
payload: unknown;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Legacy RPC response interface
|
|
298
|
+
*/
|
|
299
|
+
interface LegacyRpcResponse<T = unknown> {
|
|
300
|
+
success: boolean;
|
|
301
|
+
data?: T;
|
|
302
|
+
error?: {
|
|
303
|
+
code: string;
|
|
304
|
+
message: string;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Database reference returned by db() method
|
|
309
|
+
*/
|
|
310
|
+
interface DatabaseRef {
|
|
311
|
+
name: string;
|
|
312
|
+
stub: DurableObjectStub;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Collection reference returned by collection() method
|
|
316
|
+
*/
|
|
317
|
+
interface CollectionRef {
|
|
318
|
+
dbName: string;
|
|
319
|
+
collectionName: string;
|
|
320
|
+
stub: DurableObjectStub;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Batched executor options
|
|
324
|
+
*/
|
|
325
|
+
interface BatchedExecutorOptions {
|
|
326
|
+
maxBatchSize?: number;
|
|
327
|
+
flushInterval?: number;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Pipelined operation reference
|
|
331
|
+
*/
|
|
332
|
+
interface PipelineOp {
|
|
333
|
+
id: string;
|
|
334
|
+
method: string;
|
|
335
|
+
params: unknown[];
|
|
336
|
+
dependencies: string[];
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* RPC client options
|
|
340
|
+
*/
|
|
341
|
+
interface RpcClientOptions {
|
|
342
|
+
/** Enable automatic reconnection */
|
|
343
|
+
autoReconnect?: boolean;
|
|
344
|
+
/** Maximum retry attempts */
|
|
345
|
+
maxRetries?: number;
|
|
346
|
+
/** Reconnect interval in milliseconds */
|
|
347
|
+
reconnectInterval?: number;
|
|
348
|
+
/** Enable request deduplication */
|
|
349
|
+
deduplicate?: boolean;
|
|
350
|
+
/** Deduplication TTL in milliseconds */
|
|
351
|
+
deduplicationTtl?: number;
|
|
352
|
+
/** Request timeout in milliseconds */
|
|
353
|
+
timeout?: number;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Options for request deduplicator
|
|
357
|
+
*/
|
|
358
|
+
interface DeduplicatorOptions {
|
|
359
|
+
ttl?: number;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Event handler type
|
|
363
|
+
*/
|
|
364
|
+
type EventHandler<T = unknown> = (event: T) => void;
|
|
365
|
+
/**
|
|
366
|
+
* Reconnect event data
|
|
367
|
+
*/
|
|
368
|
+
interface ReconnectEvent {
|
|
369
|
+
attempt: number;
|
|
370
|
+
lastError?: Error;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* RPC Handler interface
|
|
374
|
+
*/
|
|
375
|
+
interface RpcHandler {
|
|
376
|
+
fetch(request: Request): Promise<Response>;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* MongoDB-compatible error codes
|
|
380
|
+
*/
|
|
381
|
+
declare const ErrorCode: {
|
|
382
|
+
readonly OK: 0;
|
|
383
|
+
readonly INTERNAL_ERROR: 1;
|
|
384
|
+
readonly BAD_VALUE: 2;
|
|
385
|
+
readonly NO_SUCH_KEY: 4;
|
|
386
|
+
readonly GRAPH_CONTAINS_CYCLE: 5;
|
|
387
|
+
readonly HOST_UNREACHABLE: 6;
|
|
388
|
+
readonly HOST_NOT_FOUND: 7;
|
|
389
|
+
readonly UNKNOWN_ERROR: 8;
|
|
390
|
+
readonly FAILED_TO_PARSE: 9;
|
|
391
|
+
readonly CANNOT_MUTATE_OBJECT: 10;
|
|
392
|
+
readonly USER_NOT_FOUND: 11;
|
|
393
|
+
readonly UNSUPPORTED_FORMAT: 12;
|
|
394
|
+
readonly UNAUTHORIZED: 13;
|
|
395
|
+
readonly TYPE_MISMATCH: 14;
|
|
396
|
+
readonly OVERFLOW: 15;
|
|
397
|
+
readonly INVALID_LENGTH: 16;
|
|
398
|
+
readonly PROTOCOL_ERROR: 17;
|
|
399
|
+
readonly AUTHENTICATION_FAILED: 18;
|
|
400
|
+
readonly CANNOT_REUSE_OBJECT: 19;
|
|
401
|
+
readonly ILLEGAL_OPERATION: 20;
|
|
402
|
+
readonly EMPTY_ARRAY_OPERATION: 21;
|
|
403
|
+
readonly INVALID_BSON: 22;
|
|
404
|
+
readonly ALREADY_INITIALIZED: 23;
|
|
405
|
+
readonly LOCK_TIMEOUT: 24;
|
|
406
|
+
readonly REMOTE_VALIDATION_ERROR: 25;
|
|
407
|
+
readonly NAMESPACE_NOT_FOUND: 26;
|
|
408
|
+
readonly INDEX_NOT_FOUND: 27;
|
|
409
|
+
readonly PATH_NOT_VIABLE: 28;
|
|
410
|
+
readonly NON_EXISTENT_PATH: 29;
|
|
411
|
+
readonly INVALID_PATH: 30;
|
|
412
|
+
readonly ROLE_NOT_FOUND: 31;
|
|
413
|
+
readonly ROLES_NOT_RELATED: 32;
|
|
414
|
+
readonly PRIVILEGE_NOT_FOUND: 33;
|
|
415
|
+
readonly CANNOT_BACKFILL_ARRAY: 34;
|
|
416
|
+
readonly COMMAND_NOT_FOUND: 59;
|
|
417
|
+
readonly DATABASE_NOT_FOUND: 60;
|
|
418
|
+
readonly LOCATION_ERROR: 16755;
|
|
419
|
+
readonly DUPLICATE_KEY: 11000;
|
|
420
|
+
};
|
|
421
|
+
type ErrorCodeValue = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
422
|
+
/**
|
|
423
|
+
* Get the code name for an error code
|
|
424
|
+
*/
|
|
425
|
+
declare function getErrorCodeName(code: number): string;
|
|
426
|
+
/**
|
|
427
|
+
* Create a success response (Document format for wire protocol)
|
|
428
|
+
*/
|
|
429
|
+
declare function successResponse(data?: Record<string, unknown>): Record<string, unknown>;
|
|
430
|
+
/**
|
|
431
|
+
* Create an error response (Document format for wire protocol)
|
|
432
|
+
*/
|
|
433
|
+
declare function errorResponse(code: number, errmsg: string, codeName?: string): Record<string, unknown>;
|
|
434
|
+
/**
|
|
435
|
+
* Create a legacy success response
|
|
436
|
+
*/
|
|
437
|
+
declare function legacySuccessResponse<T>(data: T): LegacyRpcResponse<T>;
|
|
438
|
+
/**
|
|
439
|
+
* Create a legacy error response
|
|
440
|
+
*/
|
|
441
|
+
declare function legacyErrorResponse(code: string, message: string): LegacyRpcResponse<never>;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Index specification type
|
|
445
|
+
* Keys are field names, values are 1 (ascending), -1 (descending), or 'text' for text indexes
|
|
446
|
+
*/
|
|
447
|
+
type IndexSpec = Record<string, 1 | -1 | 'text'>;
|
|
448
|
+
/**
|
|
449
|
+
* Options for creating an index
|
|
450
|
+
*/
|
|
451
|
+
interface CreateIndexOptions {
|
|
452
|
+
/** Name of the index (auto-generated if not provided) */
|
|
453
|
+
name?: string;
|
|
454
|
+
/** Create a unique index */
|
|
455
|
+
unique?: boolean;
|
|
456
|
+
/** Create a sparse index (only index documents with the field) */
|
|
457
|
+
sparse?: boolean;
|
|
458
|
+
/** Create index in background */
|
|
459
|
+
background?: boolean;
|
|
460
|
+
/** Partial filter expression for partial indexes */
|
|
461
|
+
partialFilterExpression?: Record<string, unknown>;
|
|
462
|
+
/** TTL in seconds for TTL indexes */
|
|
463
|
+
expireAfterSeconds?: number;
|
|
464
|
+
/** Weights for text index fields (higher weight = more important) */
|
|
465
|
+
weights?: Record<string, number>;
|
|
466
|
+
/** Default language for text index */
|
|
467
|
+
default_language?: string;
|
|
468
|
+
/** Field containing document language override */
|
|
469
|
+
language_override?: string;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Result from createIndex operation
|
|
473
|
+
*/
|
|
474
|
+
interface CreateIndexResult {
|
|
475
|
+
ok: 1;
|
|
476
|
+
numIndexesBefore: number;
|
|
477
|
+
numIndexesAfter: number;
|
|
478
|
+
createdCollectionAutomatically: boolean;
|
|
479
|
+
note?: string;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Index information returned by listIndexes
|
|
483
|
+
*/
|
|
484
|
+
interface IndexInfo {
|
|
485
|
+
/** Index name */
|
|
486
|
+
name: string;
|
|
487
|
+
/** Index key specification */
|
|
488
|
+
key: IndexSpec;
|
|
489
|
+
/** Version (always 2 for SQLite backed indexes) */
|
|
490
|
+
v: number;
|
|
491
|
+
/** Whether this is a unique index */
|
|
492
|
+
unique?: boolean;
|
|
493
|
+
/** Whether this is a sparse index */
|
|
494
|
+
sparse?: boolean;
|
|
495
|
+
/** Partial filter expression */
|
|
496
|
+
partialFilterExpression?: Record<string, unknown>;
|
|
497
|
+
/** TTL in seconds */
|
|
498
|
+
expireAfterSeconds?: number;
|
|
499
|
+
/** Weights for text index fields */
|
|
500
|
+
weights?: Record<string, number>;
|
|
501
|
+
/** Default language for text index */
|
|
502
|
+
default_language?: string;
|
|
503
|
+
/** Whether this is a text index */
|
|
504
|
+
textIndexVersion?: number;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Result from dropIndex operation
|
|
508
|
+
*/
|
|
509
|
+
interface DropIndexResult {
|
|
510
|
+
ok: 1;
|
|
511
|
+
nIndexesWas: number;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Document type - any JSON-serializable object with optional _id
|
|
515
|
+
*/
|
|
516
|
+
interface Document {
|
|
517
|
+
_id?: string | ObjectId;
|
|
518
|
+
[key: string]: unknown;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Insert result
|
|
522
|
+
*/
|
|
523
|
+
interface InsertOneResult {
|
|
524
|
+
acknowledged: boolean;
|
|
525
|
+
insertedId: string;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Delete result
|
|
529
|
+
*/
|
|
530
|
+
interface DeleteResult {
|
|
531
|
+
acknowledged: boolean;
|
|
532
|
+
deletedCount: number;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Update result
|
|
536
|
+
*/
|
|
537
|
+
interface UpdateResult {
|
|
538
|
+
acknowledged: boolean;
|
|
539
|
+
matchedCount: number;
|
|
540
|
+
modifiedCount: number;
|
|
541
|
+
/** Number of documents upserted (only present when upsert: true was used) */
|
|
542
|
+
upsertedCount?: number;
|
|
543
|
+
/** ID of the upserted document (only present when a document was upserted) */
|
|
544
|
+
upsertedId?: string;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* SQLite Schema Management for MondoDB
|
|
549
|
+
*
|
|
550
|
+
* This module handles the initialization and management of SQLite tables
|
|
551
|
+
* for MongoDB-compatible document storage in Cloudflare Durable Objects.
|
|
552
|
+
*
|
|
553
|
+
* UNIFIED SCHEMA TYPES:
|
|
554
|
+
* This module serves as the single source of truth for all schema-related types
|
|
555
|
+
* used by both IndexManager and MondoDatabase.
|
|
556
|
+
*/
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Current schema version - derived from migrations module
|
|
560
|
+
*/
|
|
561
|
+
declare const SCHEMA_VERSION: number;
|
|
562
|
+
/**
|
|
563
|
+
* Table definitions for the schema (exported for reference/testing)
|
|
564
|
+
*
|
|
565
|
+
* UNIFIED SCHEMA: This schema supports both MondoDatabase and IndexManager:
|
|
566
|
+
* - collections table: stores collection metadata including indexes JSON
|
|
567
|
+
* - documents table: stores documents with _id as the document identifier
|
|
568
|
+
*
|
|
569
|
+
* Note: The actual table creation is handled by migrations.ts.
|
|
570
|
+
* These definitions are kept in sync for reference and testing.
|
|
571
|
+
*/
|
|
572
|
+
declare const SCHEMA_TABLES: {
|
|
573
|
+
readonly collections: {
|
|
574
|
+
readonly name: "collections";
|
|
575
|
+
readonly sql: string;
|
|
576
|
+
};
|
|
577
|
+
readonly documents: {
|
|
578
|
+
readonly name: "documents";
|
|
579
|
+
readonly sql: string;
|
|
580
|
+
};
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* Interface for SQL query result with parameter binding
|
|
584
|
+
* Used by MondoDatabase with Cloudflare's native SQL interface
|
|
585
|
+
*/
|
|
586
|
+
interface SqlQueryResult {
|
|
587
|
+
toArray(): unknown[];
|
|
588
|
+
run(): void;
|
|
589
|
+
bind(...params: unknown[]): SqlQueryResult;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Interface for Cloudflare Durable Object SQL storage
|
|
593
|
+
* Used by MondoDatabase for direct SQL execution
|
|
594
|
+
*/
|
|
595
|
+
interface SqlStorage {
|
|
596
|
+
exec(sql: string, ...params: unknown[]): SqlQueryResult;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Interface for Cloudflare Durable Object storage
|
|
600
|
+
* Used by MondoDatabase and SchemaManager
|
|
601
|
+
*/
|
|
602
|
+
interface DurableObjectStorage {
|
|
603
|
+
sql: SqlStorage;
|
|
604
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
605
|
+
put(key: string, value: unknown): Promise<void>;
|
|
606
|
+
/**
|
|
607
|
+
* Execute a synchronous callback wrapped in a transaction.
|
|
608
|
+
* If the callback throws, the transaction is rolled back.
|
|
609
|
+
* Only available for SQLite-backed Durable Objects.
|
|
610
|
+
*/
|
|
611
|
+
transactionSync<T>(callback: () => T): T;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Interface for SQL prepared statement
|
|
615
|
+
* Used by IndexManager for prepared statement execution
|
|
616
|
+
*/
|
|
617
|
+
interface SQLStatement {
|
|
618
|
+
bind(...params: unknown[]): SQLStatement;
|
|
619
|
+
run(): void;
|
|
620
|
+
first<T = unknown>(): T | null;
|
|
621
|
+
all<T = unknown>(): T[];
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Interface for SQLite-compatible storage with SQL execution
|
|
625
|
+
* Used by IndexManager for prepared statement-based operations
|
|
626
|
+
*
|
|
627
|
+
* This is an alternative interface to DurableObjectStorage that provides
|
|
628
|
+
* a prepare() method for creating prepared statements, which is useful
|
|
629
|
+
* for operations that need to retrieve results or bind parameters.
|
|
630
|
+
*/
|
|
631
|
+
interface SQLStorage {
|
|
632
|
+
exec(sql: string): void;
|
|
633
|
+
prepare(sql: string): SQLStatement;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* TTL Index information with collection context
|
|
637
|
+
*/
|
|
638
|
+
interface TTLIndexInfo {
|
|
639
|
+
collectionName: string;
|
|
640
|
+
collectionId: number;
|
|
641
|
+
indexName: string;
|
|
642
|
+
field: string;
|
|
643
|
+
expireAfterSeconds: number;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* TTL metadata for tracking cleanup operations
|
|
647
|
+
*/
|
|
648
|
+
interface TTLMetadata {
|
|
649
|
+
field: string;
|
|
650
|
+
expireAfterSeconds: number;
|
|
651
|
+
lastCleanupAt?: string;
|
|
652
|
+
lastCleanupCount?: number;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Result of a TTL cleanup operation
|
|
656
|
+
*/
|
|
657
|
+
interface TTLCleanupResult {
|
|
658
|
+
ok: 1;
|
|
659
|
+
collectionsProcessed: number;
|
|
660
|
+
documentsDeleted: number;
|
|
661
|
+
errors?: string[];
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Query info for deleting expired documents
|
|
665
|
+
*/
|
|
666
|
+
interface ExpiredDocumentsQuery {
|
|
667
|
+
sql: string;
|
|
668
|
+
params: unknown[];
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Schema validation result
|
|
672
|
+
*/
|
|
673
|
+
interface SchemaValidationResult {
|
|
674
|
+
valid: boolean;
|
|
675
|
+
missingTables: string[];
|
|
676
|
+
missingIndexes: string[];
|
|
677
|
+
errors: string[];
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* SchemaManager handles SQLite schema initialization and migrations
|
|
681
|
+
*/
|
|
682
|
+
declare class SchemaManager {
|
|
683
|
+
private storage;
|
|
684
|
+
constructor(storage: DurableObjectStorage);
|
|
685
|
+
/**
|
|
686
|
+
* Initialize the schema, running migrations if needed
|
|
687
|
+
*/
|
|
688
|
+
initializeSchema(): Promise<void>;
|
|
689
|
+
/**
|
|
690
|
+
* Validate that the schema is properly initialized
|
|
691
|
+
* Returns true if all required tables exist
|
|
692
|
+
*/
|
|
693
|
+
validateSchema(): Promise<boolean>;
|
|
694
|
+
/**
|
|
695
|
+
* Detailed schema validation with specific error information
|
|
696
|
+
*/
|
|
697
|
+
validateSchemaDetailed(): Promise<SchemaValidationResult>;
|
|
698
|
+
/**
|
|
699
|
+
* Get the current schema version from storage
|
|
700
|
+
*/
|
|
701
|
+
getSchemaVersion(): Promise<number>;
|
|
702
|
+
/**
|
|
703
|
+
* Check if schema needs migration
|
|
704
|
+
*/
|
|
705
|
+
needsMigration(): Promise<boolean>;
|
|
706
|
+
/**
|
|
707
|
+
* Get list of pending migrations
|
|
708
|
+
*/
|
|
709
|
+
getPendingMigrations(): Promise<number[]>;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Types for aggregation pipeline stages
|
|
714
|
+
*/
|
|
715
|
+
|
|
716
|
+
type PipelineStage = {
|
|
717
|
+
$match: Record<string, unknown>;
|
|
718
|
+
} | {
|
|
719
|
+
$project: Record<string, unknown>;
|
|
720
|
+
} | {
|
|
721
|
+
$group: GroupStage;
|
|
722
|
+
} | {
|
|
723
|
+
$sort: Record<string, 1 | -1>;
|
|
724
|
+
} | {
|
|
725
|
+
$limit: number;
|
|
726
|
+
} | {
|
|
727
|
+
$skip: number;
|
|
728
|
+
} | {
|
|
729
|
+
$count: string;
|
|
730
|
+
} | {
|
|
731
|
+
$lookup: LookupStage;
|
|
732
|
+
} | {
|
|
733
|
+
$unwind: string | UnwindStage;
|
|
734
|
+
} | {
|
|
735
|
+
$addFields: Record<string, unknown>;
|
|
736
|
+
} | {
|
|
737
|
+
$bucket: BucketStage;
|
|
738
|
+
} | {
|
|
739
|
+
$facet: Record<string, PipelineStage[]>;
|
|
740
|
+
} | {
|
|
741
|
+
$search: SearchStage;
|
|
742
|
+
} | {
|
|
743
|
+
$vectorSearch: VectorSearchPipelineStage;
|
|
744
|
+
};
|
|
745
|
+
interface SearchStage {
|
|
746
|
+
index?: string;
|
|
747
|
+
text?: {
|
|
748
|
+
query: string;
|
|
749
|
+
path?: string | string[];
|
|
750
|
+
};
|
|
751
|
+
phrase?: {
|
|
752
|
+
query: string;
|
|
753
|
+
path?: string | string[];
|
|
754
|
+
};
|
|
755
|
+
wildcard?: {
|
|
756
|
+
query: string;
|
|
757
|
+
path?: string | string[];
|
|
758
|
+
};
|
|
759
|
+
compound?: {
|
|
760
|
+
must?: SearchStage[];
|
|
761
|
+
should?: SearchStage[];
|
|
762
|
+
mustNot?: SearchStage[];
|
|
763
|
+
filter?: SearchStage[];
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
interface GroupStage {
|
|
767
|
+
_id: null | string | Record<string, string>;
|
|
768
|
+
[accumulator: string]: unknown;
|
|
769
|
+
}
|
|
770
|
+
interface LookupStage {
|
|
771
|
+
from: string;
|
|
772
|
+
localField?: string;
|
|
773
|
+
foreignField?: string;
|
|
774
|
+
as: string;
|
|
775
|
+
let?: Record<string, string>;
|
|
776
|
+
pipeline?: PipelineStage[];
|
|
777
|
+
}
|
|
778
|
+
interface UnwindStage {
|
|
779
|
+
path: string;
|
|
780
|
+
includeArrayIndex?: string;
|
|
781
|
+
preserveNullAndEmptyArrays?: boolean;
|
|
782
|
+
}
|
|
783
|
+
interface BucketStage {
|
|
784
|
+
groupBy: string;
|
|
785
|
+
boundaries: number[];
|
|
786
|
+
default?: string;
|
|
787
|
+
output?: Record<string, unknown>;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* $vectorSearch pipeline stage for vector similarity search
|
|
791
|
+
* Compatible with MongoDB Atlas vector search
|
|
792
|
+
*/
|
|
793
|
+
interface VectorSearchPipelineStage {
|
|
794
|
+
/** Name of the vector search index */
|
|
795
|
+
index: string;
|
|
796
|
+
/** Path to the vector field in documents */
|
|
797
|
+
path: string;
|
|
798
|
+
/** The query vector to search for */
|
|
799
|
+
queryVector: number[];
|
|
800
|
+
/** Number of candidates to consider (default: limit * 10) */
|
|
801
|
+
numCandidates?: number;
|
|
802
|
+
/** Maximum number of results to return */
|
|
803
|
+
limit: number;
|
|
804
|
+
/** Optional filter to apply before vector search */
|
|
805
|
+
filter?: Record<string, unknown>;
|
|
806
|
+
/** Whether to perform exact search (slower but more accurate) */
|
|
807
|
+
exact?: boolean;
|
|
808
|
+
/** Field name to store the similarity score (default: 'score') */
|
|
809
|
+
scoreField?: string;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* MondoDatabase - MongoDB-compatible Durable Object
|
|
814
|
+
*
|
|
815
|
+
* This is the main Durable Object class that provides MongoDB-compatible
|
|
816
|
+
* operations backed by Cloudflare's SQLite storage.
|
|
817
|
+
*/
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* Interface for Durable Object state
|
|
821
|
+
*/
|
|
822
|
+
interface DurableObjectState {
|
|
823
|
+
storage: DurableObjectStorage;
|
|
824
|
+
blockConcurrencyWhile<T>(callback: () => Promise<T>): void;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Interface for Cloudflare Environment bindings
|
|
828
|
+
*/
|
|
829
|
+
interface Env {
|
|
830
|
+
/** Optional worker-loader binding for $function support */
|
|
831
|
+
LOADER?: WorkerLoader;
|
|
832
|
+
/** Enable debug endpoints (/internal/reset, /internal/dump) - DO NOT enable in production */
|
|
833
|
+
ENABLE_DEBUG_ENDPOINTS?: string;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Result of an insertMany operation
|
|
837
|
+
* Note: This uses string[] for insertedIds (matching MongoDB's native driver behavior),
|
|
838
|
+
* while the shared InsertManyResult type uses Record<number, string> for MongoDB compatibility
|
|
839
|
+
*/
|
|
840
|
+
interface InsertManyResult {
|
|
841
|
+
acknowledged: boolean;
|
|
842
|
+
insertedCount: number;
|
|
843
|
+
insertedIds: string[];
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* MondoDatabase Durable Object
|
|
847
|
+
*
|
|
848
|
+
* Provides MongoDB-compatible document storage using Cloudflare Durable Objects
|
|
849
|
+
* with SQLite as the backing store.
|
|
850
|
+
*/
|
|
851
|
+
declare class MondoDatabase {
|
|
852
|
+
private state;
|
|
853
|
+
private env;
|
|
854
|
+
private schemaManager;
|
|
855
|
+
private initialized;
|
|
856
|
+
private mcpHandler;
|
|
857
|
+
constructor(state: DurableObjectState, env: Env);
|
|
858
|
+
/**
|
|
859
|
+
* Check if the database is initialized
|
|
860
|
+
*/
|
|
861
|
+
isInitialized(): boolean;
|
|
862
|
+
/**
|
|
863
|
+
* Get the schema manager for advanced operations
|
|
864
|
+
*/
|
|
865
|
+
getSchemaManager(): SchemaManager;
|
|
866
|
+
/**
|
|
867
|
+
* Get the underlying storage
|
|
868
|
+
*/
|
|
869
|
+
getStorage(): DurableObjectStorage;
|
|
870
|
+
/**
|
|
871
|
+
* Get or create a collection by name, returning the collection_id
|
|
872
|
+
*/
|
|
873
|
+
private getOrCreateCollection;
|
|
874
|
+
/**
|
|
875
|
+
* Get collection ID by name, returns undefined if not found
|
|
876
|
+
*/
|
|
877
|
+
private getCollectionId;
|
|
878
|
+
/**
|
|
879
|
+
* Insert a single document into a collection
|
|
880
|
+
*/
|
|
881
|
+
insertOne(collection: string, document: Document): Promise<InsertOneResult>;
|
|
882
|
+
/**
|
|
883
|
+
* Insert multiple documents into a collection
|
|
884
|
+
*/
|
|
885
|
+
insertMany(collection: string, documents: Document[]): Promise<InsertManyResult>;
|
|
886
|
+
/**
|
|
887
|
+
* Find a single document matching the query
|
|
888
|
+
*/
|
|
889
|
+
findOne(collection: string, query?: Document): Promise<Document | null>;
|
|
890
|
+
/**
|
|
891
|
+
* Find all documents matching the query
|
|
892
|
+
*/
|
|
893
|
+
find(collection: string, query?: Document): Promise<Document[]>;
|
|
894
|
+
/**
|
|
895
|
+
* Update a single document matching the filter
|
|
896
|
+
*/
|
|
897
|
+
updateOne(collection: string, filter: Document, update: {
|
|
898
|
+
$set?: Document;
|
|
899
|
+
$unset?: Record<string, unknown>;
|
|
900
|
+
}): Promise<UpdateResult>;
|
|
901
|
+
/**
|
|
902
|
+
* Delete a single document matching the filter
|
|
903
|
+
*/
|
|
904
|
+
deleteOne(collection: string, filter: Document): Promise<DeleteResult>;
|
|
905
|
+
/**
|
|
906
|
+
* Build WHERE clause from MongoDB-style query
|
|
907
|
+
* Supports: _id, simple field equality, $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $exists
|
|
908
|
+
*/
|
|
909
|
+
private buildWhereClause;
|
|
910
|
+
/**
|
|
911
|
+
* Convert a field name (possibly with dot notation) to JSON path
|
|
912
|
+
* e.g., "profile.level" -> "$.profile.level"
|
|
913
|
+
*/
|
|
914
|
+
private fieldToJsonPath;
|
|
915
|
+
/**
|
|
916
|
+
* Set a nested value in an object using dot notation path
|
|
917
|
+
*/
|
|
918
|
+
private setNestedValue;
|
|
919
|
+
/**
|
|
920
|
+
* Delete a nested value from an object using dot notation path
|
|
921
|
+
*/
|
|
922
|
+
private deleteNestedValue;
|
|
923
|
+
/**
|
|
924
|
+
* Delete multiple documents matching the filter
|
|
925
|
+
*/
|
|
926
|
+
deleteMany(collection: string, filter?: Document): Promise<DeleteResult>;
|
|
927
|
+
/**
|
|
928
|
+
* Count documents matching the filter
|
|
929
|
+
*/
|
|
930
|
+
countDocuments(collection: string, filter?: Document): Promise<number>;
|
|
931
|
+
/**
|
|
932
|
+
* Execute an aggregation pipeline on a collection
|
|
933
|
+
*
|
|
934
|
+
* Supports async execution for $function operators that require
|
|
935
|
+
* JavaScript execution via worker-loader.
|
|
936
|
+
*
|
|
937
|
+
* @param collection - The collection name
|
|
938
|
+
* @param pipeline - Array of aggregation pipeline stages
|
|
939
|
+
* @returns Array of result documents
|
|
940
|
+
*/
|
|
941
|
+
aggregate(collection: string, pipeline: PipelineStage[]): Promise<unknown[]>;
|
|
942
|
+
/**
|
|
943
|
+
* Reset database - for testing purposes
|
|
944
|
+
*/
|
|
945
|
+
private reset;
|
|
946
|
+
/**
|
|
947
|
+
* Dump database contents - for debugging
|
|
948
|
+
*/
|
|
949
|
+
private dump;
|
|
950
|
+
/**
|
|
951
|
+
* Handle incoming fetch requests
|
|
952
|
+
* Implements HTTP API for MongoDB-compatible operations
|
|
953
|
+
*/
|
|
954
|
+
fetch(request: Request): Promise<Response>;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* RPC Target - Server-side RPC handler for capnweb-style Workers RPC
|
|
959
|
+
*
|
|
960
|
+
* Implements:
|
|
961
|
+
* - MondoRpcTarget extending RpcTarget base class
|
|
962
|
+
* - Request routing to Durable Object stubs
|
|
963
|
+
* - HTTP batch protocol support
|
|
964
|
+
* - Promise pipelining for chained operations
|
|
965
|
+
*/
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Base class for RPC targets (capnweb-style)
|
|
969
|
+
*/
|
|
970
|
+
declare class RpcTarget {
|
|
971
|
+
protected methods: Map<string, (...args: unknown[]) => Promise<unknown>>;
|
|
972
|
+
/**
|
|
973
|
+
* Allowlist of methods that can be invoked via RPC.
|
|
974
|
+
* Subclasses should override this to define their allowed methods.
|
|
975
|
+
* This prevents invocation of inherited methods like constructor, __proto__, toString, etc.
|
|
976
|
+
*/
|
|
977
|
+
protected allowedMethods: Set<string>;
|
|
978
|
+
/**
|
|
979
|
+
* Register a method handler
|
|
980
|
+
*/
|
|
981
|
+
protected registerMethod(name: string, handler: (...args: unknown[]) => Promise<unknown>): void;
|
|
982
|
+
/**
|
|
983
|
+
* Check if a method exists and is allowed
|
|
984
|
+
*/
|
|
985
|
+
hasMethod(name: string): boolean;
|
|
986
|
+
/**
|
|
987
|
+
* Invoke a method by name
|
|
988
|
+
*/
|
|
989
|
+
invoke(method: string, params: unknown[]): Promise<unknown>;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* MondoRpcTarget provides MongoDB-compatible API via Workers RPC
|
|
993
|
+
*/
|
|
994
|
+
declare class MondoRpcTarget extends RpcTarget {
|
|
995
|
+
private env;
|
|
996
|
+
private currentConnectionString;
|
|
997
|
+
private databases;
|
|
998
|
+
/**
|
|
999
|
+
* Explicit allowlist of methods that can be invoked via RPC.
|
|
1000
|
+
* This prevents invocation of inherited methods like constructor, __proto__, toString, etc.
|
|
1001
|
+
*/
|
|
1002
|
+
protected allowedMethods: Set<string>;
|
|
1003
|
+
constructor(env: MondoEnv);
|
|
1004
|
+
/**
|
|
1005
|
+
* Connect to a MongoDB-compatible connection string
|
|
1006
|
+
*/
|
|
1007
|
+
connect(connectionString: string): Promise<{
|
|
1008
|
+
connected: boolean;
|
|
1009
|
+
database?: string;
|
|
1010
|
+
}>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Get the current connection string
|
|
1013
|
+
*/
|
|
1014
|
+
get connectionString(): string | null;
|
|
1015
|
+
/**
|
|
1016
|
+
* Get a database reference
|
|
1017
|
+
*/
|
|
1018
|
+
db(name: string): Promise<DatabaseRef>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Get a collection reference
|
|
1021
|
+
*/
|
|
1022
|
+
collection(dbName: string, collectionName: string): Promise<CollectionRef>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Execute a find operation
|
|
1025
|
+
*/
|
|
1026
|
+
find(dbName: string, collectionName: string, query: Record<string, unknown>): Promise<unknown[]>;
|
|
1027
|
+
/**
|
|
1028
|
+
* Execute an insertOne operation
|
|
1029
|
+
*/
|
|
1030
|
+
insertOne(dbName: string, collectionName: string, document: Record<string, unknown>): Promise<{
|
|
1031
|
+
insertedId: string;
|
|
1032
|
+
}>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Execute an updateOne operation
|
|
1035
|
+
*/
|
|
1036
|
+
updateOne(dbName: string, collectionName: string, filter: Record<string, unknown>, update: Record<string, unknown>): Promise<{
|
|
1037
|
+
matchedCount: number;
|
|
1038
|
+
modifiedCount: number;
|
|
1039
|
+
}>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Execute a deleteOne operation
|
|
1042
|
+
*/
|
|
1043
|
+
deleteOne(dbName: string, collectionName: string, filter: Record<string, unknown>): Promise<{
|
|
1044
|
+
deletedCount: number;
|
|
1045
|
+
}>;
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Create a Workers RPC response from a target and request
|
|
1049
|
+
*/
|
|
1050
|
+
declare function newWorkersRpcResponse(target: RpcTarget, request: Request): Promise<Response>;
|
|
1051
|
+
/**
|
|
1052
|
+
* Batched RPC executor that coalesces multiple requests
|
|
1053
|
+
*/
|
|
1054
|
+
declare class BatchedRpcExecutor {
|
|
1055
|
+
private stub;
|
|
1056
|
+
private options;
|
|
1057
|
+
private queue;
|
|
1058
|
+
private flushTimer;
|
|
1059
|
+
constructor(stub: DurableObjectStub, options?: BatchedExecutorOptions);
|
|
1060
|
+
/**
|
|
1061
|
+
* Execute a method with batching
|
|
1062
|
+
*/
|
|
1063
|
+
execute(method: string, params: Record<string, unknown>): Promise<unknown>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Flush pending requests
|
|
1066
|
+
*/
|
|
1067
|
+
flush(): Promise<void>;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Pipeline tracker for chained operations
|
|
1071
|
+
*/
|
|
1072
|
+
declare class PipelineTracker {
|
|
1073
|
+
private operations;
|
|
1074
|
+
private dependencyGraph;
|
|
1075
|
+
/**
|
|
1076
|
+
* Track a new operation
|
|
1077
|
+
*/
|
|
1078
|
+
track(method: string, params: unknown[], dependency?: string): string;
|
|
1079
|
+
/**
|
|
1080
|
+
* Get all dependencies for an operation
|
|
1081
|
+
*/
|
|
1082
|
+
getDependencies(opId: string): string[];
|
|
1083
|
+
/**
|
|
1084
|
+
* Get operation by ID
|
|
1085
|
+
*/
|
|
1086
|
+
getOperation(opId: string): PipelineOp | undefined;
|
|
1087
|
+
/**
|
|
1088
|
+
* Get all operations in dependency order
|
|
1089
|
+
*/
|
|
1090
|
+
getOrderedOperations(): PipelineOp[];
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Pipelined RPC proxy for chained method calls
|
|
1094
|
+
*/
|
|
1095
|
+
declare class PipelinedRpcProxy {
|
|
1096
|
+
private target;
|
|
1097
|
+
private tracker;
|
|
1098
|
+
private currentDb;
|
|
1099
|
+
private currentCollection;
|
|
1100
|
+
constructor(target: MondoRpcTarget);
|
|
1101
|
+
/**
|
|
1102
|
+
* Get a database reference (pipelined)
|
|
1103
|
+
*/
|
|
1104
|
+
db(name: string): PipelinedDbProxy;
|
|
1105
|
+
/**
|
|
1106
|
+
* Execute the pipelined operations
|
|
1107
|
+
*/
|
|
1108
|
+
execute(): Promise<unknown>;
|
|
1109
|
+
/**
|
|
1110
|
+
* Get the underlying target
|
|
1111
|
+
*/
|
|
1112
|
+
getTarget(): MondoRpcTarget;
|
|
1113
|
+
/**
|
|
1114
|
+
* Get current database name
|
|
1115
|
+
*/
|
|
1116
|
+
getCurrentDb(): string | null;
|
|
1117
|
+
/**
|
|
1118
|
+
* Get current collection name
|
|
1119
|
+
*/
|
|
1120
|
+
getCurrentCollection(): string | null;
|
|
1121
|
+
/**
|
|
1122
|
+
* Set current collection
|
|
1123
|
+
*/
|
|
1124
|
+
setCurrentCollection(name: string): void;
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Pipelined database proxy
|
|
1128
|
+
*/
|
|
1129
|
+
declare class PipelinedDbProxy {
|
|
1130
|
+
private parent;
|
|
1131
|
+
private dbName;
|
|
1132
|
+
private operationId;
|
|
1133
|
+
constructor(parent: PipelinedRpcProxy, dbName: string, opId: string);
|
|
1134
|
+
/**
|
|
1135
|
+
* Get the operation ID
|
|
1136
|
+
*/
|
|
1137
|
+
get opId(): string;
|
|
1138
|
+
/**
|
|
1139
|
+
* Get a collection reference (pipelined)
|
|
1140
|
+
*/
|
|
1141
|
+
collection(name: string): PipelinedCollectionProxy;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Pipelined collection proxy
|
|
1145
|
+
*/
|
|
1146
|
+
declare class PipelinedCollectionProxy {
|
|
1147
|
+
private parent;
|
|
1148
|
+
private dbName;
|
|
1149
|
+
private collectionName;
|
|
1150
|
+
constructor(parent: PipelinedRpcProxy, dbName: string, collectionName: string);
|
|
1151
|
+
/**
|
|
1152
|
+
* Find documents (executes the pipeline)
|
|
1153
|
+
*/
|
|
1154
|
+
find(query: Record<string, unknown>): Promise<unknown[]>;
|
|
1155
|
+
/**
|
|
1156
|
+
* Insert one document
|
|
1157
|
+
*/
|
|
1158
|
+
insertOne(document: Record<string, unknown>): Promise<{
|
|
1159
|
+
insertedId: string;
|
|
1160
|
+
}>;
|
|
1161
|
+
/**
|
|
1162
|
+
* Update one document
|
|
1163
|
+
*/
|
|
1164
|
+
updateOne(filter: Record<string, unknown>, update: Record<string, unknown>): Promise<{
|
|
1165
|
+
matchedCount: number;
|
|
1166
|
+
modifiedCount: number;
|
|
1167
|
+
}>;
|
|
1168
|
+
/**
|
|
1169
|
+
* Delete one document
|
|
1170
|
+
*/
|
|
1171
|
+
deleteOne(filter: Record<string, unknown>): Promise<{
|
|
1172
|
+
deletedCount: number;
|
|
1173
|
+
}>;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* Worker Entrypoint - Workers RPC service binding support
|
|
1178
|
+
*
|
|
1179
|
+
* Implements:
|
|
1180
|
+
* - MondoEntrypoint extending WorkerEntrypoint
|
|
1181
|
+
* - Service binding methods
|
|
1182
|
+
* - TypeScript declarations
|
|
1183
|
+
* - Environment safety
|
|
1184
|
+
*/
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Execution context interface
|
|
1188
|
+
*/
|
|
1189
|
+
interface ExecutionContext {
|
|
1190
|
+
waitUntil(promise: Promise<unknown>): void;
|
|
1191
|
+
passThroughOnException(): void;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Mondo bindings interface (for service binding consumers)
|
|
1195
|
+
*/
|
|
1196
|
+
interface MondoBindings {
|
|
1197
|
+
/** Connect to a MongoDB-compatible connection string */
|
|
1198
|
+
connect(connectionString: string): Promise<{
|
|
1199
|
+
connected: boolean;
|
|
1200
|
+
database?: string;
|
|
1201
|
+
}>;
|
|
1202
|
+
/** Get a database reference */
|
|
1203
|
+
db(name: string): Promise<DatabaseRef>;
|
|
1204
|
+
/** Get a collection reference */
|
|
1205
|
+
collection(dbName: string, collectionName: string): Promise<CollectionRef>;
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Default options for the entrypoint
|
|
1209
|
+
*/
|
|
1210
|
+
declare const DEFAULT_OPTIONS: {
|
|
1211
|
+
/** Maximum batch size for batched operations */
|
|
1212
|
+
readonly maxBatchSize: 100;
|
|
1213
|
+
/** Request timeout in milliseconds */
|
|
1214
|
+
readonly timeout: 30000;
|
|
1215
|
+
/** Enable background cleanup */
|
|
1216
|
+
readonly enableCleanup: true;
|
|
1217
|
+
/** Cleanup interval in milliseconds */
|
|
1218
|
+
readonly cleanupInterval: 60000;
|
|
1219
|
+
};
|
|
1220
|
+
/**
|
|
1221
|
+
* Entrypoint options
|
|
1222
|
+
*/
|
|
1223
|
+
interface MondoEntrypointOptions {
|
|
1224
|
+
maxBatchSize?: number;
|
|
1225
|
+
timeout?: number;
|
|
1226
|
+
enableCleanup?: boolean;
|
|
1227
|
+
cleanupInterval?: number;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Base class for Worker entrypoints (capnweb-style)
|
|
1231
|
+
*/
|
|
1232
|
+
declare class WorkerEntrypoint {
|
|
1233
|
+
protected ctx: ExecutionContext;
|
|
1234
|
+
protected env: unknown;
|
|
1235
|
+
constructor(ctx: ExecutionContext, env: unknown);
|
|
1236
|
+
/**
|
|
1237
|
+
* Handle HTTP fetch requests
|
|
1238
|
+
*/
|
|
1239
|
+
fetch(_request: Request): Promise<Response>;
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Type guard for Mondo environment
|
|
1243
|
+
*/
|
|
1244
|
+
declare function isMondoEnv(env: unknown): env is MondoEnv;
|
|
1245
|
+
/**
|
|
1246
|
+
* Validate environment bindings
|
|
1247
|
+
*/
|
|
1248
|
+
declare function validateEnv(env: unknown): boolean;
|
|
1249
|
+
/**
|
|
1250
|
+
* MondoEntrypoint extends WorkerEntrypoint for service binding support
|
|
1251
|
+
*
|
|
1252
|
+
* Usage in wrangler.toml:
|
|
1253
|
+
* ```toml
|
|
1254
|
+
* [[services]]
|
|
1255
|
+
* binding = "MONDO"
|
|
1256
|
+
* service = "mongo.do"
|
|
1257
|
+
* entrypoint = "MondoEntrypoint"
|
|
1258
|
+
* ```
|
|
1259
|
+
*
|
|
1260
|
+
* Usage in consuming worker:
|
|
1261
|
+
* ```typescript
|
|
1262
|
+
* const result = await env.MONDO.connect('mongodb://localhost/mydb');
|
|
1263
|
+
* ```
|
|
1264
|
+
*/
|
|
1265
|
+
declare class MondoEntrypoint extends WorkerEntrypoint implements MondoBindings {
|
|
1266
|
+
protected env: MondoEnv;
|
|
1267
|
+
private rpcTarget;
|
|
1268
|
+
private entrypointOptions;
|
|
1269
|
+
private cleanupScheduled;
|
|
1270
|
+
constructor(ctx: ExecutionContext, env: MondoEnv);
|
|
1271
|
+
/**
|
|
1272
|
+
* Get the entrypoint options
|
|
1273
|
+
*/
|
|
1274
|
+
get options(): Required<MondoEntrypointOptions>;
|
|
1275
|
+
/**
|
|
1276
|
+
* Handle HTTP fetch requests
|
|
1277
|
+
*/
|
|
1278
|
+
fetch(request: Request): Promise<Response>;
|
|
1279
|
+
/**
|
|
1280
|
+
* Connect to a MongoDB-compatible connection string
|
|
1281
|
+
*/
|
|
1282
|
+
connect(connectionString: string): Promise<{
|
|
1283
|
+
connected: boolean;
|
|
1284
|
+
database?: string;
|
|
1285
|
+
}>;
|
|
1286
|
+
/**
|
|
1287
|
+
* Get a database reference
|
|
1288
|
+
*/
|
|
1289
|
+
db(name: string): Promise<DatabaseRef>;
|
|
1290
|
+
/**
|
|
1291
|
+
* Get a collection reference
|
|
1292
|
+
*/
|
|
1293
|
+
collection(dbName: string, collectionName: string): Promise<CollectionRef>;
|
|
1294
|
+
/**
|
|
1295
|
+
* Execute a find operation
|
|
1296
|
+
*/
|
|
1297
|
+
find(dbName: string, collectionName: string, query: Record<string, unknown>): Promise<unknown[]>;
|
|
1298
|
+
/**
|
|
1299
|
+
* Execute an insertOne operation
|
|
1300
|
+
*/
|
|
1301
|
+
insertOne(dbName: string, collectionName: string, document: Record<string, unknown>): Promise<{
|
|
1302
|
+
insertedId: string;
|
|
1303
|
+
}>;
|
|
1304
|
+
/**
|
|
1305
|
+
* Execute an updateOne operation
|
|
1306
|
+
*/
|
|
1307
|
+
updateOne(dbName: string, collectionName: string, filter: Record<string, unknown>, update: Record<string, unknown>): Promise<{
|
|
1308
|
+
matchedCount: number;
|
|
1309
|
+
modifiedCount: number;
|
|
1310
|
+
}>;
|
|
1311
|
+
/**
|
|
1312
|
+
* Execute a deleteOne operation
|
|
1313
|
+
*/
|
|
1314
|
+
deleteOne(dbName: string, collectionName: string, filter: Record<string, unknown>): Promise<{
|
|
1315
|
+
deletedCount: number;
|
|
1316
|
+
}>;
|
|
1317
|
+
/**
|
|
1318
|
+
* Schedule background cleanup task
|
|
1319
|
+
*/
|
|
1320
|
+
scheduleCleanup(): void;
|
|
1321
|
+
/**
|
|
1322
|
+
* Run cleanup task
|
|
1323
|
+
*/
|
|
1324
|
+
private runCleanup;
|
|
1325
|
+
/**
|
|
1326
|
+
* Get the underlying RPC target (for testing)
|
|
1327
|
+
*/
|
|
1328
|
+
getRpcTarget(): MondoRpcTarget;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
export { type ErrorCodeValue as $, type WorkerStub as A, type WorkerEntrypoint$1 as B, type CreateIndexOptions as C, type DropIndexResult as D, type ExecutionContext as E, type RpcResponse as F, type BatchResponse as G, type HttpRpcRequest as H, type IndexInfo as I, type HttpRpcSuccessResponse as J, type HttpRpcErrorResponse as K, type HttpRpcResponse as L, type MondoEnv as M, type LegacyRpcRequest as N, ObjectId as O, type PipelineStage as P, type LegacyRpcResponse as Q, type RpcClientOptions as R, type SQLStorage as S, type TTLIndexInfo as T, type DatabaseRef as U, type CollectionRef as V, WorkerEntrypoint as W, type BatchedExecutorOptions as X, type PipelineOp as Y, type ReconnectEvent as Z, type RpcHandler as _, MondoEntrypoint as a, RpcTarget as a0, MondoRpcTarget as a1, newWorkersRpcResponse as a2, BatchedRpcExecutor as a3, PipelineTracker as a4, PipelinedRpcProxy as a5, validateEnv as a6, isMondoEnv as a7, DEFAULT_OPTIONS as a8, type MondoBindings as a9, type MondoEntrypointOptions as aa, MondoDatabase as b, type IndexSpec as c, type CreateIndexResult as d, type ExpiredDocumentsQuery as e, type TTLMetadata as f, type TTLCleanupResult as g, type EventHandler as h, type RpcRequest as i, type DeduplicatorOptions as j, SchemaManager as k, SCHEMA_VERSION as l, SCHEMA_TABLES as m, type SQLStatement as n, ErrorCode as o, getErrorCodeName as p, errorResponse as q, legacySuccessResponse as r, successResponse as s, legacyErrorResponse as t, MessageType as u, type DurableObjectNamespace as v, type DurableObjectId as w, type DurableObjectStub as x, type WorkerLoader as y, type WorkerCode as z };
|