mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
add change set to mutator insert/update after event
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"type": "module",
|
||||
"sideEffects": false,
|
||||
"bin": "./dist/cli/index.js",
|
||||
"version": "0.10.0-rc.5",
|
||||
"version": "0.10.0-rc.7",
|
||||
"description": "Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.",
|
||||
"homepage": "https://bknd.io",
|
||||
"repository": {
|
||||
|
||||
@@ -167,7 +167,9 @@ export class Mutator<
|
||||
|
||||
const res = await this.single(query);
|
||||
|
||||
await this.emgr.emit(new Mutator.Events.MutatorInsertAfter({ entity, data: res.data }));
|
||||
await this.emgr.emit(
|
||||
new Mutator.Events.MutatorInsertAfter({ entity, data: res.data, changed: validatedData }),
|
||||
);
|
||||
|
||||
return res as any;
|
||||
}
|
||||
@@ -198,7 +200,12 @@ export class Mutator<
|
||||
const res = await this.single(query);
|
||||
|
||||
await this.emgr.emit(
|
||||
new Mutator.Events.MutatorUpdateAfter({ entity, entityId: id, data: res.data }),
|
||||
new Mutator.Events.MutatorUpdateAfter({
|
||||
entity,
|
||||
entityId: id,
|
||||
data: res.data,
|
||||
changed: validatedData,
|
||||
}),
|
||||
);
|
||||
|
||||
return res as any;
|
||||
|
||||
@@ -18,7 +18,11 @@ export class MutatorInsertBefore extends Event<{ entity: Entity; data: EntityDat
|
||||
});
|
||||
}
|
||||
}
|
||||
export class MutatorInsertAfter extends Event<{ entity: Entity; data: EntityData }> {
|
||||
export class MutatorInsertAfter extends Event<{
|
||||
entity: Entity;
|
||||
data: EntityData;
|
||||
changed: EntityData;
|
||||
}> {
|
||||
static override slug = "mutator-insert-after";
|
||||
}
|
||||
export class MutatorUpdateBefore extends Event<
|
||||
@@ -48,6 +52,7 @@ export class MutatorUpdateAfter extends Event<{
|
||||
entity: Entity;
|
||||
entityId: PrimaryFieldType;
|
||||
data: EntityData;
|
||||
changed: EntityData;
|
||||
}> {
|
||||
static override slug = "mutator-update-after";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user