mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 23:09:34 +00:00
refactor(capabilities): share single-operation declarations (#17222)
This commit is contained in:
1 parent
e0e77f53e7
commit
cd867bd411
1 file changed
+138
-214
@@ -141,6 +141,11 @@ const providerBinding = <const Operations extends CapabilityOperationSelection>(
|
||||
operations: Operations,
|
||||
) => ({ identity, operations });
|
||||
|
||||
const singleOperation = <const Operation extends CanonicalOperationName>(
|
||||
identity: ProviderIdentity,
|
||||
operation: Operation,
|
||||
) => ({ providers: [providerBinding(identity, [operation])] }) as const;
|
||||
|
||||
/** Shared source facts, with no factory, schema or generated-catalog imports. */
|
||||
export const CAPABILITY_DECLARATIONS = {
|
||||
adbDevice: {
|
||||
@@ -162,13 +167,10 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
androidApplicationGraph: {
|
||||
providers: [
|
||||
providerBinding(ANDROID_APPLICATION_PROVIDER, [
|
||||
"project_android_application_graph",
|
||||
]),
|
||||
],
|
||||
},
|
||||
androidApplicationGraph: singleOperation(
|
||||
ANDROID_APPLICATION_PROVIDER,
|
||||
"project_android_application_graph",
|
||||
),
|
||||
apkSignature: {
|
||||
providers: [
|
||||
providerBinding(APK_SIGNATURE_PROVIDER_IDENTITY, {
|
||||
@@ -183,16 +185,11 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
appleApplicationGraph: {
|
||||
providers: [
|
||||
providerBinding(APPLE_APPLICATION_PROVIDER, [
|
||||
"project_apple_application_graph",
|
||||
]),
|
||||
],
|
||||
},
|
||||
appleIps: {
|
||||
providers: [providerBinding(APPLE_IPS_PROVIDER, ["inspect_apple_ips"])],
|
||||
},
|
||||
appleApplicationGraph: singleOperation(
|
||||
APPLE_APPLICATION_PROVIDER,
|
||||
"project_apple_application_graph",
|
||||
),
|
||||
appleIps: singleOperation(APPLE_IPS_PROVIDER, "inspect_apple_ips"),
|
||||
applicationWorkflows: {
|
||||
providers: [
|
||||
providerBinding(JAVASCRIPT_APPLICATION_WORKFLOW_PROVIDER, [
|
||||
@@ -217,11 +214,10 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
],
|
||||
},
|
||||
artifactResources: { providers: [] },
|
||||
binaryLayout: {
|
||||
providers: [
|
||||
providerBinding(PWNTOOLS_PROVIDER_IDENTITY, ["inspect_binary_layout"]),
|
||||
],
|
||||
},
|
||||
binaryLayout: singleOperation(
|
||||
PWNTOOLS_PROVIDER_IDENTITY,
|
||||
"inspect_binary_layout",
|
||||
),
|
||||
browserObservation: {
|
||||
providers: [
|
||||
providerBinding(CDP_BROWSER_PROVIDER_IDENTITY, {
|
||||
@@ -236,11 +232,7 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
byteEntropy: {
|
||||
providers: [
|
||||
providerBinding(BYTE_ENTROPY_PROVIDER, ["inspect_byte_entropy"]),
|
||||
],
|
||||
},
|
||||
byteEntropy: singleOperation(BYTE_ENTROPY_PROVIDER, "inspect_byte_entropy"),
|
||||
cutter: {
|
||||
providers: [
|
||||
providerBinding(CUTTER_PROVIDER_IDENTITY, {
|
||||
@@ -256,31 +248,20 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
],
|
||||
},
|
||||
desktopBuildComputers: { providers: [] },
|
||||
devicetree: {
|
||||
providers: [providerBinding(DEVICETREE_PROVIDER, ["inspect_devicetree"])],
|
||||
},
|
||||
dwarfUnits: {
|
||||
providers: [providerBinding(DWARF_UNITS_PROVIDER, ["inspect_dwarf_units"])],
|
||||
},
|
||||
nativeToolchain: {
|
||||
providers: [
|
||||
providerBinding(NATIVE_TOOLCHAIN_PROVIDER, ["identify_native_toolchain"]),
|
||||
],
|
||||
},
|
||||
electronActiveObservation: {
|
||||
providers: [
|
||||
providerBinding(PLAYWRIGHT_ELECTRON_ACTIVE_PROVIDER_IDENTITY, [
|
||||
"capture_electron_scenario",
|
||||
]),
|
||||
],
|
||||
},
|
||||
electronFuses: {
|
||||
providers: [
|
||||
providerBinding(ELECTRON_FUSE_PROVIDER_IDENTITY, [
|
||||
"inspect_electron_fuses",
|
||||
]),
|
||||
],
|
||||
},
|
||||
devicetree: singleOperation(DEVICETREE_PROVIDER, "inspect_devicetree"),
|
||||
dwarfUnits: singleOperation(DWARF_UNITS_PROVIDER, "inspect_dwarf_units"),
|
||||
nativeToolchain: singleOperation(
|
||||
NATIVE_TOOLCHAIN_PROVIDER,
|
||||
"identify_native_toolchain",
|
||||
),
|
||||
electronActiveObservation: singleOperation(
|
||||
PLAYWRIGHT_ELECTRON_ACTIVE_PROVIDER_IDENTITY,
|
||||
"capture_electron_scenario",
|
||||
),
|
||||
electronFuses: singleOperation(
|
||||
ELECTRON_FUSE_PROVIDER_IDENTITY,
|
||||
"inspect_electron_fuses",
|
||||
),
|
||||
electronObservation: {
|
||||
providers: [
|
||||
providerBinding(CDP_ELECTRON_PROVIDER_IDENTITY, [
|
||||
@@ -289,33 +270,23 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
]),
|
||||
],
|
||||
},
|
||||
elfDependencies: {
|
||||
providers: [
|
||||
providerBinding(ELF_DEPENDENCIES_PROVIDER, ["inspect_elf_dependencies"]),
|
||||
],
|
||||
},
|
||||
elfNotes: {
|
||||
providers: [providerBinding(ELF_NOTES_PROVIDER, ["inspect_elf_notes"])],
|
||||
},
|
||||
elfDebugLink: {
|
||||
providers: [
|
||||
providerBinding(ELF_DEBUG_LINK_PROVIDER, ["inspect_elf_debug_link"]),
|
||||
],
|
||||
},
|
||||
nativeInitializers: {
|
||||
providers: [
|
||||
providerBinding(NATIVE_INITIALIZERS_PROVIDER, [
|
||||
"inspect_native_initializers",
|
||||
]),
|
||||
],
|
||||
},
|
||||
elfUnwindRanges: {
|
||||
providers: [
|
||||
providerBinding(ELF_UNWIND_RANGES_PROVIDER, [
|
||||
"inspect_elf_unwind_ranges",
|
||||
]),
|
||||
],
|
||||
},
|
||||
elfDependencies: singleOperation(
|
||||
ELF_DEPENDENCIES_PROVIDER,
|
||||
"inspect_elf_dependencies",
|
||||
),
|
||||
elfNotes: singleOperation(ELF_NOTES_PROVIDER, "inspect_elf_notes"),
|
||||
elfDebugLink: singleOperation(
|
||||
ELF_DEBUG_LINK_PROVIDER,
|
||||
"inspect_elf_debug_link",
|
||||
),
|
||||
nativeInitializers: singleOperation(
|
||||
NATIVE_INITIALIZERS_PROVIDER,
|
||||
"inspect_native_initializers",
|
||||
),
|
||||
elfUnwindRanges: singleOperation(
|
||||
ELF_UNWIND_RANGES_PROVIDER,
|
||||
"inspect_elf_unwind_ranges",
|
||||
),
|
||||
erlangBeam: {
|
||||
providers: [
|
||||
providerBinding(ERLANG_BEAM_PROVIDER_IDENTITY, {
|
||||
@@ -336,21 +307,15 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
providerBinding(UNBLOB_PROVIDER_IDENTITY, ["extract_firmware"]),
|
||||
],
|
||||
},
|
||||
espNvs: {
|
||||
providers: [providerBinding(ESP_NVS_PROVIDER, ["inspect_esp_nvs"])],
|
||||
},
|
||||
firmwareMmio: {
|
||||
providers: [
|
||||
providerBinding(FIRMWARE_MMIO_PROVIDER, ["inspect_firmware_mmio"]),
|
||||
],
|
||||
},
|
||||
firmwareVectorTable: {
|
||||
providers: [
|
||||
providerBinding(FIRMWARE_VECTOR_TABLE_PROVIDER, [
|
||||
"inspect_firmware_vector_table",
|
||||
]),
|
||||
],
|
||||
},
|
||||
espNvs: singleOperation(ESP_NVS_PROVIDER, "inspect_esp_nvs"),
|
||||
firmwareMmio: singleOperation(
|
||||
FIRMWARE_MMIO_PROVIDER,
|
||||
"inspect_firmware_mmio",
|
||||
),
|
||||
firmwareVectorTable: singleOperation(
|
||||
FIRMWARE_VECTOR_TABLE_PROVIDER,
|
||||
"inspect_firmware_vector_table",
|
||||
),
|
||||
uefiAnalysis: {
|
||||
providers: [
|
||||
providerBinding(UEFI_PROVIDER_IDENTITY, { group: "UEFI_TOOL_CONTRACTS" }),
|
||||
@@ -392,13 +357,10 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
harmonyApplicationGraph: {
|
||||
providers: [
|
||||
providerBinding(HARMONY_APPLICATION_PROVIDER, [
|
||||
"project_harmony_application_graph",
|
||||
]),
|
||||
],
|
||||
},
|
||||
harmonyApplicationGraph: singleOperation(
|
||||
HARMONY_APPLICATION_PROVIDER,
|
||||
"project_harmony_application_graph",
|
||||
),
|
||||
hopper: {
|
||||
providers: [providerBinding(HOPPER_PROVIDER_IDENTITY, HOPPER_OPERATIONS)],
|
||||
},
|
||||
@@ -412,13 +374,10 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
javascriptApplication: {
|
||||
providers: [
|
||||
providerBinding(JAVASCRIPT_APPLICATION_PROVIDER, [
|
||||
"analyze_javascript_application",
|
||||
]),
|
||||
],
|
||||
},
|
||||
javascriptApplication: singleOperation(
|
||||
JAVASCRIPT_APPLICATION_PROVIDER,
|
||||
"analyze_javascript_application",
|
||||
),
|
||||
javascriptRecovery: {
|
||||
providers: [
|
||||
providerBinding(WAKARU_PROVIDER_IDENTITY, {
|
||||
@@ -433,40 +392,30 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
javascriptRuntimeReconciliation: {
|
||||
providers: [
|
||||
providerBinding(JAVASCRIPT_RUNTIME_RECONCILIATION_PROVIDER, [
|
||||
"reconcile_javascript_runtime",
|
||||
]),
|
||||
],
|
||||
},
|
||||
javascriptRuntimeReconciliation: singleOperation(
|
||||
JAVASCRIPT_RUNTIME_RECONCILIATION_PROVIDER,
|
||||
"reconcile_javascript_runtime",
|
||||
),
|
||||
jeb: {
|
||||
providers: [
|
||||
providerBinding(JEB_PROVIDER_IDENTITY, { group: "JEB_TOOL_CONTRACTS" }),
|
||||
],
|
||||
},
|
||||
kernelBuildConfig: {
|
||||
providers: [
|
||||
providerBinding(KERNEL_BUILD_CONFIG_PROVIDER, [
|
||||
"inspect_kernel_build_config",
|
||||
]),
|
||||
],
|
||||
},
|
||||
kernelModule: {
|
||||
providers: [
|
||||
providerBinding(KERNEL_MODULE_PROVIDER, ["inspect_kernel_module"]),
|
||||
],
|
||||
},
|
||||
kernelBuildConfig: singleOperation(
|
||||
KERNEL_BUILD_CONFIG_PROVIDER,
|
||||
"inspect_kernel_build_config",
|
||||
),
|
||||
kernelModule: singleOperation(
|
||||
KERNEL_MODULE_PROVIDER,
|
||||
"inspect_kernel_module",
|
||||
),
|
||||
kuna: {
|
||||
providers: [providerBinding(KUNA_PROVIDER_IDENTITY, KUNA_OPERATIONS)],
|
||||
},
|
||||
machoFunctionStarts: {
|
||||
providers: [
|
||||
providerBinding(MACHO_FUNCTION_STARTS_PROVIDER, [
|
||||
"inspect_macho_function_starts",
|
||||
]),
|
||||
],
|
||||
},
|
||||
machoFunctionStarts: singleOperation(
|
||||
MACHO_FUNCTION_STARTS_PROVIDER,
|
||||
"inspect_macho_function_starts",
|
||||
),
|
||||
managedStatic: {
|
||||
providers: [
|
||||
providerBinding(MANAGED_STATIC_PROVIDER, {
|
||||
@@ -488,11 +437,10 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
nativeExports: {
|
||||
providers: [
|
||||
providerBinding(NATIVE_EXPORTS_PROVIDER, ["inspect_native_exports"]),
|
||||
],
|
||||
},
|
||||
nativeExports: singleOperation(
|
||||
NATIVE_EXPORTS_PROVIDER,
|
||||
"inspect_native_exports",
|
||||
),
|
||||
nativeMacOS: {
|
||||
providers: [
|
||||
providerBinding(NATIVE_MACOS_PROVIDER_IDENTITY, {
|
||||
@@ -512,54 +460,37 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
providerBinding(PCAP_PROVIDER_IDENTITY, { group: "PCAP_TOOL_CONTRACTS" }),
|
||||
],
|
||||
},
|
||||
peCertificates: {
|
||||
providers: [
|
||||
providerBinding(PE_CERTIFICATES_PROVIDER, ["inspect_pe_certificates"]),
|
||||
],
|
||||
},
|
||||
peImports: {
|
||||
providers: [providerBinding(PE_IMPORTS_PROVIDER, ["inspect_pe_imports"])],
|
||||
},
|
||||
peLoadConfig: {
|
||||
providers: [
|
||||
providerBinding(PE_LOAD_CONFIG_PROVIDER, ["inspect_pe_load_config"]),
|
||||
],
|
||||
},
|
||||
peUnwindRanges: {
|
||||
providers: [
|
||||
providerBinding(PE_UNWIND_RANGES_PROVIDER, ["inspect_pe_unwind_ranges"]),
|
||||
],
|
||||
},
|
||||
peOverlay: {
|
||||
providers: [providerBinding(PE_OVERLAY_PROVIDER, ["inspect_pe_overlay"])],
|
||||
},
|
||||
binaryHardening: {
|
||||
providers: [
|
||||
providerBinding(BINARY_HARDENING_PROVIDER, ["inspect_binary_hardening"]),
|
||||
],
|
||||
},
|
||||
peResources: {
|
||||
providers: [
|
||||
providerBinding(PE_RESOURCES_PROVIDER, ["inspect_pe_resources"]),
|
||||
],
|
||||
},
|
||||
labviewArtifact: {
|
||||
providers: [
|
||||
providerBinding(LABVIEW_PROVIDER_IDENTITY, ["inspect_labview_artifact"]),
|
||||
],
|
||||
},
|
||||
windowsShortcut: {
|
||||
providers: [
|
||||
providerBinding(WINDOWS_SHORTCUT_PROVIDER, ["inspect_windows_shortcut"]),
|
||||
],
|
||||
},
|
||||
firmwareArchitectureCandidates: {
|
||||
providers: [
|
||||
providerBinding(FIRMWARE_ARCHITECTURE_CANDIDATES_PROVIDER, [
|
||||
"inspect_firmware_architecture_candidates",
|
||||
]),
|
||||
],
|
||||
},
|
||||
peCertificates: singleOperation(
|
||||
PE_CERTIFICATES_PROVIDER,
|
||||
"inspect_pe_certificates",
|
||||
),
|
||||
peImports: singleOperation(PE_IMPORTS_PROVIDER, "inspect_pe_imports"),
|
||||
peLoadConfig: singleOperation(
|
||||
PE_LOAD_CONFIG_PROVIDER,
|
||||
"inspect_pe_load_config",
|
||||
),
|
||||
peUnwindRanges: singleOperation(
|
||||
PE_UNWIND_RANGES_PROVIDER,
|
||||
"inspect_pe_unwind_ranges",
|
||||
),
|
||||
peOverlay: singleOperation(PE_OVERLAY_PROVIDER, "inspect_pe_overlay"),
|
||||
binaryHardening: singleOperation(
|
||||
BINARY_HARDENING_PROVIDER,
|
||||
"inspect_binary_hardening",
|
||||
),
|
||||
peResources: singleOperation(PE_RESOURCES_PROVIDER, "inspect_pe_resources"),
|
||||
labviewArtifact: singleOperation(
|
||||
LABVIEW_PROVIDER_IDENTITY,
|
||||
"inspect_labview_artifact",
|
||||
),
|
||||
windowsShortcut: singleOperation(
|
||||
WINDOWS_SHORTCUT_PROVIDER,
|
||||
"inspect_windows_shortcut",
|
||||
),
|
||||
firmwareArchitectureCandidates: singleOperation(
|
||||
FIRMWARE_ARCHITECTURE_CANDIDATES_PROVIDER,
|
||||
"inspect_firmware_architecture_candidates",
|
||||
),
|
||||
pythonPyc: {
|
||||
providers: [
|
||||
providerBinding(PYTHON_PYC_PROVIDER_IDENTITY, {
|
||||
@@ -630,11 +561,10 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
recordedCrash: {
|
||||
providers: [
|
||||
providerBinding(PWNTOOLS_PROVIDER_IDENTITY, ["inspect_recorded_crash"]),
|
||||
],
|
||||
},
|
||||
recordedCrash: singleOperation(
|
||||
PWNTOOLS_PROVIDER_IDENTITY,
|
||||
"inspect_recorded_crash",
|
||||
),
|
||||
reverseEngineering: {
|
||||
providers: [
|
||||
providerBinding(OBJDUMP_PROVIDER_IDENTITY, ["inspect_with_objdump"]),
|
||||
@@ -669,16 +599,14 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
wasmArtifact: {
|
||||
providers: [
|
||||
providerBinding(WABT_PROVIDER_IDENTITY, ["inspect_wasm_artifact"]),
|
||||
],
|
||||
},
|
||||
webModuleTrace: {
|
||||
providers: [
|
||||
providerBinding(WEB_MODULE_TRACE_PROVIDER, ["trace_web_module_imports"]),
|
||||
],
|
||||
},
|
||||
wasmArtifact: singleOperation(
|
||||
WABT_PROVIDER_IDENTITY,
|
||||
"inspect_wasm_artifact",
|
||||
),
|
||||
webModuleTrace: singleOperation(
|
||||
WEB_MODULE_TRACE_PROVIDER,
|
||||
"trace_web_module_imports",
|
||||
),
|
||||
webNetworkCapture: {
|
||||
providers: [
|
||||
providerBinding(SAZ_CAPTURE_PROVIDER_IDENTITY, {
|
||||
@@ -702,18 +630,14 @@ export const CAPABILITY_DECLARATIONS = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
webScriptExport: {
|
||||
providers: [
|
||||
providerBinding(WEB_SCRIPT_EXPORT_PROVIDER, ["export_web_scripts"]),
|
||||
],
|
||||
},
|
||||
webSourceLocation: {
|
||||
providers: [
|
||||
providerBinding(WEB_SOURCE_LOCATION_PROVIDER, [
|
||||
"trace_web_source_location",
|
||||
]),
|
||||
],
|
||||
},
|
||||
webScriptExport: singleOperation(
|
||||
WEB_SCRIPT_EXPORT_PROVIDER,
|
||||
"export_web_scripts",
|
||||
),
|
||||
webSourceLocation: singleOperation(
|
||||
WEB_SOURCE_LOCATION_PROVIDER,
|
||||
"trace_web_source_location",
|
||||
),
|
||||
} as const satisfies Readonly<Record<string, CapabilityDeclaration>>;
|
||||
|
||||
export type CapabilityDeclarationId = keyof typeof CAPABILITY_DECLARATIONS;
|
||||
Reference in new issue
Block a user