@dnax/core 0.2.6 → 0.2.8
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 +11 -9
- package/driver/mongo/rest.ts +2 -2
- package/lib/schema.ts +6 -1
- package/package.json +1 -1
package/app/hono.ts
CHANGED
|
@@ -127,15 +127,17 @@ function HonoInstance(): typeof app {
|
|
|
127
127
|
let nextLifecyle: any = false;
|
|
128
128
|
|
|
129
129
|
// Middleware for apis
|
|
130
|
-
|
|
131
|
-
await midd
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
130
|
+
if (col?.middlewares?.length) {
|
|
131
|
+
for await (let midd of col?.middlewares) {
|
|
132
|
+
await midd({
|
|
133
|
+
token: c.var["token"] || null,
|
|
134
|
+
action: action,
|
|
135
|
+
c: c,
|
|
136
|
+
isAuth: c.var?._v?.isAuth || false,
|
|
137
|
+
rest: new useRest({ tenant_id: tenant_id }),
|
|
138
|
+
session: session as any,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
if (col && col?.access?.beforeAction) {
|
package/driver/mongo/rest.ts
CHANGED
|
@@ -298,7 +298,7 @@ class useRest {
|
|
|
298
298
|
}),
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
return resolve(data);
|
|
301
|
+
return resolve(toJson(data));
|
|
302
302
|
} catch (err) {
|
|
303
303
|
return reject(err);
|
|
304
304
|
}
|
|
@@ -659,7 +659,7 @@ class useRest {
|
|
|
659
659
|
update.$set = transformAllDate(update.$set);
|
|
660
660
|
update.$set = await hashPasswordAuto(update.$set, col);
|
|
661
661
|
// data = transformAllDate(data);
|
|
662
|
-
//
|
|
662
|
+
//update.$set = deepSetId(col, update.$set);
|
|
663
663
|
var { valid, output, error } = this.validator(
|
|
664
664
|
collection,
|
|
665
665
|
update.$set,
|
package/lib/schema.ts
CHANGED
|
@@ -50,7 +50,12 @@ function buildSchema(col: Collection) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (f?.type == "relationship") {
|
|
53
|
-
propertySchema[f.name] = v
|
|
53
|
+
propertySchema[f.name] = v
|
|
54
|
+
.string()
|
|
55
|
+
.optional()
|
|
56
|
+
.messages({
|
|
57
|
+
"string.base": `${f.name} must be ObjectId or String`,
|
|
58
|
+
});
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
if (f?.type == "relationship" && f.relation?.hasMany) {
|