@dnax/core 0.7.1 → 0.7.3
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/driver/mongo/connect.ts +4 -1
- package/lib/orama/index.ts +2 -0
- package/package.json +1 -1
- package/types/index.ts +2 -1
package/driver/mongo/connect.ts
CHANGED
|
@@ -5,7 +5,10 @@ import { consola } from "consola";
|
|
|
5
5
|
async function connectToMongo(t: Tenant) {
|
|
6
6
|
return new Promise(async (resolve, reject) => {
|
|
7
7
|
let client = new MongoClient(
|
|
8
|
-
t?.database?.uri || "mongodb://localhost:27017"
|
|
8
|
+
t?.database?.uri || "mongodb://localhost:27017",
|
|
9
|
+
{
|
|
10
|
+
...(t?.database?.options || {}),
|
|
11
|
+
}
|
|
9
12
|
);
|
|
10
13
|
await client
|
|
11
14
|
.connect()
|
package/lib/orama/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { optionsType, searchType } from "./@types";
|
|
|
2
2
|
import * as orama from "@orama/orama";
|
|
3
3
|
import fs from "fs-extra";
|
|
4
4
|
import _ from "lodash";
|
|
5
|
+
import cleanDeep from "clean-deep";
|
|
5
6
|
import { ObjectId } from "mongodb";
|
|
6
7
|
import path from "path";
|
|
7
8
|
class searchEngine {
|
|
@@ -47,6 +48,7 @@ class searchEngine {
|
|
|
47
48
|
let ids = [];
|
|
48
49
|
if (Array.isArray(documents)) {
|
|
49
50
|
documents.map((doc) => {
|
|
51
|
+
doc = cleanDeep(doc);
|
|
50
52
|
doc.id = doc?._id || doc?.id || new ObjectId().toString();
|
|
51
53
|
doc._id = doc?.id;
|
|
52
54
|
});
|
package/package.json
CHANGED
package/types/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
updateParams,
|
|
18
18
|
} from "../driver/mongo/@types";
|
|
19
19
|
import type { RouterRoute } from "hono/types";
|
|
20
|
-
|
|
20
|
+
import type { MongoClientOptions } from "mongodb";
|
|
21
21
|
export type Socket = {
|
|
22
22
|
enabled: boolean;
|
|
23
23
|
handler: (ctx: { rest: useRest; io: Io; session: sessionCtx }) => void;
|
|
@@ -37,6 +37,7 @@ export type Tenant = {
|
|
|
37
37
|
client?: InstanceType<typeof MongoClient>;
|
|
38
38
|
db?: Db;
|
|
39
39
|
isConnected?: boolean;
|
|
40
|
+
options?: MongoClientOptions;
|
|
40
41
|
};
|
|
41
42
|
};
|
|
42
43
|
export type Actions =
|