mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 14:59:05 +00:00
refactor(javascript): share transfer read result typing (#16981)
This commit is contained in:
1 parent
52dbe3a63a
commit
d464573d4e
1 file changed
+8
-12
@@ -276,16 +276,18 @@ export const writeJavaScriptAnalysisTransfer = async (
|
||||
});
|
||||
};
|
||||
|
||||
type TransferRead<Projection> = {
|
||||
readonly module: JavaScriptModuleSemanticIr;
|
||||
readonly projection: Projection;
|
||||
};
|
||||
|
||||
/** Decode producer records into realm-local, source-bound facts; sealing follows in the consumer. */
|
||||
export function readJavaScriptAnalysisTransfer(
|
||||
path: string,
|
||||
descriptor: Descriptor,
|
||||
source: Pick<JavaScriptArtifactFile, "path" | "sha256">,
|
||||
signal?: AbortSignal,
|
||||
): Promise<{
|
||||
readonly module: JavaScriptModuleSemanticIr;
|
||||
readonly projection: JavaScriptSemanticFileProjection;
|
||||
}>;
|
||||
): Promise<TransferRead<JavaScriptSemanticFileProjection>>;
|
||||
/** Validate the transfer while retaining only module facts when graph admission fails. */
|
||||
export function readJavaScriptAnalysisTransfer(
|
||||
path: string,
|
||||
@@ -293,10 +295,7 @@ export function readJavaScriptAnalysisTransfer(
|
||||
source: Pick<JavaScriptArtifactFile, "path" | "sha256">,
|
||||
signal: AbortSignal | undefined,
|
||||
capacity: JavaScriptSemanticProjectionCapacity | null,
|
||||
): Promise<{
|
||||
readonly module: JavaScriptModuleSemanticIr;
|
||||
readonly projection: JavaScriptSemanticFileProjection | null;
|
||||
}>;
|
||||
): Promise<TransferRead<JavaScriptSemanticFileProjection | null>>;
|
||||
export async function readJavaScriptAnalysisTransfer(
|
||||
path: string,
|
||||
descriptor: Descriptor,
|
||||
@@ -306,10 +305,7 @@ export async function readJavaScriptAnalysisTransfer(
|
||||
nodes: JAVASCRIPT_SEMANTIC_ITEM_MAXIMUM,
|
||||
unknowns: JAVASCRIPT_SEMANTIC_ITEM_MAXIMUM,
|
||||
},
|
||||
): Promise<{
|
||||
readonly module: JavaScriptModuleSemanticIr;
|
||||
readonly projection: JavaScriptSemanticFileProjection | null;
|
||||
}> {
|
||||
): Promise<TransferRead<JavaScriptSemanticFileProjection | null>> {
|
||||
if (
|
||||
capacity !== null &&
|
||||
[capacity.nodes, capacity.unknowns].some(
|
||||
|
||||
Reference in new issue
Block a user