feat: added project level migrations for kms convernsion

This commit is contained in:
=
2025-02-10 15:46:37 +05:30
parent 4c7ae3475a
commit 3e5a58eec4
18 changed files with 570 additions and 83 deletions
@@ -0,0 +1,19 @@
export const newRingBuffer = <T>(bufferSize = 10) => {
const bufferItems: { id: string; item: T }[] = [];
let bufferIndex = 0;
const push = (id: string, item: T) => {
if (bufferItems.length < bufferSize) {
bufferItems.push({ id, item });
} else {
bufferItems[bufferIndex] = { id, item };
}
bufferIndex = (bufferIndex + 1) % bufferSize;
};
const getItem = (id: string) => {
return bufferItems.find((i) => i.id === id)?.item;
};
return { push, getItem };
};