@prisma-next/mongo 0.0.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/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # @prisma-next/mongo
2
+
3
+ One-package MongoDB setup for Prisma Next. Install this single package to get config, runtime, and all transitive type dependencies.
4
+
5
+ ## Package Classification
6
+
7
+ - **Domain**: extensions
8
+ - **Layer**: adapters
9
+ - **Planes**: shared (config), runtime (runtime)
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ // prisma-next.config.ts
15
+ import { defineConfig } from '@prisma-next/mongo/config';
16
+
17
+ export default defineConfig({
18
+ contract: './prisma/contract.prisma',
19
+ db: { connection: process.env['MONGODB_URL']! },
20
+ });
21
+ ```
22
+
23
+ ## Exports
24
+
25
+ ### `@prisma-next/mongo/config`
26
+
27
+ Simplified `defineConfig` that pre-wires all MongoDB internals (family, target, adapter, driver, contract providers). Pass a contract path and optional db config.
28
+
29
+ ### `@prisma-next/mongo/runtime`
30
+
31
+ Re-exports `createMongoRuntime` from `@prisma-next/mongo-runtime` for composing the MongoDB execution pipeline.
32
+
33
+ ## Dependencies
34
+
35
+ This package bundles all the transitive dependencies needed for a MongoDB Prisma Next project, including those referenced in the emitted `contract.d.ts`:
36
+
37
+ - `@prisma-next/mongo-contract` (contract type definitions)
38
+ - `@prisma-next/adapter-mongo` (adapter + codec types)
39
+ - `@prisma-next/contract` (shared contract types)
40
+
41
+ ## Related Docs
42
+
43
+ - Architecture: `docs/Architecture Overview.md`
44
+ - Subsystem: `docs/architecture docs/subsystems/5. Adapters & Targets.md`
@@ -0,0 +1,13 @@
1
+ import { PrismaNextConfig } from "@prisma-next/config/config-types";
2
+
3
+ //#region src/config/define-config.d.ts
4
+ interface MongoConfigOptions {
5
+ readonly contract: string;
6
+ readonly db?: {
7
+ readonly connection?: string;
8
+ };
9
+ }
10
+ declare function defineConfig(options: MongoConfigOptions): PrismaNextConfig<'mongo', 'mongo'>;
11
+ //#endregion
12
+ export { type MongoConfigOptions, defineConfig };
13
+ //# sourceMappingURL=config.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.mts","names":[],"sources":["../src/config/define-config.ts"],"sourcesContent":[],"mappings":";;;UASiB,kBAAA;;EAAA,SAAA,EAAA,CAAA,EAAA;IAeD,SAAA,UAAY,CAAA,EAAU,MAAA;;;iBAAtB,YAAA,UAAsB,qBAAqB"}
@@ -0,0 +1,38 @@
1
+ import { pathToFileURL } from "node:url";
2
+ import mongoAdapter from "@prisma-next/adapter-mongo/control";
3
+ import { defineConfig as defineConfig$1 } from "@prisma-next/config/config-types";
4
+ import mongoDriver from "@prisma-next/driver-mongo/control";
5
+ import { mongoFamilyDescriptor, mongoTargetDescriptor } from "@prisma-next/family-mongo/control";
6
+ import { mongoContract } from "@prisma-next/mongo-contract-psl/provider";
7
+ import { extname, isAbsolute, resolve } from "pathe";
8
+
9
+ //#region src/config/define-config.ts
10
+ function deriveOutputPath(contractPath) {
11
+ const ext = extname(contractPath);
12
+ if (ext.length === 0) return `${contractPath}.json`;
13
+ return `${contractPath.slice(0, -ext.length)}.json`;
14
+ }
15
+ function defineConfig(options) {
16
+ const output = deriveOutputPath(options.contract);
17
+ const ext = extname(options.contract);
18
+ const absoluteContractPath = isAbsolute(options.contract) ? options.contract : resolve(process.cwd(), options.contract);
19
+ return defineConfig$1({
20
+ family: mongoFamilyDescriptor,
21
+ target: mongoTargetDescriptor,
22
+ adapter: mongoAdapter,
23
+ driver: mongoDriver,
24
+ contract: ext === ".ts" ? {
25
+ source: async () => {
26
+ const { typescriptContract } = await import("@prisma-next/mongo-contract-ts/config-types");
27
+ const mod = await import(pathToFileURL(absoluteContractPath).href);
28
+ return typescriptContract(mod.default ?? mod.contract, output).source({ composedExtensionPacks: [] });
29
+ },
30
+ output
31
+ } : mongoContract(options.contract, { output }),
32
+ ...options.db !== void 0 ? { db: options.db } : {}
33
+ });
34
+ }
35
+
36
+ //#endregion
37
+ export { defineConfig };
38
+ //# sourceMappingURL=config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.mjs","names":["coreDefineConfig"],"sources":["../src/config/define-config.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url';\nimport mongoAdapter from '@prisma-next/adapter-mongo/control';\nimport type { PrismaNextConfig } from '@prisma-next/config/config-types';\nimport { defineConfig as coreDefineConfig } from '@prisma-next/config/config-types';\nimport mongoDriver from '@prisma-next/driver-mongo/control';\nimport { mongoFamilyDescriptor, mongoTargetDescriptor } from '@prisma-next/family-mongo/control';\nimport { mongoContract } from '@prisma-next/mongo-contract-psl/provider';\nimport { extname, isAbsolute, resolve } from 'pathe';\n\nexport interface MongoConfigOptions {\n readonly contract: string;\n readonly db?: {\n readonly connection?: string;\n };\n}\n\nfunction deriveOutputPath(contractPath: string): string {\n const ext = extname(contractPath);\n if (ext.length === 0) {\n return `${contractPath}.json`;\n }\n return `${contractPath.slice(0, -ext.length)}.json`;\n}\n\nexport function defineConfig(options: MongoConfigOptions): PrismaNextConfig<'mongo', 'mongo'> {\n const output = deriveOutputPath(options.contract);\n const ext = extname(options.contract);\n\n const absoluteContractPath = isAbsolute(options.contract)\n ? options.contract\n : resolve(process.cwd(), options.contract);\n\n const contractConfig =\n ext === '.ts'\n ? {\n source: async () => {\n const { typescriptContract } = await import(\n '@prisma-next/mongo-contract-ts/config-types'\n );\n const mod = await import(pathToFileURL(absoluteContractPath).href);\n const contract = mod.default ?? mod.contract;\n return typescriptContract(contract, output).source({\n composedExtensionPacks: [],\n });\n },\n output,\n }\n : mongoContract(options.contract, { output });\n\n return coreDefineConfig({\n family: mongoFamilyDescriptor,\n target: mongoTargetDescriptor,\n adapter: mongoAdapter,\n driver: mongoDriver,\n contract: contractConfig,\n ...(options.db !== undefined ? { db: options.db } : {}),\n });\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAS,iBAAiB,cAA8B;CACtD,MAAM,MAAM,QAAQ,aAAa;AACjC,KAAI,IAAI,WAAW,EACjB,QAAO,GAAG,aAAa;AAEzB,QAAO,GAAG,aAAa,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC;;AAG/C,SAAgB,aAAa,SAAiE;CAC5F,MAAM,SAAS,iBAAiB,QAAQ,SAAS;CACjD,MAAM,MAAM,QAAQ,QAAQ,SAAS;CAErC,MAAM,uBAAuB,WAAW,QAAQ,SAAS,GACrD,QAAQ,WACR,QAAQ,QAAQ,KAAK,EAAE,QAAQ,SAAS;AAmB5C,QAAOA,eAAiB;EACtB,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,UArBA,QAAQ,QACJ;GACE,QAAQ,YAAY;IAClB,MAAM,EAAE,uBAAuB,MAAM,OACnC;IAEF,MAAM,MAAM,MAAM,OAAO,cAAc,qBAAqB,CAAC;AAE7D,WAAO,mBADU,IAAI,WAAW,IAAI,UACA,OAAO,CAAC,OAAO,EACjD,wBAAwB,EAAE,EAC3B,CAAC;;GAEJ;GACD,GACD,cAAc,QAAQ,UAAU,EAAE,QAAQ,CAAC;EAQ/C,GAAI,QAAQ,OAAO,SAAY,EAAE,IAAI,QAAQ,IAAI,GAAG,EAAE;EACvD,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { MongoContract, MongoContractWithTypeMaps, MongoTypeMaps } from "@prisma-next/mongo-contract";
2
+ import { mongoOrm } from "@prisma-next/mongo-orm";
3
+ import { mongoPipeline } from "@prisma-next/mongo-pipeline-builder";
4
+ import { MongoRuntime } from "@prisma-next/mongo-runtime";
5
+
6
+ //#region src/runtime/mongo.d.ts
7
+ interface MongoOptions {
8
+ readonly contractJson: unknown;
9
+ }
10
+ interface MongoClient<TContract extends MongoContractWithTypeMaps<MongoContract, MongoTypeMaps>> {
11
+ readonly pipeline: ReturnType<typeof mongoPipeline<TContract>>;
12
+ connect(uri: string, dbName: string): Promise<ConnectedMongoClient<TContract>>;
13
+ }
14
+ interface ConnectedMongoClient<TContract extends MongoContractWithTypeMaps<MongoContract, MongoTypeMaps>> {
15
+ readonly orm: ReturnType<typeof mongoOrm<TContract>>;
16
+ readonly runtime: MongoRuntime;
17
+ readonly pipeline: ReturnType<typeof mongoPipeline<TContract>>;
18
+ readonly contract: TContract;
19
+ close(): Promise<void>;
20
+ }
21
+ declare function mongo<TContract extends MongoContractWithTypeMaps<MongoContract, MongoTypeMaps>>(options: MongoOptions): MongoClient<TContract>;
22
+ //#endregion
23
+ export { type ConnectedMongoClient, type MongoClient, type MongoOptions, mongo as default };
24
+ //# sourceMappingURL=runtime.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/runtime/mongo.ts"],"sourcesContent":[],"mappings":";;;;;;UAaiB,YAAA;;AAAjB;AAIiB,UAAA,WAAW,CAAA,kBACR,yBADQ,CACkB,aADlB,EACiC,aADjC,CAAA,CAAA,CAAA;EACkB,SAAA,QAAA,EAEzB,UAFyB,CAAA,OAEP,aAFO,CAEO,SAFP,CAAA,CAAA;EAAe,OAAA,CAAA,GAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAGrB,OAHqB,CAGb,oBAHa,CAGQ,SAHR,CAAA,CAAA;;AAER,UAIpC,oBAJoC,CAAA,kBAKjC,yBALiC,CAKP,aALO,EAKQ,aALR,CAAA,CAAA,CAAA;EAAd,SAAA,GAAA,EAOvB,UAPuB,CAAA,OAOL,QAPK,CAOI,SAPJ,CAAA,CAAA;EAAlB,SAAA,OAAA,EAQD,YARC;EACgD,SAAA,QAAA,EAQhD,UARgD,CAAA,OAQ9B,aAR8B,CAQhB,SARgB,CAAA,CAAA;EAArB,SAAA,QAAA,EAS3B,SAT2B;EAAR,KAAA,EAAA,EAU7B,OAV6B,CAAA,IAAA,CAAA;;AAGvB,iBAUO,KAVa,CAAA,kBAWjB,yBAXiB,CAWS,aAXT,EAWwB,aAXxB,CAAA,CAAA,CAAA,OAAA,EAY1B,YAZ0B,CAAA,EAYX,WAZW,CAYC,SAZD,CAAA"}
@@ -0,0 +1,39 @@
1
+ import { createMongoAdapter } from "@prisma-next/adapter-mongo";
2
+ import { createMongoDriver } from "@prisma-next/driver-mongo";
3
+ import { validateMongoContract } from "@prisma-next/mongo-contract";
4
+ import { mongoOrm } from "@prisma-next/mongo-orm";
5
+ import { mongoPipeline } from "@prisma-next/mongo-pipeline-builder";
6
+ import { createMongoRuntime } from "@prisma-next/mongo-runtime";
7
+
8
+ //#region src/runtime/mongo.ts
9
+ function mongo(options) {
10
+ const { contract } = validateMongoContract(options.contractJson);
11
+ const pipeline = mongoPipeline({ contractJson: options.contractJson });
12
+ return {
13
+ pipeline,
14
+ async connect(uri, dbName) {
15
+ const runtime = createMongoRuntime({
16
+ adapter: createMongoAdapter(),
17
+ driver: await createMongoDriver(uri, dbName),
18
+ contract,
19
+ targetId: "mongo"
20
+ });
21
+ return {
22
+ orm: mongoOrm({
23
+ contract,
24
+ executor: runtime
25
+ }),
26
+ runtime,
27
+ pipeline,
28
+ contract,
29
+ async close() {
30
+ await runtime.close();
31
+ }
32
+ };
33
+ }
34
+ };
35
+ }
36
+
37
+ //#endregion
38
+ export { mongo as default };
39
+ //# sourceMappingURL=runtime.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../src/runtime/mongo.ts"],"sourcesContent":["import { createMongoAdapter } from '@prisma-next/adapter-mongo';\nimport { createMongoDriver } from '@prisma-next/driver-mongo';\nimport type {\n MongoContract,\n MongoContractWithTypeMaps,\n MongoTypeMaps,\n} from '@prisma-next/mongo-contract';\nimport { validateMongoContract } from '@prisma-next/mongo-contract';\nimport { mongoOrm } from '@prisma-next/mongo-orm';\nimport { mongoPipeline } from '@prisma-next/mongo-pipeline-builder';\nimport type { MongoRuntime } from '@prisma-next/mongo-runtime';\nimport { createMongoRuntime } from '@prisma-next/mongo-runtime';\n\nexport interface MongoOptions {\n readonly contractJson: unknown;\n}\n\nexport interface MongoClient<\n TContract extends MongoContractWithTypeMaps<MongoContract, MongoTypeMaps>,\n> {\n readonly pipeline: ReturnType<typeof mongoPipeline<TContract>>;\n connect(uri: string, dbName: string): Promise<ConnectedMongoClient<TContract>>;\n}\n\nexport interface ConnectedMongoClient<\n TContract extends MongoContractWithTypeMaps<MongoContract, MongoTypeMaps>,\n> {\n readonly orm: ReturnType<typeof mongoOrm<TContract>>;\n readonly runtime: MongoRuntime;\n readonly pipeline: ReturnType<typeof mongoPipeline<TContract>>;\n readonly contract: TContract;\n close(): Promise<void>;\n}\n\nexport default function mongo<\n TContract extends MongoContractWithTypeMaps<MongoContract, MongoTypeMaps>,\n>(options: MongoOptions): MongoClient<TContract> {\n const { contract } = validateMongoContract<TContract>(options.contractJson);\n const pipeline = mongoPipeline<TContract>({ contractJson: options.contractJson });\n\n return {\n pipeline,\n async connect(uri: string, dbName: string): Promise<ConnectedMongoClient<TContract>> {\n const adapter = createMongoAdapter();\n const driver = await createMongoDriver(uri, dbName);\n const runtime = createMongoRuntime({ adapter, driver, contract, targetId: 'mongo' });\n const orm = mongoOrm<TContract>({ contract, executor: runtime });\n\n return {\n orm,\n runtime,\n pipeline,\n contract,\n async close() {\n await runtime.close();\n },\n };\n },\n };\n}\n"],"mappings":";;;;;;;;AAkCA,SAAwB,MAEtB,SAA+C;CAC/C,MAAM,EAAE,aAAa,sBAAiC,QAAQ,aAAa;CAC3E,MAAM,WAAW,cAAyB,EAAE,cAAc,QAAQ,cAAc,CAAC;AAEjF,QAAO;EACL;EACA,MAAM,QAAQ,KAAa,QAA0D;GAGnF,MAAM,UAAU,mBAAmB;IAAE,SAFrB,oBAAoB;IAEU,QAD/B,MAAM,kBAAkB,KAAK,OAAO;IACG;IAAU,UAAU;IAAS,CAAC;AAGpF,UAAO;IACL,KAHU,SAAoB;KAAE;KAAU,UAAU;KAAS,CAAC;IAI9D;IACA;IACA;IACA,MAAM,QAAQ;AACZ,WAAM,QAAQ,OAAO;;IAExB;;EAEJ"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@prisma-next/mongo",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "description": "One-package Mongo setup for Prisma Next",
7
+ "scripts": {
8
+ "build": "tsdown",
9
+ "test": "vitest run",
10
+ "test:coverage": "vitest run --coverage",
11
+ "typecheck": "tsc --project tsconfig.json --noEmit",
12
+ "lint": "biome check . --error-on-warnings",
13
+ "lint:fix": "biome check --write .",
14
+ "lint:fix:unsafe": "biome check --write --unsafe .",
15
+ "clean": "rm -rf dist dist-tsc dist-tsc-prod coverage .tmp-output"
16
+ },
17
+ "dependencies": {
18
+ "@prisma-next/adapter-mongo": "workspace:*",
19
+ "@prisma-next/config": "workspace:*",
20
+ "@prisma-next/contract": "workspace:*",
21
+ "@prisma-next/driver-mongo": "workspace:*",
22
+ "@prisma-next/family-mongo": "workspace:*",
23
+ "@prisma-next/framework-components": "workspace:*",
24
+ "@prisma-next/mongo-contract": "workspace:*",
25
+ "@prisma-next/mongo-contract-psl": "workspace:*",
26
+ "@prisma-next/mongo-contract-ts": "workspace:*",
27
+ "@prisma-next/mongo-orm": "workspace:*",
28
+ "@prisma-next/mongo-pipeline-builder": "workspace:*",
29
+ "@prisma-next/mongo-runtime": "workspace:*",
30
+ "@prisma-next/target-mongo": "workspace:*",
31
+ "pathe": "^2.0.3"
32
+ },
33
+ "devDependencies": {
34
+ "@prisma-next/test-utils": "workspace:*",
35
+ "@prisma-next/tsconfig": "workspace:*",
36
+ "@prisma-next/tsdown": "workspace:*",
37
+ "tsdown": "catalog:",
38
+ "typescript": "catalog:",
39
+ "vitest": "catalog:"
40
+ },
41
+ "files": [
42
+ "dist",
43
+ "src"
44
+ ],
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/prisma/prisma-next.git",
48
+ "directory": "packages/3-extensions/mongo"
49
+ },
50
+ "engines": {
51
+ "node": ">=20"
52
+ },
53
+ "exports": {
54
+ "./config": "./dist/config.mjs",
55
+ "./runtime": "./dist/runtime.mjs",
56
+ "./package.json": "./package.json"
57
+ }
58
+ }
@@ -0,0 +1,58 @@
1
+ import { pathToFileURL } from 'node:url';
2
+ import mongoAdapter from '@prisma-next/adapter-mongo/control';
3
+ import type { PrismaNextConfig } from '@prisma-next/config/config-types';
4
+ import { defineConfig as coreDefineConfig } from '@prisma-next/config/config-types';
5
+ import mongoDriver from '@prisma-next/driver-mongo/control';
6
+ import { mongoFamilyDescriptor, mongoTargetDescriptor } from '@prisma-next/family-mongo/control';
7
+ import { mongoContract } from '@prisma-next/mongo-contract-psl/provider';
8
+ import { extname, isAbsolute, resolve } from 'pathe';
9
+
10
+ export interface MongoConfigOptions {
11
+ readonly contract: string;
12
+ readonly db?: {
13
+ readonly connection?: string;
14
+ };
15
+ }
16
+
17
+ function deriveOutputPath(contractPath: string): string {
18
+ const ext = extname(contractPath);
19
+ if (ext.length === 0) {
20
+ return `${contractPath}.json`;
21
+ }
22
+ return `${contractPath.slice(0, -ext.length)}.json`;
23
+ }
24
+
25
+ export function defineConfig(options: MongoConfigOptions): PrismaNextConfig<'mongo', 'mongo'> {
26
+ const output = deriveOutputPath(options.contract);
27
+ const ext = extname(options.contract);
28
+
29
+ const absoluteContractPath = isAbsolute(options.contract)
30
+ ? options.contract
31
+ : resolve(process.cwd(), options.contract);
32
+
33
+ const contractConfig =
34
+ ext === '.ts'
35
+ ? {
36
+ source: async () => {
37
+ const { typescriptContract } = await import(
38
+ '@prisma-next/mongo-contract-ts/config-types'
39
+ );
40
+ const mod = await import(pathToFileURL(absoluteContractPath).href);
41
+ const contract = mod.default ?? mod.contract;
42
+ return typescriptContract(contract, output).source({
43
+ composedExtensionPacks: [],
44
+ });
45
+ },
46
+ output,
47
+ }
48
+ : mongoContract(options.contract, { output });
49
+
50
+ return coreDefineConfig({
51
+ family: mongoFamilyDescriptor,
52
+ target: mongoTargetDescriptor,
53
+ adapter: mongoAdapter,
54
+ driver: mongoDriver,
55
+ contract: contractConfig,
56
+ ...(options.db !== undefined ? { db: options.db } : {}),
57
+ });
58
+ }
@@ -0,0 +1,2 @@
1
+ export type { MongoConfigOptions } from '../config/define-config';
2
+ export { defineConfig } from '../config/define-config';
@@ -0,0 +1,2 @@
1
+ export type { ConnectedMongoClient, MongoClient, MongoOptions } from '../runtime/mongo';
2
+ export { default } from '../runtime/mongo';
@@ -0,0 +1,60 @@
1
+ import { createMongoAdapter } from '@prisma-next/adapter-mongo';
2
+ import { createMongoDriver } from '@prisma-next/driver-mongo';
3
+ import type {
4
+ MongoContract,
5
+ MongoContractWithTypeMaps,
6
+ MongoTypeMaps,
7
+ } from '@prisma-next/mongo-contract';
8
+ import { validateMongoContract } from '@prisma-next/mongo-contract';
9
+ import { mongoOrm } from '@prisma-next/mongo-orm';
10
+ import { mongoPipeline } from '@prisma-next/mongo-pipeline-builder';
11
+ import type { MongoRuntime } from '@prisma-next/mongo-runtime';
12
+ import { createMongoRuntime } from '@prisma-next/mongo-runtime';
13
+
14
+ export interface MongoOptions {
15
+ readonly contractJson: unknown;
16
+ }
17
+
18
+ export interface MongoClient<
19
+ TContract extends MongoContractWithTypeMaps<MongoContract, MongoTypeMaps>,
20
+ > {
21
+ readonly pipeline: ReturnType<typeof mongoPipeline<TContract>>;
22
+ connect(uri: string, dbName: string): Promise<ConnectedMongoClient<TContract>>;
23
+ }
24
+
25
+ export interface ConnectedMongoClient<
26
+ TContract extends MongoContractWithTypeMaps<MongoContract, MongoTypeMaps>,
27
+ > {
28
+ readonly orm: ReturnType<typeof mongoOrm<TContract>>;
29
+ readonly runtime: MongoRuntime;
30
+ readonly pipeline: ReturnType<typeof mongoPipeline<TContract>>;
31
+ readonly contract: TContract;
32
+ close(): Promise<void>;
33
+ }
34
+
35
+ export default function mongo<
36
+ TContract extends MongoContractWithTypeMaps<MongoContract, MongoTypeMaps>,
37
+ >(options: MongoOptions): MongoClient<TContract> {
38
+ const { contract } = validateMongoContract<TContract>(options.contractJson);
39
+ const pipeline = mongoPipeline<TContract>({ contractJson: options.contractJson });
40
+
41
+ return {
42
+ pipeline,
43
+ async connect(uri: string, dbName: string): Promise<ConnectedMongoClient<TContract>> {
44
+ const adapter = createMongoAdapter();
45
+ const driver = await createMongoDriver(uri, dbName);
46
+ const runtime = createMongoRuntime({ adapter, driver, contract, targetId: 'mongo' });
47
+ const orm = mongoOrm<TContract>({ contract, executor: runtime });
48
+
49
+ return {
50
+ orm,
51
+ runtime,
52
+ pipeline,
53
+ contract,
54
+ async close() {
55
+ await runtime.close();
56
+ },
57
+ };
58
+ },
59
+ };
60
+ }