mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
Excluded ngrx, datorama, angular, react and langchain from stream pipe query.
This commit is contained in:
@@ -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)
|
||||
)
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
@@ -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(),
|
||||
},
|
||||
"",
|
||||
]);
|
||||
@@ -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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user