mirror of
https://github.com/morluto/rea
synced 2026-10-27 14:42:18 -04:00
fix(javascript): trace nested Electron bridge members (#2745)
* fix(javascript): trace nested Electron bridge members * fix(javascript): preserve shallow Electron bridge paths * fix(javascript): preserve exact Electron bridge member paths * fix(javascript): preserve exact Electron bridge paths * fix(javascript): preserve bridge entry ownership * fix(javascript): preserve bridge path identity * fix(javascript): normalize typed feature seeds before tracing * test(javascript): normalize direct selector seed inputs * refactor(javascript): consume normalized feature seed defaults --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
@@ -17,33 +17,65 @@ export const featureSeedMatchMode = (seed: {
|
||||
}): "exact" | "contains" =>
|
||||
seed.match ?? (seed.kind === "string" ? "contains" : "exact");
|
||||
|
||||
const literalSeedKinds = [
|
||||
"route",
|
||||
"string",
|
||||
"api",
|
||||
"channel",
|
||||
"module",
|
||||
"native-export",
|
||||
] as const;
|
||||
const apiSeedSchema = z.union([
|
||||
z.strictObject({
|
||||
kind: z.literal("api"),
|
||||
value: boundedTextSchema,
|
||||
match: z.enum(["exact", "contains"]).nullable().default(null),
|
||||
case_sensitive: z.boolean().default(false),
|
||||
}),
|
||||
z.strictObject({
|
||||
kind: z.literal("api"),
|
||||
value: z.literal(""),
|
||||
match: z.literal("exact"),
|
||||
case_sensitive: z.boolean().default(false),
|
||||
}),
|
||||
]);
|
||||
|
||||
const apiPathSeedSchema = z.union([
|
||||
z.strictObject({
|
||||
kind: z.literal("api"),
|
||||
value: boundedTextSchema,
|
||||
match: z.enum(["exact", "contains"]).nullable().default(null),
|
||||
case_sensitive: z.boolean().default(false),
|
||||
entry_path: z.array(z.string()).min(1),
|
||||
}),
|
||||
z.strictObject({
|
||||
kind: z.literal("api"),
|
||||
value: z.literal(""),
|
||||
match: z.literal("exact"),
|
||||
case_sensitive: z.boolean().default(false),
|
||||
entry_path: z.array(z.string()).min(1),
|
||||
}),
|
||||
]);
|
||||
|
||||
/**
|
||||
* Literal starting point for one application feature trace. An empty value,
|
||||
* such as the channel in `ipcMain.handle("")`, must be an explicit exact
|
||||
* literal seed: empty containment would select every node.
|
||||
*/
|
||||
const applicationFeatureSeedSchema = z.union([
|
||||
export const applicationFeatureSeedSchema = z.union([
|
||||
z.strictObject({
|
||||
kind: z.enum(["node-id", ...literalSeedKinds]),
|
||||
kind: z.enum([
|
||||
"node-id",
|
||||
"route",
|
||||
"string",
|
||||
"channel",
|
||||
"module",
|
||||
"native-export",
|
||||
]),
|
||||
value: boundedTextSchema,
|
||||
match: z.enum(["exact", "contains"]).nullable().default(null),
|
||||
case_sensitive: z.boolean().default(false),
|
||||
}),
|
||||
z.strictObject({
|
||||
kind: z.enum(literalSeedKinds),
|
||||
kind: z.enum(["route", "string", "channel", "module", "native-export"]),
|
||||
value: z.literal(""),
|
||||
match: z.literal("exact"),
|
||||
case_sensitive: z.boolean().default(false),
|
||||
}),
|
||||
apiSeedSchema,
|
||||
apiPathSeedSchema,
|
||||
]);
|
||||
|
||||
/** Check unique native identities before projecting an application trace. */
|
||||
@@ -156,7 +188,10 @@ export const applicationFeatureTraceResultSchema = z.strictObject({
|
||||
export type TraceApplicationFeatureInput = z.infer<
|
||||
typeof traceApplicationFeatureInputSchema
|
||||
>;
|
||||
export type ApplicationFeatureSeed = z.infer<
|
||||
export type ApplicationFeatureSeed = z.output<
|
||||
typeof applicationFeatureSeedSchema
|
||||
>;
|
||||
export type ApplicationFeatureSeedInput = z.input<
|
||||
typeof applicationFeatureSeedSchema
|
||||
>;
|
||||
export type ApplicationFeatureTraceResult = z.infer<
|
||||
|
||||
Reference in New Issue
Block a user