mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 21:46:01 +00:00
* perf(artifacts): isolate offline session composition from deep providers * test(mcp): use the artifact session factory in bundle resource tests
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import type { AnalysisSettingsReader } from "../domain/analysisSettings.js";
|
|
import { combineBundleResourceClients } from "../application/binary/BundleResourceSession.js";
|
|
import {
|
|
BUNDLE_ARTIFACT_RESOURCE_OPERATIONS,
|
|
BUNDLE_NATIVE_RESOURCE_OPERATIONS,
|
|
} from "../ports/BundleResourceOperations.js";
|
|
|
|
export const createBundleResourceFactory = (
|
|
environment: Readonly<NodeJS.ProcessEnv>,
|
|
platform: NodeJS.Platform,
|
|
settings?: AnalysisSettingsReader,
|
|
) => {
|
|
return {
|
|
createClient: async (
|
|
root: import("../domain/apple/bundleResourceRoot.js").ResolvedAppBundleResourceRoot,
|
|
) => {
|
|
const [{ ArtifactProvider }, { NativeMacOSProvider }] = await Promise.all(
|
|
[
|
|
import("../artifacts/ArtifactProvider.js"),
|
|
import("../native/NativeMacOSProvider.js"),
|
|
],
|
|
);
|
|
const artifact = new ArtifactProvider(environment, platform, settings);
|
|
const native = new NativeMacOSProvider(environment, undefined, platform);
|
|
const capabilities = [
|
|
...artifact
|
|
.capabilities()
|
|
.filter(({ operation }) =>
|
|
BUNDLE_ARTIFACT_RESOURCE_OPERATIONS.has(operation),
|
|
),
|
|
...native
|
|
.capabilities()
|
|
.filter(({ operation }) =>
|
|
BUNDLE_NATIVE_RESOURCE_OPERATIONS.has(operation),
|
|
),
|
|
];
|
|
return {
|
|
client: combineBundleResourceClients(
|
|
artifact.createBundleResourceClient(root),
|
|
native.createBundleResourceClient(root),
|
|
),
|
|
capabilities,
|
|
};
|
|
},
|
|
};
|
|
};
|