@dnax/core 0.12.4 → 0.12.6
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 +1 -0
- package/lib/routes.ts +6 -2
- package/package.json +1 -1
- package/types/index.ts +3 -1
package/app/hono.ts
CHANGED
package/lib/routes.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Hono } from "hono";
|
|
|
9
9
|
async function loadAutoRoutes() {
|
|
10
10
|
let endpoints = [] as any;
|
|
11
11
|
if (Cfg?.tenants) {
|
|
12
|
-
for await (let t of Cfg
|
|
12
|
+
for await (let t of Cfg?.tenants) {
|
|
13
13
|
let tenantPath = `${t.dir}/routes/**/*.{ts,js}`;
|
|
14
14
|
const glob = new Glob(tenantPath);
|
|
15
15
|
for await (let file of glob.scan({
|
|
@@ -30,11 +30,15 @@ async function loadAutoRoutes() {
|
|
|
30
30
|
let instance = {
|
|
31
31
|
router: new Hono(),
|
|
32
32
|
};
|
|
33
|
+
let rest = new useRest({
|
|
34
|
+
tenant_id: t.id,
|
|
35
|
+
});
|
|
33
36
|
inject?.default?.handler({
|
|
37
|
+
rest,
|
|
34
38
|
io: Cfg.io,
|
|
35
39
|
router: instance.router,
|
|
36
40
|
});
|
|
37
|
-
if (baseURL) {
|
|
41
|
+
if (baseURL && inject?.default?.enabled) {
|
|
38
42
|
endpoints.push({
|
|
39
43
|
router: instance.router,
|
|
40
44
|
base: baseURL,
|
package/package.json
CHANGED
package/types/index.ts
CHANGED
|
@@ -118,7 +118,7 @@ export type Field = {
|
|
|
118
118
|
validate?: {
|
|
119
119
|
schema?: AnySchema;
|
|
120
120
|
};
|
|
121
|
-
relationTo?: string;
|
|
121
|
+
//relationTo?: string;
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
export type cronCtx = {
|
|
@@ -444,6 +444,7 @@ export type routeOption = {
|
|
|
444
444
|
export type endpointCtx = {
|
|
445
445
|
enabled: boolean;
|
|
446
446
|
handler: (ctx: {
|
|
447
|
+
rest: InstanceType<typeof useRest>;
|
|
447
448
|
io: Io;
|
|
448
449
|
router: {
|
|
449
450
|
post: (path: string, clb: (c: Context) => void) => {};
|
|
@@ -455,6 +456,7 @@ export type endpointCtx = {
|
|
|
455
456
|
export type routeCtx = {
|
|
456
457
|
enabled: boolean;
|
|
457
458
|
handler: (ctx: {
|
|
459
|
+
rest: InstanceType<typeof useRest>;
|
|
458
460
|
io: Io;
|
|
459
461
|
router: {
|
|
460
462
|
post: (path: string, clb: (c: Context) => void) => {};
|