Skip to content

invertase/firebase-extension-utilities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

493f274 · May 29, 2024

History

29 Commits
Feb 20, 2024
May 29, 2024
May 29, 2024
Feb 13, 2024
May 29, 2024
May 29, 2024
Feb 13, 2024
Feb 15, 2024
May 29, 2024
Feb 13, 2024
May 29, 2024
May 29, 2024
May 29, 2024
Feb 20, 2024
Feb 12, 2024

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