@dnax/core 0.75.5 → 0.76.0
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 +4 -1
- package/driver/mongo/rest.ts +3 -1
- package/package.json +1 -1
- package/types/index.ts +1 -1
package/app/hono.ts
CHANGED
|
@@ -321,6 +321,7 @@ function HonoInstance(): typeof app {
|
|
|
321
321
|
const col = getCollection(collection, c.var["tenant-id"]);
|
|
322
322
|
|
|
323
323
|
// Controlle des actions à mener
|
|
324
|
+
|
|
324
325
|
if (!getAction(action) && !col?.actions?.hasOwnProperty(action)) {
|
|
325
326
|
throw new ContextError(
|
|
326
327
|
`Action ${action} not found on ${collection}`,
|
|
@@ -364,7 +365,7 @@ function HonoInstance(): typeof app {
|
|
|
364
365
|
// if action and collection
|
|
365
366
|
//getCollection(collection, c.var["tenant-id"]
|
|
366
367
|
if (
|
|
367
|
-
getAction(action) &&
|
|
368
|
+
(getAction(action) || col?.actions?.hasOwnProperty(action)) &&
|
|
368
369
|
getCollection(collection, c.var["tenant-id"]) &&
|
|
369
370
|
collection
|
|
370
371
|
) {
|
|
@@ -660,6 +661,8 @@ function HonoInstance(): typeof app {
|
|
|
660
661
|
response = await rest.insertOne(collection, body?.data || {});
|
|
661
662
|
}
|
|
662
663
|
|
|
664
|
+
// perform Actions
|
|
665
|
+
|
|
663
666
|
if (!getAction(action) && col?.actions?.hasOwnProperty(action)) {
|
|
664
667
|
response = await rest.runAction(collection, action, body?.data || {});
|
|
665
668
|
}
|
package/driver/mongo/rest.ts
CHANGED
|
@@ -2361,7 +2361,9 @@ class useRest {
|
|
|
2361
2361
|
try {
|
|
2362
2362
|
let col = getCollection(collection, this.#tenant_id);
|
|
2363
2363
|
if (!col) return fn.error(`Collection ${collection} not found`, 404);
|
|
2364
|
-
if (col?.
|
|
2364
|
+
if (!col?.actions?.hasOwnProperty(action))
|
|
2365
|
+
return fn.error(`Action ${action} not found on ${collection}`, 404);
|
|
2366
|
+
if (col?.actions?.[action]) {
|
|
2365
2367
|
let result = await col?.actions?.[action]({
|
|
2366
2368
|
error: fn.error,
|
|
2367
2369
|
io: Cfg.io,
|
package/package.json
CHANGED
package/types/index.ts
CHANGED