Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pavelgj/genkitx-rxjs
https://github.com/pavelgj/genkitx-rxjs
Last synced: 13 days 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 (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-17T15:04:50.000Z (6 months ago)
- Last Synced: 2024-12-28T12:12:23.965Z (18 days 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-firebase-genkit - `genkitx-rxjs` - A simple RxJS helper/adapter for Firebase 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`).