Excluded ngrx, datorama, angular, react and langchain from stream pipe query.

This commit is contained in:
Napalys Klicius
2025-05-27 09:45:37 +02:00
parent e964b175e6
commit 5214cc0407
4 changed files with 63 additions and 1 deletions

View File

@@ -45,7 +45,8 @@ API::Node getNonStreamApi() {
exists(string moduleName |
moduleName
.regexpMatch([
"rxjs(|/.*)", "@strapi(|/.*)", "highland(|/.*)", "execa(|/.*)", "arktype(|/.*)"
"rxjs(|/.*)", "@strapi(|/.*)", "highland(|/.*)", "execa(|/.*)", "arktype(|/.*)",
"@ngrx(|/.*)", "@datorama(|/.*)", "@angular(|/.*)", "react.*", "@langchain(|/.*)",
]) and
result = API::moduleImport(moduleName)
)

View File

@@ -0,0 +1,29 @@
import React, { Suspense } from "react";
import { renderToPipeableStream } from "react-dom/server";
import { PassThrough } from "stream";
import { act } from "react-dom/test-utils";
const writable = new PassThrough();
let output = "";
writable.on("data", chunk => { output += chunk.toString(); });
writable.on("end", () => { /* stream ended */ });
let errors = [];
let shellErrors = [];
await act(async () => {
renderToPipeableStream(
<Suspense fallback={<Fallback />}>
<Throw />
</Suspense>,
{
onError(err) {
errors.push(err.message);
},
onShellError(err) {
shellErrors.push(err.message);
}
}
).pipe(writable);
});

View File

@@ -0,0 +1,15 @@
import { RunnablePassthrough, RunnableSequence } from "@langchain/core/runnables";
const fakeRetriever = RunnablePassthrough.from((_q: string) =>
Promise.resolve([{ pageContent: "Hello world." }])
);
const formatDocumentsAsString = (documents: { pageContent: string }[]) =>documents.map((d) => d.pageContent).join("\n\n");
const chain = RunnableSequence.from([
{
context: fakeRetriever.pipe(formatDocumentsAsString),
question: new RunnablePassthrough(),
},
"",
]);

View File

@@ -0,0 +1,17 @@
import { Component } from '@angular/core';
import { Store, select } from '@ngrx/store';
import { Observable } from 'rxjs';
@Component({
selector: 'minimal-example',
template: `
<div>{{ value$ | async }}</div>
`
})
export class MinimalExampleComponent {
value$: Observable<any>;
constructor(private store: Store<any>) {
this.value$ = this.store.pipe(select('someSlice'));
}
}