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
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Automatic Embedding Pipeline for MondoDB
|
|
3
|
-
*
|
|
4
|
-
* This module provides automatic embedding generation for documents
|
|
5
|
-
* using Cloudflare Workers AI and Vectorize.
|
|
6
|
-
*/
|
|
7
|
-
export { serializeForEmbedding, serializeDocument, serializeDocuments, DocumentSerializer, type SerializationOptions, type AutoEmbeddingConfig, type SerializedDocument, type VectorizeMetadata, type VectorizeMetadataValue } from './document-serializer';
|
|
8
|
-
export { EmbeddingManager, DEFAULT_EMBEDDING_MODEL, type EmbeddingConfig, type EmbedDocumentOptions, type EmbedResult } from './embedding-manager';
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/embedding/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC"}
|
package/dist/embedding/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Automatic Embedding Pipeline for MondoDB
|
|
3
|
-
*
|
|
4
|
-
* This module provides automatic embedding generation for documents
|
|
5
|
-
* using Cloudflare Workers AI and Vectorize.
|
|
6
|
-
*/
|
|
7
|
-
export { serializeForEmbedding, serializeDocument, serializeDocuments, DocumentSerializer } from './document-serializer';
|
|
8
|
-
export { EmbeddingManager, DEFAULT_EMBEDDING_MODEL } from './embedding-manager';
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/embedding/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAMnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EAIxB,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AggregationExecutor - Handles async execution of aggregation pipelines
|
|
3
|
-
*
|
|
4
|
-
* This class manages the execution of MongoDB aggregation pipelines that may
|
|
5
|
-
* contain $function operators. It:
|
|
6
|
-
* 1. Translates the pipeline to SQL using AggregationTranslator
|
|
7
|
-
* 2. Executes the SQL query
|
|
8
|
-
* 3. Detects function placeholders in the results
|
|
9
|
-
* 4. Executes user functions via FunctionExecutor
|
|
10
|
-
* 5. Merges function results back into documents
|
|
11
|
-
*/
|
|
12
|
-
import type { WorkerLoader } from '../types/function';
|
|
13
|
-
import type { PipelineStage } from '../translator/aggregation-translator';
|
|
14
|
-
/**
|
|
15
|
-
* Environment bindings for the aggregation executor
|
|
16
|
-
*/
|
|
17
|
-
interface AggregationExecutorEnv {
|
|
18
|
-
LOADER?: WorkerLoader;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* SQL interface for executing queries
|
|
22
|
-
*/
|
|
23
|
-
interface SqlInterface {
|
|
24
|
-
exec: (query: string, ...params: unknown[]) => {
|
|
25
|
-
results: unknown[];
|
|
26
|
-
toArray?: () => unknown[];
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* AggregationExecutor handles the execution of aggregation pipelines
|
|
31
|
-
* with support for $function operators that require async execution
|
|
32
|
-
*/
|
|
33
|
-
export declare class AggregationExecutor {
|
|
34
|
-
private sql;
|
|
35
|
-
private functionExecutor;
|
|
36
|
-
constructor(sql: SqlInterface, env: AggregationExecutorEnv);
|
|
37
|
-
/**
|
|
38
|
-
* Execute an aggregation pipeline
|
|
39
|
-
*/
|
|
40
|
-
execute(collection: string, pipeline: PipelineStage[]): Promise<unknown[]>;
|
|
41
|
-
/**
|
|
42
|
-
* Check if a document contains any function placeholders
|
|
43
|
-
* The marker may be wrapped in quotes from SQL string output
|
|
44
|
-
*/
|
|
45
|
-
private documentHasFunctions;
|
|
46
|
-
/**
|
|
47
|
-
* Execute pipeline with function placeholders
|
|
48
|
-
*/
|
|
49
|
-
private executeWithFunctions;
|
|
50
|
-
/**
|
|
51
|
-
* SECURITY: Direct function execution has been disabled to prevent arbitrary code execution.
|
|
52
|
-
*
|
|
53
|
-
* The $function operator requires the LOADER binding for secure sandboxed execution
|
|
54
|
-
* via Cloudflare worker-loader. Without this binding, $function operators cannot be used.
|
|
55
|
-
*
|
|
56
|
-
* This method is kept as a private placeholder that throws an error to prevent
|
|
57
|
-
* any bypass attempts.
|
|
58
|
-
*
|
|
59
|
-
* @throws Error - Always throws to prevent unsafe code execution
|
|
60
|
-
*/
|
|
61
|
-
private executeDirectBatch;
|
|
62
|
-
/**
|
|
63
|
-
* Collect all function invocations from a document
|
|
64
|
-
*/
|
|
65
|
-
private collectFunctionInvocations;
|
|
66
|
-
/**
|
|
67
|
-
* Parse a function marker from a string value
|
|
68
|
-
* Handles both direct markers and SQL string output with quotes
|
|
69
|
-
*/
|
|
70
|
-
private parseFunctionMarker;
|
|
71
|
-
/**
|
|
72
|
-
* Group batch items by function body
|
|
73
|
-
*/
|
|
74
|
-
private groupByFunction;
|
|
75
|
-
/**
|
|
76
|
-
* Extract arguments for a function from document data
|
|
77
|
-
*/
|
|
78
|
-
private extractArgs;
|
|
79
|
-
/**
|
|
80
|
-
* Extract a field value from a document using JSON path
|
|
81
|
-
*/
|
|
82
|
-
private extractFieldValue;
|
|
83
|
-
/**
|
|
84
|
-
* Set a field value in a document using field path
|
|
85
|
-
*/
|
|
86
|
-
private setFieldValue;
|
|
87
|
-
/**
|
|
88
|
-
* Execute facet pipelines
|
|
89
|
-
*/
|
|
90
|
-
private executeFacets;
|
|
91
|
-
}
|
|
92
|
-
export {};
|
|
93
|
-
//# sourceMappingURL=aggregation-executor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregation-executor.d.ts","sourceRoot":"","sources":["../../src/executor/aggregation-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AAEzE;;GAEG;AACH,UAAU,sBAAsB;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAA;CACtB;AAED;;GAEG;AACH,UAAU,YAAY;IACpB,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK;QAAE,OAAO,EAAE,OAAO,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,OAAO,EAAE,CAAA;KAAE,CAAA;CACjG;AAuBD;;;GAGG;AACH,qBAAa,mBAAmB;IAI5B,OAAO,CAAC,GAAG;IAHb,OAAO,CAAC,gBAAgB,CAAyB;gBAGvC,GAAG,EAAE,YAAY,EACzB,GAAG,EAAE,sBAAsB;IAK7B;;OAEG;IACG,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA8BhF;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAc5B;;OAEG;YACW,oBAAoB;IA6ElC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAsBlC;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAoB3B;;OAEG;IACH,OAAO,CAAC,eAAe;IAcvB;;OAEG;IACH,OAAO,CAAC,WAAW;IAYnB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAezB;;OAEG;IACH,OAAO,CAAC,aAAa;IAgBrB;;OAEG;YACW,aAAa;CAkB5B"}
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AggregationExecutor - Handles async execution of aggregation pipelines
|
|
3
|
-
*
|
|
4
|
-
* This class manages the execution of MongoDB aggregation pipelines that may
|
|
5
|
-
* contain $function operators. It:
|
|
6
|
-
* 1. Translates the pipeline to SQL using AggregationTranslator
|
|
7
|
-
* 2. Executes the SQL query
|
|
8
|
-
* 3. Detects function placeholders in the results
|
|
9
|
-
* 4. Executes user functions via FunctionExecutor
|
|
10
|
-
* 5. Merges function results back into documents
|
|
11
|
-
*/
|
|
12
|
-
import { FunctionExecutor } from './function-executor';
|
|
13
|
-
import { AggregationTranslator } from '../translator/aggregation-translator';
|
|
14
|
-
/**
|
|
15
|
-
* AggregationExecutor handles the execution of aggregation pipelines
|
|
16
|
-
* with support for $function operators that require async execution
|
|
17
|
-
*/
|
|
18
|
-
export class AggregationExecutor {
|
|
19
|
-
sql;
|
|
20
|
-
functionExecutor;
|
|
21
|
-
constructor(sql, env) {
|
|
22
|
-
this.sql = sql;
|
|
23
|
-
this.functionExecutor = env.LOADER ? new FunctionExecutor(env) : null;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Execute an aggregation pipeline
|
|
27
|
-
*/
|
|
28
|
-
async execute(collection, pipeline) {
|
|
29
|
-
const translator = new AggregationTranslator(collection);
|
|
30
|
-
const { sql, params, facets } = translator.translate(pipeline);
|
|
31
|
-
// Handle facets separately
|
|
32
|
-
if (facets) {
|
|
33
|
-
return this.executeFacets(facets);
|
|
34
|
-
}
|
|
35
|
-
// Execute SQL query
|
|
36
|
-
const rawResults = this.sql.exec(sql, ...params);
|
|
37
|
-
const results = rawResults.toArray ? rawResults.toArray() : rawResults.results;
|
|
38
|
-
// Parse results
|
|
39
|
-
const documents = results.map(row => {
|
|
40
|
-
const data = row.data;
|
|
41
|
-
return JSON.parse(data);
|
|
42
|
-
});
|
|
43
|
-
// Check if any results contain function placeholders
|
|
44
|
-
const hasFunctions = documents.some(doc => this.documentHasFunctions(doc));
|
|
45
|
-
if (!hasFunctions) {
|
|
46
|
-
return documents;
|
|
47
|
-
}
|
|
48
|
-
// Process function placeholders, passing pipeline for post-sort if needed
|
|
49
|
-
return this.executeWithFunctions(documents, pipeline);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Check if a document contains any function placeholders
|
|
53
|
-
* The marker may be wrapped in quotes from SQL string output
|
|
54
|
-
*/
|
|
55
|
-
documentHasFunctions(doc) {
|
|
56
|
-
for (const value of Object.values(doc)) {
|
|
57
|
-
if (typeof value === 'string' && value.includes('__FUNCTION__')) {
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
if (typeof value === 'object' && value !== null) {
|
|
61
|
-
if (this.documentHasFunctions(value)) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Execute pipeline with function placeholders
|
|
70
|
-
*/
|
|
71
|
-
async executeWithFunctions(documents, pipeline = []) {
|
|
72
|
-
// Collect all function invocations for batch processing
|
|
73
|
-
const batchItems = [];
|
|
74
|
-
for (let docIndex = 0; docIndex < documents.length; docIndex++) {
|
|
75
|
-
const doc = documents[docIndex];
|
|
76
|
-
if (doc) {
|
|
77
|
-
this.collectFunctionInvocations(doc, doc, [], docIndex, batchItems);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
// Group by function body for batch execution
|
|
81
|
-
const functionGroups = this.groupByFunction(batchItems);
|
|
82
|
-
// Execute each function group
|
|
83
|
-
for (const [body, items] of functionGroups.entries()) {
|
|
84
|
-
const argsArray = items.map(item => item.args);
|
|
85
|
-
try {
|
|
86
|
-
let results;
|
|
87
|
-
if (this.functionExecutor) {
|
|
88
|
-
// Use secure sandboxed execution via worker-loader
|
|
89
|
-
results = await this.functionExecutor.executeBatch(body, argsArray);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
// Fallback: direct evaluation (for development/testing without worker_loaders)
|
|
93
|
-
// WARNING: This is NOT sandboxed and should only be used in trusted environments
|
|
94
|
-
results = this.executeDirectBatch(body, argsArray);
|
|
95
|
-
}
|
|
96
|
-
// Apply results back to documents
|
|
97
|
-
for (let i = 0; i < items.length; i++) {
|
|
98
|
-
const item = items[i];
|
|
99
|
-
if (item) {
|
|
100
|
-
const result = results[i];
|
|
101
|
-
const doc = documents[item.docIndex];
|
|
102
|
-
if (doc) {
|
|
103
|
-
this.setFieldValue(doc, item.fieldPath, result);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
// Re-throw with context
|
|
110
|
-
throw error;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
// Re-apply $sort stages after function execution
|
|
114
|
-
// This is needed because SQL sorting happened on placeholder strings, not computed values
|
|
115
|
-
// Use the last $sort stage since that represents the final ordering intent
|
|
116
|
-
const sortStages = pipeline.filter(stage => '$sort' in stage);
|
|
117
|
-
const lastSortStage = sortStages[sortStages.length - 1];
|
|
118
|
-
if (lastSortStage) {
|
|
119
|
-
documents.sort((a, b) => {
|
|
120
|
-
for (const [field, direction] of Object.entries(lastSortStage.$sort)) {
|
|
121
|
-
const aVal = this.extractFieldValue(a, `$.${field}`);
|
|
122
|
-
const bVal = this.extractFieldValue(b, `$.${field}`);
|
|
123
|
-
// Handle different types
|
|
124
|
-
if (aVal === bVal)
|
|
125
|
-
continue;
|
|
126
|
-
if (aVal === null || aVal === undefined)
|
|
127
|
-
return direction;
|
|
128
|
-
if (bVal === null || bVal === undefined)
|
|
129
|
-
return -direction;
|
|
130
|
-
// Compare values
|
|
131
|
-
const comparison = aVal < bVal ? -1 : 1;
|
|
132
|
-
return comparison * direction;
|
|
133
|
-
}
|
|
134
|
-
return 0;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return documents;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* SECURITY: Direct function execution has been disabled to prevent arbitrary code execution.
|
|
141
|
-
*
|
|
142
|
-
* The $function operator requires the LOADER binding for secure sandboxed execution
|
|
143
|
-
* via Cloudflare worker-loader. Without this binding, $function operators cannot be used.
|
|
144
|
-
*
|
|
145
|
-
* This method is kept as a private placeholder that throws an error to prevent
|
|
146
|
-
* any bypass attempts.
|
|
147
|
-
*
|
|
148
|
-
* @throws Error - Always throws to prevent unsafe code execution
|
|
149
|
-
*/
|
|
150
|
-
executeDirectBatch(_body, _argsArray) {
|
|
151
|
-
// SECURITY: new Function() has been removed to prevent arbitrary code execution
|
|
152
|
-
// The $function operator requires the LOADER binding for secure sandboxed execution
|
|
153
|
-
throw new Error('SECURITY: $function operator requires the LOADER binding for secure sandboxed execution. ' +
|
|
154
|
-
'Direct function execution is disabled to prevent arbitrary code execution. ' +
|
|
155
|
-
'Please configure the worker_loaders binding in your wrangler.toml to enable $function support.');
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Collect all function invocations from a document
|
|
159
|
-
*/
|
|
160
|
-
collectFunctionInvocations(root, current, path, docIndex, items) {
|
|
161
|
-
for (const [key, value] of Object.entries(current)) {
|
|
162
|
-
const fieldPath = [...path, key];
|
|
163
|
-
if (typeof value === 'string' && value.includes('__FUNCTION__')) {
|
|
164
|
-
const fnSpec = this.parseFunctionMarker(value);
|
|
165
|
-
if (fnSpec) {
|
|
166
|
-
const args = this.extractArgs(root, fnSpec);
|
|
167
|
-
items.push({ docIndex, fieldPath, fnSpec, args });
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
171
|
-
this.collectFunctionInvocations(root, value, fieldPath, docIndex, items);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Parse a function marker from a string value
|
|
177
|
-
* Handles both direct markers and SQL string output with quotes
|
|
178
|
-
*/
|
|
179
|
-
parseFunctionMarker(value) {
|
|
180
|
-
// Try to find the __FUNCTION__ marker in the string
|
|
181
|
-
// Match __FUNCTION__ followed by a JSON object
|
|
182
|
-
const match = value.match(/__FUNCTION__({.+})$/) || value.match(/__FUNCTION__({.+})'?$/);
|
|
183
|
-
if (match && match[1]) {
|
|
184
|
-
try {
|
|
185
|
-
return JSON.parse(match[1]);
|
|
186
|
-
}
|
|
187
|
-
catch {
|
|
188
|
-
// Try unescaping single quotes (from SQL string escaping)
|
|
189
|
-
try {
|
|
190
|
-
const unescaped = match[1].replace(/''/g, "'");
|
|
191
|
-
return JSON.parse(unescaped);
|
|
192
|
-
}
|
|
193
|
-
catch {
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Group batch items by function body
|
|
202
|
-
*/
|
|
203
|
-
groupByFunction(items) {
|
|
204
|
-
const groups = new Map();
|
|
205
|
-
for (const item of items) {
|
|
206
|
-
const body = item.fnSpec.body;
|
|
207
|
-
if (!groups.has(body)) {
|
|
208
|
-
groups.set(body, []);
|
|
209
|
-
}
|
|
210
|
-
groups.get(body).push(item);
|
|
211
|
-
}
|
|
212
|
-
return groups;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Extract arguments for a function from document data
|
|
216
|
-
*/
|
|
217
|
-
extractArgs(doc, fnSpec) {
|
|
218
|
-
return fnSpec.argOrder.map(arg => {
|
|
219
|
-
if (arg.type === 'literal') {
|
|
220
|
-
const index = arg.index;
|
|
221
|
-
return fnSpec.literalArgs[index];
|
|
222
|
-
}
|
|
223
|
-
// Extract field value using path
|
|
224
|
-
const path = arg.path;
|
|
225
|
-
return this.extractFieldValue(doc, path);
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Extract a field value from a document using JSON path
|
|
230
|
-
*/
|
|
231
|
-
extractFieldValue(doc, path) {
|
|
232
|
-
// path is like "$.field" or "$.nested.field"
|
|
233
|
-
const parts = path.replace(/^\$\./, '').split('.');
|
|
234
|
-
let value = doc;
|
|
235
|
-
for (const part of parts) {
|
|
236
|
-
if (value === null || value === undefined) {
|
|
237
|
-
return undefined;
|
|
238
|
-
}
|
|
239
|
-
value = value[part];
|
|
240
|
-
}
|
|
241
|
-
return value;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Set a field value in a document using field path
|
|
245
|
-
*/
|
|
246
|
-
setFieldValue(doc, path, value) {
|
|
247
|
-
let current = doc;
|
|
248
|
-
for (let i = 0; i < path.length - 1; i++) {
|
|
249
|
-
const key = path[i];
|
|
250
|
-
if (key !== undefined) {
|
|
251
|
-
current = current[key];
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
const lastKey = path[path.length - 1];
|
|
255
|
-
if (lastKey !== undefined) {
|
|
256
|
-
current[lastKey] = value;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Execute facet pipelines
|
|
261
|
-
*/
|
|
262
|
-
async executeFacets(facets) {
|
|
263
|
-
const result = {};
|
|
264
|
-
for (const [name, facet] of Object.entries(facets)) {
|
|
265
|
-
const rawResults = this.sql.exec(facet.sql, ...facet.params);
|
|
266
|
-
const results = rawResults.toArray ? rawResults.toArray() : rawResults.results;
|
|
267
|
-
result[name] = results.map(row => {
|
|
268
|
-
const data = row.data;
|
|
269
|
-
return JSON.parse(data);
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
return [result];
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
//# sourceMappingURL=aggregation-executor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregation-executor.js","sourceRoot":"","sources":["../../src/executor/aggregation-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AAuC5E;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAIpB;IAHF,gBAAgB,CAAyB;IAEjD,YACU,GAAiB,EACzB,GAA2B;QADnB,QAAG,GAAH,GAAG,CAAc;QAGzB,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACvE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,UAAkB,EAAE,QAAyB;QACzD,MAAM,UAAU,GAAG,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAA;QACxD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;QAE9D,2BAA2B;QAC3B,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QACnC,CAAC;QAED,oBAAoB;QACpB,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,CAAA;QAChD,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,C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AAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QACrC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,CAAC,OAAO,CAAC,GAAG,KAAK,CAAA;QAC1B,CAAC;IACH,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,aAAa,CACzB,MAA0D;QAE1D,MAAM,MAAM,GAA8B,EAAE,CAAA;QAE5C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACnD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;YAC5D,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAA;YAE9E,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBAC/B,MAAM,IAAI,GAAI,GAAwB,CAAC,IAAI,CAAA;gBAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACzB,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,CAAA;IACjB,CAAC;CAEF"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FunctionExecutor - Secure execution of user functions via worker-loader
|
|
3
|
-
*
|
|
4
|
-
* Uses Cloudflare's worker-loader binding to execute arbitrary JavaScript
|
|
5
|
-
* in isolated V8 contexts with:
|
|
6
|
-
* - globalOutbound: null (no network access)
|
|
7
|
-
* - Empty env (no binding access)
|
|
8
|
-
* - Timeout enforcement
|
|
9
|
-
*/
|
|
10
|
-
import type { WorkerLoader } from '../types/function';
|
|
11
|
-
interface Env {
|
|
12
|
-
LOADER?: WorkerLoader;
|
|
13
|
-
}
|
|
14
|
-
export declare class FunctionExecutor {
|
|
15
|
-
private env;
|
|
16
|
-
constructor(env: Env);
|
|
17
|
-
/**
|
|
18
|
-
* Execute a function with given arguments
|
|
19
|
-
*/
|
|
20
|
-
execute(body: string, args: unknown[], timeout?: number): Promise<unknown>;
|
|
21
|
-
/**
|
|
22
|
-
* Execute a function for multiple arg sets in a single isolate (batch mode)
|
|
23
|
-
*/
|
|
24
|
-
executeBatch(body: string, argsArray: unknown[][], timeout?: number): Promise<unknown[]>;
|
|
25
|
-
/**
|
|
26
|
-
* Normalize function body to consistent format
|
|
27
|
-
*/
|
|
28
|
-
private normalizeBody;
|
|
29
|
-
/**
|
|
30
|
-
* Generate SHA-256 hash of function body for caching
|
|
31
|
-
*/
|
|
32
|
-
private hashFunction;
|
|
33
|
-
/**
|
|
34
|
-
* Generate the worker code that executes user functions
|
|
35
|
-
*/
|
|
36
|
-
private generateWorkerCode;
|
|
37
|
-
}
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=function-executor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function-executor.d.ts","sourceRoot":"","sources":["../../src/executor/function-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,mBAAmB,CAAA;AAEjE,UAAU,GAAG;IACX,MAAM,CAAC,EAAE,YAAY,CAAA;CACtB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,GAAG,CAAK;gBAEJ,GAAG,EAAE,GAAG;IAIpB;;OAEG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IA2C9E;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,SAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA2C7F;;OAEG;IACH,OAAO,CAAC,aAAa;IASrB;;OAEG;YACW,YAAY;IAU1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAyD3B"}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FunctionExecutor - Secure execution of user functions via worker-loader
|
|
3
|
-
*
|
|
4
|
-
* Uses Cloudflare's worker-loader binding to execute arbitrary JavaScript
|
|
5
|
-
* in isolated V8 contexts with:
|
|
6
|
-
* - globalOutbound: null (no network access)
|
|
7
|
-
* - Empty env (no binding access)
|
|
8
|
-
* - Timeout enforcement
|
|
9
|
-
*/
|
|
10
|
-
export class FunctionExecutor {
|
|
11
|
-
env;
|
|
12
|
-
constructor(env) {
|
|
13
|
-
this.env = env;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Execute a function with given arguments
|
|
17
|
-
*/
|
|
18
|
-
async execute(body, args, timeout = 5000) {
|
|
19
|
-
if (!this.env.LOADER) {
|
|
20
|
-
throw new Error('$function requires worker_loaders binding. ' +
|
|
21
|
-
'Add to wrangler.jsonc: "worker_loaders": [{ "binding": "LOADER" }]');
|
|
22
|
-
}
|
|
23
|
-
const normalizedBody = this.normalizeBody(body);
|
|
24
|
-
const hash = await this.hashFunction(normalizedBody);
|
|
25
|
-
const loader = this.env.LOADER;
|
|
26
|
-
const worker = loader.get(`fn-${hash}`, async () => ({
|
|
27
|
-
compatibilityDate: '2024-09-25',
|
|
28
|
-
mainModule: 'fn.js',
|
|
29
|
-
modules: {
|
|
30
|
-
'fn.js': this.generateWorkerCode(normalizedBody, false)
|
|
31
|
-
},
|
|
32
|
-
globalOutbound: null,
|
|
33
|
-
env: {}
|
|
34
|
-
}));
|
|
35
|
-
if (!worker.getEntrypoint) {
|
|
36
|
-
throw new Error('Worker stub does not support getEntrypoint');
|
|
37
|
-
}
|
|
38
|
-
const entrypoint = worker.getEntrypoint();
|
|
39
|
-
const response = await entrypoint.fetch(new Request('http://internal/execute', {
|
|
40
|
-
method: 'POST',
|
|
41
|
-
headers: { 'Content-Type': 'application/json' },
|
|
42
|
-
body: JSON.stringify({ args, timeout })
|
|
43
|
-
}));
|
|
44
|
-
const result = await response.json();
|
|
45
|
-
if (result.error) {
|
|
46
|
-
throw new Error(`$function execution failed: ${result.error}`);
|
|
47
|
-
}
|
|
48
|
-
return result.result;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Execute a function for multiple arg sets in a single isolate (batch mode)
|
|
52
|
-
*/
|
|
53
|
-
async executeBatch(body, argsArray, timeout = 10000) {
|
|
54
|
-
if (!this.env.LOADER) {
|
|
55
|
-
throw new Error('$function requires worker_loaders binding. ' +
|
|
56
|
-
'Add to wrangler.jsonc: "worker_loaders": [{ "binding": "LOADER" }]');
|
|
57
|
-
}
|
|
58
|
-
const normalizedBody = this.normalizeBody(body);
|
|
59
|
-
const hash = await this.hashFunction(normalizedBody);
|
|
60
|
-
const loader = this.env.LOADER;
|
|
61
|
-
const worker = loader.get(`fn-batch-${hash}`, async () => ({
|
|
62
|
-
compatibilityDate: '2024-09-25',
|
|
63
|
-
mainModule: 'fn.js',
|
|
64
|
-
modules: {
|
|
65
|
-
'fn.js': this.generateWorkerCode(normalizedBody, true)
|
|
66
|
-
},
|
|
67
|
-
globalOutbound: null,
|
|
68
|
-
env: {}
|
|
69
|
-
}));
|
|
70
|
-
if (!worker.getEntrypoint) {
|
|
71
|
-
throw new Error('Worker stub does not support getEntrypoint');
|
|
72
|
-
}
|
|
73
|
-
const entrypoint = worker.getEntrypoint();
|
|
74
|
-
const response = await entrypoint.fetch(new Request('http://internal/execute-batch', {
|
|
75
|
-
method: 'POST',
|
|
76
|
-
headers: { 'Content-Type': 'application/json' },
|
|
77
|
-
body: JSON.stringify({ argsArray, timeout })
|
|
78
|
-
}));
|
|
79
|
-
const result = await response.json();
|
|
80
|
-
if (result.error) {
|
|
81
|
-
throw new Error(`$function batch execution failed: ${result.error}`);
|
|
82
|
-
}
|
|
83
|
-
return result.results ?? [];
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Normalize function body to consistent format
|
|
87
|
-
*/
|
|
88
|
-
normalizeBody(body) {
|
|
89
|
-
const trimmed = body.trim();
|
|
90
|
-
// Wrap function declarations in parentheses for invocation
|
|
91
|
-
if (trimmed.startsWith('function')) {
|
|
92
|
-
return `(${trimmed})`;
|
|
93
|
-
}
|
|
94
|
-
return trimmed;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Generate SHA-256 hash of function body for caching
|
|
98
|
-
*/
|
|
99
|
-
async hashFunction(body) {
|
|
100
|
-
const encoder = new TextEncoder();
|
|
101
|
-
const data = encoder.encode(body);
|
|
102
|
-
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
|
|
103
|
-
return Array.from(new Uint8Array(hashBuffer))
|
|
104
|
-
.map(b => b.toString(16).padStart(2, '0'))
|
|
105
|
-
.join('')
|
|
106
|
-
.substring(0, 16); // Use first 16 chars for shorter IDs
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Generate the worker code that executes user functions
|
|
110
|
-
*/
|
|
111
|
-
generateWorkerCode(body, isBatch) {
|
|
112
|
-
if (isBatch) {
|
|
113
|
-
return `
|
|
114
|
-
export default {
|
|
115
|
-
async fetch(request) {
|
|
116
|
-
try {
|
|
117
|
-
const { argsArray, timeout = 10000 } = await request.json();
|
|
118
|
-
const fn = ${body};
|
|
119
|
-
|
|
120
|
-
const executeWithTimeout = async (args) => {
|
|
121
|
-
const result = fn(...args);
|
|
122
|
-
if (result instanceof Promise) {
|
|
123
|
-
return Promise.race([
|
|
124
|
-
result,
|
|
125
|
-
new Promise((_, reject) =>
|
|
126
|
-
setTimeout(() => reject(new Error('Function execution timeout')), timeout)
|
|
127
|
-
)
|
|
128
|
-
]);
|
|
129
|
-
}
|
|
130
|
-
return result;
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const results = await Promise.all(argsArray.map(args => executeWithTimeout(args)));
|
|
134
|
-
return Response.json({ results });
|
|
135
|
-
} catch (err) {
|
|
136
|
-
return Response.json({ error: err.message });
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
`;
|
|
141
|
-
}
|
|
142
|
-
return `
|
|
143
|
-
export default {
|
|
144
|
-
async fetch(request) {
|
|
145
|
-
try {
|
|
146
|
-
const { args, timeout = 5000 } = await request.json();
|
|
147
|
-
const fn = ${body};
|
|
148
|
-
const result = fn(...args);
|
|
149
|
-
|
|
150
|
-
// Enforce timeout for async functions
|
|
151
|
-
if (result instanceof Promise) {
|
|
152
|
-
const timeoutPromise = new Promise((_, reject) =>
|
|
153
|
-
setTimeout(() => reject(new Error('Function execution timeout')), timeout)
|
|
154
|
-
);
|
|
155
|
-
const finalResult = await Promise.race([result, timeoutPromise]);
|
|
156
|
-
return Response.json({ result: finalResult });
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return Response.json({ result });
|
|
160
|
-
} catch (err) {
|
|
161
|
-
return Response.json({ error: err.message });
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
`;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
//# sourceMappingURL=function-executor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function-executor.js","sourceRoot":"","sources":["../../src/executor/function-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,MAAM,OAAO,gBAAgB;IACnB,GAAG,CAAK;IAEhB,YAAY,GAAQ;QAClB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,IAAe,EAAE,OAAO,GAAG,IAAI;QACzD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CACb,6CAA6C;gBAC7C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ACF"}
|
package/dist/executor/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/executor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA"}
|
package/dist/executor/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/executor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA"}
|