Complete redo of content indexing and querying (#517)
Complete redo of data store Introduces live queries and live templates
This commit is contained in:
@@ -105,7 +105,7 @@ export class EndpointHook implements Hook<EndpointHookT> {
|
||||
}
|
||||
}
|
||||
// console.log("Shouldn't get here");
|
||||
next();
|
||||
await next();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+18
-6
@@ -53,12 +53,18 @@ export class EventHook implements Hook<EventHookT> {
|
||||
manifest!.functions,
|
||||
)
|
||||
) {
|
||||
if (functionDef.events && functionDef.events.includes(eventName)) {
|
||||
// Only dispatch functions that can run in this environment
|
||||
if (await plug.canInvoke(name)) {
|
||||
const result = await plug.invoke(name, args);
|
||||
if (result !== undefined) {
|
||||
responses.push(result);
|
||||
if (functionDef.events) {
|
||||
for (const event of functionDef.events) {
|
||||
if (
|
||||
event === eventName || eventNameToRegex(event).test(eventName)
|
||||
) {
|
||||
// Only dispatch functions that can run in this environment
|
||||
if (await plug.canInvoke(name)) {
|
||||
const result = await plug.invoke(name, args);
|
||||
if (result !== undefined) {
|
||||
responses.push(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,3 +106,9 @@ export class EventHook implements Hook<EventHookT> {
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
|
||||
function eventNameToRegex(eventName: string): RegExp {
|
||||
return new RegExp(
|
||||
`^${eventName.replace(/\*/g, ".*").replace(/\//g, "\\/")}$`,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user