mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
add change set to mutator insert/update after event
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"bin": "./dist/cli/index.js",
|
"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.",
|
"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",
|
"homepage": "https://bknd.io",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -167,7 +167,9 @@ export class Mutator<
|
|||||||
|
|
||||||
const res = await this.single(query);
|
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;
|
return res as any;
|
||||||
}
|
}
|
||||||
@@ -198,7 +200,12 @@ export class Mutator<
|
|||||||
const res = await this.single(query);
|
const res = await this.single(query);
|
||||||
|
|
||||||
await this.emgr.emit(
|
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;
|
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";
|
static override slug = "mutator-insert-after";
|
||||||
}
|
}
|
||||||
export class MutatorUpdateBefore extends Event<
|
export class MutatorUpdateBefore extends Event<
|
||||||
@@ -48,6 +52,7 @@ export class MutatorUpdateAfter extends Event<{
|
|||||||
entity: Entity;
|
entity: Entity;
|
||||||
entityId: PrimaryFieldType;
|
entityId: PrimaryFieldType;
|
||||||
data: EntityData;
|
data: EntityData;
|
||||||
|
changed: EntityData;
|
||||||
}> {
|
}> {
|
||||||
static override slug = "mutator-update-after";
|
static override slug = "mutator-update-after";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user