-
-
Save mkotsollaris/fb0a37193267f80a65a3b61bb04497ca to your computer and use it in GitHub Desktop.
Drift engine with Upstash pseudo-code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getAllRemoteState = async () => { | |
const result = await getAllRemoteKeys(); | |
const enabledResources: string[] = await result.reduce( async (acc:string[], currKey:string) => { | |
const accum = await acc; | |
await axios.get(`${URL}/get/${currKey}`, getHeaders()).then(({data}) => data); | |
accum.push(currKey); | |
return accum; | |
}, []); | |
return enabledResources; | |
} | |
const computeToBeDeleted= async (directoryPath='') => { | |
const localResources = await getLocalResources(directoryPath); | |
const remoteResources = await getAllRemoteResourceKeys(); | |
const result = remoteResources.filter(x => !localResources.includes(x)); | |
return result; | |
} | |
const computeToBeAdded = async (directoryPath='') => { | |
const localTurboFlags = await getTurboFlagsOnDirectory(directoryPath); | |
const remoteTurboFlags = await getAllRemoteState(); | |
const result = localTurboFlags.filter(x => !remoteTurboFlags.includes(x)) | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment