@dnax/core 0.7.0 → 0.7.2
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/app/hono.ts +17 -0
- package/driver/mongo/connect.ts +4 -1
- package/package.json +1 -1
- package/types/index.ts +4 -1
package/app/hono.ts
CHANGED
|
@@ -111,6 +111,23 @@ function HonoInstance(): typeof app {
|
|
|
111
111
|
cors({
|
|
112
112
|
origin: Cfg.server?.cors?.origin || [],
|
|
113
113
|
credentials: Cfg.server?.cors?.credentials || true,
|
|
114
|
+
allowMethods: Cfg.server?.cors?.allowMethods || [
|
|
115
|
+
"GET",
|
|
116
|
+
"POST",
|
|
117
|
+
"PUT",
|
|
118
|
+
"DELETE",
|
|
119
|
+
"OPTIONS",
|
|
120
|
+
],
|
|
121
|
+
allowHeaders: Cfg.server?.cors?.allowHeaders || [
|
|
122
|
+
"Tenant-Id",
|
|
123
|
+
"Content-Type",
|
|
124
|
+
"Authorization",
|
|
125
|
+
"Accept",
|
|
126
|
+
"Origin",
|
|
127
|
+
"X-Requested-With",
|
|
128
|
+
"Access-Control-Request-Method",
|
|
129
|
+
"Access-Control-Request-Headers",
|
|
130
|
+
],
|
|
114
131
|
})
|
|
115
132
|
);
|
|
116
133
|
//eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoibm9tIiwiaWF0IjoxNzE3Nzc0MDQzLCJleHAiOjE3MTc3NzQxMDN9.Ud4-0y8pa4SMIcSn8PU1A-sjC-hT4ZVe_u3AdChyIJU
|
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/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 =
|
|
@@ -358,6 +359,8 @@ export type Config = {
|
|
|
358
359
|
cors?: {
|
|
359
360
|
origin: string[];
|
|
360
361
|
credentials?: boolean;
|
|
362
|
+
allowMethods?: Array<string>;
|
|
363
|
+
allowHeaders?: Array<string>;
|
|
361
364
|
};
|
|
362
365
|
socket?: {
|
|
363
366
|
/**
|