https://github.com/pavelgj/genkitx-rxjs
  
  
     
    https://github.com/pavelgj/genkitx-rxjs
  
        Last synced: 3 months ago 
        JSON representation
    
- Host: GitHub
 - URL: https://github.com/pavelgj/genkitx-rxjs
 - Owner: pavelgj
 - License: apache-2.0
 - Created: 2024-07-17T15:03:12.000Z (over 1 year ago)
 - Default Branch: main
 - Last Pushed: 2024-07-17T15:04:50.000Z (over 1 year ago)
 - Last Synced: 2025-06-25T17:56:56.511Z (4 months ago)
 - Language: TypeScript
 - Size: 60.5 KB
 - Stars: 0
 - Watchers: 1
 - Forks: 0
 - Open Issues: 0
 - 
            Metadata Files:
            
- Readme: README.md
 - License: LICENSE
 
 
Awesome Lists containing this project
- awesome-genkit - `genkitx-rxjs` - A simple RxJS helper/adapter for Genkit. (Plugins / JavaScript - Community)
 - trackawesomelist - `genkitx-rxjs` - A simple RxJS helper/adapter for Firebase Genkit. (Recently Updated / [Sep 15, 2024](/content/2024/09/15/README.md))
 
README
          ## genkitx-rxjs
A simple RxJS helper/adapter for Firebase Genkit.
Allows defining flows that work with Observables:
```ts
import { defineRxFlow } from 'genkitx-rxjs';
export const myRxFlow = defineRxFlow(
  { name: "myRxFlow", inputSchema: z.string(), outputSchema: z.number() },
  (input) => input.pipe(map(parseInt))
);
```
Makes it easy to use flows as an operator function:
```ts
export const parse = defineRxFlow(
  { name: "parse", inputSchema: z.string(), outputSchema: z.number() },
  (input) => input.pipe(map(parseInt))
);
const OutputSchema = z.object({
  originalNumber: z.number(),
  incrementedNumber: z.number(),
});
export const numberPlusPlus = defineFlow(
  { name: "incrementBy", inputSchema: z.number(), outputSchema: OutputSchema },
  async (num) => {
    return { originalNumber: num, incrementedNumber: num + 1 };
  }
);
export const myRxFlow = defineRxFlow(
  { name: "myRxFlow", inputSchema: z.string(), outputSchema: OutputSchema },
  (input) =>
    input.pipe(
      rxFlowRun(parse),
      rxFlowRun(numberPlusPlus)
    )
);
```
`rxFlowRun` can both RxFlows (`defineRxFlow`) and vanilla flows (`defineFlow`).