mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
* refactor(native): read retained inventory views through the operation fact contracts * refactor(native): read matching inventories through the operation fact contracts (#10887) * refactor(native): read dispatch symbol fallbacks as lenient name facts at the port (#10889) * refactor(native): read dispatch symbol fallbacks as lenient name facts at the port * test(native): accept undeclared name-row fields in both dispatch consumers * refactor(native): read literal searches and overview counts as operation facts (#10894) * refactor(native): read literal searches and overview counts as operation facts * refactor(native): read addressed inventory rows as operation facts in every reader (#10899) * refactor(native): read addressed inventory rows as operation facts in every reader * test(native): cover xrefs name resolution through the name fact contract * test(server): pin procedure completion to the procedure inventory contract
75 lines
2.3 KiB
TypeScript
75 lines
2.3 KiB
TypeScript
import { z } from "zod";
|
|
import { nativeSymbolMetadataSchema } from "./nativeSymbol.js";
|
|
import { analysisStringSchema } from "./nativeString.js";
|
|
import { ok, type Result } from "../result.js";
|
|
import { AnalysisOutputError } from "../analysisErrorCore.js";
|
|
import type { JsonValue } from "../jsonValue.js";
|
|
import { invalidNativeOutput } from "./nativeProviderOutput.js";
|
|
|
|
/** Canonical named native observations; same-address alternatives stay separate. */
|
|
export const addressedValueSchema = z.object({
|
|
address: z.string(),
|
|
value: z.string(),
|
|
symbol: nativeSymbolMetadataSchema.exactOptional(),
|
|
objc_class_label: z.literal("hopper_legacy_class_object").exactOptional(),
|
|
procedure: z
|
|
.object({
|
|
external: z.boolean(),
|
|
thunk: z.boolean(),
|
|
thunk_target: z.string().nullable(),
|
|
})
|
|
.exactOptional(),
|
|
string: z
|
|
.object({
|
|
encoding: z.string(),
|
|
termination: z.enum(["missing", "present_or_not_required"]),
|
|
byte_length: z.number().int().min(0),
|
|
})
|
|
.exactOptional(),
|
|
matched_aliases: z
|
|
.array(z.string())
|
|
.min(1)
|
|
.exactOptional()
|
|
.describe(
|
|
"Procedure search only: the procedure's secondary names that matched. value stays its primary name.",
|
|
),
|
|
});
|
|
|
|
/** Canonical row arrays shared by complete delivery and retained source validation. */
|
|
export const nativeInventoryRowsSchemas = {
|
|
names: z.array(addressedValueSchema),
|
|
strings: z.array(analysisStringSchema),
|
|
};
|
|
|
|
export const NATIVE_INVENTORY_OPERATIONS = [
|
|
"list_procedures",
|
|
"search_procedures",
|
|
"list_strings",
|
|
"search_strings",
|
|
"list_names",
|
|
] as const;
|
|
|
|
export const nativeInventoryOperationSchema = z.enum(
|
|
NATIVE_INVENTORY_OPERATIONS,
|
|
);
|
|
export type NativeInventoryOperation = z.infer<
|
|
typeof nativeInventoryOperationSchema
|
|
>;
|
|
|
|
export const isNativeInventoryOperation = (
|
|
operation: string,
|
|
): operation is NativeInventoryOperation =>
|
|
NATIVE_INVENTORY_OPERATIONS.some((supported) => supported === operation);
|
|
|
|
export interface AddressedName {
|
|
readonly address: string;
|
|
readonly name: string;
|
|
readonly objc_class_label?: "hopper_legacy_class_object";
|
|
}
|
|
|
|
/** An analyzed bookmark retains a missing provider label as null. */
|
|
export const analysisBookmarkSchema = z.strictObject({
|
|
address: z.string(),
|
|
name: z.string().nullable(),
|
|
});
|