Skip to content

invertase/firebase-extension-utilities

Repository files navigation

firebase-extension-utilites

firestore-onwrite-processor

This provides a processor class which you can pass to your firestore onWrite call, and will handle the state of processes on firestore fields for you.

import {
  FirestoreOnWriteProcessor,
  FirestoreOnWriteProcess,
} from "@invertase/firebase-extension-utilities";

// this can be async if needed
const processFn = ({ input }) => {
  // do stuff here
  return { output };
};

const myProcess = new FirestoreOnWriteProcess(processFn, {
  id: "myProcessId",
  fieldDependencyArray: ["input"],
});

const myProcessor = new FirestoreOnWriteProcessor({
  processes: [myProcess],
});

export const myFunction = functions.firestore
  .document(COLLECTION_NAME / { id })
  .onWrite(myProcessor.run);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published