@prisma/orm-target-mongo 8.0.0-rc.21-dev.20 → 8.0.0-rc.21-dev.21
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/adapter__control.d.mts +2 -2
- package/dist/adapter__control.d.mts.map +1 -1
- package/dist/{mongo-driver-CTyvKDUg-Bm9sBrfs.d.mts → control-4GDkJr5g.d.mts} +16 -6
- package/dist/control-4GDkJr5g.d.mts.map +1 -0
- package/dist/control-CZxDL43O.mjs +45 -0
- package/dist/control-CZxDL43O.mjs.map +1 -0
- package/dist/driver.d.mts +3 -2
- package/dist/driver.mjs +2 -2
- package/dist/driver__control.d.mts +2 -17
- package/dist/driver__control.mjs +1 -49
- package/dist/driver__runtime.d.mts +2 -0
- package/dist/driver__runtime.mjs +65 -0
- package/dist/driver__runtime.mjs.map +1 -0
- package/dist/{mongo-driver-B6tNQUDT-CJ2_KwPq.mjs → mongo-driver-CjqtuhuS-D-ggtKWS.mjs} +18 -8
- package/dist/mongo-driver-CjqtuhuS-D-ggtKWS.mjs.map +1 -0
- package/dist/runtime-DDkdv2wO.d.mts +22 -0
- package/dist/runtime-DDkdv2wO.d.mts.map +1 -0
- package/package.json +10 -9
- package/dist/driver__control.d.mts.map +0 -1
- package/dist/driver__control.mjs.map +0 -1
- package/dist/mongo-driver-B6tNQUDT-CJ2_KwPq.mjs.map +0 -1
- package/dist/mongo-driver-CTyvKDUg-Bm9sBrfs.d.mts.map +0 -1
|
@@ -4,7 +4,7 @@ import { ControlDriverInstance } from "@prisma/orm-framework/components/control"
|
|
|
4
4
|
import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
5
5
|
import { MongoSchemaIR } from "@prisma/orm-family-mongo/schema-ir";
|
|
6
6
|
import { Db, Document } from "mongodb";
|
|
7
|
-
import { MongoControlDriverInstance, MongoControlDriverInstance as MongoControlDriverInstance$1,
|
|
7
|
+
import { MongoControlDriverInstance, MongoControlDriverInstance as MongoControlDriverInstance$1, MongoQueryable } from "@prisma/orm-family-mongo/lowering";
|
|
8
8
|
import { MongoControlAdapter, MongoControlAdapterDescriptor, MongoRunnerDependencies } from "@prisma/orm-family-mongo/family/control-adapter";
|
|
9
9
|
//#region ../../../3-targets/mongo/2-adapter/dist/control.d.mts
|
|
10
10
|
//#region src/core/introspect-schema.d.ts
|
|
@@ -39,7 +39,7 @@ declare class MongoControlAdapterImpl implements MongoControlAdapter<'mongo'> {
|
|
|
39
39
|
readonly familyId: "mongo";
|
|
40
40
|
readonly targetId: "mongo";
|
|
41
41
|
readonly markerLocation = "_prisma_migrations";
|
|
42
|
-
executeDdl(driver:
|
|
42
|
+
executeDdl(driver: MongoQueryable, command: AnyMongoDdlCommand): Promise<void>;
|
|
43
43
|
readMarker(driver: ControlDriverInstance<'mongo', 'mongo'>, space: string): Promise<ContractMarkerRecord | null>;
|
|
44
44
|
readAllMarkers(driver: ControlDriverInstance<'mongo', 'mongo'>): Promise<ReadonlyMap<string, ContractMarkerRecord>>;
|
|
45
45
|
initMarker(driver: ControlDriverInstance<'mongo', 'mongo'>, space: string, destination: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter__control.d.mts","names":[],"sources":["../../../../3-targets/mongo/2-adapter/dist/control.d.mts"],"mappings":";;;;;;;;;;iBASiB,iBAAiB,IAAI,KAAK,QAAQ;;;;;;;;;cASrC,mCAAmC,8BAA8B,QAAQ;mBACpE;EACjB,YAAY,IAAI;EAChB,YAAY,KAAK,qBAAqB,QAAQ;EAC9C,gBAAgB,MAAM,yBAAyB,QAAQ;;;;;;;;;;;;;cAa3C,mCAAmC;;WAEtC;WACA;WACA;EACT,WAAW,QAAQ,
|
|
1
|
+
{"version":3,"file":"adapter__control.d.mts","names":[],"sources":["../../../../3-targets/mongo/2-adapter/dist/control.d.mts"],"mappings":";;;;;;;;;;iBASiB,iBAAiB,IAAI,KAAK,QAAQ;;;;;;;;;cASrC,mCAAmC,8BAA8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import { ControlDriverDescriptor } from "@prisma/orm-framework/components/control";
|
|
1
2
|
import { AggregateWireCommand, AnyMongoDdlWireCommand, AnyMongoDmlWireCommand, CollModWireCommand, CreateCollectionWireCommand, CreateIndexWireCommand, DeleteManyResult, DeleteManyWireCommand, DeleteOneResult, DeleteOneWireCommand, DropCollectionWireCommand, DropIndexWireCommand, FindOneAndDeleteWireCommand, FindOneAndUpdateWireCommand, InsertManyResult, InsertManyWireCommand, InsertOneResult, InsertOneWireCommand, RenameCollectionWireCommand, UpdateManyResult, UpdateManyWireCommand, UpdateOneResult, UpdateOneWireCommand } from "@prisma/orm-family-mongo/wire";
|
|
2
3
|
import { Db, Document, MongoClient } from "mongodb";
|
|
3
|
-
import {
|
|
4
|
-
//#region ../../../3-targets/mongo/3-driver/dist/
|
|
4
|
+
import { MongoControlDriverInstance, MongoQueryable } from "@prisma/orm-family-mongo/lowering";
|
|
5
|
+
//#region ../../../3-targets/mongo/3-driver/dist/control.d.mts
|
|
5
6
|
//#region src/mongo-driver.d.ts
|
|
6
|
-
declare class MongoDriverImpl implements
|
|
7
|
+
declare class MongoDriverImpl implements MongoQueryable {
|
|
7
8
|
protected readonly db: Db;
|
|
8
9
|
protected readonly client: MongoClient | undefined;
|
|
9
10
|
protected constructor(db: Db, client: MongoClient | undefined);
|
|
@@ -32,7 +33,16 @@ declare class MongoDriverImpl implements MongoDriver {
|
|
|
32
33
|
protected executeDropIndexCommand(cmd: DropIndexWireCommand): Promise<void>;
|
|
33
34
|
protected executeCollModCommand(cmd: CollModWireCommand): Promise<void>;
|
|
34
35
|
}
|
|
35
|
-
declare function createMongoDriver(uri: string, dbName: string): Promise<MongoDriver>;
|
|
36
36
|
//#endregion
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
//#region src/exports/control.d.ts
|
|
38
|
+
declare class MongoControlDriver extends MongoDriverImpl implements MongoControlDriverInstance {
|
|
39
|
+
readonly familyId: "mongo";
|
|
40
|
+
readonly targetId: "mongo";
|
|
41
|
+
readonly db: Db;
|
|
42
|
+
constructor(db: Db, mongoClient: MongoClient);
|
|
43
|
+
databaseName(): Promise<string>;
|
|
44
|
+
}
|
|
45
|
+
declare const mongoControlDriverDescriptor: ControlDriverDescriptor<'mongo', 'mongo', MongoControlDriver>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { mongoControlDriverDescriptor as n, MongoControlDriver as t };
|
|
48
|
+
//# sourceMappingURL=control-4GDkJr5g.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-4GDkJr5g.d.mts","names":[],"sources":["../../../../3-targets/mongo/3-driver/dist/control.d.mts"],"mappings":";;;;;;cAKc,2BAA2B;qBACpB,IAAI;qBACJ,QAAQ;YACjB,YAAY,IAAI,IAAI,QAAQ;SAC/B,eAAe,aAAa,iBAAiB,QAAQ;SACrD,OAAO,IAAI,KAAK;EACvB,QAAQ,MAAM,yBAAyB,aAAa,yBAAyB,cAAc;EAC3F,IAAI,aAAa,yBAAyB;EAC1C,SAAS;YACC,wBAAwB,KAAK,uBAAuB,cAAc;;;;YAIlE,OAAO,UAAU,WAAW;YAC5B,wBAAwB,KAAK,uBAAuB,cAAc;YAClE,yBAAyB,KAAK,wBAAwB,cAAc;YACpE,yBAAyB,KAAK,wBAAwB,cAAc;YACpE,wBAAwB,KAAK,uBAAuB,cAAc;YAClE,yBAAyB,KAAK,wBAAwB,cAAc;YACpE,+BAA+B,KAAK,8BAA8B,cAAc;YAChF,+BAA+B,KAAK,8BAA8B,cAAc;YAChF,wBAAwB,KAAK,KAAK,uBAAuB,cAAc;YACvE,+BAA+B,KAAK,8BAA8B;YAClE,0BAA0B,KAAK,yBAAyB;YACxD,6BAA6B,KAAK,4BAA4B;YAC9D,+BAA+B,KAAK,8BAA8B;YAClE,wBAAwB,KAAK,uBAAuB;YACpD,sBAAsB,KAAK,qBAAqB;;;;cAI9C,2BAA2B,2BAA2B;WACzD;WACA;WACA,IAAI;EACb,YAAY,IAAI,IAAI,aAAa;EACjC,gBAAgB;;cAEJ,8BAA8B,0CAA0C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { n as MongoDriverImpl, r as mongoDriverDescriptorMeta, t as DRIVER_INFO } from "./mongo-driver-CjqtuhuS-D-ggtKWS.mjs";
|
|
2
|
+
import { MongoClient } from "mongodb";
|
|
3
|
+
import { errorRuntime } from "@prisma/orm-framework/errors/execution";
|
|
4
|
+
import { redactDatabaseUrl } from "@prisma/orm-framework/utils/redact-db-url";
|
|
5
|
+
//#region ../../../3-targets/mongo/3-driver/dist/control.mjs
|
|
6
|
+
var MongoControlDriver = class extends MongoDriverImpl {
|
|
7
|
+
familyId = "mongo";
|
|
8
|
+
targetId = "mongo";
|
|
9
|
+
db;
|
|
10
|
+
constructor(db, mongoClient) {
|
|
11
|
+
super(db, mongoClient);
|
|
12
|
+
this.db = db;
|
|
13
|
+
}
|
|
14
|
+
async databaseName() {
|
|
15
|
+
return this.db.databaseName;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const mongoControlDriverDescriptor = {
|
|
19
|
+
...mongoDriverDescriptorMeta,
|
|
20
|
+
async create(url) {
|
|
21
|
+
const client = new MongoClient(url, {
|
|
22
|
+
serverSelectionTimeoutMS: 5e3,
|
|
23
|
+
connectTimeoutMS: 5e3,
|
|
24
|
+
driverInfo: DRIVER_INFO
|
|
25
|
+
});
|
|
26
|
+
try {
|
|
27
|
+
await client.connect();
|
|
28
|
+
return new MongoControlDriver(client.db(), client);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
try {
|
|
31
|
+
await client.close();
|
|
32
|
+
} catch {}
|
|
33
|
+
throw errorRuntime("DRIVER.CONNECTION_FAILED", "Database connection failed", {
|
|
34
|
+
why: error instanceof Error ? error.message : String(error),
|
|
35
|
+
fix: "Verify the MongoDB URL, ensure the database is reachable, and confirm credentials/permissions",
|
|
36
|
+
meta: { ...redactDatabaseUrl(url) },
|
|
37
|
+
cause: error
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { mongoControlDriverDescriptor as n, MongoControlDriver as t };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=control-CZxDL43O.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-CZxDL43O.mjs","names":[],"sources":["../../../../3-targets/mongo/3-driver/dist/control.mjs"],"sourcesContent":["import { n as mongoDriverDescriptorMeta, r as DRIVER_INFO, t as MongoDriverImpl } from \"./mongo-driver-CjqtuhuS.mjs\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { redactDatabaseUrl } from \"@internal/utils/redact-db-url\";\nimport { MongoClient } from \"mongodb\";\n//#region src/exports/control.ts\nvar MongoControlDriver = class extends MongoDriverImpl {\n\tfamilyId = \"mongo\";\n\ttargetId = \"mongo\";\n\tdb;\n\tconstructor(db, mongoClient) {\n\t\tsuper(db, mongoClient);\n\t\tthis.db = db;\n\t}\n\tasync databaseName() {\n\t\treturn this.db.databaseName;\n\t}\n};\nconst mongoControlDriverDescriptor = {\n\t...mongoDriverDescriptorMeta,\n\tasync create(url) {\n\t\tconst client = new MongoClient(url, {\n\t\t\tserverSelectionTimeoutMS: 5e3,\n\t\t\tconnectTimeoutMS: 5e3,\n\t\t\tdriverInfo: DRIVER_INFO\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect();\n\t\t\treturn new MongoControlDriver(client.db(), client);\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait client.close();\n\t\t\t} catch {}\n\t\t\tthrow errorRuntime(\"DRIVER.CONNECTION_FAILED\", \"Database connection failed\", {\n\t\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\t\tfix: \"Verify the MongoDB URL, ensure the database is reachable, and confirm credentials/permissions\",\n\t\t\t\tmeta: { ...redactDatabaseUrl(url) },\n\t\t\t\tcause: error\n\t\t\t});\n\t\t}\n\t}\n};\n//#endregion\nexport { MongoControlDriver, mongoControlDriverDescriptor as default };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;AAKA,IAAI,qBAAqB,cAAc,gBAAgB;CACtD,WAAW;CACX,WAAW;CACX;CACA,YAAY,IAAI,aAAa;EAC5B,MAAM,IAAI,WAAW;EACrB,KAAK,KAAK;CACX;CACA,MAAM,eAAe;EACpB,OAAO,KAAK,GAAG;CAChB;AACD;AACA,MAAM,+BAA+B;CACpC,GAAG;CACH,MAAM,OAAO,KAAK;EACjB,MAAM,SAAS,IAAI,YAAY,KAAK;GACnC,0BAA0B;GAC1B,kBAAkB;GAClB,YAAY;EACb,CAAC;EACD,IAAI;GACH,MAAM,OAAO,QAAQ;GACrB,OAAO,IAAI,mBAAmB,OAAO,GAAG,GAAG,MAAM;EAClD,SAAS,OAAO;GACf,IAAI;IACH,MAAM,OAAO,MAAM;GACpB,QAAQ,CAAC;GACT,MAAM,aAAa,4BAA4B,8BAA8B;IAC5E,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IAC1D,KAAK;IACL,MAAM,EAAE,GAAG,kBAAkB,GAAG,EAAE;IAClC,OAAO;GACR,CAAC;EACF;CACD;AACD"}
|
package/dist/driver.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { t as MongoControlDriver } from "./control-4GDkJr5g.mjs";
|
|
2
|
+
import { n as MongoRuntimeDriver, t as MongoBinding } from "./runtime-DDkdv2wO.mjs";
|
|
3
|
+
export { type MongoBinding, MongoControlDriver, type MongoRuntimeDriver };
|
package/dist/driver.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { t as MongoControlDriver } from "./control-CZxDL43O.mjs";
|
|
2
|
+
export { MongoControlDriver };
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
|
|
3
|
-
import { Db, MongoClient } from "mongodb";
|
|
4
|
-
import { MongoControlDriverInstance } from "@prisma/orm-family-mongo/lowering";
|
|
5
|
-
//#region ../../../3-targets/mongo/3-driver/dist/control.d.mts
|
|
6
|
-
//#region src/exports/control.d.ts
|
|
7
|
-
declare class MongoControlDriver extends MongoDriverImpl implements MongoControlDriverInstance {
|
|
8
|
-
readonly familyId: "mongo";
|
|
9
|
-
readonly targetId: "mongo";
|
|
10
|
-
readonly db: Db;
|
|
11
|
-
constructor(db: Db, mongoClient: MongoClient);
|
|
12
|
-
databaseName(): Promise<string>;
|
|
13
|
-
}
|
|
14
|
-
declare const mongoControlDriverDescriptor: ControlDriverDescriptor<'mongo', 'mongo', MongoControlDriver>;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { MongoControlDriver, mongoControlDriverDescriptor as default };
|
|
17
|
-
//# sourceMappingURL=driver__control.d.mts.map
|
|
1
|
+
import { n as mongoControlDriverDescriptor, t as MongoControlDriver } from "./control-4GDkJr5g.mjs";
|
|
2
|
+
export { MongoControlDriver, mongoControlDriverDescriptor as default };
|
package/dist/driver__control.mjs
CHANGED
|
@@ -1,50 +1,2 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { MongoClient } from "mongodb";
|
|
3
|
-
import { errorRuntime } from "@prisma/orm-framework/errors/execution";
|
|
4
|
-
import { redactDatabaseUrl } from "@prisma/orm-framework/utils/redact-db-url";
|
|
5
|
-
//#region ../../../3-targets/mongo/3-driver/dist/control.mjs
|
|
6
|
-
var MongoControlDriver = class extends MongoDriverImpl {
|
|
7
|
-
familyId = "mongo";
|
|
8
|
-
targetId = "mongo";
|
|
9
|
-
db;
|
|
10
|
-
constructor(db, mongoClient) {
|
|
11
|
-
super(db, mongoClient);
|
|
12
|
-
this.db = db;
|
|
13
|
-
}
|
|
14
|
-
async databaseName() {
|
|
15
|
-
return this.db.databaseName;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const mongoControlDriverDescriptor = {
|
|
19
|
-
kind: "driver",
|
|
20
|
-
familyId: "mongo",
|
|
21
|
-
targetId: "mongo",
|
|
22
|
-
id: "mongo",
|
|
23
|
-
version: DRIVER_INFO.version,
|
|
24
|
-
capabilities: {},
|
|
25
|
-
async create(url) {
|
|
26
|
-
const client = new MongoClient(url, {
|
|
27
|
-
serverSelectionTimeoutMS: 5e3,
|
|
28
|
-
connectTimeoutMS: 5e3,
|
|
29
|
-
driverInfo: DRIVER_INFO
|
|
30
|
-
});
|
|
31
|
-
try {
|
|
32
|
-
await client.connect();
|
|
33
|
-
return new MongoControlDriver(client.db(), client);
|
|
34
|
-
} catch (error) {
|
|
35
|
-
try {
|
|
36
|
-
await client.close();
|
|
37
|
-
} catch {}
|
|
38
|
-
throw errorRuntime("DRIVER.CONNECTION_FAILED", "Database connection failed", {
|
|
39
|
-
why: error instanceof Error ? error.message : String(error),
|
|
40
|
-
fix: "Verify the MongoDB URL, ensure the database is reachable, and confirm credentials/permissions",
|
|
41
|
-
meta: { ...redactDatabaseUrl(url) },
|
|
42
|
-
cause: error
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
//#endregion
|
|
1
|
+
import { n as mongoControlDriverDescriptor, t as MongoControlDriver } from "./control-CZxDL43O.mjs";
|
|
48
2
|
export { MongoControlDriver, mongoControlDriverDescriptor as default };
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=driver__control.mjs.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { n as MongoDriverImpl, r as mongoDriverDescriptorMeta } from "./mongo-driver-CjqtuhuS-D-ggtKWS.mjs";
|
|
2
|
+
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
3
|
+
//#region ../../../3-targets/mongo/3-driver/dist/runtime.mjs
|
|
4
|
+
const notConnectedMessages = {
|
|
5
|
+
unbound: "Mongo driver not connected. Call connect(binding) before execute or run.",
|
|
6
|
+
closed: "Mongo driver is closed. Call connect(binding) to reconnect."
|
|
7
|
+
};
|
|
8
|
+
const ALREADY_CONNECTED_MESSAGE = "Mongo driver already connected. Call close() before reconnecting with a new binding.";
|
|
9
|
+
async function connectedDriver(binding) {
|
|
10
|
+
if (binding.kind === "mongoClient") return MongoDriverImpl.fromDb(binding.client.db(binding.dbName));
|
|
11
|
+
return MongoDriverImpl.fromConnection(binding.url, binding.dbName);
|
|
12
|
+
}
|
|
13
|
+
var MongoUnboundDriverImpl = class {
|
|
14
|
+
familyId = "mongo";
|
|
15
|
+
targetId = "mongo";
|
|
16
|
+
#delegate = null;
|
|
17
|
+
#connecting = null;
|
|
18
|
+
#disconnectedState = "unbound";
|
|
19
|
+
#notConnectedError() {
|
|
20
|
+
return structuredError("DRIVER.NOT_CONNECTED", notConnectedMessages[this.#disconnectedState]);
|
|
21
|
+
}
|
|
22
|
+
#requireDelegate() {
|
|
23
|
+
if (this.#delegate === null) throw this.#notConnectedError();
|
|
24
|
+
return this.#delegate;
|
|
25
|
+
}
|
|
26
|
+
async connect(binding) {
|
|
27
|
+
if (this.#delegate !== null || this.#connecting !== null) throw structuredError("DRIVER.ALREADY_CONNECTED", ALREADY_CONNECTED_MESSAGE, { meta: { bindingKind: binding.kind } });
|
|
28
|
+
const connecting = connectedDriver(binding);
|
|
29
|
+
this.#connecting = connecting;
|
|
30
|
+
try {
|
|
31
|
+
const delegate = await connecting;
|
|
32
|
+
if (this.#connecting !== connecting) throw this.#notConnectedError();
|
|
33
|
+
this.#delegate = delegate;
|
|
34
|
+
this.#disconnectedState = "unbound";
|
|
35
|
+
} finally {
|
|
36
|
+
if (this.#connecting === connecting) this.#connecting = null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async *execute(wireCommand) {
|
|
40
|
+
yield* this.#requireDelegate().execute(wireCommand);
|
|
41
|
+
}
|
|
42
|
+
async run(wireCommand) {
|
|
43
|
+
return this.#requireDelegate().run(wireCommand);
|
|
44
|
+
}
|
|
45
|
+
async close() {
|
|
46
|
+
const delegate = this.#delegate;
|
|
47
|
+
const connecting = this.#connecting;
|
|
48
|
+
this.#delegate = null;
|
|
49
|
+
this.#connecting = null;
|
|
50
|
+
this.#disconnectedState = "closed";
|
|
51
|
+
const connected = await connecting?.catch(() => null);
|
|
52
|
+
await Promise.all([delegate?.close(), connected?.close()]);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
function createMongoRuntimeDriver() {
|
|
56
|
+
return new MongoUnboundDriverImpl();
|
|
57
|
+
}
|
|
58
|
+
const mongoRuntimeDriverDescriptor = {
|
|
59
|
+
...mongoDriverDescriptorMeta,
|
|
60
|
+
create: createMongoRuntimeDriver
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { mongoRuntimeDriverDescriptor as default };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=driver__runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver__runtime.mjs","names":["#disconnectedState","#delegate","#notConnectedError","#connecting","#requireDelegate"],"sources":["../../../../3-targets/mongo/3-driver/dist/runtime.mjs"],"sourcesContent":["import { n as mongoDriverDescriptorMeta, t as MongoDriverImpl } from \"./mongo-driver-CjqtuhuS.mjs\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/core/runtime/mongo-runtime-driver.ts\nconst notConnectedMessages = {\n\tunbound: \"Mongo driver not connected. Call connect(binding) before execute or run.\",\n\tclosed: \"Mongo driver is closed. Call connect(binding) to reconnect.\"\n};\nconst ALREADY_CONNECTED_MESSAGE = \"Mongo driver already connected. Call close() before reconnecting with a new binding.\";\nasync function connectedDriver(binding) {\n\tif (binding.kind === \"mongoClient\") return MongoDriverImpl.fromDb(binding.client.db(binding.dbName));\n\treturn MongoDriverImpl.fromConnection(binding.url, binding.dbName);\n}\nvar MongoUnboundDriverImpl = class {\n\tfamilyId = \"mongo\";\n\ttargetId = \"mongo\";\n\t#delegate = null;\n\t#connecting = null;\n\t#disconnectedState = \"unbound\";\n\t#notConnectedError() {\n\t\treturn structuredError(\"DRIVER.NOT_CONNECTED\", notConnectedMessages[this.#disconnectedState]);\n\t}\n\t#requireDelegate() {\n\t\tif (this.#delegate === null) throw this.#notConnectedError();\n\t\treturn this.#delegate;\n\t}\n\tasync connect(binding) {\n\t\tif (this.#delegate !== null || this.#connecting !== null) throw structuredError(\"DRIVER.ALREADY_CONNECTED\", ALREADY_CONNECTED_MESSAGE, { meta: { bindingKind: binding.kind } });\n\t\tconst connecting = connectedDriver(binding);\n\t\tthis.#connecting = connecting;\n\t\ttry {\n\t\t\tconst delegate = await connecting;\n\t\t\tif (this.#connecting !== connecting) throw this.#notConnectedError();\n\t\t\tthis.#delegate = delegate;\n\t\t\tthis.#disconnectedState = \"unbound\";\n\t\t} finally {\n\t\t\tif (this.#connecting === connecting) this.#connecting = null;\n\t\t}\n\t}\n\tasync *execute(wireCommand) {\n\t\tyield* this.#requireDelegate().execute(wireCommand);\n\t}\n\tasync run(wireCommand) {\n\t\treturn this.#requireDelegate().run(wireCommand);\n\t}\n\tasync close() {\n\t\tconst delegate = this.#delegate;\n\t\tconst connecting = this.#connecting;\n\t\tthis.#delegate = null;\n\t\tthis.#connecting = null;\n\t\tthis.#disconnectedState = \"closed\";\n\t\tconst connected = await connecting?.catch(() => null);\n\t\tawait Promise.all([delegate?.close(), connected?.close()]);\n\t}\n};\nfunction createMongoRuntimeDriver() {\n\treturn new MongoUnboundDriverImpl();\n}\n//#endregion\n//#region src/exports/runtime.ts\nconst mongoRuntimeDriverDescriptor = {\n\t...mongoDriverDescriptorMeta,\n\tcreate: createMongoRuntimeDriver\n};\n//#endregion\nexport { mongoRuntimeDriverDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;AAGA,MAAM,uBAAuB;CAC5B,SAAS;CACT,QAAQ;AACT;AACA,MAAM,4BAA4B;AAClC,eAAe,gBAAgB,SAAS;CACvC,IAAI,QAAQ,SAAS,eAAe,OAAO,gBAAgB,OAAO,QAAQ,OAAO,GAAG,QAAQ,MAAM,CAAC;CACnG,OAAO,gBAAgB,eAAe,Q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,9 +1,17 @@
|
|
|
1
1
|
import { assertNever } from "@prisma/orm-framework/utils/internal-error";
|
|
2
2
|
import { BSON, MongoClient } from "mongodb";
|
|
3
|
-
//#region ../../../3-targets/mongo/3-driver/dist/mongo-driver-
|
|
3
|
+
//#region ../../../3-targets/mongo/3-driver/dist/mongo-driver-CjqtuhuS.mjs
|
|
4
4
|
const DRIVER_INFO = {
|
|
5
5
|
name: "Prisma",
|
|
6
|
-
version: "8.0.0-rc.21-dev.
|
|
6
|
+
version: "8.0.0-rc.21-dev.21"
|
|
7
|
+
};
|
|
8
|
+
const mongoDriverDescriptorMeta = {
|
|
9
|
+
kind: "driver",
|
|
10
|
+
familyId: "mongo",
|
|
11
|
+
targetId: "mongo",
|
|
12
|
+
id: "mongo",
|
|
13
|
+
version: DRIVER_INFO.version,
|
|
14
|
+
capabilities: {}
|
|
7
15
|
};
|
|
8
16
|
/* v8 ignore start */
|
|
9
17
|
function unreachableKind(value) {
|
|
@@ -21,7 +29,12 @@ var MongoDriverImpl = class MongoDriverImpl {
|
|
|
21
29
|
}
|
|
22
30
|
static async fromConnection(uri, dbName) {
|
|
23
31
|
const client = new MongoClient(uri, { driverInfo: DRIVER_INFO });
|
|
24
|
-
|
|
32
|
+
try {
|
|
33
|
+
await client.connect();
|
|
34
|
+
} catch (error) {
|
|
35
|
+
await client.close();
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
25
38
|
return new MongoDriverImpl(client.db(dbName), client);
|
|
26
39
|
}
|
|
27
40
|
static fromDb(db) {
|
|
@@ -178,10 +191,7 @@ var MongoDriverImpl = class MongoDriverImpl {
|
|
|
178
191
|
});
|
|
179
192
|
}
|
|
180
193
|
};
|
|
181
|
-
async function createMongoDriver(uri, dbName) {
|
|
182
|
-
return MongoDriverImpl.fromConnection(uri, dbName);
|
|
183
|
-
}
|
|
184
194
|
//#endregion
|
|
185
|
-
export { MongoDriverImpl as n,
|
|
195
|
+
export { MongoDriverImpl as n, mongoDriverDescriptorMeta as r, DRIVER_INFO as t };
|
|
186
196
|
|
|
187
|
-
//# sourceMappingURL=mongo-driver-
|
|
197
|
+
//# sourceMappingURL=mongo-driver-CjqtuhuS-D-ggtKWS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo-driver-CjqtuhuS-D-ggtKWS.mjs","names":[],"sources":["../../../../3-targets/mongo/3-driver/dist/mongo-driver-CjqtuhuS.mjs"],"sourcesContent":["import { BSON, MongoClient } from \"mongodb\";\nimport { assertNever } from \"@internal/utils/internal-error\";\n//#endregion\n//#region src/core/driver-info.ts\nconst DRIVER_INFO = {\n\tname: \"Prisma\",\n\tversion: \"8.0.0-rc.21-dev.21\"\n};\n//#endregion\n//#region src/core/descriptor-meta.ts\nconst mongoDriverDescriptorMeta = {\n\tkind: \"driver\",\n\tfamilyId: \"mongo\",\n\ttargetId: \"mongo\",\n\tid: \"mongo\",\n\tversion: DRIVER_INFO.version,\n\tcapabilities: {}\n};\n//#endregion\n//#region src/mongo-driver.ts\n/* v8 ignore start */\nfunction unreachableKind(value) {\n\tconst candidate = value;\n\tif (typeof candidate === \"object\" && candidate !== null && \"kind\" in candidate && typeof candidate.kind === \"string\") return candidate.kind;\n\treturn \"unknown\";\n}\n/* v8 ignore stop */\nvar MongoDriverImpl = class MongoDriverImpl {\n\tdb;\n\tclient;\n\tconstructor(db, client) {\n\t\tthis.db = db;\n\t\tthis.client = client;\n\t}\n\tstatic async fromConnection(uri, dbName) {\n\t\tconst client = new MongoClient(uri, { driverInfo: DRIVER_INFO });\n\t\ttry {\n\t\t\tawait client.connect();\n\t\t} catch (error) {\n\t\t\tawait client.close();\n\t\t\tthrow error;\n\t\t}\n\t\treturn new MongoDriverImpl(client.db(dbName), client);\n\t}\n\tstatic fromDb(db) {\n\t\treturn new MongoDriverImpl(db, void 0);\n\t}\n\texecute(wireCommand) {\n\t\tswitch (wireCommand.kind) {\n\t\t\tcase \"insertOne\": return this.executeInsertOneCommand(wireCommand);\n\t\t\tcase \"updateOne\": return this.executeUpdateOneCommand(wireCommand);\n\t\t\tcase \"insertMany\": return this.executeInsertManyCommand(wireCommand);\n\t\t\tcase \"updateMany\": return this.executeUpdateManyCommand(wireCommand);\n\t\t\tcase \"deleteOne\": return this.executeDeleteOneCommand(wireCommand);\n\t\t\tcase \"deleteMany\": return this.executeDeleteManyCommand(wireCommand);\n\t\t\tcase \"findOneAndUpdate\": return this.executeFindOneAndUpdateCommand(wireCommand);\n\t\t\tcase \"findOneAndDelete\": return this.executeFindOneAndDeleteCommand(wireCommand);\n\t\t\tcase \"aggregate\": return this.executeAggregateCommand(wireCommand);\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: return assertNever(wireCommand, `Unknown wire command kind: ${unreachableKind(wireCommand)}`);\n\t\t}\n\t}\n\tasync run(wireCommand) {\n\t\tswitch (wireCommand.kind) {\n\t\t\tcase \"createCollection\": return this.executeCreateCollectionCommand(wireCommand);\n\t\t\tcase \"createIndex\": return this.executeCreateIndexCommand(wireCommand);\n\t\t\tcase \"dropCollection\": return this.executeDropCollectionCommand(wireCommand);\n\t\t\tcase \"renameCollection\": return this.executeRenameCollectionCommand(wireCommand);\n\t\t\tcase \"dropIndex\": return this.executeDropIndexCommand(wireCommand);\n\t\t\tcase \"collMod\": return this.executeCollModCommand(wireCommand);\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: return assertNever(wireCommand, `Unknown DDL wire command kind: ${unreachableKind(wireCommand)}`);\n\t\t}\n\t}\n\tasync close() {\n\t\tawait this.client?.close();\n\t}\n\tasync *executeInsertOneCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).insertOne(cmd.document);\n\t\tyield {\n\t\t\tinsertedId: result.insertedId,\n\t\t\tdocument: this.asRead({\n\t\t\t\t_id: result.insertedId,\n\t\t\t\t...cmd.document\n\t\t\t})\n\t\t};\n\t}\n\t/**\n\t* The server stores an inserted document as the driver wrote it, apart from moving `_id` first, so writing it to BSON and reading it back with the client's options gives what a read returns, without a query.\n\t*/\n\tasRead(document) {\n\t\tconst { raw: _raw, ...options } = this.db.bsonOptions;\n\t\treturn BSON.deserialize(BSON.serialize(document, options), options);\n\t}\n\tasync *executeUpdateOneCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).updateOne(cmd.filter, cmd.update, { upsert: cmd.upsert });\n\t\tyield {\n\t\t\tmatchedCount: result.matchedCount,\n\t\t\tmodifiedCount: result.modifiedCount,\n\t\t\tupsertedCount: result.upsertedCount,\n\t\t\tupsertedId: result.upsertedId ?? void 0\n\t\t};\n\t}\n\tasync *executeInsertManyCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).insertMany(cmd.documents);\n\t\tconst insertedIds = Object.values(result.insertedIds);\n\t\tyield {\n\t\t\tinsertedIds,\n\t\t\tinsertedCount: result.insertedCount,\n\t\t\tdocuments: cmd.documents.map((document, index) => this.asRead({\n\t\t\t\t_id: insertedIds[index],\n\t\t\t\t...document\n\t\t\t}))\n\t\t};\n\t}\n\tasync *executeUpdateManyCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).updateMany(cmd.filter, cmd.update, {\n\t\t\tupsert: cmd.upsert,\n\t\t\t...cmd.bypassDocumentValidation ? { bypassDocumentValidation: true } : {}\n\t\t});\n\t\tyield {\n\t\t\tmatchedCount: result.matchedCount,\n\t\t\tmodifiedCount: result.modifiedCount,\n\t\t\tupsertedCount: result.upsertedCount,\n\t\t\tupsertedId: result.upsertedId ?? void 0\n\t\t};\n\t}\n\tasync *executeDeleteOneCommand(cmd) {\n\t\tyield { deletedCount: (await this.db.collection(cmd.collection).deleteOne(cmd.filter)).deletedCount };\n\t}\n\tasync *executeDeleteManyCommand(cmd) {\n\t\tyield { deletedCount: (await this.db.collection(cmd.collection).deleteMany(cmd.filter)).deletedCount };\n\t}\n\tasync *executeFindOneAndUpdateCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).findOneAndUpdate(cmd.filter, cmd.update, {\n\t\t\tupsert: cmd.upsert,\n\t\t\t...cmd.returnDocument != null ? { returnDocument: cmd.returnDocument } : {},\n\t\t\t...cmd.sort != null ? { sort: cmd.sort } : {}\n\t\t});\n\t\tif (result) yield result;\n\t}\n\tasync *executeFindOneAndDeleteCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).findOneAndDelete(cmd.filter, { ...cmd.sort != null ? { sort: cmd.sort } : {} });\n\t\tif (result) yield result;\n\t}\n\tasync *executeAggregateCommand(cmd) {\n\t\tyield* this.db.collection(cmd.collection).aggregate(cmd.pipeline);\n\t}\n\tasync executeCreateCollectionCommand(cmd) {\n\t\tconst { validator, validationLevel, validationAction, capped, size, max, timeseries, collation, changeStreamPreAndPostImages, clusteredIndex } = cmd;\n\t\tawait this.db.createCollection(cmd.collection, {\n\t\t\t...validator !== void 0 ? { validator } : {},\n\t\t\t...validationLevel !== void 0 ? { validationLevel } : {},\n\t\t\t...validationAction !== void 0 ? { validationAction } : {},\n\t\t\t...capped !== void 0 ? { capped } : {},\n\t\t\t...size !== void 0 ? { size } : {},\n\t\t\t...max !== void 0 ? { max } : {},\n\t\t\t...timeseries !== void 0 ? { timeseries } : {},\n\t\t\t...collation !== void 0 ? { collation } : {},\n\t\t\t...changeStreamPreAndPostImages !== void 0 ? { changeStreamPreAndPostImages } : {},\n\t\t\t...clusteredIndex !== void 0 ? { clusteredIndex } : {}\n\t\t});\n\t}\n\tasync executeCreateIndexCommand(cmd) {\n\t\tconst { unique, sparse, expireAfterSeconds, partialFilterExpression, name, wildcardProjection, collation, weights, default_language, language_override } = cmd;\n\t\tawait this.db.collection(cmd.collection).createIndex(cmd.key, {\n\t\t\t...unique !== void 0 ? { unique } : {},\n\t\t\t...sparse !== void 0 ? { sparse } : {},\n\t\t\t...expireAfterSeconds !== void 0 ? { expireAfterSeconds } : {},\n\t\t\t...partialFilterExpression !== void 0 ? { partialFilterExpression } : {},\n\t\t\t...name !== void 0 ? { name } : {},\n\t\t\t...wildcardProjection !== void 0 ? { wildcardProjection } : {},\n\t\t\t...collation !== void 0 ? { collation } : {},\n\t\t\t...weights !== void 0 ? { weights } : {},\n\t\t\t...default_language !== void 0 ? { default_language } : {},\n\t\t\t...language_override !== void 0 ? { language_override } : {}\n\t\t});\n\t}\n\tasync executeDropCollectionCommand(cmd) {\n\t\tawait this.db.collection(cmd.collection).drop();\n\t}\n\tasync executeRenameCollectionCommand(cmd) {\n\t\tawait this.db.renameCollection(cmd.collection, cmd.to);\n\t}\n\tasync executeDropIndexCommand(cmd) {\n\t\tawait this.db.collection(cmd.collection).dropIndex(cmd.name);\n\t}\n\tasync executeCollModCommand(cmd) {\n\t\tconst { validator, validationLevel, validationAction, changeStreamPreAndPostImages } = cmd;\n\t\tawait this.db.command({\n\t\t\tcollMod: cmd.collection,\n\t\t\t...validator !== void 0 ? { validator } : {},\n\t\t\t...validationLevel !== void 0 ? { validationLevel } : {},\n\t\t\t...validationAction !== void 0 ? { validationAction } : {},\n\t\t\t...changeStreamPreAndPostImages !== void 0 ? { changeStreamPreAndPostImages } : {}\n\t\t});\n\t}\n};\n//#endregion\nexport { mongoDriverDescriptorMeta as n, DRIVER_INFO as r, MongoDriverImpl as t };\n\n//# sourceMappingURL=mongo-driver-CjqtuhuS.mjs.map"],"mappings":";;;AAIA,MAAM,cAAc;CACnB,MAAM;CACN,SAAS;AACV;AAGA,MAAM,4BAA4B;CACjC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS,YAAY;CACrB,cAAc,CAAC;AAChB;;AAIA,SAAS,gBAAgB,OAAO;CAC/B,MAAM,YAAY;CAClB,IAAI,OAAO,cAAc,YAAY,cAAc,QAAQ,UAAU,aAAa,OAAO,UAAU,SAAS,UAAU,OAAO,UAAU;CACvI,OAAO;AACR;;AAEA,IAAI,kBAAkB,MAAM,gBAAgB;CAC3C;CACA;CACA,YAAY,IAAI,QAAQ;EACvB,KAAK,KAAK;EACV,KAAK,SAAS;CACf;CACA,aAAa,eAAe,KAAK,QAAQ;EACxC,MAAM,SAAS,IAAI,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;EAC5D,CAAC;CACF;CACA,MAAM,6BAA6B,KAAK;EACvC,MAAM,KAAK,GAAG,WAAW,IAAI,UAAU,CAAC,CAAC,KAAK;CAC/C;CACA,MAAM,+BAA+B,KAAK;EACzC,MAAM,KAAK,GAAG,iBAAiB,IAAI,YAAY,IAAI,EAAE;CACtD;CACA,MAAM,wBAAwB,KAAK;EAClC,MAAM,KAAK,GAAG,WAAW,IAAI,UAAU,CAAC,CAAC,UAAU,IAAI,IAAI;CAC5D;CACA,MAAM,sBAAsB,KAAK;EAChC,MAAM,EAAE,WAAW,iBAAiB,kBAAkB,iCAAiC;EACvF,MAAM,KAAK,GAAG,QAAQ;GACrB,SAAS,IAAI;GACb,GAAG,cAAc,KAAK,IAAI,EAAE,UAAU,IAAI,CAAC;GAC3C,GAAG,oBAAoB,KAAK,IAAI,EAAE,gBAAgB,IAAI,CAAC;GACvD,GAAG,qBAAqB,KAAK,IAAI,EAAE,iBAAiB,IAAI,CAAC;GACzD,GAAG,iCAAiC,KAAK,IAAI,EAAE,6BAA6B,IAAI,CAAC;EAClF,CAAC;CACF;AACD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MongoClient } from "mongodb";
|
|
2
|
+
import { MongoDriver } from "@prisma/orm-family-mongo/lowering";
|
|
3
|
+
import { RuntimeDriverDescriptor, RuntimeDriverInstance } from "@prisma/orm-framework/components/execution";
|
|
4
|
+
//#region ../../../3-targets/mongo/3-driver/dist/runtime.d.mts
|
|
5
|
+
//#region src/core/runtime/mongo-runtime-driver.d.ts
|
|
6
|
+
/** What a Mongo runtime driver connects to. The driver closes a client it creates from `url`, and leaves a caller's `mongoClient` open. */
|
|
7
|
+
type MongoBinding = {
|
|
8
|
+
readonly kind: 'url';
|
|
9
|
+
readonly url: string;
|
|
10
|
+
readonly dbName: string;
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'mongoClient';
|
|
13
|
+
readonly client: MongoClient;
|
|
14
|
+
readonly dbName: string;
|
|
15
|
+
};
|
|
16
|
+
type MongoRuntimeDriver = RuntimeDriverInstance<'mongo', 'mongo'> & MongoDriver<MongoBinding>;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/exports/runtime.d.ts
|
|
19
|
+
declare const mongoRuntimeDriverDescriptor: RuntimeDriverDescriptor<'mongo', 'mongo', void, MongoRuntimeDriver>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { MongoRuntimeDriver as n, mongoRuntimeDriverDescriptor as r, MongoBinding as t };
|
|
22
|
+
//# sourceMappingURL=runtime-DDkdv2wO.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-DDkdv2wO.d.mts","names":[],"sources":["../../../../3-targets/mongo/3-driver/dist/runtime.d.mts"],"mappings":";;;;;;KAKK;WACM;WACA;WACA;;WAEA;WACA,QAAQ;WACR;;KAEN,qBAAqB,0CAA0C,YAAY;;;cAGlE,8BAA8B,gDAAgD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-target-mongo",
|
|
3
|
-
"version": "8.0.0-rc.21-dev.
|
|
3
|
+
"version": "8.0.0-rc.21-dev.21",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@prisma/orm-family-mongo": "8.0.0-rc.21-dev.
|
|
13
|
-
"@prisma/orm-framework": "8.0.0-rc.21-dev.
|
|
14
|
-
"@prisma/orm-toolchain": "8.0.0-rc.21-dev.
|
|
12
|
+
"@prisma/orm-family-mongo": "8.0.0-rc.21-dev.21",
|
|
13
|
+
"@prisma/orm-framework": "8.0.0-rc.21-dev.21",
|
|
14
|
+
"@prisma/orm-toolchain": "8.0.0-rc.21-dev.21",
|
|
15
15
|
"arktype": "^2.2.2",
|
|
16
16
|
"bson": "^7.2.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@internal/adapter-mongo": "8.0.0-rc.21-dev.
|
|
20
|
-
"@internal/driver-mongo": "8.0.0-rc.21-dev.
|
|
21
|
-
"@internal/target-mongo": "8.0.0-rc.21-dev.
|
|
22
|
-
"@repo/tsconfig": "8.0.0-rc.21-dev.
|
|
23
|
-
"@repo/tsdown": "8.0.0-rc.21-dev.
|
|
19
|
+
"@internal/adapter-mongo": "8.0.0-rc.21-dev.21",
|
|
20
|
+
"@internal/driver-mongo": "8.0.0-rc.21-dev.21",
|
|
21
|
+
"@internal/target-mongo": "8.0.0-rc.21-dev.21",
|
|
22
|
+
"@repo/tsconfig": "8.0.0-rc.21-dev.21",
|
|
23
|
+
"@repo/tsdown": "8.0.0-rc.21-dev.21",
|
|
24
24
|
"tsdown": "0.22.14",
|
|
25
25
|
"typescript": "5.9.3"
|
|
26
26
|
},
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"./adapter/runtime": "./dist/adapter__runtime.mjs",
|
|
40
40
|
"./driver": "./dist/driver.mjs",
|
|
41
41
|
"./driver/control": "./dist/driver__control.mjs",
|
|
42
|
+
"./driver/runtime": "./dist/driver__runtime.mjs",
|
|
42
43
|
"./target": "./dist/target.mjs",
|
|
43
44
|
"./target/codec-ids": "./dist/target__codec-ids.mjs",
|
|
44
45
|
"./target/codec-types": "./dist/target__codec-types.mjs",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"driver__control.d.mts","names":[],"sources":["../../../../3-targets/mongo/3-driver/dist/control.d.mts"],"mappings":";;;;;;cAKc,2BAA2B,2BAA2B;WACzD;WACA;WACA,IAAI;EACb,YAAY,IAAI,IAAI,aAAa;EACjC,gBAAgB;;cAEJ,8BAA8B,0CAA0C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"driver__control.mjs","names":[],"sources":["../../../../3-targets/mongo/3-driver/dist/control.mjs"],"sourcesContent":["import { r as DRIVER_INFO, t as MongoDriverImpl } from \"./mongo-driver-B6tNQUDT.mjs\";\nimport { MongoClient } from \"mongodb\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { redactDatabaseUrl } from \"@internal/utils/redact-db-url\";\n//#region src/exports/control.ts\nvar MongoControlDriver = class extends MongoDriverImpl {\n\tfamilyId = \"mongo\";\n\ttargetId = \"mongo\";\n\tdb;\n\tconstructor(db, mongoClient) {\n\t\tsuper(db, mongoClient);\n\t\tthis.db = db;\n\t}\n\tasync databaseName() {\n\t\treturn this.db.databaseName;\n\t}\n};\nconst mongoControlDriverDescriptor = {\n\tkind: \"driver\",\n\tfamilyId: \"mongo\",\n\ttargetId: \"mongo\",\n\tid: \"mongo\",\n\tversion: DRIVER_INFO.version,\n\tcapabilities: {},\n\tasync create(url) {\n\t\tconst client = new MongoClient(url, {\n\t\t\tserverSelectionTimeoutMS: 5e3,\n\t\t\tconnectTimeoutMS: 5e3,\n\t\t\tdriverInfo: DRIVER_INFO\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect();\n\t\t\treturn new MongoControlDriver(client.db(), client);\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait client.close();\n\t\t\t} catch {}\n\t\t\tthrow errorRuntime(\"DRIVER.CONNECTION_FAILED\", \"Database connection failed\", {\n\t\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\t\tfix: \"Verify the MongoDB URL, ensure the database is reachable, and confirm credentials/permissions\",\n\t\t\t\tmeta: { ...redactDatabaseUrl(url) },\n\t\t\t\tcause: error\n\t\t\t});\n\t\t}\n\t}\n};\n//#endregion\nexport { MongoControlDriver, mongoControlDriverDescriptor as default };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;AAKA,IAAI,qBAAqB,cAAc,gBAAgB;CACtD,WAAW;CACX,WAAW;CACX;CACA,YAAY,IAAI,aAAa;EAC5B,MAAM,IAAI,WAAW;EACrB,KAAK,KAAK;CACX;CACA,MAAM,eAAe;EACpB,OAAO,KAAK,GAAG;CAChB;AACD;AACA,MAAM,+BAA+B;CACpC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS,YAAY;CACrB,cAAc,CAAC;CACf,MAAM,OAAO,KAAK;EACjB,MAAM,SAAS,IAAI,YAAY,KAAK;GACnC,0BAA0B;GAC1B,kBAAkB;GAClB,YAAY;EACb,CAAC;EACD,IAAI;GACH,MAAM,OAAO,QAAQ;GACrB,OAAO,IAAI,mBAAmB,OAAO,GAAG,GAAG,MAAM;EAClD,SAAS,OAAO;GACf,IAAI;IACH,MAAM,OAAO,MAAM;GACpB,QAAQ,CAAC;GACT,MAAM,aAAa,4BAA4B,8BAA8B;IAC5E,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IAC1D,KAAK;IACL,MAAM,EAAE,GAAG,kBAAkB,GAAG,EAAE;IAClC,OAAO;GACR,CAAC;EACF;CACD;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mongo-driver-B6tNQUDT-CJ2_KwPq.mjs","names":[],"sources":["../../../../3-targets/mongo/3-driver/dist/mongo-driver-B6tNQUDT.mjs"],"sourcesContent":["import { assertNever } from \"@internal/utils/internal-error\";\nimport { BSON, MongoClient } from \"mongodb\";\n//#endregion\n//#region src/core/driver-info.ts\nconst DRIVER_INFO = {\n\tname: \"Prisma\",\n\tversion: \"8.0.0-rc.21-dev.20\"\n};\n//#endregion\n//#region src/mongo-driver.ts\n/* v8 ignore start */\nfunction unreachableKind(value) {\n\tconst candidate = value;\n\tif (typeof candidate === \"object\" && candidate !== null && \"kind\" in candidate && typeof candidate.kind === \"string\") return candidate.kind;\n\treturn \"unknown\";\n}\n/* v8 ignore stop */\nvar MongoDriverImpl = class MongoDriverImpl {\n\tdb;\n\tclient;\n\tconstructor(db, client) {\n\t\tthis.db = db;\n\t\tthis.client = client;\n\t}\n\tstatic async fromConnection(uri, dbName) {\n\t\tconst client = new MongoClient(uri, { driverInfo: DRIVER_INFO });\n\t\tawait client.connect();\n\t\treturn new MongoDriverImpl(client.db(dbName), client);\n\t}\n\tstatic fromDb(db) {\n\t\treturn new MongoDriverImpl(db, void 0);\n\t}\n\texecute(wireCommand) {\n\t\tswitch (wireCommand.kind) {\n\t\t\tcase \"insertOne\": return this.executeInsertOneCommand(wireCommand);\n\t\t\tcase \"updateOne\": return this.executeUpdateOneCommand(wireCommand);\n\t\t\tcase \"insertMany\": return this.executeInsertManyCommand(wireCommand);\n\t\t\tcase \"updateMany\": return this.executeUpdateManyCommand(wireCommand);\n\t\t\tcase \"deleteOne\": return this.executeDeleteOneCommand(wireCommand);\n\t\t\tcase \"deleteMany\": return this.executeDeleteManyCommand(wireCommand);\n\t\t\tcase \"findOneAndUpdate\": return this.executeFindOneAndUpdateCommand(wireCommand);\n\t\t\tcase \"findOneAndDelete\": return this.executeFindOneAndDeleteCommand(wireCommand);\n\t\t\tcase \"aggregate\": return this.executeAggregateCommand(wireCommand);\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: return assertNever(wireCommand, `Unknown wire command kind: ${unreachableKind(wireCommand)}`);\n\t\t}\n\t}\n\tasync run(wireCommand) {\n\t\tswitch (wireCommand.kind) {\n\t\t\tcase \"createCollection\": return this.executeCreateCollectionCommand(wireCommand);\n\t\t\tcase \"createIndex\": return this.executeCreateIndexCommand(wireCommand);\n\t\t\tcase \"dropCollection\": return this.executeDropCollectionCommand(wireCommand);\n\t\t\tcase \"renameCollection\": return this.executeRenameCollectionCommand(wireCommand);\n\t\t\tcase \"dropIndex\": return this.executeDropIndexCommand(wireCommand);\n\t\t\tcase \"collMod\": return this.executeCollModCommand(wireCommand);\n\t\t\t// v8 ignore next 4\n\t\t\tdefault: return assertNever(wireCommand, `Unknown DDL wire command kind: ${unreachableKind(wireCommand)}`);\n\t\t}\n\t}\n\tasync close() {\n\t\tawait this.client?.close();\n\t}\n\tasync *executeInsertOneCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).insertOne(cmd.document);\n\t\tyield {\n\t\t\tinsertedId: result.insertedId,\n\t\t\tdocument: this.asRead({\n\t\t\t\t_id: result.insertedId,\n\t\t\t\t...cmd.document\n\t\t\t})\n\t\t};\n\t}\n\t/**\n\t* The server stores an inserted document as the driver wrote it, apart from moving `_id` first, so writing it to BSON and reading it back with the client's options gives what a read returns, without a query.\n\t*/\n\tasRead(document) {\n\t\tconst { raw: _raw, ...options } = this.db.bsonOptions;\n\t\treturn BSON.deserialize(BSON.serialize(document, options), options);\n\t}\n\tasync *executeUpdateOneCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).updateOne(cmd.filter, cmd.update, { upsert: cmd.upsert });\n\t\tyield {\n\t\t\tmatchedCount: result.matchedCount,\n\t\t\tmodifiedCount: result.modifiedCount,\n\t\t\tupsertedCount: result.upsertedCount,\n\t\t\tupsertedId: result.upsertedId ?? void 0\n\t\t};\n\t}\n\tasync *executeInsertManyCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).insertMany(cmd.documents);\n\t\tconst insertedIds = Object.values(result.insertedIds);\n\t\tyield {\n\t\t\tinsertedIds,\n\t\t\tinsertedCount: result.insertedCount,\n\t\t\tdocuments: cmd.documents.map((document, index) => this.asRead({\n\t\t\t\t_id: insertedIds[index],\n\t\t\t\t...document\n\t\t\t}))\n\t\t};\n\t}\n\tasync *executeUpdateManyCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).updateMany(cmd.filter, cmd.update, {\n\t\t\tupsert: cmd.upsert,\n\t\t\t...cmd.bypassDocumentValidation ? { bypassDocumentValidation: true } : {}\n\t\t});\n\t\tyield {\n\t\t\tmatchedCount: result.matchedCount,\n\t\t\tmodifiedCount: result.modifiedCount,\n\t\t\tupsertedCount: result.upsertedCount,\n\t\t\tupsertedId: result.upsertedId ?? void 0\n\t\t};\n\t}\n\tasync *executeDeleteOneCommand(cmd) {\n\t\tyield { deletedCount: (await this.db.collection(cmd.collection).deleteOne(cmd.filter)).deletedCount };\n\t}\n\tasync *executeDeleteManyCommand(cmd) {\n\t\tyield { deletedCount: (await this.db.collection(cmd.collection).deleteMany(cmd.filter)).deletedCount };\n\t}\n\tasync *executeFindOneAndUpdateCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).findOneAndUpdate(cmd.filter, cmd.update, {\n\t\t\tupsert: cmd.upsert,\n\t\t\t...cmd.returnDocument != null ? { returnDocument: cmd.returnDocument } : {},\n\t\t\t...cmd.sort != null ? { sort: cmd.sort } : {}\n\t\t});\n\t\tif (result) yield result;\n\t}\n\tasync *executeFindOneAndDeleteCommand(cmd) {\n\t\tconst result = await this.db.collection(cmd.collection).findOneAndDelete(cmd.filter, { ...cmd.sort != null ? { sort: cmd.sort } : {} });\n\t\tif (result) yield result;\n\t}\n\tasync *executeAggregateCommand(cmd) {\n\t\tyield* this.db.collection(cmd.collection).aggregate(cmd.pipeline);\n\t}\n\tasync executeCreateCollectionCommand(cmd) {\n\t\tconst { validator, validationLevel, validationAction, capped, size, max, timeseries, collation, changeStreamPreAndPostImages, clusteredIndex } = cmd;\n\t\tawait this.db.createCollection(cmd.collection, {\n\t\t\t...validator !== void 0 ? { validator } : {},\n\t\t\t...validationLevel !== void 0 ? { validationLevel } : {},\n\t\t\t...validationAction !== void 0 ? { validationAction } : {},\n\t\t\t...capped !== void 0 ? { capped } : {},\n\t\t\t...size !== void 0 ? { size } : {},\n\t\t\t...max !== void 0 ? { max } : {},\n\t\t\t...timeseries !== void 0 ? { timeseries } : {},\n\t\t\t...collation !== void 0 ? { collation } : {},\n\t\t\t...changeStreamPreAndPostImages !== void 0 ? { changeStreamPreAndPostImages } : {},\n\t\t\t...clusteredIndex !== void 0 ? { clusteredIndex } : {}\n\t\t});\n\t}\n\tasync executeCreateIndexCommand(cmd) {\n\t\tconst { unique, sparse, expireAfterSeconds, partialFilterExpression, name, wildcardProjection, collation, weights, default_language, language_override } = cmd;\n\t\tawait this.db.collection(cmd.collection).createIndex(cmd.key, {\n\t\t\t...unique !== void 0 ? { unique } : {},\n\t\t\t...sparse !== void 0 ? { sparse } : {},\n\t\t\t...expireAfterSeconds !== void 0 ? { expireAfterSeconds } : {},\n\t\t\t...partialFilterExpression !== void 0 ? { partialFilterExpression } : {},\n\t\t\t...name !== void 0 ? { name } : {},\n\t\t\t...wildcardProjection !== void 0 ? { wildcardProjection } : {},\n\t\t\t...collation !== void 0 ? { collation } : {},\n\t\t\t...weights !== void 0 ? { weights } : {},\n\t\t\t...default_language !== void 0 ? { default_language } : {},\n\t\t\t...language_override !== void 0 ? { language_override } : {}\n\t\t});\n\t}\n\tasync executeDropCollectionCommand(cmd) {\n\t\tawait this.db.collection(cmd.collection).drop();\n\t}\n\tasync executeRenameCollectionCommand(cmd) {\n\t\tawait this.db.renameCollection(cmd.collection, cmd.to);\n\t}\n\tasync executeDropIndexCommand(cmd) {\n\t\tawait this.db.collection(cmd.collection).dropIndex(cmd.name);\n\t}\n\tasync executeCollModCommand(cmd) {\n\t\tconst { validator, validationLevel, validationAction, changeStreamPreAndPostImages } = cmd;\n\t\tawait this.db.command({\n\t\t\tcollMod: cmd.collection,\n\t\t\t...validator !== void 0 ? { validator } : {},\n\t\t\t...validationLevel !== void 0 ? { validationLevel } : {},\n\t\t\t...validationAction !== void 0 ? { validationAction } : {},\n\t\t\t...changeStreamPreAndPostImages !== void 0 ? { changeStreamPreAndPostImages } : {}\n\t\t});\n\t}\n};\nasync function createMongoDriver(uri, dbName) {\n\treturn MongoDriverImpl.fromConnection(uri, dbName);\n}\n//#endregion\nexport { createMongoDriver as n, DRIVER_INFO as r, MongoDriverImpl as t };\n\n//# sourceMappingURL=mongo-driver-B6tNQUDT.mjs.map"],"mappings":";;;AAIA,MAAM,cAAc;CACnB,MAAM;CACN,SAAS;AACV;;AAIA,SAAS,gBAAgB,OAAO;CAC/B,MAAM,YAAY;CAClB,IAAI,OAAO,cAAc,YAAY,cAAc,QAAQ,UAAU,aAAa,OAAO,UAAU,SAAS,UAAU,OAAO,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